From f3474dad1d4780d36badb6b6e15adbe2c811b93a Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 13 Jun 2018 14:55:20 +0100 Subject: [PATCH 1/5] BUG: rigidBodyMotionState: not readable in binary. Fixes #871. --- .../rigidBodyMeshMotion/rigidBodyMeshMotion.C | 3 ++- .../rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C index 428ff83c0f..38408510cc 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C @@ -357,7 +357,8 @@ bool Foam::rigidBodyMeshMotion::writeObject ); model_.state().write(dict); - return dict.regIOobject::write(); + // Force ascii writing + return dict.regIOobject::writeObject(IOstream::ASCII, ver, cmp, valid); } diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C index 4746876226..3351c068a7 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C @@ -301,7 +301,8 @@ bool Foam::rigidBodyMeshMotionSolver::writeObject ); model_.state().write(dict); - return dict.regIOobject::write(); + // Force ascii writing + return dict.regIOobject::writeObject(IOstream::ASCII, ver, cmp, valid); } From 5390c48b2d2c72ea199b7ecfaf1122c76dd85c5e Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Sat, 16 Jun 2018 00:29:41 +0200 Subject: [PATCH 2/5] BUG: dictionary lookup of embedded coordinateSystem fails (fixes #879) - also fix incorrect documentation in forces functionObject and interRegionExplicitPorositySource fvOption. --- src/functionObjects/forces/forces/forces.H | 16 +++++++++----- .../interRegionExplicitPorositySource.H | 9 ++++++-- .../coordinateSystems/coordinateSystem.C | 22 +++++++++++++------ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/functionObjects/forces/forces/forces.H b/src/functionObjects/forces/forces/forces.H index 41d4aa6b6f..4a27514c6a 100644 --- a/src/functionObjects/forces/forces/forces.H +++ b/src/functionObjects/forces/forces/forces.H @@ -111,8 +111,12 @@ Note coordinateSystem { origin (0 0 0); - e3 (0 0 1); - e1 (1 0 0); + coordinateRotation + { + type axesRotation; + e3 (0 0 1); + e1 (1 0 0); + } } \endverbatim @@ -346,11 +350,11 @@ protected: //- Write binned data void writeBins(); - //- Disallow default bitwise copy construct - forces(const forces&); + //- No copy construct + forces(const forces&) = delete; - //- Disallow default bitwise assignment - void operator=(const forces&); + //- No copy assignment + void operator=(const forces&) = delete; public: diff --git a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H index e42e29d3db..1b0c33b95b 100644 --- a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H +++ b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H @@ -43,8 +43,13 @@ Description coordinateSystem { - e1 (0.70710678 0.70710678 0); - e2 (0 0 1); + origin (0 0 0); + coordinateRotation + { + type axesRotation; + e1 (0.70710678 0.70710678 0); + e2 (0 0 1); + } } } } diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C index b4a9e78820..484f410c5e 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.C +++ b/src/meshTools/coordinateSystems/coordinateSystem.C @@ -129,9 +129,21 @@ Foam::coordinateSystem::coordinateSystem { const entry* entryPtr = dict.lookupEntryPtr(typeName_(), false, false); - // non-dictionary entry is a lookup into global coordinateSystems - if (entryPtr && !entryPtr->isDict()) + if (!entryPtr) { + // No 'coordinateSystem' entry + init(dict, obr); + } + else if (entryPtr->isDict()) + { + // 'coordinateSystem' as dictionary entry - use it + init(entryPtr->dict(), obr); + } + else + { + // 'coordinateSystem' as non-dictionary entry + // - this is a lookup into global coordinateSystems + keyType key(entryPtr->stream()); const coordinateSystems& lst = coordinateSystems::New(obr); @@ -152,15 +164,11 @@ Foam::coordinateSystem::coordinateSystem << exit(FatalError); } - // copy coordinateSystem, but assign the name as the typeName + // Copy from coordinateSystem, but assign the name as the typeName // to avoid strange things in writeDict() operator=(lst[index]); name_ = typeName_(); } - else - { - init(dict, obr); - } } From 5754405bfb6547965d8057fbdcb4e70543ea5930 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 18 Jun 2018 08:42:55 +0200 Subject: [PATCH 3/5] CONFIG: cannot pass additional arguments to foamEtcFile (closes #880) - add support by using updated foamEtcFile from 1806, which also add the '-config' short-cut option. --- bin/foamEtcFile | 170 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 120 insertions(+), 50 deletions(-) diff --git a/bin/foamEtcFile b/bin/foamEtcFile index e61279b591..195b91bdbe 100755 --- a/bin/foamEtcFile +++ b/bin/foamEtcFile @@ -4,7 +4,7 @@ # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation -# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. +# \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. #------------------------------------------------------------------------------- # License # This file is part of OpenFOAM, licensed under GNU General Public License @@ -46,7 +46,7 @@ printHelp() { cat<&2 # done - -# Save the essential bits of information -# silently remove leading ~OpenFOAM/ (used in Foam::findEtcFile) -nArgs=$# -fileName="${1#~OpenFOAM/}" - # Define the various places to be searched: unset dirList case "$optMode" in (*u*) # (U)ser @@ -309,27 +335,61 @@ case "$optMode" in (*o*) # (O)ther == shipped esac set -- $dirList +[ "$#" -ge 1 ] || die "No directories to scan. Programming error?" +exitCode=2 # Fallback is a FileNotFound error + + +# +# Preliminaries +# + +# Special handling of config.sh/ , config.csh/ directories +if [ -n "$optConfig" -a -n "$shellOutput" -a -n "$fileName" ] +then + case "$shellOutput" in + csh*) + optConfig="config.csh/" + ;; + sh*) + optConfig="config.sh/" + ;; + *) + unset optConfig + ;; + esac + + if [ -n "$optConfig" ] + then + case "$fileName" in + /* | config.csh* | config.sh*) + # Does not need or cannot add a prefix + unset optConfig + ;; + *) + fileName="$optConfig$fileName" + ;; + esac + fi +fi + # # The main routine # -exitCode=0 if [ -n "$optList" ] then # List directories, or potential file locations [ "$nArgs" -le 1 ] || \ - die "-list expects 0 or 1 filename, but $nArgs provided" + die "-list options expect 0 or 1 filename, but $nArgs provided" - # A silly combination, but -quiet does have precedence + # A silly combination, but -quiet has absolute precedence [ -n "$optQuiet" ] && exit 0 # Test for directory or file too? if [ "$optList" = "test" ] then - exitCode=2 # Fallback to a general error (file not found) - if [ "$nArgs" -eq 1 ] then for dir @@ -352,6 +412,7 @@ then done fi else + exitCode=0 # OK, already verified that $# != 0 for dir do echo "$dir${fileName:+/}$fileName" @@ -362,35 +423,44 @@ else [ "$nArgs" -eq 1 ] || die "One filename expected - $nArgs provided" - exitCode=2 # Fallback to a general error (file not found) + # Output for sourcing files ("source" for csh, "." for POSIX shell) + # Only allow sourcing a single file (disallow combination with -all) + case "$shellOutput" in + csh*) + shellOutput="source " # eg, "source FILE" + ;; + sh*) + shellOutput=". " # eg, ". FILE" + ;; + esac + + # Anti-pattern: -all disables shell commands + if [ -n "$optAll" ] + then + unset shellOutput verboseOutput + fi for dir do - if [ -f "$dir/$fileName" ] + resolved="$dir/$fileName" + if [ -f "$resolved" ] then - exitCode=0 - [ -n "$optQuiet" ] && break - - case "$optShell" in - (*verbose) - echo "Using: $dir/$fileName" 1>&2 - ;; - esac - - case "$optShell" in - csh*) - echo "source $dir/$fileName" + exitCode=0 # OK + if [ -n "$optQuiet" ] + then break - ;; - sh*) - echo ". $dir/$fileName" - break - ;; - *) - echo "$dir/$fileName" - [ -n "$optAll" ] || break - ;; - esac + elif [ -n "$verboseOutput" ] + then + echo "$verboseOutput$resolved" 1>&2 + fi + + if [ -n "$shellOutput" ] + then + echo "$shellOutput$resolved $evalArgs" + else + echo "$resolved" + fi + [ -n "$optAll" ] || break fi done From 5cd6e4bed4451d6aadb2e274817bded99e0d3472 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 19 Jun 2018 19:14:16 +0200 Subject: [PATCH 4/5] ENH: report the function object name that causes the FatalError --- .../functionObjects/functionObjectList/functionObjectList.C | 4 +++- src/functionObjects/forces/forces/forces.C | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 76ee09ff27..12ba812afe 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -827,7 +827,9 @@ bool Foam::functionObjectList::read() { // Bit of trickery to get the original message err.write(Warning, false); - InfoInFunction << nl << endl; + InfoInFunction << nl + << "--> while loading function object '" << key << "'" + << nl << endl; } // Restore previous exception throwing state diff --git a/src/functionObjects/forces/forces/forces.C b/src/functionObjects/forces/forces/forces.C index f1a945b302..a6d7d32ffd 100644 --- a/src/functionObjects/forces/forces/forces.C +++ b/src/functionObjects/forces/forces/forces.C @@ -876,6 +876,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict) } coordSys_.clear(); + localSystem_ = false; // Centre of rotation for moment calculations // specified directly, from coordinate system, or implicitly (0 0 0) From 8295d398aa938995f2a267341e1c900bc39310d0 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 19 Jun 2018 21:24:38 +0200 Subject: [PATCH 5/5] BUG: accessing invalid coordinateRotation after move assignment (fixes #884) - incorrect coordinateSystem clear() after the move - add Test-coordinateSystem --- applications/test/coordinateSystem/Make/files | 3 + .../test/coordinateSystem/Make/options | 5 + .../coordinateSystem/Test-coordinateSystem.C | 108 +++++++++++++++++ applications/test/coordinateSystem/testDict1 | 112 ++++++++++++++++++ .../coordinateRotationNew.C | 22 ++-- .../coordinateSystems/coordinateSystem.C | 42 +++---- .../coordinateSystems/coordinateSystem.H | 37 +++--- .../coordinateSystems/coordinateSystemNew.C | 10 +- 8 files changed, 284 insertions(+), 55 deletions(-) create mode 100644 applications/test/coordinateSystem/Make/files create mode 100644 applications/test/coordinateSystem/Make/options create mode 100644 applications/test/coordinateSystem/Test-coordinateSystem.C create mode 100644 applications/test/coordinateSystem/testDict1 diff --git a/applications/test/coordinateSystem/Make/files b/applications/test/coordinateSystem/Make/files new file mode 100644 index 0000000000..d20def6640 --- /dev/null +++ b/applications/test/coordinateSystem/Make/files @@ -0,0 +1,3 @@ +Test-coordinateSystem.C + +EXE = $(FOAM_USER_APPBIN)/Test-coordinateSystem diff --git a/applications/test/coordinateSystem/Make/options b/applications/test/coordinateSystem/Make/options new file mode 100644 index 0000000000..54c035b8f5 --- /dev/null +++ b/applications/test/coordinateSystem/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lmeshTools diff --git a/applications/test/coordinateSystem/Test-coordinateSystem.C b/applications/test/coordinateSystem/Test-coordinateSystem.C new file mode 100644 index 0000000000..3f68919a52 --- /dev/null +++ b/applications/test/coordinateSystem/Test-coordinateSystem.C @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Application + Test-coordinateSystem + +Description + Expand coordinate system definitions + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "coordinateSystem.H" +#include "Fstream.H" +#include "IOstreams.H" + +using namespace Foam; + +void doTest(const dictionary& dict) +{ + Info<< dict.dictName() << dict << nl; + + // Could fail? + const bool throwingIOError = FatalIOError.throwExceptions(); + const bool throwingError = FatalError.throwExceptions(); + try + { + coordinateSystem cs1(dict.dictName(), dict); + + coordinateSystem cs2; + + // Move assign + cs2 = std::move(cs1); + + // Info< z, z -> -y + +rot_x90_axesRotation +{ + origin (0 0 0); + coordinateRotation + { + type axesRotation; + e1 (1 0 0); + e3 (0 -1 0); + } +} + +rot_x90_euler +{ + origin (0 0 0); + coordinateRotation + { + type EulerRotation; + rotation (0 90 0); // z-x'-z'' + } +} + + +// Rotate 45 deg around z: x -> (1 1 0), y = (-1 1 0) + +rot_z45_axesRotation +{ + origin (0 0 0); + coordinateRotation + { + type axesRotation; + e1 (1 1 0); + e3 (0 0 1); + } +} + +rot_z45_euler +{ + origin (0 0 0); + coordinateRotation + { + type EulerRotation; + rotation (45 0 0); // z-x'-z'' + } +} + + +// Rotate -45 deg around z: x -> (1 -1 0), y = (1 1 0) +rot_zm45_axesRotation +{ + origin (0 0 0); + coordinateRotation + { + type axesRotation; + e1 (1 -1 0); + e3 (0 0 1); + } +} + +rot_zm45_euler +{ + origin (0 0 0); + coordinateRotation + { + type EulerRotation; + rotation (-45 0 0); // z-x'-z'' + } +} + + +// Null transforms + +null_axesRotation +{ + origin (0 0 0); + coordinateRotation + { + type axesRotation; + e1 (1 0 0); + e3 (0 0 1); + } +} + +null_euler +{ + origin (0 0 0); + coordinateRotation + { + type EulerRotation; + rotation (0 0 0); // z-x'-z'' + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotationNew.C b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotationNew.C index a1e939abad..f9ed1f1e00 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotationNew.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotationNew.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,16 +34,16 @@ Foam::autoPtr Foam::coordinateRotation::New const objectRegistry& obr ) { - const word rotType = dict.lookup("type"); + const word modelType(dict.get("type")); - auto cstrIter = objectRegistryConstructorTablePtr_->cfind(rotType); + auto cstrIter = objectRegistryConstructorTablePtr_->cfind(modelType); if (!cstrIter.found()) { FatalIOErrorInFunction(dict) - << "Unknown coordinateRotation type " << rotType << nl << nl - << "Valid coordinateRotation types :" << nl - << objectRegistryConstructorTablePtr_->sortedToc() + << "Unknown coordinateRotation type " << modelType << nl << nl + << "Valid types: " + << flatOutput(objectRegistryConstructorTablePtr_->sortedToc()) << exit(FatalIOError); } @@ -56,16 +56,16 @@ Foam::autoPtr Foam::coordinateRotation::New const dictionary& dict ) { - const word rotType = dict.lookup("type"); + const word modelType(dict.get("type")); - auto cstrIter = dictionaryConstructorTablePtr_->cfind(rotType); + auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType); if (!cstrIter.found()) { FatalIOErrorInFunction(dict) - << "Unknown coordinateRotation type " << rotType << nl << nl - << "Valid coordinateRotation types :" << nl - << dictionaryConstructorTablePtr_->sortedToc() + << "Unknown coordinateRotation type " << modelType << nl << nl + << "Valid types: " + << flatOutput(dictionaryConstructorTablePtr_->sortedToc()) << exit(FatalIOError); } diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C index 86d07138d7..5ec4361974 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.C +++ b/src/meshTools/coordinateSystems/coordinateSystem.C @@ -210,7 +210,7 @@ Foam::dictionary Foam::coordinateSystem::dict(bool ignoreType) const dict.add("name", name_); - // only write type for derived types + // Only write type for derived types if (!ignoreType && type() != typeName_()) { dict.add("type", type()); @@ -304,8 +304,6 @@ void Foam::coordinateSystem::transfer(coordinateSystem& cs) note_ = std::move(cs.note_); origin_ = std::move(cs.origin_); R_ = std::move(cs.R_); - - cs.clear(); } @@ -348,7 +346,16 @@ void Foam::coordinateSystem::operator=(const coordinateSystem& cs) name_ = cs.name_; note_ = cs.note_; origin_ = cs.origin_; - R_ = cs.R_.clone(); + + // Some extra safety + if (cs.R_.valid()) + { + R_ = cs.R_.clone(); + } + else + { + R_.reset(new axesRotation(sphericalTensor::I)); + } } void Foam::coordinateSystem::operator=(coordinateSystem&& cs) @@ -357,38 +364,27 @@ void Foam::coordinateSystem::operator=(coordinateSystem&& cs) } -void Foam::coordinateSystem::init(const dictionary& rhs) +void Foam::coordinateSystem::init(const dictionary& dict) { - rhs.lookup("origin") >> origin_; + dict.lookup("origin") >> origin_; note_.clear(); - rhs.readIfPresent("note", note_); - R_ = coordinateRotation::New(rhs.subDict("coordinateRotation")); + dict.readIfPresent("note", note_); + R_ = coordinateRotation::New(dict.subDict("coordinateRotation")); } void Foam::coordinateSystem::init ( - const dictionary& rhs, + const dictionary& dict, const objectRegistry& obr ) { - if (debug) - { - Pout<< "coordinateSystem::operator=" - "(" - "const dictionary&, " - "const objectRegistry&" - ") : " - << "assign from " << rhs << endl; - } - - rhs.lookup("origin") >> origin_; + dict.lookup("origin") >> origin_; // The 'note' entry is optional note_.clear(); - rhs.readIfPresent("note", note_); - - R_ = coordinateRotation::New(rhs.subDict("coordinateRotation"), obr); + dict.readIfPresent("note", note_); + R_ = coordinateRotation::New(dict.subDict("coordinateRotation"), obr); } diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinateSystems/coordinateSystem.H index 52ee69f1d3..d47608b392 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.H +++ b/src/meshTools/coordinateSystems/coordinateSystem.H @@ -76,7 +76,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators +// Forward declarations class coordinateSystem; @@ -101,7 +101,8 @@ class coordinateSystem //- Origin point origin_; - //- Local-to-Global transformation tensor + //- Local-to-Global transformation tensor. + // May be invalid after a move assignment or transfer autoPtr R_; @@ -110,11 +111,11 @@ protected: // Protected Member Functions //- Convert from local coordinate system to the global Cartesian system - // with optional translation for the origin + //- with optional translation for the origin virtual vector localToGlobal(const vector&, bool translate) const; //- Convert from local coordinate system to the global Cartesian system - // with optional translation for the origin + //- with optional translation for the origin virtual tmp localToGlobal ( const vectorField&, @@ -122,11 +123,11 @@ protected: ) const; //- Convert from global Cartesian system to the local coordinate system - // with optional translation for the origin + //- with optional translation for the origin virtual vector globalToLocal(const vector&, bool translate) const; //- Convert from global Cartesian system to the local coordinate system - // with optional translation for the origin + //- with optional translation for the origin virtual tmp globalToLocal ( const vectorField&, @@ -134,10 +135,10 @@ protected: ) const; //- Init from dict and obr - void init(const dictionary&); + void init(const dictionary& dict); //- Init from dictionary - void init(const dictionary&, const objectRegistry&); + void init(const dictionary& dict, const objectRegistry& obr); public: @@ -182,18 +183,18 @@ public: ); //- Construct from dictionary with a given name - coordinateSystem(const word& name, const dictionary&); + coordinateSystem(const word& name, const dictionary& dict); //- Construct from dictionary with default name - coordinateSystem(const dictionary&); + explicit coordinateSystem(const dictionary& dict); //- Construct from dictionary (default name) // With the ability to reference global coordinateSystems - coordinateSystem(const objectRegistry&, const dictionary&); + coordinateSystem(const objectRegistry& obr, const dictionary& dict); //- Construct from Istream // The Istream contains a word followed by a dictionary - coordinateSystem(Istream&); + coordinateSystem(Istream& is); //- Return clone @@ -322,10 +323,10 @@ public: // Write //- Write - virtual void write(Ostream&) const; + virtual void write(Ostream& os) const; //- Write dictionary - void writeDict(Ostream&, bool subDict=true) const; + void writeDict(Ostream& os, bool subDict=true) const; // Transformations @@ -396,7 +397,7 @@ public: void operator=(coordinateSystem&& cs); - // friend Operators + // Friend Operators friend bool operator!= ( @@ -407,7 +408,11 @@ public: // IOstream Operators - friend Ostream& operator<<(Ostream&, const coordinateSystem&); + friend Ostream& operator<< + ( + Ostream& os, + const coordinateSystem& cs + ); }; diff --git a/src/meshTools/coordinateSystems/coordinateSystemNew.C b/src/meshTools/coordinateSystems/coordinateSystemNew.C index bb4c5e9138..9f0fd18866 100644 --- a/src/meshTools/coordinateSystems/coordinateSystemNew.C +++ b/src/meshTools/coordinateSystems/coordinateSystemNew.C @@ -35,9 +35,9 @@ Foam::autoPtr Foam::coordinateSystem::New ) { const dictionary& coordDict = dict.subDict(typeName_()); - const word coordType = coordDict.lookup("type"); + const word modelType(coordDict.get("type")); - auto cstrIter = dictionaryConstructorTablePtr_->cfind(coordType); + auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType); if (!cstrIter.found()) { @@ -45,9 +45,9 @@ Foam::autoPtr Foam::coordinateSystem::New ( dict ) << "Unknown coordinateSystem type " - << coordType << nl << nl - << "Valid coordinateSystem types :" << nl - << dictionaryConstructorTablePtr_->sortedToc() + << modelType << nl << nl + << "Valid types: " + << flatOutput(dictionaryConstructorTablePtr_->sortedToc()) << exit(FatalIOError); }