From f4ee841c6decae89f4fba4ae3bc629b40ef0ff70 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Mon, 20 Jan 2020 12:14:18 +0100 Subject: [PATCH] STYLE: adjust code format for trackingData - rationalized some layout and comments --- .../LES/LESdeltas/smoothDelta/smoothDelta.H | 74 ++++++------- .../smoothDelta/smoothDeltaDeltaDataI.H | 2 +- .../directions/directionInfo/directionInfo.C | 25 +++-- .../directions/directionInfo/directionInfo.H | 32 +++--- .../directions/directionInfo/directionInfoI.H | 28 ++--- .../wallNormalInfo/wallNormalInfo.C | 23 ++-- .../wallNormalInfo/wallNormalInfo.H | 32 +++--- .../wallNormalInfo/wallNormalInfoI.H | 30 ++---- .../layeredSolver/pointEdgeStructuredWalk.H | 46 +++++--- .../layeredSolver/pointEdgeStructuredWalkI.H | 26 +---- .../pointPatchDist/externalPointEdgePoint.C | 15 +-- .../pointPatchDist/externalPointEdgePoint.H | 47 ++++---- .../pointPatchDist/externalPointEdgePointI.H | 43 ++------ .../pointEdgeCollapse/pointEdgeCollapse.C | 24 +++-- .../pointEdgeCollapse/pointEdgeCollapse.H | 39 ++++--- .../pointEdgeCollapse/pointEdgeCollapseI.H | 59 ++++------ .../polyTopoChange/refinementData.C | 22 ++-- .../polyTopoChange/refinementData.H | 29 +++-- .../polyTopoChange/refinementDataI.H | 17 +-- .../polyTopoChange/refinementDistanceData.C | 17 +-- .../polyTopoChange/refinementDistanceData.H | 46 ++++---- .../polyTopoChange/refinementDistanceDataI.H | 15 ++- .../finiteVolume/fvc/fvcSmooth/smoothData.H | 101 ++++++++++-------- .../finiteVolume/fvc/fvcSmooth/smoothDataI.H | 12 +-- .../finiteVolume/fvc/fvcSmooth/sweepData.H | 84 +++++++++------ .../finiteVolume/fvc/fvcSmooth/sweepDataI.H | 21 ++-- .../wallDist/wallPointYPlus/wallPointYPlusI.H | 30 ++---- .../meshRefinement/patchFaceOrientation.C | 15 +-- .../meshRefinement/patchFaceOrientation.H | 29 ++--- .../meshRefinement/patchFaceOrientationI.H | 15 +-- .../meshRefinement/transportData.H | 8 +- .../meshRefinement/transportDataI.H | 6 +- .../snappyHexMesh/meshRefinement/wallPoints.C | 20 ++-- .../snappyHexMesh/meshRefinement/wallPoints.H | 36 +++---- .../meshRefinement/wallPointsI.H | 10 +- .../PointIntegrateData/PointIntegrateData.H | 27 ++--- .../PointIntegrateData/PointIntegrateDataI.H | 25 ++--- .../algorithms/MeshWave/FaceCellWave.C | 5 +- .../algorithms/MeshWave/FaceCellWave.H | 34 +++--- .../algorithms/MeshWave/FaceCellWaveName.C | 2 +- src/meshTools/algorithms/MeshWave/MeshWave.H | 28 +++-- .../PatchEdgeFaceWave/PatchEdgeFaceWave.C | 26 ----- .../PatchEdgeFaceWave/PatchEdgeFaceWave.H | 59 +++++----- .../PatchEdgeFaceWave/PatchEdgeFaceWaveName.C | 2 +- .../PatchEdgeFaceWave/patchEdgeFaceInfo.C | 15 +-- .../PatchEdgeFaceWave/patchEdgeFaceInfo.H | 41 +++---- .../PatchEdgeFaceWave/patchEdgeFaceInfoI.H | 42 ++------ .../PatchEdgeFaceWave/patchEdgeFaceRegion.C | 15 +-- .../PatchEdgeFaceWave/patchEdgeFaceRegion.H | 33 +++--- .../PatchEdgeFaceWave/patchEdgeFaceRegionI.H | 19 ++-- .../PatchEdgeFaceWave/patchEdgeFaceRegions.C | 15 +-- .../PatchEdgeFaceWave/patchEdgeFaceRegions.H | 39 +++---- .../PatchEdgeFaceWave/patchEdgeFaceRegionsI.H | 13 +-- .../algorithms/PointEdgeWave/PointData.C | 29 +++-- .../algorithms/PointEdgeWave/PointData.H | 25 +++-- .../algorithms/PointEdgeWave/PointDataI.H | 27 +---- .../algorithms/PointEdgeWave/PointEdgeWave.C | 19 ++-- .../algorithms/PointEdgeWave/PointEdgeWave.H | 26 ++--- .../PointEdgeWave/PointEdgeWaveName.C | 2 +- .../algorithms/PointEdgeWave/pointEdgePoint.C | 17 +-- .../algorithms/PointEdgeWave/pointEdgePoint.H | 51 +++++---- .../PointEdgeWave/pointEdgePointI.H | 45 +++----- src/meshTools/cellClassification/cellInfo.C | 22 ++-- src/meshTools/cellClassification/cellInfo.H | 38 +++---- src/meshTools/cellClassification/cellInfoI.H | 30 +++--- src/meshTools/cellDist/wallPoint/wallPoint.C | 21 +++- src/meshTools/cellDist/wallPoint/wallPoint.H | 52 +++++---- .../cellDist/wallPoint/wallPointData.C | 26 ++--- .../cellDist/wallPoint/wallPointData.H | 33 +++--- .../cellDist/wallPoint/wallPointDataI.H | 42 ++------ src/meshTools/cellDist/wallPoint/wallPointI.H | 53 +++------ .../meshStructure/pointTopoDistanceData.C | 15 +-- .../meshStructure/pointTopoDistanceData.H | 24 ++--- .../meshStructure/pointTopoDistanceDataI.H | 8 +- .../meshStructure/topoDistanceData.C | 15 +-- .../meshStructure/topoDistanceData.H | 24 ++--- .../meshStructure/topoDistanceDataI.H | 8 +- src/meshTools/regionSplit/minData.H | 25 +++-- src/meshTools/regionSplit/minDataI.H | 20 ++-- .../inverseDistance/meshToMeshData.C | 16 +-- .../inverseDistance/meshToMeshData.H | 62 +++++------ .../inverseDistance/meshToMeshDataI.H | 12 +-- .../inverseDistance/waveMethod.C | 3 +- .../structuredRenumber/OppositeFaceCellWave.H | 6 +- 84 files changed, 1115 insertions(+), 1199 deletions(-) diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.H b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.H index 1397b6ba7f1..6bcd6efdd4e 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,15 +59,18 @@ class smoothDelta { public: - //- Public member class used by mesh-wave to propagate the delta-ratio + //- Public class used by mesh-wave to propagate the delta-ratio class deltaData { - scalar delta_; + // Private Data + + scalar delta_; + // Private Member Functions - //- Update. Gets information from neighbouring face/cell and - // uses this to update itself (if necessary) and return true. + //- Update gets information from neighbouring face/cell and + //- uses this to update itself (if necessary) and return true. template<class TrackingData> inline bool update ( @@ -82,7 +85,7 @@ public: // Constructors - //- Construct null + //- Default construct inline deltaData(); //- Construct from delta value @@ -93,21 +96,19 @@ public: // Access - scalar delta() const - { - return delta_; - } + scalar delta() const + { + return delta_; + } // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. - // Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -118,7 +119,7 @@ public: ) const; //- Convert any absolute coordinates into relative to - // (patch)face centre + //- (patch)face centre template<class TrackingData> inline void leaveDomain ( @@ -184,40 +185,40 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const deltaData&, TrackingData& td) const; - // Member Operators - // Needed for List IO - inline bool operator==(const deltaData&) const; + // Member Operators - inline bool operator!=(const deltaData&) const; + //- Test for equality + inline bool operator==(const deltaData&) const; - // IOstream Operators + //- Test for inequality + inline bool operator!=(const deltaData&) const; - friend Ostream& operator<< - ( - Ostream& os, - const deltaData& wDist - ) - { - return os << wDist.delta_; - } - friend Istream& operator>>(Istream& is, deltaData& wDist) - { - return is >> wDist.delta_; - } + // IOstream Operators + + friend Ostream& operator<<(Ostream& os, const deltaData& rhs) + { + return os << rhs.delta_; + } + + friend Istream& operator>>(Istream& is, deltaData& rhs) + { + return is >> rhs.delta_; + } }; private: - // Private data + // Private Data autoPtr<LESdelta> geometricDelta_; + scalar maxDeltaRatio_; @@ -253,10 +254,9 @@ private: DynamicList<deltaData>& changedFacesInfo ); - public: - //- Runtime type information + //- Declare type-name, virtual type (with debug switch) TypeName("smooth"); @@ -278,7 +278,7 @@ public: // Member Functions //- Read the LESdelta dictionary - virtual void read(const dictionary&); + virtual void read(const dictionary& dict); // Correct values virtual void correct(); diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDeltaDeltaDataI.H b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDeltaDeltaDataI.H index aa30b6f54ec..827cfda8336 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDeltaDeltaDataI.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDeltaDeltaDataI.H @@ -198,7 +198,7 @@ inline bool Foam::LESModels::smoothDelta::deltaData::operator== const deltaData& rhs ) const { - return delta_ == rhs.delta(); + return delta_ == rhs.delta_; } diff --git a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.C b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.C index 593fd803eee..ed19d054c11 100644 --- a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.C +++ b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -199,23 +200,23 @@ Foam::label Foam::directionInfo::edgeToFaceIndex } -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::directionInfo& wDist + Ostream& os, + const directionInfo& rhs ) { if (os.format() == IOstream::ASCII) { - os << wDist.index_ << wDist.n_; + os << rhs.index_ << rhs.n_; } else { os.write ( - reinterpret_cast<const char*>(&wDist.index_), + reinterpret_cast<const char*>(&rhs.index_), sizeof(directionInfo) ); } @@ -225,19 +226,23 @@ Foam::Ostream& Foam::operator<< } -Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::directionInfo& wDist) +Foam::Istream& Foam::operator>> +( + Istream& is, + directionInfo& rhs +) { if (is.format() == IOstream::ASCII) { - is >> wDist.index_ >> wDist.n_; + is >> rhs.index_ >> rhs.n_; } else if (!is.checkLabelSize<>() || !is.checkScalarSize<>()) { // Non-native label or scalar size is.beginRawRead(); - readRawLabel(is, &wDist.index_); - readRawScalar(is, wDist.n_.data(), vector::nComponents); + readRawLabel(is, &rhs.index_); + readRawScalar(is, rhs.n_.data(), vector::nComponents); is.endRawRead(); } @@ -245,7 +250,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::directionInfo& wDist) { is.read ( - reinterpret_cast<char*>(&wDist.index_), + reinterpret_cast<char*>(&rhs.index_), sizeof(directionInfo) ); } diff --git a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.H b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.H index 4865e8f2d15..6cdf73ef7d6 100644 --- a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.H +++ b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -72,13 +72,11 @@ class polyMesh; class primitiveMesh; class edge; class face; -class polyMesh; class directionInfo; Istream& operator>>(Istream&, directionInfo&); Ostream& operator<<(Ostream&, const directionInfo&); - /*---------------------------------------------------------------------------*\ Class directionInfo Declaration \*---------------------------------------------------------------------------*/ @@ -87,10 +85,10 @@ class directionInfo { // Private Data - // Either mesh edge or face point + //- The mesh edge or face point label index_; - // Local n axis + //- The local n axis vector n_; @@ -128,44 +126,42 @@ public: const label edgeI ); + // Constructors - //- Construct null + //- Default construct, index=-1, vector::zero inline directionInfo(); //- Construct from components inline directionInfo ( - const label, + const label index, const vector& n ); - //- Construct as copy - inline directionInfo(const directionInfo&); - // Member Functions // Access - inline label index() const + label index() const { return index_; } - inline const vector& n() const + const vector& n() const { return n_; } + // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -242,15 +238,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const directionInfo&, TrackingData& td) const; + // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const directionInfo&) const; + //- Test for inequality inline bool operator!=(const directionInfo&) const; diff --git a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfoI.H b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfoI.H index a689f76e760..a50fb84446b 100644 --- a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfoI.H +++ b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfoI.H @@ -31,7 +31,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor inline Foam::directionInfo::directionInfo() : index_(-3), @@ -39,7 +38,6 @@ inline Foam::directionInfo::directionInfo() {} -// Construct from components inline Foam::directionInfo::directionInfo ( const label index, @@ -51,14 +49,6 @@ inline Foam::directionInfo::directionInfo {} -// Construct as copy -inline Foam::directionInfo::directionInfo(const directionInfo& w2) -: - index_(w2.index()), - n_(w2.n()) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class TrackingData> @@ -76,8 +66,7 @@ inline bool Foam::directionInfo::sameGeometry const directionInfo& w2, const scalar tol, TrackingData& td -) - const +) const { return true; } @@ -253,7 +242,6 @@ inline bool Foam::directionInfo::updateFace index_ = -2; } - n_ = neighbourInfo.n(); return true; @@ -300,15 +288,19 @@ inline bool Foam::directionInfo::equal // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline bool Foam::directionInfo::operator==(const Foam::directionInfo& rhs) - const +inline bool Foam::directionInfo::operator== +( + const directionInfo& rhs +) const { - return index() == rhs.index() && n() == rhs.n(); + return index_ == rhs.index_ && n_ == rhs.n_; } -inline bool Foam::directionInfo::operator!=(const Foam::directionInfo& rhs) - const +inline bool Foam::directionInfo::operator!= +( + const directionInfo& rhs +) const { return !(*this == rhs); } diff --git a/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.C b/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.C index 228e86d407e..f6a0b45c94e 100644 --- a/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.C +++ b/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,23 +28,23 @@ License #include "wallNormalInfo.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::wallNormalInfo& wDist + Ostream& os, + const wallNormalInfo& rhs ) { if (os.format() == IOstream::ASCII) { - os << wDist.normal(); + os << rhs.normal(); } else { os.write ( - reinterpret_cast<const char*>(&wDist.normal_), + reinterpret_cast<const char*>(&rhs.normal_), sizeof(vector) ); } @@ -53,18 +54,22 @@ Foam::Ostream& Foam::operator<< } -Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallNormalInfo& wDist) +Foam::Istream& Foam::operator>> +( + Istream& is, + wallNormalInfo& rhs +) { if (is.format() == IOstream::ASCII) { - is >> wDist.normal_; + is >> rhs.normal_; } else if (!is.checkLabelSize<>() || !is.checkScalarSize<>()) { // Non-native label or scalar size is.beginRawRead(); - readRawScalar(is, wDist.normal_.data(), vector::nComponents); + readRawScalar(is, rhs.normal_.data(), vector::nComponents); is.endRawRead(); } @@ -72,7 +77,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallNormalInfo& wDist) { is.read ( - reinterpret_cast<char*>(&wDist.normal_), + reinterpret_cast<char*>(&rhs.normal_), sizeof(vector) ); } diff --git a/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.H b/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.H index 73da1fab900..630203f44f9 100644 --- a/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.H +++ b/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.H @@ -58,52 +58,58 @@ class wallNormalInfo; Istream& operator>>(Istream&, wallNormalInfo&); Ostream& operator<<(Ostream&, const wallNormalInfo&); - /*---------------------------------------------------------------------------*\ Class wallNormalInfo Declaration \*---------------------------------------------------------------------------*/ class wallNormalInfo { - // Private data + // Private Data //- Normal at nearest wall point vector normal_; + // Private Member Functions - //- Evaluate distance to point. Update normal_ + //- Evaluate distance to point and update normal_ template<class TrackingData> inline bool update(const wallNormalInfo& w2, TrackingData& td); + public: // Constructors - //- Construct null + //- Default construct inline wallNormalInfo(); //- Construct from normal inline wallNormalInfo(const vector& normal); - //- Construct as copy - inline wallNormalInfo(const wallNormalInfo&); + // Member Functions // Access - inline const vector& normal() const; + const vector& normal() const + { + return normal_; + } + vector& normal() + { + return normal_; + } // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -180,15 +186,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const wallNormalInfo&, TrackingData& td) const; + // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const wallNormalInfo&) const; + //- Test for inequality inline bool operator!=(const wallNormalInfo&) const; diff --git a/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfoI.H b/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfoI.H index 92bfc65c854..0260c2828de 100644 --- a/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfoI.H +++ b/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfoI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -60,35 +61,20 @@ inline bool Foam::wallNormalInfo::update // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor inline Foam::wallNormalInfo::wallNormalInfo() : normal_(point::max) {} -// Construct from normal inline Foam::wallNormalInfo::wallNormalInfo(const vector& normal) : normal_(normal) {} -// Construct as copy -inline Foam::wallNormalInfo::wallNormalInfo(const wallNormalInfo& wpt) -: - normal_(wpt.normal()) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const Foam::vector& Foam::wallNormalInfo::normal() const -{ - return normal_; -} - - template<class TrackingData> inline bool Foam::wallNormalInfo::valid(TrackingData& td) const { @@ -207,15 +193,19 @@ inline bool Foam::wallNormalInfo::equal // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline bool Foam::wallNormalInfo::operator==(const Foam::wallNormalInfo& rhs) - const +inline bool Foam::wallNormalInfo::operator== +( + const wallNormalInfo& rhs +) const { - return normal() == rhs.normal(); + return normal_ == rhs.normal_; } -inline bool Foam::wallNormalInfo::operator!=(const Foam::wallNormalInfo& rhs) - const +inline bool Foam::wallNormalInfo::operator!= +( + const wallNormalInfo& rhs +) const { return !(*this == rhs); } diff --git a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H index befff59bd56..a7ffdf63b47 100644 --- a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H +++ b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -55,7 +55,6 @@ class pointEdgeStructuredWalk; Istream& operator>>(Istream&, pointEdgeStructuredWalk&); Ostream& operator<<(Ostream&, const pointEdgeStructuredWalk&); - /*---------------------------------------------------------------------------*\ Class pointEdgeStructuredWalk Declaration \*---------------------------------------------------------------------------*/ @@ -95,7 +94,7 @@ public: // Constructors - //- Construct null + //- Default construct inline pointEdgeStructuredWalk(); //- Construct from components @@ -113,27 +112,35 @@ public: // Access - //- True if starting point is valid (ie, not point::max) - inline bool inZone() const; - //- The distance information - inline scalar dist() const; + scalar dist() const + { + return dist_; + } //- Tracking data - inline const vector& data() const; + const vector& data() const + { + return data_; + } //- Index (if any) associated with data - inline label index() const; + label index() const + { + return index_; + } + //- True if starting point is valid (ie, not point::max) + inline bool inZone() const; - // Needed by meshWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + // Needed by MeshWave + + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -217,16 +224,21 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> - inline bool equal(const pointEdgeStructuredWalk&, TrackingData&) - const; + inline bool equal + ( + const pointEdgeStructuredWalk&, + TrackingData& + ) const; // Member Operators - //Note: Used to determine whether to call update. + //- Test for equality inline bool operator==(const pointEdgeStructuredWalk&) const; + + //- Test for inequality inline bool operator!=(const pointEdgeStructuredWalk&) const; diff --git a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H index 6a14b39b7f3..f7dbbea529b 100644 --- a/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H +++ b/src/dynamicMesh/motionSolvers/displacement/layeredSolver/pointEdgeStructuredWalkI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -91,24 +91,6 @@ inline bool Foam::pointEdgeStructuredWalk::inZone() const } -inline Foam::scalar Foam::pointEdgeStructuredWalk::dist() const -{ - return dist_; -} - - -inline const Foam::vector& Foam::pointEdgeStructuredWalk::data() const -{ - return data_; -} - - -inline Foam::label Foam::pointEdgeStructuredWalk::index() const -{ - return index_; -} - - template<class TrackingData> inline bool Foam::pointEdgeStructuredWalk::valid(TrackingData& td) const { @@ -125,7 +107,7 @@ inline bool Foam::pointEdgeStructuredWalk::sameGeometry TrackingData& td ) const { - scalar diff = Foam::mag(dist() - w2.dist()); + const scalar diff = Foam::mag(dist() - w2.dist()); if (diff < SMALL) { @@ -275,7 +257,7 @@ inline bool Foam::pointEdgeStructuredWalk::equal inline bool Foam::pointEdgeStructuredWalk::operator== ( - const Foam::pointEdgeStructuredWalk& rhs + const pointEdgeStructuredWalk& rhs ) const { return previousPoint_ == rhs.previousPoint_; @@ -284,7 +266,7 @@ inline bool Foam::pointEdgeStructuredWalk::operator== inline bool Foam::pointEdgeStructuredWalk::operator!= ( - const Foam::pointEdgeStructuredWalk& rhs + const pointEdgeStructuredWalk& rhs ) const { return !(*this == rhs); diff --git a/src/dynamicMesh/pointPatchDist/externalPointEdgePoint.C b/src/dynamicMesh/pointPatchDist/externalPointEdgePoint.C index 93a88314413..b2bfbfe7f86 100644 --- a/src/dynamicMesh/pointPatchDist/externalPointEdgePoint.C +++ b/src/dynamicMesh/pointPatchDist/externalPointEdgePoint.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,25 +28,25 @@ License #include "externalPointEdgePoint.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::externalPointEdgePoint& wDist + Ostream& os, + const externalPointEdgePoint& rhs ) { - return os << wDist.origin() << wDist.distSqr(); + return os << rhs.origin() << rhs.distSqr(); } Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::externalPointEdgePoint& wDist + Istream& is, + externalPointEdgePoint& rhs ) { - return is >> wDist.origin_ >> wDist.distSqr_; + return is >> rhs.origin_ >> rhs.distSqr_; } diff --git a/src/dynamicMesh/pointPatchDist/externalPointEdgePoint.H b/src/dynamicMesh/pointPatchDist/externalPointEdgePoint.H index d38c265c8ff..c0783aae04c 100644 --- a/src/dynamicMesh/pointPatchDist/externalPointEdgePoint.H +++ b/src/dynamicMesh/pointPatchDist/externalPointEdgePoint.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,14 +56,13 @@ class externalPointEdgePoint; Istream& operator>>(Istream&, externalPointEdgePoint&); Ostream& operator<<(Ostream&, const externalPointEdgePoint&); - /*---------------------------------------------------------------------------*\ - Class externalPointEdgePoint Declaration + Class externalPointEdgePoint Declaration \*---------------------------------------------------------------------------*/ class externalPointEdgePoint { - // Private data + // Private Data //- Position of nearest wall center point origin_; @@ -74,9 +73,9 @@ class externalPointEdgePoint // Private Member Functions - //- Evaluate distance to point. Update distSqr, origin from whomever - // is nearer pt. Return true if w2 is closer to point, - // false otherwise. + //- Evaluate distance to point. + // Update distSqr, origin from whomever is nearer pt. + // \return true if w2 is closer to point, false otherwise. template<class TrackingData> inline bool update ( @@ -86,8 +85,8 @@ class externalPointEdgePoint TrackingData& td ); - //- Combine current with w2. Update distSqr, origin if w2 has smaller - // quantities and returns true. + //- Combine current with w2. + // Update distSqr, origin if w2 has smaller quantities and return true template<class TrackingData> inline bool update ( @@ -103,6 +102,7 @@ public: class trackingData { public: + const pointField& points_; trackingData(const pointField& points) @@ -112,36 +112,37 @@ public: }; - // Constructors - //- Construct null + //- Default construct inline externalPointEdgePoint(); //- Construct from origin, distance inline externalPointEdgePoint(const point&, const scalar); - //- Construct as copy - inline externalPointEdgePoint(const externalPointEdgePoint&); - // Member Functions // Access - inline const point& origin() const; + const point& origin() const + { + return origin_; + } - inline scalar distSqr() const; + scalar distSqr() const + { + return distSqr_; + } // Needed by PointEdgeWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -151,7 +152,7 @@ public: ) const; //- Convert origin to relative vector to leaving point - // (= point coordinate) + //- (= point coordinate) template<class TrackingData> inline void leaveDomain ( @@ -225,7 +226,7 @@ public: TrackingData& td ); - //- Equivalent to operator== with TrackingData + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal ( @@ -236,8 +237,10 @@ public: // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const externalPointEdgePoint&) const; + + //- Test for inequality inline bool operator!=(const externalPointEdgePoint&) const; diff --git a/src/dynamicMesh/pointPatchDist/externalPointEdgePointI.H b/src/dynamicMesh/pointPatchDist/externalPointEdgePointI.H index 78e18f1d8ef..2228c169049 100644 --- a/src/dynamicMesh/pointPatchDist/externalPointEdgePointI.H +++ b/src/dynamicMesh/pointPatchDist/externalPointEdgePointI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -39,7 +40,7 @@ inline bool Foam::externalPointEdgePoint::update TrackingData& td ) { - scalar dist2 = magSqr(pt - w2.origin()); + const scalar dist2 = magSqr(pt - w2.origin()); if (!valid(td)) { @@ -50,7 +51,7 @@ inline bool Foam::externalPointEdgePoint::update return true; } - scalar diff = distSqr_ - dist2; + const scalar diff = distSqr_ - dist2; if (diff < 0) { @@ -91,7 +92,7 @@ inline bool Foam::externalPointEdgePoint::update return true; } - scalar diff = distSqr_ - w2.distSqr(); + const scalar diff = distSqr_ - w2.distSqr(); if (diff < 0) { @@ -135,30 +136,8 @@ inline Foam::externalPointEdgePoint::externalPointEdgePoint {} -inline Foam::externalPointEdgePoint::externalPointEdgePoint -( - const externalPointEdgePoint& wpt -) -: - origin_(wpt.origin()), - distSqr_(wpt.distSqr()) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const Foam::point& Foam::externalPointEdgePoint::origin() const -{ - return origin_; -} - - -inline Foam::scalar Foam::externalPointEdgePoint::distSqr() const -{ - return distSqr_; -} - - template<class TrackingData> inline bool Foam::externalPointEdgePoint::valid(TrackingData& td) const { @@ -175,7 +154,7 @@ inline bool Foam::externalPointEdgePoint::sameGeometry TrackingData& td ) const { - scalar diff = Foam::mag(distSqr() - w2.distSqr()); + const scalar diff = Foam::mag(distSqr() - w2.distSqr()); if (diff < SMALL) { @@ -305,19 +284,17 @@ inline bool Foam::externalPointEdgePoint::equal inline bool Foam::externalPointEdgePoint::operator== ( - const Foam::externalPointEdgePoint& rhs -) -const + const externalPointEdgePoint& rhs +) const { - return (origin() == rhs.origin()) && (distSqr() == rhs.distSqr()); + return origin_ == rhs.origin_ && distSqr_ == rhs.distSqr_; } inline bool Foam::externalPointEdgePoint::operator!= ( - const Foam::externalPointEdgePoint& rhs -) -const + const externalPointEdgePoint& rhs +) const { return !(*this == rhs); } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.C index af09e6342d5..39a24d3529f 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,30 +28,31 @@ License #include "pointEdgeCollapse.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::pointEdgeCollapse& wDist + Ostream& os, + const pointEdgeCollapse& rhs ) { return os - << wDist.collapsePoint_ - << wDist.collapseIndex_ - << wDist.collapsePriority_; + << rhs.collapsePoint_ + << rhs.collapseIndex_ + << rhs.collapsePriority_; } + Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::pointEdgeCollapse& wDist + Istream& is, + pointEdgeCollapse& rhs ) { return is - >> wDist.collapsePoint_ - >> wDist.collapseIndex_ - >> wDist.collapsePriority_; + >> rhs.collapsePoint_ + >> rhs.collapseIndex_ + >> rhs.collapsePriority_; } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.H index 80e64598e13..5d3f72ee2fa 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -55,14 +55,13 @@ class pointEdgeCollapse; Istream& operator>>(Istream&, pointEdgeCollapse&); Ostream& operator<<(Ostream&, const pointEdgeCollapse&); - /*---------------------------------------------------------------------------*\ - Class pointEdgeCollapse Declaration + Class pointEdgeCollapse Declaration \*---------------------------------------------------------------------------*/ class pointEdgeCollapse { - // Private data + // Private Data //- Collapse location point collapsePoint_; @@ -85,7 +84,6 @@ class pointEdgeCollapse TrackingData& td ); - //- Check for same coordinate inline bool samePoint(const point& pt) const; @@ -93,7 +91,7 @@ public: // Constructors - //- Construct null + //- Default construct inline pointEdgeCollapse(); //- Construct from components @@ -109,17 +107,25 @@ public: // Access - inline const point& collapsePoint() const; + const point& collapsePoint() const + { + return collapsePoint_; + } - inline label collapseIndex() const; + label collapseIndex() const + { + return collapseIndex_; + } - inline label collapsePriority() const; + label collapsePriority() const + { + return collapsePriority_; + } - // Needed by meshWave + // Needed by MeshWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; @@ -198,16 +204,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> - inline bool equal(const pointEdgeCollapse&, TrackingData&) - const; + inline bool equal(const pointEdgeCollapse&, TrackingData&) const; // Member Operators - //Note: Used to determine whether to call update. + //- Test for equality inline bool operator==(const pointEdgeCollapse&) const; + + //- Test for inequality inline bool operator!=(const pointEdgeCollapse&) const; diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapseI.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapseI.H index b7063453d21..27beacf0284 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapseI.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapseI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,7 +31,6 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Update this with w2. template<class TrackingData> inline bool Foam::pointEdgeCollapse::update ( @@ -99,9 +98,24 @@ inline bool Foam::pointEdgeCollapse::update } +inline bool Foam::pointEdgeCollapse::samePoint(const point& pt) const +{ + bool isLegal1 = (cmptMin(collapsePoint_) < 0.5*GREAT); + bool isLegal2 = (cmptMin(pt) < 0.5*GREAT); + + if (isLegal1 && isLegal2) + { + return mag(collapsePoint_ - pt) < 1e-9;//SMALL; + } + else + { + return isLegal1 == isLegal2; + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor inline Foam::pointEdgeCollapse::pointEdgeCollapse() : collapsePoint_(GREAT, GREAT, GREAT), @@ -110,7 +124,6 @@ inline Foam::pointEdgeCollapse::pointEdgeCollapse() {} -// Construct from origin, distance inline Foam::pointEdgeCollapse::pointEdgeCollapse ( const point& collapsePoint, @@ -126,40 +139,6 @@ inline Foam::pointEdgeCollapse::pointEdgeCollapse // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const Foam::point& Foam::pointEdgeCollapse::collapsePoint() const -{ - return collapsePoint_; -} - - -inline Foam::label Foam::pointEdgeCollapse::collapseIndex() const -{ - return collapseIndex_; -} - - -inline Foam::label Foam::pointEdgeCollapse::collapsePriority() const -{ - return collapsePriority_; -} - - -inline bool Foam::pointEdgeCollapse::samePoint(const point& pt) const -{ - bool isLegal1 = (cmptMin(collapsePoint_) < 0.5*GREAT); - bool isLegal2 = (cmptMin(pt) < 0.5*GREAT); - - if (isLegal1 && isLegal2) - { - return mag(collapsePoint_ - pt) < 1e-9;//SMALL; - } - else - { - return isLegal1 == isLegal2; - } -} - - template<class TrackingData> inline bool Foam::pointEdgeCollapse::valid(TrackingData& td) const { @@ -282,7 +261,7 @@ inline bool Foam::pointEdgeCollapse::equal inline bool Foam::pointEdgeCollapse::operator== ( - const Foam::pointEdgeCollapse& rhs + const pointEdgeCollapse& rhs ) const { return @@ -294,7 +273,7 @@ inline bool Foam::pointEdgeCollapse::operator== inline bool Foam::pointEdgeCollapse::operator!= ( - const Foam::pointEdgeCollapse& rhs + const pointEdgeCollapse& rhs ) const { return !(*this == rhs); diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.C index 35dc89d75ce..13ee823d946 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,23 +28,23 @@ License #include "refinementData.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::refinementData& wDist + Ostream& os, + const refinementData& rhs ) { if (os.format() == IOstream::ASCII) { - os << wDist.refinementCount_ << token::SPACE << wDist.count_; + os << rhs.refinementCount_ << token::SPACE << rhs.count_; } else { os.write ( - reinterpret_cast<const char*>(&wDist.refinementCount_), + reinterpret_cast<const char*>(&rhs.refinementCount_), sizeof(refinementData) ); } @@ -54,18 +54,22 @@ Foam::Ostream& Foam::operator<< } -Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::refinementData& wDist) +Foam::Istream& Foam::operator>> +( + Istream& is, + refinementData& rhs +) { if (is.format() == IOstream::ASCII) { - is >> wDist.refinementCount_ >> wDist.count_; + is >> rhs.refinementCount_ >> rhs.count_; } else { Detail::readContiguous<refinementData> ( is, - reinterpret_cast<char*>(&wDist.refinementCount_), + reinterpret_cast<char*>(&rhs.refinementCount_), sizeof(refinementData) ); } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.H index e7c19d7b266..1c72c872e4e 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,14 +56,13 @@ class refinementData; Istream& operator>>(Istream&, refinementData&); Ostream& operator<<(Ostream&, const refinementData&); - /*---------------------------------------------------------------------------*\ Class refinementData Declaration \*---------------------------------------------------------------------------*/ class refinementData { - // Private data + // Private Data //- Count which triggers refinement label refinementCount_; @@ -75,7 +74,7 @@ public: // Constructors - //- Construct null + //- Default construct inline refinementData(); //- Construct from count @@ -86,27 +85,25 @@ public: // Access - inline label refinementCount() const + label refinementCount() const { return refinementCount_; } - - inline label& refinementCount() + label& refinementCount() { return refinementCount_; } - inline label count() const + label count() const { return count_; } - - inline label& count() + label& count() { return count_; } - inline bool isRefined() const + bool isRefined() const { return count_ >= refinementCount_; } @@ -115,12 +112,11 @@ public: // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -197,16 +193,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const refinementData&, TrackingData& td) const; // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const refinementData&) const; + //- Test for inequality inline bool operator!=(const refinementData&) const; diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDataI.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDataI.H index 95da8d3fe8b..f8bdaae0cbe 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDataI.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDataI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,7 +28,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor inline Foam::refinementData::refinementData() : refinementCount_(-1), @@ -35,7 +35,6 @@ inline Foam::refinementData::refinementData() {} -// Construct from components inline Foam::refinementData::refinementData ( const label refinementCount, @@ -251,15 +250,19 @@ inline bool Foam::refinementData::equal // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline bool Foam::refinementData::operator==(const Foam::refinementData& rhs) - const +inline bool Foam::refinementData::operator== +( + const refinementData& rhs +) const { - return count() == rhs.count() && refinementCount() == rhs.refinementCount(); + return count_ == rhs.count_ && refinementCount_ == rhs.refinementCount_; } -inline bool Foam::refinementData::operator!=(const Foam::refinementData& rhs) - const +inline bool Foam::refinementData::operator!= +( + const refinementData& rhs +) const { return !(*this == rhs); } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceData.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceData.C index de2cb7171a7..c3aa09374a7 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceData.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceData.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,27 +28,27 @@ License #include "refinementDistanceData.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::refinementDistanceData& wDist + Ostream& os, + const refinementDistanceData& rhs ) { return os - << wDist.level0Size_ << token::SPACE << wDist.origin_ - << token::SPACE << wDist.originLevel_; + << rhs.level0Size_ << token::SPACE << rhs.origin_ + << token::SPACE << rhs.originLevel_; } Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::refinementDistanceData& wDist + Istream& is, + refinementDistanceData& rhs ) { - return is >> wDist.level0Size_ >> wDist.origin_ >> wDist.originLevel_; + return is >> rhs.level0Size_ >> rhs.origin_ >> rhs.originLevel_; } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceData.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceData.H index e103075202f..5e0cecacd9b 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceData.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceData.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,7 +63,7 @@ Ostream& operator<<(Ostream&, const refinementDistanceData&); class refinementDistanceData { - // Private data + // Private Data //- Unrefined (level0) buffer size (nBufferLayers*level0Size) scalar level0Size_; @@ -75,7 +75,8 @@ class refinementDistanceData // Private Member Functions - //- Updates with neighbouring data. Returns true if something changed. + //- Updates with neighbouring data. + // \return true if something changed. template<class TrackingData> inline bool update ( @@ -89,7 +90,7 @@ public: // Constructors - //- Construct null + //- Default construct inline refinementDistanceData(); //- Construct from count @@ -105,32 +106,29 @@ public: // Access - inline scalar level0Size() const + scalar level0Size() const { return level0Size_; } - - inline scalar& level0Size() + scalar& level0Size() { return level0Size_; } - inline const point& origin() const + const point& origin() const { return origin_; } - - inline point& origin() + point& origin() { return origin_; } - inline label originLevel() const + label originLevel() const { return originLevel_; } - - inline label& originLevel() + label& originLevel() { return originLevel_; } @@ -138,19 +136,18 @@ public: // Other - //- Calculates the wanted level at a given point. Walks out from - // the origin. + //- Calculates the wanted level at a given point. + // Walks out from the origin. inline label wantedLevel(const point& pt) const; // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData&) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -227,19 +224,18 @@ public: TrackingData& ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> - inline bool equal - ( - const refinementDistanceData&, - TrackingData& - ) const; + inline bool equal(const refinementDistanceData&, TrackingData&) + const; + // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const refinementDistanceData&) const; + //- Test for inequality inline bool operator!=(const refinementDistanceData&) const; diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceDataI.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceDataI.H index 04d3a30ad54..e7995019e60 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceDataI.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementDistanceDataI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,9 +31,10 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Returns the wanted level -inline Foam::label Foam::refinementDistanceData::wantedLevel(const point& pt) - const +inline Foam::label Foam::refinementDistanceData::wantedLevel +( + const point& pt +) const { const scalar distSqr = magSqr(pt-origin_); @@ -122,14 +123,12 @@ inline bool Foam::refinementDistanceData::update // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor inline Foam::refinementDistanceData::refinementDistanceData() : level0Size_(-1) {} -// Construct from components inline Foam::refinementDistanceData::refinementDistanceData ( const scalar level0Size, @@ -283,7 +282,7 @@ inline bool Foam::refinementDistanceData::equal inline bool Foam::refinementDistanceData::operator== ( - const Foam::refinementDistanceData& rhs + const refinementDistanceData& rhs ) const { return @@ -295,7 +294,7 @@ inline bool Foam::refinementDistanceData::operator== inline bool Foam::refinementDistanceData::operator!= ( - const Foam::refinementDistanceData& rhs + const refinementDistanceData& rhs ) const { return !(*this == rhs); diff --git a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothData.H b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothData.H index f425d036346..546d56faea7 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothData.H +++ b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothData.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -44,33 +44,27 @@ SourceFiles namespace Foam { +// Forward Declarations +class smoothData; + +Ostream& operator<<(Ostream&, const smoothData&); +Istream& operator>>(Istream&, smoothData&); + /*---------------------------------------------------------------------------*\ Class smoothData Declaration \*---------------------------------------------------------------------------*/ class smoothData { + // Private Data -public: - - //- Class used to pass additional data in - class trackData - { - public: - - //- Cut off distance - scalar maxRatio; - }; - - -private: + scalar value_; - scalar value_; // Private Member Functions - //- Update - gets information from neighbouring face/cell and - // uses this to update itself (if necessary) and return true + //- Update gets information from neighbouring face/cell and + //- uses this to update itself (if necessary) and return true template<class TrackingData> inline bool update ( @@ -83,10 +77,28 @@ private: public: + //- Class used to pass additional data in + class trackData + { + public: + + //- Cut off distance + scalar maxRatio; + }; + + + // Generated Methods + + //- Copy construct + smoothData(const smoothData&) = default; + + //- Copy assignment + smoothData& operator=(const smoothData&) = default; + // Constructors - //- Construct null + //- Default construct inline smoothData(); //- Construct from inverse field value @@ -103,16 +115,20 @@ public: return value_; } + //- The value + scalar& value() + { + return value_; + } + // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data - // Used for cyclics checking + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -123,7 +139,7 @@ public: ) const; //- Convert any absolute coordinates into relative to - // (patch)face centre + //- (patch)face centre template<class TrackingData> inline void leaveDomain ( @@ -189,36 +205,37 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const smoothData&, TrackingData& td) const; - // Member Operators + // Member Operators - inline void operator=(const scalar value); + //- Assign new value + void operator=(const scalar value) + { + value_ = value; + } - // Needed for List IO - inline bool operator==(const smoothData&) const; + //- Test for equality + inline bool operator==(const smoothData&) const; - inline bool operator!=(const smoothData&) const; + //- Test for inequality + inline bool operator!=(const smoothData&) const; - // IOstream Operators + // IOstream Operators - friend Ostream& operator<< - ( - Ostream& os, - const smoothData& svf - ) - { - return os << svf.value_; - } + friend Ostream& operator<<(Ostream& os, const smoothData& rhs) + { + return os << rhs.value_; + } - friend Istream& operator>>(Istream& is, smoothData& svf) - { - return is >> svf.value_; - } + friend Istream& operator>>(Istream& is, smoothData& rhs) + { + return is >> rhs.value_; + } }; diff --git a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothDataI.H b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothDataI.H index 5386127837a..301b478d215 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothDataI.H +++ b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/smoothDataI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -192,21 +193,12 @@ inline bool Foam::smoothData::equal // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline void Foam::smoothData::operator= -( - const scalar value -) -{ - value_ = value; -} - - inline bool Foam::smoothData::operator== ( const smoothData& rhs ) const { - return value_ == rhs.value(); + return value_ == rhs.value_; } diff --git a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepData.H b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepData.H index aad84f23370..fea4a8986e2 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepData.H +++ b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepData.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -44,19 +44,29 @@ SourceFiles namespace Foam { +// Forward Declarations +class sweepData; + +Ostream& operator<<(Ostream&, const sweepData&); +Istream& operator>>(Istream&, sweepData&); + /*---------------------------------------------------------------------------*\ Class sweepData Declaration \*---------------------------------------------------------------------------*/ class sweepData { - scalar value_; - point origin_; + // Private Data + + scalar value_; + + point origin_; + // Private Member Functions - //- Update - gets information from neighbouring face/cell and - // uses this to update itself (if necessary) and return true + //- Update gets information from neighbouring face/cell and + //- uses this to update itself (if necessary) and return true template<class TrackingData> inline bool update ( @@ -69,12 +79,21 @@ class sweepData public: + // Generated Methods + + //- Copy construct + sweepData(const sweepData&) = default; + + //- Copy assignment + sweepData& operator=(const sweepData&) = default; + + // Constructors - //- Construct null + //- Default construct inline sweepData(); - //- Construct from component + //- Construct from components inline sweepData(const scalar value, const point& origin); @@ -88,6 +107,12 @@ public: return value_; } + //- The value + scalar& value() + { + return value_; + } + //- Return origin const point& origin() const { @@ -97,13 +122,11 @@ public: // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data - // Used for cyclics checking + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -180,36 +203,37 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const sweepData&, TrackingData& td) const; - // Member Operators + // Member Operators - inline void operator=(const scalar value); + //- Assign new value + void operator=(const scalar value) + { + value_ = value; + } - // Needed for List IO - inline bool operator==(const sweepData&) const; + //- Test for equality + inline bool operator==(const sweepData&) const; - inline bool operator!=(const sweepData&) const; + //- Test for inequality + inline bool operator!=(const sweepData&) const; - // IOstream Operators + // IOstream Operators - friend Ostream& operator<< - ( - Ostream& os, - const sweepData& svf - ) - { - return os << svf.value_ << svf.origin_; - } + friend Ostream& operator<<(Ostream& os, const sweepData& rhs) + { + return os << rhs.value_ << rhs.origin_; + } - friend Istream& operator>>(Istream& is, sweepData& svf) - { - return is >> svf.value_ >> svf.origin_; - } + friend Istream& operator>>(Istream& is, sweepData& rhs) + { + return is >> rhs.value_ >> rhs.origin_; + } }; diff --git a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepDataI.H b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepDataI.H index 31e73043258..a57cfcd8801 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepDataI.H +++ b/src/finiteVolume/finiteVolume/fvc/fvcSmooth/sweepDataI.H @@ -44,7 +44,7 @@ inline bool Foam::sweepData::update return true; } - scalar myDist2 = magSqr(position - origin()); + const scalar myDist2 = magSqr(position - origin()); if (myDist2 < SMALL) { @@ -76,11 +76,15 @@ inline bool Foam::sweepData::update inline Foam::sweepData::sweepData() : value_(-GREAT), - origin_(vector::max) + origin_(point::max) {} -inline Foam::sweepData::sweepData(const scalar value, const point& origin) +inline Foam::sweepData::sweepData +( + const scalar value, + const point& origin +) : value_(value), origin_(origin) @@ -208,21 +212,12 @@ inline bool Foam::sweepData::equal // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline void Foam::sweepData::operator= -( - const scalar value -) -{ - value_ = value; -} - - inline bool Foam::sweepData::operator== ( const sweepData& rhs ) const { - return origin() == rhs.origin(); + return origin_ == rhs.origin_; } diff --git a/src/finiteVolume/fvMesh/wallDist/wallPointYPlus/wallPointYPlusI.H b/src/finiteVolume/fvMesh/wallDist/wallPointYPlus/wallPointYPlusI.H index d7ecccfb6d8..18ff15e8a05 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallPointYPlus/wallPointYPlusI.H +++ b/src/finiteVolume/fvMesh/wallDist/wallPointYPlus/wallPointYPlusI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,16 +26,11 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Update this with w2 if w2 nearer to pt. template<class TrackingData> -inline bool wallPointYPlus::update +inline bool Foam::wallPointYPlus::update ( const point& pt, const wallPointYPlus& w2, @@ -42,11 +38,11 @@ inline bool wallPointYPlus::update TrackingData& td ) { - scalar dist2 = magSqr(pt - w2.origin()); + const scalar dist2 = magSqr(pt - w2.origin()); if (valid(td)) { - scalar diff = distSqr() - dist2; + const scalar diff = distSqr() - dist2; if (diff < 0) { @@ -65,7 +61,7 @@ inline bool wallPointYPlus::update // Either *this is not yet valid or w2 is closer { // only propagate if interesting (i.e. y+ < 100) - scalar yPlus = Foam::sqrt(dist2)/w2.data(); + const scalar yPlus = Foam::sqrt(dist2)/w2.data(); if (yPlus < yPlusCutOff) { @@ -86,8 +82,7 @@ inline bool wallPointYPlus::update // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor -inline wallPointYPlus::wallPointYPlus() +inline Foam::wallPointYPlus::wallPointYPlus() : wallPointData<scalar>() { @@ -96,8 +91,7 @@ inline wallPointYPlus::wallPointYPlus() } -// Construct from components -inline wallPointYPlus::wallPointYPlus +inline Foam::wallPointYPlus::wallPointYPlus ( const point& origin, const scalar yStar, @@ -112,7 +106,7 @@ inline wallPointYPlus::wallPointYPlus // Update this with w2 if w2 nearer to pt. template<class TrackingData> -inline bool wallPointYPlus::updateCell +inline bool Foam::wallPointYPlus::updateCell ( const polyMesh& mesh, const label thisCelli, @@ -136,7 +130,7 @@ inline bool wallPointYPlus::updateCell // Update this with w2 if w2 nearer to pt. template<class TrackingData> -inline bool wallPointYPlus::updateFace +inline bool Foam::wallPointYPlus::updateFace ( const polyMesh& mesh, const label thisFacei, @@ -160,7 +154,7 @@ inline bool wallPointYPlus::updateFace // Update this with w2 if w2 nearer to pt. template<class TrackingData> -inline bool wallPointYPlus::updateFace +inline bool Foam::wallPointYPlus::updateFace ( const polyMesh& mesh, const label thisFacei, @@ -181,8 +175,4 @@ inline bool wallPointYPlus::updateFace } -// ************************************************************************* // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientation.C b/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientation.C index 5b1b7d71f87..9db5feeb40b 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientation.C +++ b/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientation.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,25 +28,25 @@ License #include "patchFaceOrientation.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::patchFaceOrientation& wDist + Ostream& os, + const patchFaceOrientation& rhs ) { - return os << wDist.flipStatus_; + return os << rhs.flipStatus_; } Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::patchFaceOrientation& wDist + Istream& is, + patchFaceOrientation& rhs ) { - return is >> wDist.flipStatus_; + return is >> rhs.flipStatus_; } diff --git a/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientation.H b/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientation.H index edbbf70cd57..bf6d5df1caa 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientation.H +++ b/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2015 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,14 +54,13 @@ class patchFaceOrientation; Istream& operator>>(Istream&, patchFaceOrientation&); Ostream& operator<<(Ostream&, const patchFaceOrientation&); - /*---------------------------------------------------------------------------*\ - Class patchFaceOrientation Declaration + Class patchFaceOrientation Declaration \*---------------------------------------------------------------------------*/ class patchFaceOrientation { - // Private data + // Private Data //- Flip status label flipStatus_; @@ -70,7 +69,7 @@ public: // Constructors - //- Construct null + //- Default construct inline patchFaceOrientation(); //- Construct from components @@ -79,17 +78,21 @@ public: // Member Functions + // Access + //- Orientation - inline label flipStatus() const; + label flipStatus() const + { + return flipStatus_; + } - //- Reverse orientation + //- Reverse the orientation inline void flip(); - // Needed by meshWave + // Needed by MeshWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; @@ -142,15 +145,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const patchFaceOrientation&, TrackingData&) const; // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const patchFaceOrientation&) const; + + //- Test for equality inline bool operator!=(const patchFaceOrientation&) const; diff --git a/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientationI.H b/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientationI.H index fef7d0b729d..16f1be13da3 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientationI.H +++ b/src/mesh/snappyHexMesh/meshRefinement/patchFaceOrientationI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,7 +30,7 @@ License #include "transform.H" #include "orientedSurface.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // inline Foam::patchFaceOrientation::patchFaceOrientation() : @@ -48,12 +49,6 @@ inline Foam::patchFaceOrientation::patchFaceOrientation // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline Foam::label Foam::patchFaceOrientation::flipStatus() const -{ - return flipStatus_; -} - - inline void Foam::patchFaceOrientation::flip() { if (flipStatus_ == orientedSurface::NOFLIP) @@ -210,16 +205,16 @@ inline bool Foam::patchFaceOrientation::equal inline bool Foam::patchFaceOrientation::operator== ( - const Foam::patchFaceOrientation& rhs + const patchFaceOrientation& rhs ) const { - return flipStatus() == rhs.flipStatus(); + return flipStatus_ == rhs.flipStatus_; } inline bool Foam::patchFaceOrientation::operator!= ( - const Foam::patchFaceOrientation& rhs + const patchFaceOrientation& rhs ) const { return !(*this == rhs); diff --git a/src/mesh/snappyHexMesh/meshRefinement/transportData.H b/src/mesh/snappyHexMesh/meshRefinement/transportData.H index 6089ba8b24b..a964429cda1 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/transportData.H +++ b/src/mesh/snappyHexMesh/meshRefinement/transportData.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2015-2019 OpenCFD Ltd. + Copyright (C) 2015-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -77,9 +77,9 @@ private: // Private Member Functions - //- Evaluate distance to point. Update distSqr, origin from whomever - // is nearer pt. Return true if w2 is closer to point, - // false otherwise. + //- Evaluate distance to point. + // Update distSqr, origin from whomever is nearer pt. + // \return true if w2 is closer to point, false otherwise. template<class TrackingData> inline bool update ( diff --git a/src/mesh/snappyHexMesh/meshRefinement/transportDataI.H b/src/mesh/snappyHexMesh/meshRefinement/transportDataI.H index 64861241564..b30ed52c452 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/transportDataI.H +++ b/src/mesh/snappyHexMesh/meshRefinement/transportDataI.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2015 OpenCFD Ltd. + Copyright (C) 2015-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,11 +40,11 @@ inline bool Foam::transportData::update TrackingData& td ) { - scalar dist2 = magSqr(pt - w2.origin()); + const scalar dist2 = magSqr(pt - w2.origin()); if (valid(td)) { - scalar diff = distSqr() - dist2; + const scalar diff = distSqr() - dist2; if (diff < 0) { diff --git a/src/mesh/snappyHexMesh/meshRefinement/wallPoints.C b/src/mesh/snappyHexMesh/meshRefinement/wallPoints.C index e95af4bbe74..97a5fb4c64a 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/wallPoints.C +++ b/src/mesh/snappyHexMesh/meshRefinement/wallPoints.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,29 +27,29 @@ License #include "wallPoints.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::wallPoints& wDist + Ostream& os, + const wallPoints& rhs ) { return os - << wDist.origin_ << token::SPACE << wDist.distSqr_ - << token::SPACE << wDist.surface_; // << token::SPACE << wDist.normal_; + << rhs.origin_ << token::SPACE << rhs.distSqr_ + << token::SPACE << rhs.surface_; // << token::SPACE << rhs.normal_; } Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::wallPoints& wDist + Istream& is, + wallPoints& rhs ) { return is - >> wDist.origin_ >> wDist.distSqr_>> wDist.surface_; - //>> wDist.normal_; + >> rhs.origin_ >> rhs.distSqr_ >> rhs.surface_; + //>> rhs.normal_; } diff --git a/src/mesh/snappyHexMesh/meshRefinement/wallPoints.H b/src/mesh/snappyHexMesh/meshRefinement/wallPoints.H index e0bbec0f3b9..fe8aad6818e 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/wallPoints.H +++ b/src/mesh/snappyHexMesh/meshRefinement/wallPoints.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,17 +48,13 @@ SourceFiles namespace Foam { +// Forward Declarations class polyPatch; class polyMesh; - -// Forward declaration of friend functions and operators - class wallPoints; - Istream& operator>>(Istream&, wallPoints&); Ostream& operator<<(Ostream&, const wallPoints&); - /*---------------------------------------------------------------------------*\ Class wallPoints Declaration \*---------------------------------------------------------------------------*/ @@ -67,7 +63,7 @@ class wallPoints { protected: - // Protected data + // Protected Data //- Starting points DynamicList<point> origin_; @@ -84,9 +80,9 @@ protected: // Protected Member Functions - //- Evaluate distance to point. Update distSqr, origin from whomever - // is nearer pt. Return true if w2 is closer to point, - // false otherwise. + //- Evaluate distance to point. + // Update distSqr, origin from whomever is nearer pt. + // \return true if w2 is closer to point, false otherwise. template<class TrackingData> inline bool update ( @@ -104,7 +100,7 @@ public: // Constructors - //- Construct null + //- Default construct inline wallPoints(); //- Construct from count @@ -121,21 +117,21 @@ public: // Access - inline const List<point>& origin() const + const List<point>& origin() const { return origin_; } - inline const List<scalar>& distSqr() const + const List<scalar>& distSqr() const { return distSqr_; } - inline const List<FixedList<label, 3>>& surface() const + const List<FixedList<label, 3>>& surface() const { return surface_; } - //inline const List<vector>& normal() const + //const List<vector>& normal() const //{ // return normal_; //} @@ -143,12 +139,11 @@ public: // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -225,16 +220,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const wallPoints&, TrackingData&) const; // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const wallPoints&) const; + //- Test for inequality inline bool operator!=(const wallPoints&) const; diff --git a/src/mesh/snappyHexMesh/meshRefinement/wallPointsI.H b/src/mesh/snappyHexMesh/meshRefinement/wallPointsI.H index 05093ce0ccf..89d84a3660a 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/wallPointsI.H +++ b/src/mesh/snappyHexMesh/meshRefinement/wallPointsI.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,7 +42,7 @@ inline bool Foam::wallPoints::update TrackingData& td ) { - scalar dist2 = magSqr(pt - w2.origin_[index2]); + const scalar dist2 = magSqr(pt - w2.origin_[index2]); if (!valid(td)) { @@ -55,7 +55,7 @@ inline bool Foam::wallPoints::update return true; } - scalar diff = distSqr_[index1] - dist2; + const scalar diff = distSqr_[index1] - dist2; if (diff < 0) { @@ -329,7 +329,7 @@ inline bool Foam::wallPoints::equal inline bool Foam::wallPoints::operator== ( - const Foam::wallPoints& rhs + const wallPoints& rhs ) const { return @@ -342,7 +342,7 @@ inline bool Foam::wallPoints::operator== inline bool Foam::wallPoints::operator!= ( - const Foam::wallPoints& rhs + const wallPoints& rhs ) const { return !(*this == rhs); diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/PointIntegrateData/PointIntegrateData.H b/src/mesh/snappyHexMesh/snappyHexMeshDriver/PointIntegrateData/PointIntegrateData.H index 27911db3e62..afbccd3b241 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/PointIntegrateData/PointIntegrateData.H +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/PointIntegrateData/PointIntegrateData.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,9 +59,7 @@ Istream& operator>>(Istream&, PointIntegrateData<DataType>&); template<class DataType> class PointIntegrateData { -private: - - // Private data + // Private Data //- Valid flag bool valid_; @@ -88,7 +86,7 @@ public: // Constructors - //- Construct null + //- Default construct inline PointIntegrateData(); //- Construct from data @@ -99,8 +97,11 @@ public: // Access - //- Const access the data - inline const DataType& data() const + const DataType& data() const + { + return data_; + }; + DataType& data() { return data_; }; @@ -108,11 +109,11 @@ public: // Needed by PointEdgeWave - //- Check whether original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -122,7 +123,7 @@ public: ) const; //- Convert origin to relative vector to leaving point - // (= point coordinate) + //- (= point coordinate) template<class TrackingData> inline void leaveDomain ( @@ -196,7 +197,7 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal ( @@ -207,8 +208,10 @@ public: // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const PointIntegrateData<DataType>&) const; + + //- Test for inequality inline bool operator!=(const PointIntegrateData<DataType>&) const; diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/PointIntegrateData/PointIntegrateDataI.H b/src/mesh/snappyHexMesh/snappyHexMeshDriver/PointIntegrateData/PointIntegrateDataI.H index f5b2d35a187..a6699fc5ced 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/PointIntegrateData/PointIntegrateDataI.H +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/PointIntegrateData/PointIntegrateDataI.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -215,7 +215,6 @@ inline bool Foam::PointIntegrateData<DataType>::updateEdge } -//- Same (like operator==) template<class DataType> template<class TrackingData> inline bool Foam::PointIntegrateData<DataType>::equal @@ -246,9 +245,8 @@ inline bool Foam::PointIntegrateData<DataType>::equal template<class DataType> inline bool Foam::PointIntegrateData<DataType>::operator== ( - const Foam::PointIntegrateData<DataType>& rhs -) -const + const PointIntegrateData<DataType>& rhs +) const { return this->data_ == rhs.data_; } @@ -257,30 +255,29 @@ const template<class DataType> inline bool Foam::PointIntegrateData<DataType>::operator!= ( - const Foam::PointIntegrateData<DataType>& rhs -) -const + const PointIntegrateData<DataType>& rhs +) const { return !(*this == rhs); } -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // template<class DataType> inline Foam::Ostream& Foam::operator<< ( Ostream& os, - const PointIntegrateData<DataType>& pd + const PointIntegrateData<DataType>& rhs ) { if (os.format() == IOstream::ASCII) { - return os << pd.valid_ << token::SPACE << pd.data(); + return os << rhs.valid_ << token::SPACE << rhs.data(); } else { - return os << pd.valid_ << pd.data(); + return os << rhs.valid_ << rhs.data(); } } @@ -289,10 +286,10 @@ template<class DataType> inline Foam::Istream& Foam::operator>> ( Istream& is, - PointIntegrateData<DataType>& pd + PointIntegrateData<DataType>& rhs ) { - return is >> pd.valid_ >> pd.data_; + return is >> rhs.valid_ >> rhs.data_; } diff --git a/src/meshTools/algorithms/MeshWave/FaceCellWave.C b/src/meshTools/algorithms/MeshWave/FaceCellWave.C index 783c6393ee3..877b95096ca 100644 --- a/src/meshTools/algorithms/MeshWave/FaceCellWave.C +++ b/src/meshTools/algorithms/MeshWave/FaceCellWave.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -50,6 +50,7 @@ Foam::scalar Foam::FaceCellWave<Type, TrackingData>::propagationTol_ = 0.01; template<class Type, class TrackingData> int Foam::FaceCellWave<Type, TrackingData>::dummyTrackData_ = 12345; + namespace Foam { template<class Type, class TrackingData> @@ -61,7 +62,7 @@ namespace Foam const cyclicAMIPolyPatch& patch_; - public: + public: combine ( diff --git a/src/meshTools/algorithms/MeshWave/FaceCellWave.H b/src/meshTools/algorithms/MeshWave/FaceCellWave.H index e562878d51f..b03cc805bd4 100644 --- a/src/meshTools/algorithms/MeshWave/FaceCellWave.H +++ b/src/meshTools/algorithms/MeshWave/FaceCellWave.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -60,7 +60,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations class polyMesh; class polyPatch; @@ -80,15 +80,6 @@ class FaceCellWave : public FaceCellWaveName { - // Private Member Functions - - //- No copy construct - FaceCellWave(const FaceCellWave&) = delete; - - //- No copy assignment - void operator=(const FaceCellWave&) = delete; - - protected: //- Information tagged with a source or destination id. @@ -96,6 +87,15 @@ protected: typedef std::pair<label,Type> taggedInfoType; + // Protected Static Data + + static const scalar geomTol_; + static scalar propagationTol_; + + //- Default trackdata value to satisfy default template argument. + static int dummyTrackData_; + + // Protected Data //- Reference to mesh @@ -257,14 +257,11 @@ protected: void handleExplicitConnections(); - // Protected static data - - static const scalar geomTol_; - static scalar propagationTol_; + //- No copy construct + FaceCellWave(const FaceCellWave&) = delete; - //- Used as default trackdata value to satisfy default template - // argument. - static int dummyTrackData_; + //- No copy assignment + void operator=(const FaceCellWave&) = delete; public: @@ -397,7 +394,6 @@ public: //- Iterate until no changes or maxIter reached. // \return the number of iterations taken. virtual label iterate(const label maxIter); - }; diff --git a/src/meshTools/algorithms/MeshWave/FaceCellWaveName.C b/src/meshTools/algorithms/MeshWave/FaceCellWaveName.C index 0c51d206f24..98ce6fd6ee0 100644 --- a/src/meshTools/algorithms/MeshWave/FaceCellWaveName.C +++ b/src/meshTools/algorithms/MeshWave/FaceCellWaveName.C @@ -31,7 +31,7 @@ License namespace Foam { -defineTypeNameAndDebug(FaceCellWaveName, 0); + defineTypeNameAndDebug(FaceCellWaveName, 0); } diff --git a/src/meshTools/algorithms/MeshWave/MeshWave.H b/src/meshTools/algorithms/MeshWave/MeshWave.H index f3f4409fba4..eaf327ed92e 100644 --- a/src/meshTools/algorithms/MeshWave/MeshWave.H +++ b/src/meshTools/algorithms/MeshWave/MeshWave.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -60,7 +61,13 @@ class MeshWave : public MeshWaveName { - // Private data + // Private Static Data + + //- Default trackdata value to satisfy default template argument. + static int dummyTrackData_; + + + // Private Data //- Wall information for all faces List<Type> allFaceInfo_; @@ -71,6 +78,7 @@ class MeshWave //- Wave calculation engine. FaceCellWave<Type, TrackingData> calc_; + // Private Member Functions //- No copy construct @@ -79,18 +87,14 @@ class MeshWave //- No copy assignment void operator=(const MeshWave&) = delete; - // Private static data - - //- Used as default trackdata value to satisfy default template - // argument. - static int dummyTrackData_; public: // Constructors //- Construct from mesh and list of changed faces with the Type - // for these faces. Iterates until nothing changes or maxIter reached. + //- for these faces. + // Iterates until nothing changes or maxIter reached. // (maxIter can be 0) MeshWave ( @@ -102,7 +106,7 @@ public: ); //- Construct from mesh, list of changed faces with the Type - // for these faces and initial field. + //- for these faces and initial field. // Iterates until nothing changes or maxIter reached. // (maxIter can be 0) MeshWave @@ -136,15 +140,17 @@ public: return calc_.data(); } - //- Iterate until no changes or maxIter reached. Returns actual - // number of iterations. + //- Iterate until no changes or maxIter reached. + // \return actual number of iterations. label iterate(const label maxIter) { return calc_.iterate(maxIter); } //- Number of unvisited cells, i.e. cells that were not (yet) - // reached from walking across mesh. This can happen from + //- reached from walking across mesh. + // + // This can happen from // - not enough iterations done // - a disconnected mesh // - a mesh without walls in it diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.C b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.C index 23badff9ce6..9da69e3b43e 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.C +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.C @@ -415,32 +415,6 @@ PatchEdgeFaceWave // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -< - class PrimitivePatchType, - class Type, - class TrackingData -> -Foam::label Foam::PatchEdgeFaceWave<PrimitivePatchType, Type, TrackingData>:: -nUnvisitedEdges() const -{ - return nUnvisitedEdges_; -} - - -template -< - class PrimitivePatchType, - class Type, - class TrackingData -> -Foam::label Foam::PatchEdgeFaceWave<PrimitivePatchType, Type, TrackingData>:: -nUnvisitedFaces() const -{ - return nUnvisitedFaces_; -} - - // Copy edge information into member data template < diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H index 7ddd2fb2e88..1ec3e7491de 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWave.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,7 +50,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward Declarations class polyMesh; /*---------------------------------------------------------------------------*\ @@ -73,19 +74,18 @@ class PatchEdgeFaceWave : public PatchEdgeFaceWaveName { - // Private static data + // Private Static Data - //- Relative tolerance. Stop propagation if relative changes - // less than this tolerance (responsibility for checking this is - // up to Type implementation) + //- Relative tolerance. + // Stop propagation if relative changes less than this tolerance + // (responsibility for checking this is up to Type implementation) static scalar propagationTol_; - //- Used as default trackdata value to satisfy default template - // argument. + //- Default trackdata value to satisfy default template argument. static label dummyTrackData_; - // Private data + // Private Data //- Reference to mesh const polyMesh& mesh_; @@ -130,8 +130,8 @@ class PatchEdgeFaceWave // Private Member Functions - //- Updates edgeInfo with information from neighbour. Updates all - // statistics. + //- Updates edgeInfo with information from neighbour. + // Updates all statistics. bool updateEdge ( const label edgeI, @@ -140,8 +140,8 @@ class PatchEdgeFaceWave Type& edgeInfo ); - //- Updates faceInfo with information from neighbour. Updates all - // statistics. + //- Updates faceInfo with information from neighbour. + // Updates all statistics. bool updateFace ( const label facei, @@ -180,7 +180,8 @@ public: // Constructors //- Construct from patch, list of changed edges with the Type - // for these edges. Gets work arrays to operate on, one of size + //- for these edges. + // Obtains work arrays to operate on, one of size // number of patch edges, the other number of patch faces. // Iterates until nothing changes or maxIter reached. // (maxIter can be 0) @@ -196,8 +197,8 @@ public: TrackingData& td = dummyTrackData_ ); - //- Construct from patch. Use setEdgeInfo and iterate() to do - // actual calculation + //- Construct from patch. + // Use setEdgeInfo() and iterate() to do actual calculation PatchEdgeFaceWave ( const polyMesh& mesh, @@ -229,13 +230,21 @@ public: } //- Number of unvisited faces, i.e. faces that were not (yet) - // reached from walking across patch. This can happen from + //- reached from walking across patch. + // + // This can happen from // - not enough iterations done // - a disconnected patch // - a patch without walls in it - label nUnvisitedFaces() const; + label nUnvisitedFaces() const + { + return nUnvisitedFaces_; + } - label nUnvisitedEdges() const; + label nUnvisitedEdges() const + { + return nUnvisitedEdges_; + } //- Copy initial data into allEdgeInfo_ void setEdgeInfo @@ -244,16 +253,16 @@ public: const List<Type>& changedEdgesInfo ); - //- Propagate from edge to face. Returns total number of faces - // (over all processors) changed. + //- Propagate from edge to face. + // \return total number of faces (over all processors) changed. label edgeToFace(); - //- Propagate from face to edge. Returns total number of edges - // (over all processors) changed. + //- Propagate from face to edge. + // \return total number of edges (over all processors) changed. label faceToEdge(); - //- Iterate until no changes or maxIter reached. Returns actual - // number of iterations. + //- Iterate until no changes or maxIter reached. + // \return actual number of iterations. label iterate(const label maxIter); }; @@ -276,6 +285,7 @@ class updateOp TrackingData& td_; public: + updateOp ( const polyMesh& mesh, @@ -316,6 +326,7 @@ class transformOp TrackingData& td_; public: + transformOp ( const polyMesh& mesh, diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWaveName.C b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWaveName.C index 15582ffc1b6..faf6bec50e5 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWaveName.C +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWaveName.C @@ -31,7 +31,7 @@ License namespace Foam { -defineTypeNameAndDebug(PatchEdgeFaceWaveName, 0); + defineTypeNameAndDebug(PatchEdgeFaceWaveName, 0); } diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfo.C b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfo.C index f305303a915..10839018946 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfo.C +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfo.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,25 +28,25 @@ License #include "patchEdgeFaceInfo.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::patchEdgeFaceInfo& wDist + Ostream& os, + const patchEdgeFaceInfo& rhs ) { - return os << wDist.origin() << wDist.distSqr(); + return os << rhs.origin() << rhs.distSqr(); } Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::patchEdgeFaceInfo& wDist + Istream& is, + patchEdgeFaceInfo& rhs ) { - return is >> wDist.origin_ >> wDist.distSqr_; + return is >> rhs.origin_ >> rhs.distSqr_; } diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfo.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfo.H index 1c4d3e8814b..4ea497b8f96 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfo.H +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfo.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -58,14 +58,13 @@ class patchEdgeFaceInfo; Istream& operator>>(Istream&, patchEdgeFaceInfo&); Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&); - /*---------------------------------------------------------------------------*\ Class patchEdgeFaceInfo Declaration \*---------------------------------------------------------------------------*/ class patchEdgeFaceInfo { - // Private data + // Private Data //- Position of nearest wall center point origin_; @@ -76,9 +75,9 @@ class patchEdgeFaceInfo // Private Member Functions - //- Evaluate distance to point. Update distSqr, origin from whomever - // is nearer pt. Return true if w2 is closer to point, - // false otherwise. + //- Evaluate distance to point. + // Update distSqr, origin from whomever is nearer pt. + // \return true if w2 is closer to point, false otherwise. template<class TrackingData> inline bool update ( @@ -103,29 +102,31 @@ public: // Constructors - //- Construct null + //- Default construct inline patchEdgeFaceInfo(); - //- Construct from origin, distance - inline patchEdgeFaceInfo(const point&, const scalar); - - //- Construct as copy - inline patchEdgeFaceInfo(const patchEdgeFaceInfo&); + //- Construct from origin, distance squared + inline patchEdgeFaceInfo(const point& origin, const scalar distSqr); // Member Functions // Access - inline const point& origin() const; + const point& origin() const + { + return origin_; + } - inline scalar distSqr() const; + scalar distSqr() const + { + return distSqr_; + } - // Needed by meshWave + // Needed by MeshWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; @@ -178,15 +179,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const patchEdgeFaceInfo&, TrackingData& td) const; // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const patchEdgeFaceInfo&) const; + + //- Test for inequality inline bool operator!=(const patchEdgeFaceInfo&) const; diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfoI.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfoI.H index de65986fd0c..b08570ab6d3 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfoI.H +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceInfoI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,7 +41,7 @@ inline bool Foam::patchEdgeFaceInfo::update TrackingData& td ) { - scalar dist2 = magSqr(pt - w2.origin()); + const scalar dist2 = magSqr(pt - w2.origin()); if (!valid(td)) { @@ -51,7 +52,7 @@ inline bool Foam::patchEdgeFaceInfo::update return true; } - scalar diff = distSqr_ - dist2; + const scalar diff = distSqr_ - dist2; if (diff < 0) { @@ -93,7 +94,7 @@ inline bool Foam::patchEdgeFaceInfo::update return true; } - scalar diff = distSqr_ - w2.distSqr(); + const scalar diff = distSqr_ - w2.distSqr(); if (diff < 0) { @@ -119,15 +120,12 @@ inline bool Foam::patchEdgeFaceInfo::update // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo() : - origin_(point::max), - distSqr_(sqr(GREAT)) + patchEdgeFaceInfo(point::max, sqr(GREAT)) {} -// Construct from origin, distance inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo ( const point& origin, @@ -139,28 +137,8 @@ inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo {} -// Construct as copy -inline Foam::patchEdgeFaceInfo::patchEdgeFaceInfo(const patchEdgeFaceInfo& wpt) -: - origin_(wpt.origin()), - distSqr_(wpt.distSqr()) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const Foam::point& Foam::patchEdgeFaceInfo::origin() const -{ - return origin_; -} - - -inline Foam::scalar Foam::patchEdgeFaceInfo::distSqr() const -{ - return distSqr_; -} - - template<class TrackingData> inline bool Foam::patchEdgeFaceInfo::valid(TrackingData& td) const { @@ -195,12 +173,14 @@ inline bool Foam::patchEdgeFaceInfo::updateEdge ) { const edge& e = patch.edges()[edgeI]; - point eMid = + const point eMid + ( 0.5 * ( patch.points()[patch.meshPoints()[e[0]]] + patch.points()[patch.meshPoints()[e[1]]] - ); + ) + ); return update(eMid, faceInfo, tol, td); } @@ -251,10 +231,10 @@ inline bool Foam::patchEdgeFaceInfo::equal inline bool Foam::patchEdgeFaceInfo::operator== ( - const Foam::patchEdgeFaceInfo& rhs + const patchEdgeFaceInfo& rhs ) const { - return origin() == rhs.origin(); + return origin_ == rhs.origin_; } diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.C b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.C index 24c2a262ff8..d5390591902 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.C +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2013 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,25 +28,25 @@ License #include "patchEdgeFaceRegion.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::patchEdgeFaceRegion& wDist + Ostream& os, + const patchEdgeFaceRegion& rhs ) { - return os << wDist.region_; + return os << rhs.region_; } Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::patchEdgeFaceRegion& wDist + Istream& is, + patchEdgeFaceRegion& rhs ) { - return is >> wDist.region_; + return is >> rhs.region_; } diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.H index ef9deb7270b..5da4238f1a9 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.H +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -67,15 +67,16 @@ Ostream& operator<<(Ostream&, const patchEdgeFaceRegion&); class patchEdgeFaceRegion { - // Private data + // Private Data - //- region + //- The region label region_; + // Private Member Functions - //- Combine current with w2. Update region_ if w2 has smaller - // quantities and returns true. + //- Combine current with w2. + // Update region_ if w2 has smaller quantities and return true. template<class TrackingData> inline bool update ( @@ -89,24 +90,26 @@ public: // Constructors - //- Construct null + //- Default construct inline patchEdgeFaceRegion(); - //- Construct from origin, distance - inline patchEdgeFaceRegion(const label); + //- Construct from region + inline patchEdgeFaceRegion(const label regioni); // Member Functions // Access - inline label region() const; + label region() const + { + return region_; + } - // Needed by meshWave + // Needed by MeshWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; @@ -159,15 +162,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const patchEdgeFaceRegion&, TrackingData&) const; // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const patchEdgeFaceRegion&) const; + + //- Test for inequality inline bool operator!=(const patchEdgeFaceRegion&) const; diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionI.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionI.H index aab8a505c7f..a8b95d7dfed 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionI.H +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -74,31 +75,23 @@ inline bool Foam::patchEdgeFaceRegion::update // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor inline Foam::patchEdgeFaceRegion::patchEdgeFaceRegion() : region_(-1) {} -// Construct from origin, distance inline Foam::patchEdgeFaceRegion::patchEdgeFaceRegion ( - const label region + const label regioni ) : - region_(region) + region_(regioni) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline Foam::label Foam::patchEdgeFaceRegion::region() const -{ - return region_; -} - - template<class TrackingData> inline bool Foam::patchEdgeFaceRegion::valid(TrackingData& td) const { @@ -180,16 +173,16 @@ inline bool Foam::patchEdgeFaceRegion::equal inline bool Foam::patchEdgeFaceRegion::operator== ( - const Foam::patchEdgeFaceRegion& rhs + const patchEdgeFaceRegion& rhs ) const { - return region() == rhs.region(); + return region_ == rhs.region_; } inline bool Foam::patchEdgeFaceRegion::operator!= ( - const Foam::patchEdgeFaceRegion& rhs + const patchEdgeFaceRegion& rhs ) const { return !(*this == rhs); diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.C b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.C index 6e9b307672f..a8f7a68f15c 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.C +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2013 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,25 +28,25 @@ License #include "patchEdgeFaceRegions.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::patchEdgeFaceRegions& wDist + Ostream& os, + const patchEdgeFaceRegions& rhs ) { - return os << wDist.regions_; + return os << rhs.regions(); } Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::patchEdgeFaceRegions& wDist + Istream& is, + patchEdgeFaceRegions& rhs ) { - return is >> wDist.regions_; + return is >> rhs.regions(); } diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.H index 255518435f1..a39a960dec8 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.H +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -50,25 +51,19 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward Declarations class polyMesh; - - -// Forward declaration of friend functions and operators - class patchEdgeFaceRegions; - Istream& operator>>(Istream&, patchEdgeFaceRegions&); Ostream& operator<<(Ostream&, const patchEdgeFaceRegions&); - /*---------------------------------------------------------------------------*\ - Class patchEdgeFaceRegions Declaration + Class patchEdgeFaceRegions Declaration \*---------------------------------------------------------------------------*/ class patchEdgeFaceRegions { - // Private data + // Private Data //- Region per point labelList regions_; @@ -77,27 +72,33 @@ public: // Constructors - //- Construct null + //- Default construct inline patchEdgeFaceRegions(); //- Construct from regions - inline patchEdgeFaceRegions(const labelList&); + inline patchEdgeFaceRegions(const labelList& regions); //- Construct from regions (on edge) - inline patchEdgeFaceRegions(const labelPair&); + inline patchEdgeFaceRegions(const labelPair& regions); // Member Functions // Access - inline const labelList& regions() const; + const labelList& regions() const + { + return regions_; + } + labelList& regions() + { + return regions_; + } - // Needed by meshWave + // Needed by MeshWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; @@ -150,15 +151,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const patchEdgeFaceRegions&, TrackingData&) const; // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const patchEdgeFaceRegions&) const; + + //- Test for inequality inline bool operator!=(const patchEdgeFaceRegions&) const; diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionsI.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionsI.H index d9000a46878..4ce1d8fb704 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionsI.H +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionsI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,12 +57,6 @@ inline Foam::patchEdgeFaceRegions::patchEdgeFaceRegions // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const Foam::labelList& Foam::patchEdgeFaceRegions::regions() const -{ - return regions_; -} - - template<class TrackingData> inline bool Foam::patchEdgeFaceRegions::valid(TrackingData& td) const { @@ -265,16 +260,16 @@ inline bool Foam::patchEdgeFaceRegions::equal inline bool Foam::patchEdgeFaceRegions::operator== ( - const Foam::patchEdgeFaceRegions& rhs + const patchEdgeFaceRegions& rhs ) const { - return regions() == rhs.regions(); + return regions_ == rhs.regions_; } inline bool Foam::patchEdgeFaceRegions::operator!= ( - const Foam::patchEdgeFaceRegions& rhs + const patchEdgeFaceRegions& rhs ) const { return !(*this == rhs); diff --git a/src/meshTools/algorithms/PointEdgeWave/PointData.C b/src/meshTools/algorithms/PointEdgeWave/PointData.C index dea82b284a3..c4d372ebafa 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointData.C +++ b/src/meshTools/algorithms/PointEdgeWave/PointData.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,30 +28,38 @@ License #include "PointData.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -template<class DataType> -Foam::Ostream& Foam::operator<<(Ostream& os, const PointData<DataType>& pd) +template<class T> +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const PointData<T>& rhs +) { if (os.format() == IOstream::ASCII) { return os - << static_cast<const pointEdgePoint&>(pd) - << token::SPACE << pd.data(); + << static_cast<const pointEdgePoint&>(rhs) + << token::SPACE << rhs.data(); } else { return os - << static_cast<const pointEdgePoint&>(pd) - << pd.data(); + << static_cast<const pointEdgePoint&>(rhs) + << rhs.data(); } } -template<class DataType> -Foam::Istream& Foam::operator>>(Istream& is, PointData<DataType>& pd) +template<class T> +Foam::Istream& Foam::operator>> +( + Istream& is, + PointData<T>& rhs +) { - return is >> static_cast<pointEdgePoint&>(pd) >> pd.data_; + return is >> static_cast<pointEdgePoint&>(rhs) >> rhs.data(); } diff --git a/src/meshTools/algorithms/PointEdgeWave/PointData.H b/src/meshTools/algorithms/PointEdgeWave/PointData.H index efb8e8d308c..0ec37bc18aa 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointData.H +++ b/src/meshTools/algorithms/PointEdgeWave/PointData.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -66,7 +66,7 @@ class PointData : public pointEdgePoint { - // Private data + // Private Data //- Additional transported data DataType data_; @@ -76,7 +76,7 @@ public: // Constructors - //- Construct null + //- Default construct inline PointData(); //- Construct from origin, distance and data @@ -87,19 +87,22 @@ public: const DataType& data ); - //- Construct as copy - inline PointData(const PointData&); - // Member Functions // Access - //- Const access the data - inline const DataType& data() const; + const DataType& data() const + { + return data_; + } + DataType& data() + { + return data_; + } - // Needed by meshWave + // Needed by MeshWave //- Apply rotation matrix to the data template<class TrackingData> @@ -155,9 +158,13 @@ public: TrackingData& td ); + // Member Operators + //- Test for equality inline bool operator==(const PointData<DataType>&) const; + + //- Test for inequality inline bool operator!=(const PointData<DataType>&) const; diff --git a/src/meshTools/algorithms/PointEdgeWave/PointDataI.H b/src/meshTools/algorithms/PointEdgeWave/PointDataI.H index 2d3588fe39f..94717f086e0 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointDataI.H +++ b/src/meshTools/algorithms/PointEdgeWave/PointDataI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -51,23 +51,8 @@ inline Foam::PointData<DataType>::PointData {} -template<class DataType> -inline Foam::PointData<DataType>::PointData(const PointData<DataType>& wpt) -: - pointEdgePoint(wpt), - data_(wpt.data()) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class DataType> -inline const DataType& Foam::PointData<DataType>::data() const -{ - return data_; -} - - template<class DataType> template<class TrackingData> inline void Foam::PointData<DataType>::transform @@ -207,9 +192,8 @@ inline bool Foam::PointData<DataType>::updateEdge template<class DataType> inline bool Foam::PointData<DataType>::operator== ( - const Foam::PointData<DataType>& rhs -) -const + const PointData<DataType>& rhs +) const { return pointEdgePoint::operator==(rhs) && (data() == rhs.data()); } @@ -218,9 +202,8 @@ const template<class DataType> inline bool Foam::PointData<DataType>::operator!= ( - const Foam::PointData<DataType>& rhs -) -const + const PointData<DataType>& rhs +) const { return !(*this == rhs); } diff --git a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C index 26fa464da35..113d33d7060 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C +++ b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C @@ -53,11 +53,12 @@ namespace Foam { TrackingData& td_; - public: - combineEqOp(TrackingData& td) - : - td_(td) - {} + public: + + combineEqOp(TrackingData& td) + : + td_(td) + {} void operator()(Type& x, const Type& y) const { @@ -705,16 +706,8 @@ Foam::PointEdgeWave<Type, TrackingData>::PointEdgeWave {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type, class TrackingData> -Foam::PointEdgeWave<Type, TrackingData>::~PointEdgeWave() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - template<class Type, class TrackingData> Foam::label Foam::PointEdgeWave<Type, TrackingData>::nUnvisitedPoints() const { diff --git a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H index 78d9c351f49..f25d20dd926 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H +++ b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -69,7 +70,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward Declarations class polyMesh; class polyPatch; @@ -89,19 +90,18 @@ class PointEdgeWave : public PointEdgeWaveName { - // Private static data + // Private Static Data //- Relative tolerance. Stop propagation if relative changes // less than this tolerance (responsibility for checking this is // up to Type implementation) static scalar propagationTol_; - //- Used as default trackdata value to satisfy default template - // argument. + //- Default trackdata value to satisfy default template argument. static int dummyTrackData_; - // Private data + // Private Data //- Reference to mesh const polyMesh& mesh_; @@ -167,8 +167,8 @@ class PointEdgeWave List<Type>& pointInfo ) const; - //- Updates pointInfo with information from neighbour. Updates all - // statistics. + //- Updates pointInfo with information from neighbour. + // Updates all statistics. bool updatePoint ( const label pointi, @@ -177,8 +177,8 @@ class PointEdgeWave Type& pointInfo ); - //- Updates pointInfo with information from same point. Updates all - // statistics. + //- Updates pointInfo with information from same point. + // Updates all statistics. bool updatePoint ( const label pointi, @@ -186,8 +186,8 @@ class PointEdgeWave Type& pointInfo ); - //- Updates edgeInfo with information from neighbour. Updates all - // statistics. + //- Updates edgeInfo with information from neighbour. + // Updates all statistics. bool updateEdge ( const label edgeI, @@ -196,6 +196,7 @@ class PointEdgeWave Type& edgeInfo ); + // Parallel, cyclic //- Has patches of certain type? @@ -266,7 +267,7 @@ public: //- Destructor - ~PointEdgeWave(); + ~PointEdgeWave() = default; // Member Functions @@ -336,6 +337,7 @@ class listUpdateOp TrackingData& td_; public: + listUpdateOp(const scalar tol, TrackingData& td) : tol_(tol), diff --git a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWaveName.C b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWaveName.C index 8a4dbfcfb17..7c8b972825e 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWaveName.C +++ b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWaveName.C @@ -31,7 +31,7 @@ License namespace Foam { -defineTypeNameAndDebug(PointEdgeWaveName, 0); + defineTypeNameAndDebug(PointEdgeWaveName, 0); } diff --git a/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.C b/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.C index 193e5f0bf81..8bab3436c0f 100644 --- a/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.C +++ b/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,21 +28,25 @@ License #include "pointEdgePoint.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::pointEdgePoint& wDist + Ostream& os, + const pointEdgePoint& rhs ) { - return os << wDist.origin() << wDist.distSqr(); + return os << rhs.origin() << rhs.distSqr(); } -Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::pointEdgePoint& wDist) +Foam::Istream& Foam::operator>> +( + Istream& is, + pointEdgePoint& rhs +) { - return is >> wDist.origin_ >> wDist.distSqr_; + return is >> rhs.origin() >> rhs.distSqr(); } diff --git a/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H b/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H index e0fbfe22c45..3284e2a47a2 100644 --- a/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H +++ b/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -60,14 +60,13 @@ class pointEdgePoint; Istream& operator>>(Istream&, pointEdgePoint&); Ostream& operator<<(Ostream&, const pointEdgePoint&); - /*---------------------------------------------------------------------------*\ - Class pointEdgePoint Declaration + Class pointEdgePoint Declaration \*---------------------------------------------------------------------------*/ class pointEdgePoint { - // Private data + // Private Data //- Position of nearest wall center point origin_; @@ -78,9 +77,9 @@ class pointEdgePoint // Private Member Functions - //- Evaluate distance to point. Update distSqr, origin from whomever - // is nearer pt. Return true if w2 is closer to point, - // false otherwise. + //- Evaluate distance to point. + // Update distSqr, origin from whomever is nearer pt. + // \return true if w2 is closer to point, false otherwise. template<class TrackingData> inline bool update ( @@ -105,33 +104,43 @@ public: // Constructors - //- Construct null + //- Default construct inline pointEdgePoint(); //- Construct from origin, distance - inline pointEdgePoint(const point&, const scalar); - - //- Construct as copy - inline pointEdgePoint(const pointEdgePoint&); + inline pointEdgePoint(const point& origin, const scalar distSqr); // Member Functions // Access - inline const point& origin() const; - - inline scalar distSqr() const; + const point& origin() const + { + return origin_; + } + point& origin() + { + return origin_; + } + + scalar distSqr() const + { + return distSqr_; + } + scalar& distSqr() + { + return distSqr_; + } // Needed by PointEdgeWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -215,15 +224,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const pointEdgePoint&, TrackingData& td) const; // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const pointEdgePoint&) const; + + //- Test for inequality inline bool operator!=(const pointEdgePoint&) const; diff --git a/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H b/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H index 117d322818c..7882b9480bc 100644 --- a/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H +++ b/src/meshTools/algorithms/PointEdgeWave/pointEdgePointI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,7 +41,7 @@ inline bool Foam::pointEdgePoint::update TrackingData& td ) { - scalar dist2 = magSqr(pt - w2.origin()); + const scalar dist2 = magSqr(pt - w2.origin()); if (!valid(td)) { @@ -51,7 +52,7 @@ inline bool Foam::pointEdgePoint::update return true; } - scalar diff = distSqr_ - dist2; + const scalar diff = distSqr_ - dist2; if (diff < 0) { @@ -93,7 +94,7 @@ inline bool Foam::pointEdgePoint::update return true; } - scalar diff = distSqr_ - w2.distSqr(); + const scalar diff = distSqr_ - w2.distSqr(); if (diff < 0) { @@ -119,7 +120,6 @@ inline bool Foam::pointEdgePoint::update // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor inline Foam::pointEdgePoint::pointEdgePoint() : origin_(point::max), @@ -127,7 +127,6 @@ inline Foam::pointEdgePoint::pointEdgePoint() {} -// Construct from origin, distance inline Foam::pointEdgePoint::pointEdgePoint ( const point& origin, @@ -139,28 +138,8 @@ inline Foam::pointEdgePoint::pointEdgePoint {} -// Construct as copy -inline Foam::pointEdgePoint::pointEdgePoint(const pointEdgePoint& wpt) -: - origin_(wpt.origin()), - distSqr_(wpt.distSqr()) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const Foam::point& Foam::pointEdgePoint::origin() const -{ - return origin_; -} - - -inline Foam::scalar Foam::pointEdgePoint::distSqr() const -{ - return distSqr_; -} - - template<class TrackingData> inline bool Foam::pointEdgePoint::valid(TrackingData& td) const { @@ -177,7 +156,7 @@ inline bool Foam::pointEdgePoint::sameGeometry TrackingData& td ) const { - scalar diff = Foam::mag(distSqr() - w2.distSqr()); + const scalar diff = Foam::mag(distSqr() - w2.distSqr()); if (diff < SMALL) { @@ -311,15 +290,19 @@ inline bool Foam::pointEdgePoint::equal // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline bool Foam::pointEdgePoint::operator==(const Foam::pointEdgePoint& rhs) -const +inline bool Foam::pointEdgePoint::operator== +( + const pointEdgePoint& rhs +) const { - return (origin() == rhs.origin()) && (distSqr() == rhs.distSqr()); + return origin_ == rhs.origin_ && distSqr_ == rhs.distSqr_; } -inline bool Foam::pointEdgePoint::operator!=(const Foam::pointEdgePoint& rhs) -const +inline bool Foam::pointEdgePoint::operator!= +( + const pointEdgePoint& rhs +) const { return !(*this == rhs); } diff --git a/src/meshTools/cellClassification/cellInfo.C b/src/meshTools/cellClassification/cellInfo.C index 25fa745a52c..dc650ee2604 100644 --- a/src/meshTools/cellClassification/cellInfo.C +++ b/src/meshTools/cellClassification/cellInfo.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,17 +28,26 @@ License #include "cellInfo.H" +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::cellInfo& wDist) +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const cellInfo& rhs +) { - return os << wDist.type_; + return os << rhs.type(); } -Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::cellInfo& wDist) + +Foam::Istream& Foam::operator>> +( + Istream& is, + cellInfo& rhs +) { - return is >> wDist.type_; + return is >> rhs.type(); } + // ************************************************************************* // diff --git a/src/meshTools/cellClassification/cellInfo.H b/src/meshTools/cellClassification/cellInfo.H index cad4a643807..7ba247f02af 100644 --- a/src/meshTools/cellClassification/cellInfo.H +++ b/src/meshTools/cellClassification/cellInfo.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -64,16 +64,15 @@ Ostream& operator<<(Ostream&, const cellInfo&); class cellInfo { - // Private data + // Private Data label type_; // Private Member Functions - //- Update current cell/face type with neighbouring - // type. Return true if information needs to propagate, - // false otherwise. + //- Update current cell/face type with neighbouring type. + // \return true if information needs to propagate, false otherwise. template<class TrackingData> inline bool update ( @@ -85,38 +84,39 @@ class cellInfo TrackingData& td ); + public: // Constructors - //- Construct null + //- Default construct - as cellClassification::NOTSET inline cellInfo(); - //- Construct from cType - inline cellInfo(const label); - - //- Construct as copy - inline cellInfo(const cellInfo&); + //- Construct from cellClassification type + inline explicit cellInfo(const label ctype); // Member Functions // Access - inline label type() const + label type() const + { + return type_; + } + label& type() { return type_; } - // Needed by meshWave + // Needed by MeshWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -193,15 +193,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const cellInfo&, TrackingData& td) const; + // Member Operators - //Note: Used to determine whether to call update. + //- Test for equality inline bool operator==(const cellInfo&) const; + //- Test for inequality inline bool operator!=(const cellInfo&) const; diff --git a/src/meshTools/cellClassification/cellInfoI.H b/src/meshTools/cellClassification/cellInfoI.H index 269d7068870..a08803e63b0 100644 --- a/src/meshTools/cellClassification/cellInfoI.H +++ b/src/meshTools/cellClassification/cellInfoI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -94,24 +95,15 @@ inline bool Foam::cellInfo::update // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor inline Foam::cellInfo::cellInfo() : type_(cellClassification::NOTSET) {} -// Construct from components -inline Foam::cellInfo::cellInfo(const label type) +inline Foam::cellInfo::cellInfo(const label ctype) : - type_(type) -{} - - -// Construct as copy -inline Foam::cellInfo::cellInfo(const cellInfo& w2) -: - type_(w2.type()) + type_(ctype) {} @@ -132,8 +124,7 @@ inline bool Foam::cellInfo::sameGeometry const cellInfo& w2, const scalar tol, TrackingData& td -) - const +) const { return true; } @@ -223,6 +214,7 @@ inline bool Foam::cellInfo::updateFace ); } + // Update this with neighbour information template<class TrackingData> inline bool Foam::cellInfo::updateFace @@ -259,13 +251,19 @@ inline bool Foam::cellInfo::equal // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline bool Foam::cellInfo::operator==(const Foam::cellInfo& rhs) const +inline bool Foam::cellInfo::operator== +( + const cellInfo& rhs +) const { - return type() == rhs.type(); + return type_ == rhs.type_; } -inline bool Foam::cellInfo::operator!=(const Foam::cellInfo& rhs) const +inline bool Foam::cellInfo::operator!= +( + const cellInfo& rhs +) const { return !(*this == rhs); } diff --git a/src/meshTools/cellDist/wallPoint/wallPoint.C b/src/meshTools/cellDist/wallPoint/wallPoint.C index 7c571568927..c800b322e24 100644 --- a/src/meshTools/cellDist/wallPoint/wallPoint.C +++ b/src/meshTools/cellDist/wallPoint/wallPoint.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,16 +28,26 @@ License #include "wallPoint.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::wallPoint& wDist) +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const wallPoint& rhs +) { - return os << wDist.origin() << token::SPACE << wDist.distSqr(); + return os << rhs.origin() << token::SPACE << rhs.distSqr(); } -Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallPoint& wDist) + +Foam::Istream& Foam::operator>> +( + Istream& is, + wallPoint& rhs +) { - return is >> wDist.origin() >> wDist.distSqr(); + return is >> rhs.origin() >> rhs.distSqr(); } + // ************************************************************************* // diff --git a/src/meshTools/cellDist/wallPoint/wallPoint.H b/src/meshTools/cellDist/wallPoint/wallPoint.H index 27f08d58b80..bac2e83e68c 100644 --- a/src/meshTools/cellDist/wallPoint/wallPoint.H +++ b/src/meshTools/cellDist/wallPoint/wallPoint.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -76,9 +76,9 @@ class wallPoint // Private Member Functions - //- Evaluate distance to point. Update distSqr, origin from whomever - // is nearer pt. Return true if w2 is closer to point, - // false otherwise. + //- Evaluate distance to point. + // Update distSqr, origin from whomever is nearer pt. + // \return true if w2 is closer to point, false otherwise. template<class TrackingData> inline bool update ( @@ -93,37 +93,43 @@ public: // Constructors - //- Construct null + //- Default construct inline wallPoint(); - //- Construct from origin, distance + //- Construct from origin, distance-squared inline wallPoint(const point& origin, const scalar distSqr); - //- Construct as copy - inline wallPoint(const wallPoint&); - // Member Functions // Access - inline const point& origin() const; - - inline point& origin(); - - inline scalar distSqr() const; - - inline scalar& distSqr(); + const point& origin() const + { + return origin_; + } + point& origin() + { + return origin_; + } + + scalar distSqr() const + { + return distSqr_; + } + scalar& distSqr() + { + return distSqr_; + } // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -134,7 +140,7 @@ public: ) const; //- Convert any absolute coordinates into relative to (patch)face - // centre + //- centre template<class TrackingData> inline void leaveDomain ( @@ -200,15 +206,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const wallPoint&, TrackingData& td) const; // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const wallPoint&) const; + + //- Test for inequality inline bool operator!=(const wallPoint&) const; diff --git a/src/meshTools/cellDist/wallPoint/wallPointData.C b/src/meshTools/cellDist/wallPoint/wallPointData.C index 2f51a03e0f9..82846361cf7 100644 --- a/src/meshTools/cellDist/wallPoint/wallPointData.C +++ b/src/meshTools/cellDist/wallPoint/wallPointData.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,40 +28,31 @@ License #include "wallPointData.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // template<class Type> -Ostream& operator<< +Foam::Ostream& Foam::operator<< ( Ostream& os, - const wallPointData<Type>& wDist + const wallPointData<Type>& rhs ) { return os - << static_cast<const wallPoint&>(wDist) + << static_cast<const wallPoint&>(rhs) << token::SPACE - << wDist.data(); + << rhs.data(); } template<class Type> -Istream& operator>> +Foam::Istream& Foam::operator>> ( Istream& is, - wallPointData<Type>& wDist + wallPointData<Type>& rhs ) { - return is >> static_cast<wallPoint&>(wDist) >> wDist.data_; + return is >> static_cast<wallPoint&>(rhs) >> rhs.data_; } -// ************************************************************************* // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/meshTools/cellDist/wallPoint/wallPointData.H b/src/meshTools/cellDist/wallPoint/wallPointData.H index 336be8765f1..3f2cbb4fb9c 100644 --- a/src/meshTools/cellDist/wallPoint/wallPointData.H +++ b/src/meshTools/cellDist/wallPoint/wallPointData.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -57,7 +57,7 @@ template<class Type> Ostream& operator<<(Ostream&, const wallPointData<Type>&); /*---------------------------------------------------------------------------*\ - Class wallPointData Declaration + Class wallPointData Declaration \*---------------------------------------------------------------------------*/ template<class Type> @@ -65,7 +65,7 @@ class wallPointData : public wallPoint { - // Private data + // Private Data //- Data at nearest wall center Type data_; @@ -73,9 +73,9 @@ class wallPointData // Private Member Functions - //- Evaluate distance to point. Update distSqr, origin from whomever - // is nearer pt. Return true if w2 is closer to point, - // false otherwise. + //- Evaluate distance to point. + // Update distSqr, origin from whomever is nearer pt. + // \return true if w2 is closer to point, false otherwise. template<class TrackingData> inline bool update ( @@ -88,12 +88,15 @@ class wallPointData public: - typedef Type dataType; + // Public Typedefs + + //- Type of additional data carried + typedef Type dataType; // Constructors - //- Construct null + //- Default construct inline wallPointData(); //- Construct from origin, normal, distance @@ -109,10 +112,17 @@ public: // Access - inline const Type& data() const; - inline Type& data(); + const Type& data() const + { + return data_; + } + Type& data() + { + return data_; + } + - // Needed by meshWave + // Needed by MeshWave //- Influence of neighbouring face. // Calls update(...) with cellCentre of celli @@ -153,7 +163,6 @@ public: TrackingData& td ); - // Member Operators // IOstream Operators diff --git a/src/meshTools/cellDist/wallPoint/wallPointDataI.H b/src/meshTools/cellDist/wallPoint/wallPointDataI.H index 20909603c08..6296c1ea300 100644 --- a/src/meshTools/cellDist/wallPoint/wallPointDataI.H +++ b/src/meshTools/cellDist/wallPoint/wallPointDataI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,17 +26,12 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Update this with w2 if w2 nearer to pt. template<class Type> template<class TrackingData> -inline bool wallPointData<Type>::update +inline bool Foam::wallPointData<Type>::update ( const point& pt, const wallPointData<Type>& w2, @@ -43,11 +39,11 @@ inline bool wallPointData<Type>::update TrackingData& td ) { - scalar dist2 = magSqr(pt - w2.origin()); + const scalar dist2 = magSqr(pt - w2.origin()); if (valid(td)) { - scalar diff = distSqr() - dist2; + const scalar diff = distSqr() - dist2; if (diff < 0) { @@ -76,18 +72,16 @@ inline bool wallPointData<Type>::update // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor template<class Type> -inline wallPointData<Type>::wallPointData() +inline Foam::wallPointData<Type>::wallPointData() : wallPoint(), data_() {} -// Construct from components template<class Type> -inline wallPointData<Type>::wallPointData +inline Foam::wallPointData<Type>::wallPointData ( const point& origin, const Type& data, @@ -101,24 +95,10 @@ inline wallPointData<Type>::wallPointData // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class Type> -inline const Type& wallPointData<Type>::data() const -{ - return data_; -} - - -template<class Type> -inline Type& wallPointData<Type>::data() -{ - return data_; -} - - // Update this with w2 if w2 nearer to pt. template<class Type> template<class TrackingData> -inline bool wallPointData<Type>::updateCell +inline bool Foam::wallPointData<Type>::updateCell ( const polyMesh& mesh, const label thisCelli, @@ -143,7 +123,7 @@ inline bool wallPointData<Type>::updateCell // Update this with w2 if w2 nearer to pt. template<class Type> template<class TrackingData> -inline bool wallPointData<Type>::updateFace +inline bool Foam::wallPointData<Type>::updateFace ( const polyMesh& mesh, const label thisFacei, @@ -168,7 +148,7 @@ inline bool wallPointData<Type>::updateFace // Update this with w2 if w2 nearer to pt. template<class Type> template<class TrackingData> -inline bool wallPointData<Type>::updateFace +inline bool Foam::wallPointData<Type>::updateFace ( const polyMesh& mesh, const label thisFacei, @@ -189,8 +169,4 @@ inline bool wallPointData<Type>::updateFace } -// ************************************************************************* // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/meshTools/cellDist/wallPoint/wallPointI.H b/src/meshTools/cellDist/wallPoint/wallPointI.H index f1735ea045a..b245ecbf1e8 100644 --- a/src/meshTools/cellDist/wallPoint/wallPointI.H +++ b/src/meshTools/cellDist/wallPoint/wallPointI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -47,7 +48,7 @@ inline bool Foam::wallPoint::update // return false; //} - scalar dist2 = magSqr(pt - w2.origin()); + const scalar dist2 = magSqr(pt - w2.origin()); if (!valid(td)) { @@ -58,7 +59,7 @@ inline bool Foam::wallPoint::update return true; } - scalar diff = distSqr_ - dist2; + const scalar diff = distSqr_ - dist2; if (diff < 0) { @@ -98,39 +99,8 @@ inline Foam::wallPoint::wallPoint(const point& origin, const scalar distSqr) {} -inline Foam::wallPoint::wallPoint(const wallPoint& wpt) -: - origin_(wpt.origin()), - distSqr_(wpt.distSqr()) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const Foam::point& Foam::wallPoint::origin() const -{ - return origin_; -} - - -inline Foam::point& Foam::wallPoint::origin() -{ - return origin_; -} - - -inline Foam::scalar Foam::wallPoint::distSqr() const -{ - return distSqr_; -} - - -inline Foam::scalar& Foam::wallPoint::distSqr() -{ - return distSqr_; -} - - template<class TrackingData> inline bool Foam::wallPoint::valid(TrackingData& td) const { @@ -148,7 +118,7 @@ inline bool Foam::wallPoint::sameGeometry TrackingData& td ) const { - scalar diff = mag(distSqr() - w2.distSqr()); + const scalar diff = mag(distSqr() - w2.distSqr()); if (diff < SMALL) { @@ -231,7 +201,7 @@ inline bool Foam::wallPoint::updateCell tol, td ); - } +} // Update this with w2 if w2 nearer to pt. @@ -256,6 +226,7 @@ inline bool Foam::wallPoint::updateFace ); } + // Update this with w2 if w2 nearer to pt. template<class TrackingData> inline bool Foam::wallPoint::updateFace @@ -291,13 +262,19 @@ inline bool Foam::wallPoint::equal // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline bool Foam::wallPoint::operator==(const Foam::wallPoint& rhs) const +inline bool Foam::wallPoint::operator== +( + const wallPoint& rhs +) const { - return origin() == rhs.origin(); + return origin_ == rhs.origin_; } -inline bool Foam::wallPoint::operator!=(const Foam::wallPoint& rhs) const +inline bool Foam::wallPoint::operator!= +( + const wallPoint& rhs +) const { return !(*this == rhs); } diff --git a/src/meshTools/meshStructure/pointTopoDistanceData.C b/src/meshTools/meshStructure/pointTopoDistanceData.C index c9b7113d6b1..d1b229a7a3d 100644 --- a/src/meshTools/meshStructure/pointTopoDistanceData.C +++ b/src/meshTools/meshStructure/pointTopoDistanceData.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,25 +28,25 @@ License #include "pointTopoDistanceData.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::pointTopoDistanceData& wDist + Ostream& os, + const pointTopoDistanceData& rhs ) { - return os << wDist.data_ << token::SPACE << wDist.distance_; + return os << rhs.data_ << token::SPACE << rhs.distance_; } Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::pointTopoDistanceData& wDist + Istream& is, + pointTopoDistanceData& rhs ) { - return is >> wDist.data_ >> wDist.distance_; + return is >> rhs.data_ >> rhs.distance_; } diff --git a/src/meshTools/meshStructure/pointTopoDistanceData.H b/src/meshTools/meshStructure/pointTopoDistanceData.H index 9c1d703ac53..c45df7ff2fb 100644 --- a/src/meshTools/meshStructure/pointTopoDistanceData.H +++ b/src/meshTools/meshStructure/pointTopoDistanceData.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,14 +56,13 @@ class pointTopoDistanceData; Istream& operator>>(Istream&, pointTopoDistanceData&); Ostream& operator<<(Ostream&, const pointTopoDistanceData&); - /*---------------------------------------------------------------------------*\ Class pointTopoDistanceData Declaration \*---------------------------------------------------------------------------*/ class pointTopoDistanceData { - // Private data + // Private Data //- Starting data label data_; @@ -76,7 +75,7 @@ public: // Constructors - //- Construct null with invalid (-1) for data and distance + //- Default construct, with invalid (-1) for data and distance inline pointTopoDistanceData(); //- Construct from components @@ -91,11 +90,12 @@ public: // Access - inline label data() const + label data() const { return data_; } - inline label distance() const + + label distance() const { return distance_; } @@ -103,13 +103,11 @@ public: // Needed by PointEdgeWave - - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -193,7 +191,7 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const pointTopoDistanceData&, TrackingData&) const; @@ -201,8 +199,10 @@ public: // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const pointTopoDistanceData&) const; + + //- Test for inequality inline bool operator!=(const pointTopoDistanceData&) const; diff --git a/src/meshTools/meshStructure/pointTopoDistanceDataI.H b/src/meshTools/meshStructure/pointTopoDistanceDataI.H index c438d635c9d..5d0a35a7e25 100644 --- a/src/meshTools/meshStructure/pointTopoDistanceDataI.H +++ b/src/meshTools/meshStructure/pointTopoDistanceDataI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -204,16 +204,16 @@ inline bool Foam::pointTopoDistanceData::equal inline bool Foam::pointTopoDistanceData::operator== ( - const Foam::pointTopoDistanceData& rhs + const pointTopoDistanceData& rhs ) const { - return data() == rhs.data() && distance() == rhs.distance(); + return data_ == rhs.data_ && distance_ == rhs.distance_; } inline bool Foam::pointTopoDistanceData::operator!= ( - const Foam::pointTopoDistanceData& rhs + const pointTopoDistanceData& rhs ) const { return !(*this == rhs); diff --git a/src/meshTools/meshStructure/topoDistanceData.C b/src/meshTools/meshStructure/topoDistanceData.C index f16e3e67095..b70e599b059 100644 --- a/src/meshTools/meshStructure/topoDistanceData.C +++ b/src/meshTools/meshStructure/topoDistanceData.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,25 +28,25 @@ License #include "topoDistanceData.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::topoDistanceData& wDist + Ostream& os, + const topoDistanceData& rhs ) { - return os << wDist.data_ << token::SPACE << wDist.distance_; + return os << rhs.data_ << token::SPACE << rhs.distance_; } Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::topoDistanceData& wDist + Istream& is, + topoDistanceData& rhs ) { - return is >> wDist.data_ >> wDist.distance_; + return is >> rhs.data_ >> rhs.distance_; } diff --git a/src/meshTools/meshStructure/topoDistanceData.H b/src/meshTools/meshStructure/topoDistanceData.H index ef68a882a68..e7c4f64da4c 100644 --- a/src/meshTools/meshStructure/topoDistanceData.H +++ b/src/meshTools/meshStructure/topoDistanceData.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -55,14 +55,13 @@ class topoDistanceData; Istream& operator>>(Istream&, topoDistanceData&); Ostream& operator<<(Ostream&, const topoDistanceData&); - /*---------------------------------------------------------------------------*\ - Class topoDistanceData Declaration + Class topoDistanceData Declaration \*---------------------------------------------------------------------------*/ class topoDistanceData { - // Private data + // Private Data //- Starting data label data_; @@ -75,7 +74,7 @@ public: // Constructors - //- Construct null with invalid (-1) for data and distance + //- Default construct, with invalid (-1) for data and distance inline topoDistanceData(); //- Construct from components @@ -90,11 +89,12 @@ public: // Access - inline label data() const + label data() const { return data_; } - inline label distance() const + + label distance() const { return distance_; } @@ -102,12 +102,11 @@ public: // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -184,16 +183,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const topoDistanceData&, TrackingData& td) const; // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const topoDistanceData&) const; + //- Test for inequality inline bool operator!=(const topoDistanceData&) const; diff --git a/src/meshTools/meshStructure/topoDistanceDataI.H b/src/meshTools/meshStructure/topoDistanceDataI.H index b5a6863f8e3..1ede6fe5c1d 100644 --- a/src/meshTools/meshStructure/topoDistanceDataI.H +++ b/src/meshTools/meshStructure/topoDistanceDataI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -192,16 +192,16 @@ inline bool Foam::topoDistanceData::equal inline bool Foam::topoDistanceData::operator== ( - const Foam::topoDistanceData& rhs + const topoDistanceData& rhs ) const { - return data() == rhs.data() && distance() == rhs.distance(); + return data_ == rhs.data_ && distance_ == rhs.distance_; } inline bool Foam::topoDistanceData::operator!= ( - const Foam::topoDistanceData& rhs + const topoDistanceData& rhs ) const { return !(*this == rhs); diff --git a/src/meshTools/regionSplit/minData.H b/src/meshTools/regionSplit/minData.H index a9ea6f27a23..069bee9fd03 100644 --- a/src/meshTools/regionSplit/minData.H +++ b/src/meshTools/regionSplit/minData.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2014-2016 OpenFOAM Foundation - Copyright (C) 2015-2019 OpenCFD Ltd. + Copyright (C) 2015-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -46,8 +46,7 @@ SourceFiles namespace Foam { -// Forward declarations - +// Forward Declarations class polyPatch; class polyMesh; class minData; @@ -55,14 +54,13 @@ class minData; Istream& operator>>(Istream&, minData&); Ostream& operator<<(Ostream&, const minData&); - /*---------------------------------------------------------------------------*\ Class minData Declaration \*---------------------------------------------------------------------------*/ class minData { - // Private data + // Private Data //- Starting data label data_; @@ -72,10 +70,10 @@ public: // Constructors - //- Construct null + //- Default construct inline minData(); - //- Construct from count + //- Construct from min value inline minData(const label data); @@ -83,7 +81,7 @@ public: // Access - inline label data() const + label data() const { return data_; } @@ -91,12 +89,11 @@ public: // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData& td) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -173,15 +170,17 @@ public: TrackingData& td ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal(const minData&, TrackingData& td) const; + // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const minData&) const; + //- Test for inequality inline bool operator!=(const minData&) const; diff --git a/src/meshTools/regionSplit/minDataI.H b/src/meshTools/regionSplit/minDataI.H index 2a0858c559c..2967af73f96 100644 --- a/src/meshTools/regionSplit/minDataI.H +++ b/src/meshTools/regionSplit/minDataI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2014-2016 OpenFOAM Foundation - Copyright (C) 2015-2019 OpenCFD Ltd. + Copyright (C) 2015-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -177,16 +177,16 @@ inline bool Foam::minData::equal inline bool Foam::minData::operator== ( - const Foam::minData& rhs + const minData& rhs ) const { - return data() == rhs.data(); + return data_ == rhs.data_; } inline bool Foam::minData::operator!= ( - const Foam::minData& rhs + const minData& rhs ) const { return !(*this == rhs); @@ -197,21 +197,21 @@ inline bool Foam::minData::operator!= inline Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::minData& wDist + Ostream& os, + const minData& rhs ) { - return os << wDist.data_; + return os << rhs.data_; } inline Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::minData& wDist + Istream& is, + minData& rhs ) { - return is >> wDist.data_; + return is >> rhs.data_; } diff --git a/src/overset/cellCellStencil/inverseDistance/meshToMeshData.C b/src/overset/cellCellStencil/inverseDistance/meshToMeshData.C index 033fc8e15fa..8510c624109 100644 --- a/src/overset/cellCellStencil/inverseDistance/meshToMeshData.C +++ b/src/overset/cellCellStencil/inverseDistance/meshToMeshData.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,25 +27,25 @@ License #include "meshToMeshData.H" -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< ( - Foam::Ostream& os, - const Foam::meshToMeshData& wDist + Ostream& os, + const meshToMeshData& rhs ) { - return os << wDist.tgtCelli_; + return os << rhs.tgtCelli_; } Foam::Istream& Foam::operator>> ( - Foam::Istream& is, - Foam::meshToMeshData& wDist + Istream& is, + meshToMeshData& rhs ) { - return is >> wDist.tgtCelli_; + return is >> rhs.tgtCelli_; } diff --git a/src/overset/cellCellStencil/inverseDistance/meshToMeshData.H b/src/overset/cellCellStencil/inverseDistance/meshToMeshData.H index 4bd36f4dc8b..3b7e2cf6b74 100644 --- a/src/overset/cellCellStencil/inverseDistance/meshToMeshData.H +++ b/src/overset/cellCellStencil/inverseDistance/meshToMeshData.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -57,61 +57,53 @@ Ostream& operator<<(Ostream&, const meshToMeshData&); /*---------------------------------------------------------------------------*\ - Class meshToMeshData Declaration + Class meshToMeshData Declaration \*---------------------------------------------------------------------------*/ class meshToMeshData { -public: + // Private Data + + //- Corresponding cell in tgtMesh + label tgtCelli_; - //- Class used to pass non-cell data to the update function - class trackData - { - public: - const polyMesh& tgtMesh_; +public: + // Public Classes - // Constructors + //- Class used to pass non-cell data to the update function + class trackData + { + public: + + const polyMesh& tgtMesh_; trackData(const polyMesh& tgtMesh) : tgtMesh_(tgtMesh) {} + }; - }; - - - // Private data - - // Corresponding cell in tgtMesh - label tgtCelli_; - - -public: // Constructors - //- Construct null + //- Default construct inline meshToMeshData(); - //- Construct from count - inline meshToMeshData - ( - const label tgtCelli - ); + //- Construct from target cell + inline meshToMeshData(const label tgtCelli); // Member Functions // Access - inline label tgtCell() const + label tgtCell() const { return tgtCelli_; } - - inline label& tgtCell() + label& tgtCell() { return tgtCelli_; } @@ -119,12 +111,11 @@ public: // Needed by FaceCellWave - //- Check whether origin has been changed at all or - // still contains original (invalid) value. + //- Changed or contains original (invalid) value template<class TrackingData> inline bool valid(TrackingData&) const; - //- Check for identical geometrical data. Used for cyclics checking. + //- Check for identical geometrical data (eg, cyclics checking) template<class TrackingData> inline bool sameGeometry ( @@ -134,8 +125,8 @@ public: TrackingData& ) const; - //- Convert any absolute coordinates into relative to (patch)face - // centre + //- Convert absolute coordinates into relative + //- to (patch)face centre template<class TrackingData> inline void leaveDomain ( @@ -201,7 +192,7 @@ public: TrackingData& ); - //- Same (like operator==) + //- Test for equality, with TrackingData template<class TrackingData> inline bool equal ( @@ -212,9 +203,10 @@ public: // Member Operators - // Needed for List IO + //- Test for equality inline bool operator==(const meshToMeshData&) const; + //- Test for inequality inline bool operator!=(const meshToMeshData&) const; diff --git a/src/overset/cellCellStencil/inverseDistance/meshToMeshDataI.H b/src/overset/cellCellStencil/inverseDistance/meshToMeshDataI.H index a671526d513..034ca267060 100644 --- a/src/overset/cellCellStencil/inverseDistance/meshToMeshDataI.H +++ b/src/overset/cellCellStencil/inverseDistance/meshToMeshDataI.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -116,7 +116,7 @@ inline bool Foam::meshToMeshData::updateCell const point& cc = mesh.cellCentres()[thisCelli]; // See if we are in the neighbour - label tgti = neighbourInfo.tgtCelli_; + const label tgti = neighbourInfo.tgtCelli_; // Try match of neighbour if (td.tgtMesh_.pointInCell(cc, tgti, polyMesh::CELL_TETS)) @@ -127,10 +127,8 @@ inline bool Foam::meshToMeshData::updateCell // Try match of neighbour's neighbours const labelList& tgtNbrs = td.tgtMesh_.cellCells(tgti); - forAll(tgtNbrs, i) + for (const label tgti : tgtNbrs) { - label tgti = tgtNbrs[i]; - // Try match of neighbour if (td.tgtMesh_.pointInCell(cc, tgti, polyMesh::CELL_TETS)) { @@ -211,7 +209,7 @@ inline bool Foam::meshToMeshData::equal inline bool Foam::meshToMeshData::operator== ( - const Foam::meshToMeshData& rhs + const meshToMeshData& rhs ) const { return tgtCelli_ == rhs.tgtCelli_; @@ -220,7 +218,7 @@ inline bool Foam::meshToMeshData::operator== inline bool Foam::meshToMeshData::operator!= ( - const Foam::meshToMeshData& rhs + const meshToMeshData& rhs ) const { return !(*this == rhs); diff --git a/src/overset/cellCellStencil/inverseDistance/waveMethod.C b/src/overset/cellCellStencil/inverseDistance/waveMethod.C index f615f4de481..d7d0b210aa1 100644 --- a/src/overset/cellCellStencil/inverseDistance/waveMethod.C +++ b/src/overset/cellCellStencil/inverseDistance/waveMethod.C @@ -140,7 +140,7 @@ void Foam::waveMethod::calculate forAll(cellData, celli) { - srcToTgtAddr[celli] = cellData[celli].tgtCelli_; + srcToTgtAddr[celli] = cellData[celli].tgtCell(); } } @@ -172,6 +172,7 @@ Foam::waveMethod::waveMethod Foam::waveMethod::~waveMethod() {} + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::waveMethod::calculate diff --git a/src/renumber/renumberMethods/structuredRenumber/OppositeFaceCellWave.H b/src/renumber/renumberMethods/structuredRenumber/OppositeFaceCellWave.H index 779142f25ea..0f194ccb540 100644 --- a/src/renumber/renumberMethods/structuredRenumber/OppositeFaceCellWave.H +++ b/src/renumber/renumberMethods/structuredRenumber/OppositeFaceCellWave.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -72,7 +73,7 @@ class OppositeFaceCellWave { protected: - // Protected data + // Protected Data //- For every entry in changedCells (i.e. the cell front) gives // the face that it needs to transfer to @@ -95,7 +96,8 @@ public: // Constructors //- Construct from mesh and list of changed faces with the Type - // for these faces. Iterates until nothing changes or maxIter reached. + //- for these faces. + // Iterates until nothing changes or maxIter reached. // (maxIter can be 0) OppositeFaceCellWave ( -- GitLab