diff --git a/applications/test/coordinateSystem/Test-coordinateSystem.C b/applications/test/coordinateSystem/Test-coordinateSystem.C index 7931a97abfc8d0e6b7fc844d3afc5366d0be27a4..f012bff2ee49c23ef22549901c5c9136913b074c 100644 --- a/applications/test/coordinateSystem/Test-coordinateSystem.C +++ b/applications/test/coordinateSystem/Test-coordinateSystem.C @@ -35,6 +35,7 @@ Description #include "Time.H" #include "coordinateSystems.H" #include "identityRotation.H" +#include "cartesianCS.H" #include "indirectCS.H" #include "Fstream.H" #include "IOstreams.H" @@ -58,14 +59,15 @@ void basicTests(const coordinateSystem& cs) { cs.writeEntry(cs.name(), Info); - if (isA<coordSystem::indirect>(cs)) + if (const auto* cartptr = isA<coordSystem::cartesian>(cs)) { - Info<< "indirect from:" << nl; - dynamicCast<const coordSystem::indirect>(cs).cs() - .writeEntry(cs.name(), Info); + if (!cartptr->active()) + { + Info<< "inactive cartesian = " << (*cartptr) + << " with: " << (*cartptr).R() << nl; + } } - Info<< "rotation: " << cs.R() << nl; List<point> testPoints diff --git a/src/meshTools/coordinate/rotation/EulerCoordinateRotation.C b/src/meshTools/coordinate/rotation/EulerCoordinateRotation.C index 2750bde42bc65c285e2aaaa4694a43534f2a2786..ec1785386cd1a4fcb251bdb48d96673ef941f24e 100644 --- a/src/meshTools/coordinate/rotation/EulerCoordinateRotation.C +++ b/src/meshTools/coordinate/rotation/EulerCoordinateRotation.C @@ -258,7 +258,7 @@ Foam::coordinateRotations::euler::euler() Foam::coordinateRotations::euler::euler(const euler& crot) : - coordinateRotation(crot), + coordinateRotation(), angles_(crot.angles_), degrees_(crot.degrees_), order_(crot.order_) @@ -296,7 +296,7 @@ Foam::coordinateRotations::euler::euler Foam::coordinateRotations::euler::euler(const dictionary& dict) : coordinateRotation(), - angles_(dict.getCompat<vector>("angles", {{"rotation", 1806}})), + angles_(dict.get<vector>("angles")), degrees_(dict.getOrDefault("degrees", true)), order_ ( diff --git a/src/meshTools/coordinate/rotation/EulerCoordinateRotation.H b/src/meshTools/coordinate/rotation/EulerCoordinateRotation.H index 5b25da46303b10e706d56f66b3c227a773e60fbc..2dbe8fec748f063c918d8710f0303aa968927909 100644 --- a/src/meshTools/coordinate/rotation/EulerCoordinateRotation.H +++ b/src/meshTools/coordinate/rotation/EulerCoordinateRotation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,7 +38,7 @@ Description https://en.wikipedia.org/wiki/Euler_angles \verbatim - coordinateRotation + rotation { type euler; angles (0 0 180); @@ -109,7 +109,7 @@ public: // Constructors - //- Construct null - an identity transform + //- Default construct - an identity transform euler(); //- Copy construct @@ -165,7 +165,6 @@ public: //- Write dictionary entry virtual void writeEntry(const word& keyword, Ostream& os) const; - }; @@ -173,7 +172,6 @@ public: } // End namespace coordinateRotations - //- Compatibility typedef 1806 typedef coordinateRotations::euler EulerCoordinateRotation; diff --git a/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.C b/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.C index 92c80fae65a8fea3e69f2a46f4f3a30908c28de9..e19f304f3d8dc469b084e94322d631093aa53838 100644 --- a/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.C +++ b/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -104,7 +104,7 @@ Foam::coordinateRotations::starcd::starcd() Foam::coordinateRotations::starcd::starcd(const starcd& crot) : - coordinateRotation(crot), + coordinateRotation(), angles_(crot.angles_), degrees_(crot.degrees_) {} @@ -139,7 +139,7 @@ Foam::coordinateRotations::starcd::starcd Foam::coordinateRotations::starcd::starcd(const dictionary& dict) : coordinateRotation(), - angles_(dict.getCompat<vector>("angles", {{"rotation", 1806}})), + angles_(dict.get<vector>("angles")), degrees_(dict.getOrDefault("degrees", true)) {} diff --git a/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.H b/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.H index 37077d4b6b5537384b83b0165a4a8702a2de5403..f72f5102678f3b3213bf3092a4a5663cbd9ff4c9 100644 --- a/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.H +++ b/src/meshTools/coordinate/rotation/STARCDCoordinateRotation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2018 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,7 +37,7 @@ Description - the rotation angles are in degrees, unless otherwise explicitly specified: \verbatim - coordinateRotation + rotation { type starcd; angles (0 0 180); @@ -94,7 +94,7 @@ public: // Constructors - //- Construct null - an identity transform + //- Default construct - an identity transform starcd(); //- Copy construct @@ -150,7 +150,6 @@ public: } // End namespace coordinateRotations - //- Compatibility typedef 1806 typedef coordinateRotations::starcd STARCDCoordinateRotation; diff --git a/src/meshTools/coordinate/rotation/axesRotation.C b/src/meshTools/coordinate/rotation/axesRotation.C index 155531180a2f95bb1f41f9d16a75113bfb6b2c37..a2a25ce534e06d1aa7ff4f029d6d05714ce465d1 100644 --- a/src/meshTools/coordinate/rotation/axesRotation.C +++ b/src/meshTools/coordinate/rotation/axesRotation.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2018 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -211,22 +211,13 @@ Foam::coordinateRotations::axes::axes() Foam::coordinateRotations::axes::axes(const axes& crot) : - coordinateRotation(crot), + coordinateRotation(), axis1_(crot.axis1_), axis2_(crot.axis2_), order_(crot.order_) {} -Foam::coordinateRotations::axes::axes(axes&& crot) -: - coordinateRotation(std::move(crot)), - axis1_(std::move(crot.axis1_)), - axis2_(std::move(crot.axis2_)), - order_(crot.order_) -{} - - Foam::coordinateRotations::axes::axes ( const vector& axis1, @@ -259,8 +250,8 @@ Foam::coordinateRotations::axes::axes(const dictionary& dict) void Foam::coordinateRotations::axes::clear() { - axis1_ = vector(0,0,1); // e3 = global Z - axis2_ = vector(1,0,0); // e1 = global X + axis1_ = vector(0,0,1); // primary axis (e3, global Z) + axis2_ = vector(1,0,0); // secondary axis (e1, global X) order_ = E3_E1; } diff --git a/src/meshTools/coordinate/rotation/axesRotation.H b/src/meshTools/coordinate/rotation/axesRotation.H index ceb2fc0d815d3322079ba7d8fcd53bad283a619b..2459c67fa654c123400d1a023394a2d65d86de40 100644 --- a/src/meshTools/coordinate/rotation/axesRotation.H +++ b/src/meshTools/coordinate/rotation/axesRotation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2018 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,7 +34,7 @@ Description or (e3/e1). Any nonorthogonality is absorbed into the second vector. \verbatim - coordinateRotation + rotation { type axes; e1 (1 0 0); @@ -122,15 +122,12 @@ public: // Constructors - //- Construct null - an identity transform + //- Default construct - an identity transform axes(); //- Copy construct axes(const axes& crot); - //- Move construct - axes(axes&& crot); - //- Construct from two axes axes(const vector& axis1, const vector& axis2, axisOrder order=E3_E1); diff --git a/src/meshTools/coordinate/rotation/axisAngleRotation.C b/src/meshTools/coordinate/rotation/axisAngleRotation.C index 946794837232dad497660e9bc40cfaf8a62bbd3c..d965376c1fc862df9d1b27313f486e61c95a357a 100644 --- a/src/meshTools/coordinate/rotation/axisAngleRotation.C +++ b/src/meshTools/coordinate/rotation/axisAngleRotation.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -90,7 +90,7 @@ Foam::coordinateRotations::axisAngle::axisAngle() Foam::coordinateRotations::axisAngle::axisAngle(const axisAngle& crot) : - coordinateRotation(crot), + coordinateRotation(), axis_(crot.axis_), angle_(crot.angle_), degrees_(crot.degrees_) @@ -99,17 +99,6 @@ Foam::coordinateRotations::axisAngle::axisAngle(const axisAngle& crot) } -Foam::coordinateRotations::axisAngle::axisAngle(axisAngle&& crot) -: - coordinateRotation(std::move(crot)), - axis_(std::move(crot.axis_)), - angle_(std::move(crot.angle_)), - degrees_(crot.degrees_) -{ - checkSpec(); -} - - Foam::coordinateRotations::axisAngle::axisAngle ( const vector& axis, diff --git a/src/meshTools/coordinate/rotation/axisAngleRotation.H b/src/meshTools/coordinate/rotation/axisAngleRotation.H index b7c83cd11707d9f89876a4ec5302c775b60b91b9..03a5660e9556234b48f457bf2578c5ae40279fab 100644 --- a/src/meshTools/coordinate/rotation/axisAngleRotation.H +++ b/src/meshTools/coordinate/rotation/axisAngleRotation.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,7 +31,7 @@ Description about that axis. \verbatim - coordinateRotation + rotation { type axisAngle; axis (1 0 0); @@ -99,17 +99,15 @@ public: //- Runtime type information TypeNameNoDebug("axisAngle"); + // Constructors - //- Construct null + //- Default construct. Axis = Z, angle = 0. axisAngle(); //- Copy construct axisAngle(const axisAngle& crot); - //- Move construct - axisAngle(axisAngle&& crot); - //- Construct from axis and angle axisAngle(const vector& axis, scalar angle, bool degrees); diff --git a/src/meshTools/coordinate/rotation/coordinateRotation.C b/src/meshTools/coordinate/rotation/coordinateRotation.C index 9967e5e0a80387d3a6a35566e04d59312e799f55..0ea09c00b2635389a066dc1ce1572c3efb4d6d4a 100644 --- a/src/meshTools/coordinate/rotation/coordinateRotation.C +++ b/src/meshTools/coordinate/rotation/coordinateRotation.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,7 +27,6 @@ License \*---------------------------------------------------------------------------*/ #include "coordinateRotation.H" -#include "dictionary.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/meshTools/coordinate/rotation/coordinateRotation.H b/src/meshTools/coordinate/rotation/coordinateRotation.H index ab1db37148ee35b28033be0b52bb44fc5cc7d15c..48ea6c972becc882144c226e2f6d92b247c37ff0 100644 --- a/src/meshTools/coordinate/rotation/coordinateRotation.H +++ b/src/meshTools/coordinate/rotation/coordinateRotation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,7 +37,7 @@ Description User specification of a coordinate rotation. \verbatim - coordinateRotation + rotation { type axes e1 (1 0 0); @@ -61,8 +61,9 @@ SourceFiles #ifndef coordinateRotation_H #define coordinateRotation_H -#include "vectorField.H" -#include "tensorField.H" +#include "autoPtr.H" +#include "vector.H" +#include "tensor.H" #include "dictionary.H" #include "runTimeSelectionTables.H" @@ -137,7 +138,6 @@ public: //- Write dictionary entry virtual void writeEntry(const word& keyword, Ostream& os) const = 0; - }; diff --git a/src/meshTools/coordinate/rotation/cylindricalRotation.C b/src/meshTools/coordinate/rotation/cylindricalRotation.C index 1bdb6b8f0b3fda6533e74a6bfa5e9a33b0b9aa0a..89848a084ef01b35369dc6747b54bab7cdd1bcd7 100644 --- a/src/meshTools/coordinate/rotation/cylindricalRotation.C +++ b/src/meshTools/coordinate/rotation/cylindricalRotation.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -81,7 +81,7 @@ Foam::coordinateRotations::cylindrical::cylindrical(const dictionary& dict) void Foam::coordinateRotations::cylindrical::write(Ostream& os) const { - os << type() << " axis: " << axis1_; + os << type() << " axis: " << axis1_; // primary axis } @@ -94,7 +94,7 @@ void Foam::coordinateRotations::cylindrical::writeEntry os.beginBlock(keyword); os.writeEntry("type", type()); - os.writeEntry("axis", axis1_); + os.writeEntry("axis", axis1_); // primary axis os.endBlock(); } diff --git a/src/meshTools/coordinate/rotation/cylindricalRotation.H b/src/meshTools/coordinate/rotation/cylindricalRotation.H index 72780f843255584ef0b9135e90723f9fa520d9d1..c4e3c8d2a0ff291ca86f0a0089b7aa2ab179fa32 100644 --- a/src/meshTools/coordinate/rotation/cylindricalRotation.H +++ b/src/meshTools/coordinate/rotation/cylindricalRotation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -73,6 +73,9 @@ public: // Constructors + //- Default construct - an identity transform + cylindrical() = default; + //- Copy construct cylindrical(const cylindrical& crot); @@ -110,9 +113,9 @@ public: //- Write dictionary entry virtual void writeEntry(const word& keyword, Ostream& os) const; - }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace coordinateRotations diff --git a/src/meshTools/coordinate/rotation/identityRotation.C b/src/meshTools/coordinate/rotation/identityRotation.C index d5cd36c51dfd97edafb4f1df6bbb7847079fe5a5..6396c68fe176c97aa0ee60608b22c18bf9291e4b 100644 --- a/src/meshTools/coordinate/rotation/identityRotation.C +++ b/src/meshTools/coordinate/rotation/identityRotation.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,21 +48,7 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::coordinateRotations::identity::identity() -: - coordinateRotation() -{} - - -Foam::coordinateRotations::identity::identity(const identity&) -: - identity() -{} - - Foam::coordinateRotations::identity::identity(const dictionary&) -: - identity() {} diff --git a/src/meshTools/coordinate/rotation/identityRotation.H b/src/meshTools/coordinate/rotation/identityRotation.H index 2fa36225bf3cb5b0078b51ca748bb26a11e7b10b..54c7b284dd56a7e0007515b0a655c7f93dd550b5 100644 --- a/src/meshTools/coordinate/rotation/identityRotation.H +++ b/src/meshTools/coordinate/rotation/identityRotation.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,7 +30,7 @@ Description An identity coordinateRotation. \verbatim - coordinateRotation + rotation { type none; } @@ -73,13 +73,19 @@ public: TypeNameNoDebug("none"); - // Constructors + // Generated Methods - //- Construct null - identity(); + //- Default construct + identity() = default; //- Copy construct - identity(const identity& unused); + identity(const identity&) = default; + + //- Copy assignment + identity& operator=(const identity&) = default; + + + // Constructors //- Construct from dictionary explicit identity(const dictionary& unused); @@ -110,7 +116,6 @@ public: //- Write dictionary entry virtual void writeEntry(const word& keyword, Ostream& os) const; - }; diff --git a/src/meshTools/coordinate/systems/cartesianCS.H b/src/meshTools/coordinate/systems/cartesianCS.H index 2b326e5909dd0070faa759fbfb7b9cda8bf71410..90a401d0f724eeaa4edf13f367bd150b699970eb 100644 --- a/src/meshTools/coordinate/systems/cartesianCS.H +++ b/src/meshTools/coordinate/systems/cartesianCS.H @@ -163,7 +163,6 @@ public: //- Compatibility typedef 1806 typedef coordSystem::cartesian cartesianCS; - } // End namespace Foam diff --git a/src/meshTools/coordinate/systems/coordinateSystem.C b/src/meshTools/coordinate/systems/coordinateSystem.C index 7a9faf39716902d3df3fa7290668129f25414775..cd133cb63c97606034d3cd468379f3dadedf00aa 100644 --- a/src/meshTools/coordinate/systems/coordinateSystem.C +++ b/src/meshTools/coordinate/systems/coordinateSystem.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -88,6 +88,10 @@ void Foam::coordinateSystem::assign(const dictionary& dict) { spec_ = coordinateRotation::New(finder.dict()); } + else if (finder.good() && (finder->stream().peek().isWord("none"))) + { + spec_.reset(new coordinateRotations::identity()); + } else { // Fall through to expecting e1/e2/e3 specification in the dictionary diff --git a/src/meshTools/coordinate/systems/coordinateSystem.H b/src/meshTools/coordinate/systems/coordinateSystem.H index 21083ceb8ff2848ffad69a1863aa67434689d677..4ae7db546feaac50d8e24bbcd825347661ddecd9 100644 --- a/src/meshTools/coordinate/systems/coordinateSystem.H +++ b/src/meshTools/coordinate/systems/coordinateSystem.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -67,6 +67,16 @@ Description } \endverbatim + For an identity rotation, can use a slightly more compact format: + \verbatim + coordinateSystem + { + type cartesian; + origin (0 0 0); + rotation none; + } + \endverbatim + Types of coordinateRotation: -# \link coordinateRotations::identity none \endlink -# \link coordinateRotations::axes axes \endlink @@ -429,7 +439,7 @@ public: //- Considered valid if it has a specification virtual bool valid() const { - return spec_; + return bool(spec_); } //- True if the rotation tensor is uniform for all locations @@ -495,7 +505,7 @@ public: name_ = newName; } - //- Provide non-constant access to the optional note + //- Edit access to optional note virtual string& note() { return note_;