From b89e1f025cced195ede33250798e1a2c886d7668 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Wed, 10 Jun 2020 09:40:27 +0200 Subject: [PATCH] ENH: portable scoping char for fieldCoordinateSystemTransform (fixes #1675) - replace ':' scoping with IOobject::scopedName(), which automatically uses '_' for Windows compilations where the ':' is a meta-character (drive separator) - apply similar local change for the momentum function object. *** This topic will be revisited in the future *** --- .../fieldCoordinateSystemTransform.C | 8 ++++---- src/functionObjects/field/momentum/momentum.H | 11 ++++++++++- .../incompressible/simpleFoam/pipeCyclic/0.orig/U | 6 +++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C index 2c2ca261394..2ac1d40f51d 100644 --- a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C +++ b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -80,7 +80,7 @@ Foam::functionObjects::fieldCoordinateSystemTransform::transformFieldName const word& fieldName ) const { - return fieldName + ":Transformed"; + return IOobject::scopedName(fieldName, "Transformed"); } @@ -90,7 +90,7 @@ Foam::functionObjects::fieldCoordinateSystemTransform::srotTensor() const typedef surfaceTensorField FieldType; typedef surfaceTensorField::Boundary BoundaryType; - if (!rotTensorSurface_.valid()) + if (!rotTensorSurface_) { tensorField rotations(csysPtr_->R(mesh_.faceCentres())); @@ -135,7 +135,7 @@ Foam::functionObjects::fieldCoordinateSystemTransform::vrotTensor() const typedef volTensorField FieldType; typedef volTensorField::Boundary BoundaryType; - if (!rotTensorVolume_.valid()) + if (!rotTensorVolume_) { tensorField rotations(csysPtr_->R(mesh_.cellCentres())); diff --git a/src/functionObjects/field/momentum/momentum.H b/src/functionObjects/field/momentum/momentum.H index d0e963e83e5..12472f8a002 100644 --- a/src/functionObjects/field/momentum/momentum.H +++ b/src/functionObjects/field/momentum/momentum.H @@ -135,7 +135,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations class dimensionSet; namespace functionObjects @@ -225,6 +225,15 @@ protected: //- Write momentum data void writeValues(Ostream& os); + // Protected Member Functions + + //- Return a scoped name + // TODO - revisit issue #1675 + word scopedName(const word& base) const + { + return IOobject::scopedName(this->name(), base); + } + public: diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/0.orig/U b/tutorials/incompressible/simpleFoam/pipeCyclic/0.orig/U index 62ae5ee479d..dfe87e3b570 100644 --- a/tutorials/incompressible/simpleFoam/pipeCyclic/0.orig/U +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/0.orig/U @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: v1912 | +| \\ / O peration | Version: v2006 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -29,12 +29,16 @@ boundaryField code #{ + // Uncomment for testing on non-windows systems [fragile] + // IOobject::scopeSeparator = '_'; + const vector axis(1, 0, 0); vectorField v(2.0*this->patch().Cf() ^ axis); v.replace(vector::X, 1.0); operator==(v); #}; + value $internalField; } -- GitLab