diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticle.H b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticle.H index 1759de26cc..5ad00275d5 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticle.H +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticle.H @@ -34,8 +34,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef DTRMParticle_H -#define DTRMParticle_H +#ifndef Foam_DTRMParticle_H +#define Foam_DTRMParticle_H #include "particle.H" #include "IOstream.H" @@ -50,12 +50,13 @@ SourceFiles namespace Foam { +// Forward Declarations class DTRMParticle; -using namespace Foam::radiation; -// Forward declaration of friend functions Ostream& operator<<(Ostream&, const DTRMParticle&); +using namespace Foam::radiation; + /*---------------------------------------------------------------------------*\ Class DTRMParticle Declaration \*---------------------------------------------------------------------------*/ @@ -130,7 +131,7 @@ public: ); - // Member functions + // Member Functions inline const interpolationCell& aInterp() const; inline const interpolationCell& eInterp() const; @@ -232,37 +233,34 @@ public: // Access //- Return const access to the initial position - inline const point& p0() const; + const point& p0() const noexcept { return p0_; } //- Return const access to the target position - inline const point& p1() const; + const point& p1() const noexcept { return p1_; } //- Return const access to the initial intensity - inline scalar I0() const; + scalar I0() const noexcept { return I0_; } //- Return const access to the current intensity - inline scalar I() const; + scalar I() const noexcept { return I_; } //- Return const access dA - inline scalar dA() const; + scalar dA() const noexcept { return dA_; } // Edit //- Return access to the target position - inline point& p1(); + point& p1() noexcept { return p1_; } //- Return access to the initial intensity - inline scalar& I0(); + scalar& I0() noexcept { return I0_; } //- Return access to the current intensity - inline scalar& I(); + scalar& I() noexcept { return I_; } //- Return access to dA - inline scalar& dA(); - - //- Return access to reflectedId - inline label& reflectedId(); + scalar& dA() noexcept { return dA_; } // Tracking diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticleI.H b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticleI.H index 89e98e782d..8c9d6092de 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticleI.H +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticleI.H @@ -107,58 +107,4 @@ inline Foam::scalar& Foam::DTRMParticle::trackingData::Q(label celli) } -inline const Foam::point& Foam::DTRMParticle::p0() const -{ - return p0_; -} - - -inline const Foam::point& Foam::DTRMParticle::p1() const -{ - return p1_; -} - - -inline Foam::scalar Foam::DTRMParticle::I0() const -{ - return I0_; -} - - -inline Foam::scalar Foam::DTRMParticle::I() const -{ - return I_; -} - - -inline Foam::scalar Foam::DTRMParticle::dA() const -{ - return dA_; -} - - -inline Foam::scalar& Foam::DTRMParticle::dA() -{ - return dA_; -} - - -inline Foam::point& Foam::DTRMParticle::p1() -{ - return p1_; -} - - -inline Foam::scalar& Foam::DTRMParticle::I0() -{ - return I0_; -} - - -inline Foam::scalar& Foam::DTRMParticle::I() -{ - return I_; -} - - // ************************************************************************* // diff --git a/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H b/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H index d02d8ef13a..3a03163c53 100644 --- a/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H +++ b/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef passivePositionParticle_H -#define passivePositionParticle_H +#ifndef Foam_passivePositionParticle_H +#define Foam_passivePositionParticle_H #include "passiveParticle.H" @@ -130,7 +130,9 @@ public: }; - const point& cachedPosition() const + // Member Functions + + const point& cachedPosition() const noexcept { return cachedPosition_; } diff --git a/src/functionObjects/field/extractEulerianParticles/eulerianParticle/eulerianParticle.H b/src/functionObjects/field/extractEulerianParticles/eulerianParticle/eulerianParticle.H index 5be179c9b8..cbc946a568 100644 --- a/src/functionObjects/field/extractEulerianParticles/eulerianParticle/eulerianParticle.H +++ b/src/functionObjects/field/extractEulerianParticles/eulerianParticle/eulerianParticle.H @@ -37,8 +37,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef functionObjects_eulerianParticle_H -#define functionObjects_eulerianParticle_H +#ifndef Foam_functionObjects_eulerianParticle_H +#define Foam_functionObjects_eulerianParticle_H #include "label.H" #include "scalar.H" @@ -49,7 +49,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward Declarations class Istream; class Ostream; @@ -71,10 +71,9 @@ namespace functionObjects class eulerianParticle { - public: - // Public data + // Public Data //- Index of face in faceZone that this particle hits. Also used to // identify the index of the coarse face of the surface agglomeration @@ -95,7 +94,7 @@ public: scalar time; - //- Constructor + //- Default construct eulerianParticle(); diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.H b/src/functionObjects/field/nearWallFields/findCellParticle.H index e2caa3dc77..c4238a66ba 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.H +++ b/src/functionObjects/field/nearWallFields/findCellParticle.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef findCellParticle_H -#define findCellParticle_H +#ifndef Foam_findCellParticle_H +#define Foam_findCellParticle_H #include "particle.H" #include "autoPtr.H" @@ -102,17 +102,11 @@ public: {} - // Member functions + // Member Functions - labelListList& cellToData() - { - return cellToData_; - } + labelListList& cellToData() noexcept { return cellToData_; } - List>& cellToEnd() - { - return cellToEnd_; - } + List>& cellToEnd() noexcept { return cellToEnd_; } }; @@ -130,8 +124,8 @@ public: const label data ); - //- Construct from a position and a cell, searching for the rest of the - // required topology + //- Construct from a position and a cell, + //- searching for the rest of the required topology findCellParticle ( const polyMesh& mesh, @@ -182,40 +176,22 @@ public: // Member Functions //- Point to track from - const point& start() const - { - return start_; - } + const point& start() const noexcept { return start_; } //- Point to track from - point& start() - { - return start_; - } + point& start() noexcept { return start_; } //- Point to track to - const point& end() const - { - return end_; - } + const point& end() const noexcept { return end_; } //- Point to track to - point& end() - { - return end_; - } + point& end() noexcept { return end_; } //- Transported label - label data() const - { - return data_; - } + label data() const noexcept { return data_; } //- Transported label - label& data() - { - return data_; - } + label& data() noexcept { return data_; } // Tracking diff --git a/src/functionObjects/field/streamLine/streamLineParticle.H b/src/functionObjects/field/streamLine/streamLineParticle.H index 097546e724..f7f46bb5d8 100644 --- a/src/functionObjects/field/streamLine/streamLineParticle.H +++ b/src/functionObjects/field/streamLine/streamLineParticle.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef streamLineParticle_H -#define streamLineParticle_H +#ifndef Foam_streamLineParticle_H +#define Foam_streamLineParticle_H #include "particle.H" #include "autoPtr.H" @@ -48,8 +48,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators - +// Forward Declarations class streamLineParticle; class streamLineParticleCloud; diff --git a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H index c6418db653..6fe5ff6bb7 100644 --- a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H +++ b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H @@ -37,8 +37,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef wallBoundedParticle_H -#define wallBoundedParticle_H +#ifndef Foam_wallBoundedParticle_H +#define Foam_wallBoundedParticle_H #include "particle.H" #include "autoPtr.H" @@ -49,8 +49,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators - +// Forward Declarations class wallBoundedParticle; Ostream& operator<<(Ostream&, const wallBoundedParticle&); @@ -72,15 +71,14 @@ public: : public particle::trackingData { - public: const bitSet& isWallPatch_; // Constructors - template - inline trackingData + template + trackingData ( const TrackCloudType& cloud, const bitSet& isWallPatch @@ -94,7 +92,7 @@ public: protected: - // Protected data + // Protected Data //- Particle position is updated locally as opposed to via track // functions of the base Foam::particle class @@ -212,19 +210,13 @@ public: // Member Functions - // Access + // Access - //- -1 or label of mesh edge - inline label meshEdgeStart() const - { - return meshEdgeStart_; - } + //- The mesh edge label or -1 + label meshEdgeStart() const noexcept { return meshEdgeStart_; } - //- -1 or diagonal edge - inline label diagEdge() const - { - return diagEdge_; - } + //- The diagonal edge label or -1 + label diagEdge() const noexcept { return diagEdge_; } // Track diff --git a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H index 87e01affc2..746c855ba1 100644 --- a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H +++ b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H @@ -36,8 +36,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef wallBoundedStreamLineParticle_H -#define wallBoundedStreamLineParticle_H +#ifndef Foam_wallBoundedStreamLineParticle_H +#define Foam_wallBoundedStreamLineParticle_H #include "wallBoundedParticle.H" #include "autoPtr.H" @@ -50,12 +50,9 @@ SourceFiles namespace Foam { -class wallBoundedStreamLineParticleCloud; - - -// Forward declaration of friend functions and operators - +// Forward Declarations class wallBoundedStreamLineParticle; +class wallBoundedStreamLineParticleCloud; Ostream& operator<<(Ostream&, const wallBoundedStreamLineParticle&); @@ -68,7 +65,6 @@ class wallBoundedStreamLineParticle : public wallBoundedParticle { - public: //- Class used to pass tracking data to the trackToEdge function @@ -76,10 +72,8 @@ public: : public wallBoundedParticle::trackingData { - public: - const PtrList>& vsInterp_; const PtrList>& vvInterp_; const label UIndex_; @@ -92,7 +86,7 @@ public: // Constructors - template + template trackingData ( TrackCloudType& cloud, @@ -107,11 +101,7 @@ public: List>& allVectors ) : - wallBoundedParticle::trackingData - ( - cloud, - isWallPatch - ), + wallBoundedParticle::trackingData(cloud, isWallPatch), vsInterp_(vsInterp), vvInterp_(vvInterp), UIndex_(UIndex), @@ -128,7 +118,7 @@ public: protected: - // Protected data + // Protected Data //- Track with +U or -U bool trackForward_; diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index a6061e62a7..73f57fb1cc 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -84,7 +84,7 @@ Foam::Cloud::Cloud geometryType_(cloud::geometryType::COORDINATES) { checkPatches(); - polyMesh_.oldCellCentres(); + (void)polyMesh_.oldCellCentres(); // Ask for the tetBasePtIs to trigger all processors to build // them, otherwise, if some processors have no particles then @@ -322,8 +322,8 @@ void Foam::Cloud::autoMap(const mapPolyMesh& mapper) // Ask for the tetBasePtIs to trigger all processors to build // them, otherwise, if some processors have no particles then // there is a comms mismatch. - polyMesh_.tetBasePtIs(); - polyMesh_.oldCellCentres(); + (void)polyMesh_.tetBasePtIs(); + (void)polyMesh_.oldCellCentres(); const vectorField& positions = globalPositionsPtr_(); diff --git a/src/lagrangian/basic/Cloud/CloudIO.C b/src/lagrangian/basic/Cloud/CloudIO.C index ba78da6857..efa15362ae 100644 --- a/src/lagrangian/basic/Cloud/CloudIO.C +++ b/src/lagrangian/basic/Cloud/CloudIO.C @@ -155,7 +155,7 @@ void Foam::Cloud::initCloud(const bool checkClass) // Ask for the tetBasePtIs to trigger all processors to build // them, otherwise, if some processors have no particles then // there is a comms mismatch. - polyMesh_.tetBasePtIs(); + (void)polyMesh_.tetBasePtIs(); } @@ -177,8 +177,8 @@ Foam::Cloud::Cloud { checkPatches(); - polyMesh_.tetBasePtIs(); - polyMesh_.oldCellCentres(); + (void)polyMesh_.tetBasePtIs(); + (void)polyMesh_.oldCellCentres(); initCloud(checkClass); } diff --git a/src/lagrangian/basic/indexedParticle/indexedParticle.H b/src/lagrangian/basic/indexedParticle/indexedParticle.H index 72db662cc0..e08f525de6 100644 --- a/src/lagrangian/basic/indexedParticle/indexedParticle.H +++ b/src/lagrangian/basic/indexedParticle/indexedParticle.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef indexedParticle_H -#define indexedParticle_H +#ifndef Foam_indexedParticle_H +#define Foam_indexedParticle_H #include "particle.H" #include "IOstream.H" @@ -55,7 +55,7 @@ class indexedParticle : public particle { - // Private data + // Private Data label index_; @@ -121,15 +121,9 @@ public: // Member Functions - label index() const - { - return index_; - } + label index() const noexcept { return index_; } - label& index() - { - return index_; - } + label& index() noexcept { return index_; } }; diff --git a/src/lagrangian/basic/injectedParticle/injectedParticle.H b/src/lagrangian/basic/injectedParticle/injectedParticle.H index eef8c31c20..294108a7f3 100644 --- a/src/lagrangian/basic/injectedParticle/injectedParticle.H +++ b/src/lagrangian/basic/injectedParticle/injectedParticle.H @@ -41,8 +41,8 @@ SeeAlso \*---------------------------------------------------------------------------*/ -#ifndef injectedParticle_H -#define injectedParticle_H +#ifndef Foam_injectedParticle_H +#define Foam_injectedParticle_H #include "particle.H" #include "IOstream.H" @@ -53,7 +53,7 @@ SeeAlso namespace Foam { -// Forward declarations +// Forward Declarations class injectedParticle; Ostream& operator<<(Ostream&, const injectedParticle&); @@ -67,7 +67,7 @@ class injectedParticle { protected: - // Protected data + // Protected Data // Particle properties @@ -184,37 +184,37 @@ public: // Member Functions - // Access + // Access - //- Return const access to the tag - inline label tag() const; + //- Return const access to the tag + label tag() const noexcept { return tag_; } - //- Return const access to the start of injection - inline scalar soi() const; + //- Return const access to the start of injection + scalar soi() const noexcept { return soi_; } - //- Return const access to diameter - inline scalar d() const; + //- Return const access to diameter + scalar d() const noexcept { return d_; } - //- Return const access to velocity - inline const vector& U() const; + //- Return const access to velocity + const vector& U() const noexcept { return U_; } - // Edit + // Edit - //- Return the tag - inline label& tag(); + //- Return the tag + label& tag() noexcept { return tag_; } - //- Return the start of injection - inline scalar& soi(); + //- Return the start of injection + scalar& soi() noexcept { return soi_; } - //- Return access to diameter - inline scalar& d(); + //- Return access to diameter + scalar& d() noexcept { return d_; } - //- Return access to velocity - inline vector& U(); + //- Return access to velocity + vector& U() noexcept { return U_; } - // I-O + // I-O //- Read fields static void readFields(Cloud& c); diff --git a/src/lagrangian/basic/injectedParticle/injectedParticleI.H b/src/lagrangian/basic/injectedParticle/injectedParticleI.H index ed2641ad6c..0e3476b2c6 100644 --- a/src/lagrangian/basic/injectedParticle/injectedParticleI.H +++ b/src/lagrangian/basic/injectedParticle/injectedParticleI.H @@ -25,7 +25,6 @@ License \*---------------------------------------------------------------------------*/ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // inline Foam::injectedParticle::injectedParticle @@ -64,52 +63,4 @@ inline Foam::injectedParticle::injectedParticle {} -inline Foam::label Foam::injectedParticle::tag() const -{ - return tag_; -} - - -inline Foam::scalar Foam::injectedParticle::soi() const -{ - return soi_; -} - - -inline Foam::scalar Foam::injectedParticle::d() const -{ - return d_; -} - - -inline const Foam::vector& Foam::injectedParticle::U() const -{ - return U_; -} - - -inline Foam::label& Foam::injectedParticle::tag() -{ - return tag_; -} - - -inline Foam::scalar& Foam::injectedParticle::soi() -{ - return soi_; -} - - -inline Foam::scalar& Foam::injectedParticle::d() -{ - return d_; -} - - -inline Foam::vector& Foam::injectedParticle::U() -{ - return U_; -} - - // ************************************************************************* // diff --git a/src/lagrangian/basic/particle/particle.C b/src/lagrangian/basic/particle/particle.C index a71de211aa..2ddea84408 100644 --- a/src/lagrangian/basic/particle/particle.C +++ b/src/lagrangian/basic/particle/particle.C @@ -276,10 +276,9 @@ void Foam::particle::changeFace(const label tetTriI) // Find the face in the same cell that shares the edge, and the // corresponding tetrahedra point tetPti_ = -1; - forAll(mesh_.cells()[celli_], cellFaceI) + for (const label newFaceI : mesh_.cells()[celli_]) { - const label newFaceI = mesh_.cells()[celli_][cellFaceI]; - const class face& newFace = mesh_.faces()[newFaceI]; + const Foam::face& newFace = mesh_.faces()[newFaceI]; const label newOwner = mesh_.faceOwner()[newFaceI]; // Exclude the current face @@ -374,10 +373,9 @@ void Foam::particle::changeToMasterPatch() { label thisPatch = patch(); - forAll(mesh_.cells()[celli_], cellFaceI) + for (const label otherFaceI : mesh_.cells()[celli_]) { // Skip the current face and any internal faces - const label otherFaceI = mesh_.cells()[celli_][cellFaceI]; if (facei_ == otherFaceI || mesh_.isInternalFace(otherFaceI)) { continue; @@ -386,8 +384,8 @@ void Foam::particle::changeToMasterPatch() // Compare the two faces. If they are the same, chose the one with the // lower patch index. In the case of an ACMI-wall pair, this will be // the ACMI, which is what we want. - const class face& thisFace = mesh_.faces()[facei_]; - const class face& otherFace = mesh_.faces()[otherFaceI]; + const Foam::face& thisFace = mesh_.faces()[facei_]; + const Foam::face& otherFace = mesh_.faces()[otherFaceI]; if (face::compare(thisFace, otherFace) != 0) { const label otherPatch = @@ -442,12 +440,12 @@ void Foam::particle::locate // Loop all cell tets to find the one containing the position. Track // through each tet from the cell centre. If a tet contains the position // then the track will end with a single trackToTri. - const class cell& c = mesh_.cells()[celli_]; + const Foam::cell& c = mesh_.cells()[celli_]; scalar minF = VGREAT; label minTetFacei = -1, minTetPti = -1; forAll(c, cellTetFacei) { - const class face& f = mesh_.faces()[c[cellTetFacei]]; + const Foam::face& f = mesh_.faces()[c[cellTetFacei]]; for (label tetPti = 1; tetPti < f.size() - 1; ++tetPti) { coordinates_ = barycentric(1, 0, 0, 0); @@ -735,10 +733,7 @@ Foam::scalar Foam::particle::trackToStationaryTri if (debug) { - vector o, b, v1, v2; - stationaryTetGeometry(o, b, v1, v2); - Pout<< "Tet points o=" << o << ", b=" << b - << ", v1=" << v1 << ", v2=" << v2 << endl + Pout<< "Tet points: " << currentTetIndices().tet(mesh_) << endl << "Tet determinant = " << detA << endl << "Start local coordinates = " << y0 << endl; } diff --git a/src/lagrangian/basic/particle/particle.H b/src/lagrangian/basic/particle/particle.H index dfe9dd15aa..10e282e12a 100644 --- a/src/lagrangian/basic/particle/particle.H +++ b/src/lagrangian/basic/particle/particle.H @@ -106,7 +106,7 @@ public: // Constructor - template + template trackingData(const TrackCloudType& cloud) {} }; @@ -177,15 +177,6 @@ private: // Tetrahedra functions - //- Get the vertices of the current tet - inline void stationaryTetGeometry - ( - vector& centre, - vector& base, - vector& vertex1, - vector& vertex2 - ) const; - //- Get the transformation associated with the current tet. This // will convert a barycentric position within the tet to a // Cartesian position in the global coordinate system. The @@ -292,7 +283,7 @@ private: protected: - // Patch interactions + // Patch Interactions //- Read particle from stream. Optionally (for old format) return // read position. Used by construct-from-Istream diff --git a/src/lagrangian/basic/particle/particleI.H b/src/lagrangian/basic/particle/particleI.H index 96b88310c1..79532b6d82 100644 --- a/src/lagrangian/basic/particle/particleI.H +++ b/src/lagrangian/basic/particle/particleI.H @@ -31,31 +31,11 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::particle::stationaryTetGeometry -( - vector& centre, - vector& base, - vector& vertex1, - vector& vertex2 -) const -{ - const triFace triIs(currentTetIndices().faceTriIs(mesh_)); - const vectorField& ccs = mesh_.cellCentres(); - const pointField& pts = mesh_.points(); - - centre = ccs[celli_]; - base = pts[triIs[0]]; - vertex1 = pts[triIs[1]]; - vertex2 = pts[triIs[2]]; -} - - inline Foam::barycentricTensor Foam::particle::stationaryTetTransform() const { - vector centre, base, vertex1, vertex2; - stationaryTetGeometry(centre, base, vertex1, vertex2); + const tetPointRef tet = currentTetIndices().tet(mesh_); - return barycentricTensor(centre, base, vertex1, vertex2); + return barycentricTensor(tet.a(), tet.b(), tet.c(), tet.d()); } @@ -247,10 +227,8 @@ inline Foam::Pair Foam::particle::stepFractionSpan() const return Pair(tFrac, dtFrac); } - else - { - return Pair(0, 1); - } + + return Pair(0, 1); } @@ -274,10 +252,8 @@ inline Foam::barycentricTensor Foam::particle::currentTetTransform() const { return movingTetTransform(0)[0]; } - else - { - return stationaryTetTransform(); - } + + return stationaryTetTransform(); } @@ -354,10 +330,7 @@ void Foam::particle::patchData(vector& n, vector& U) const } else { - vector centre, base, vertex1, vertex2; - stationaryTetGeometry(centre, base, vertex1, vertex2); - - n = triPointRef(base, vertex1, vertex2).unitNormal(); + n = currentTetIndices().faceTri(mesh_).unitNormal(); U = Zero; } diff --git a/src/lagrangian/basic/passiveParticle/passiveParticle.H b/src/lagrangian/basic/passiveParticle/passiveParticle.H index b6cce25024..46593237ec 100644 --- a/src/lagrangian/basic/passiveParticle/passiveParticle.H +++ b/src/lagrangian/basic/passiveParticle/passiveParticle.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef passiveParticle_H -#define passiveParticle_H +#ifndef Foam_passiveParticle_H +#define Foam_passiveParticle_H #include "particle.H" #include "IOstream.H" @@ -55,7 +55,6 @@ class passiveParticle : public particle { - public: // Constructors diff --git a/src/lagrangian/solidParticle/solidParticle.H b/src/lagrangian/solidParticle/solidParticle.H index 7e5b2b1b7b..b82f7bc7e0 100644 --- a/src/lagrangian/solidParticle/solidParticle.H +++ b/src/lagrangian/solidParticle/solidParticle.H @@ -38,8 +38,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef solidParticle_H -#define solidParticle_H +#ifndef Foam_solidParticle_H +#define Foam_solidParticle_H #include "particle.H" #include "IOstream.H" @@ -53,12 +53,11 @@ namespace Foam { // Forward Declarations -class solidParticleCloud; class solidParticle; +class solidParticleCloud; Ostream& operator<<(Ostream&, const solidParticle&); - /*---------------------------------------------------------------------------*\ Class solidParticle Declaration \*---------------------------------------------------------------------------*/ @@ -99,25 +98,41 @@ public: // Constructors - inline trackingData + trackingData ( - const solidParticleCloud& spc, + const solidParticleCloud& cld, const interpolationCellPoint& rhoInterp, const interpolationCellPoint& UInterp, const interpolationCellPoint& nuInterp, const vector& g - ); + ) + : + particle::trackingData(cld), + rhoInterp_(rhoInterp), + UInterp_(UInterp), + nuInterp_(nuInterp), + g_(g) + {} - // Member functions + // Member Functions - inline const interpolationCellPoint& rhoInterp() const; + const interpolationCellPoint& nuInterp() const noexcept + { + return nuInterp_; + } - inline const interpolationCellPoint& UInterp() const; + const interpolationCellPoint& UInterp() const noexcept + { + return UInterp_; + } - inline const interpolationCellPoint& nuInterp() const; + const interpolationCellPoint& rhoInterp() const noexcept + { + return rhoInterp_; + } - inline const vector& g() const; + const vector& g() const noexcept { return g_; } }; @@ -132,15 +147,20 @@ public: //- Construct from a position and a cell // Searches for the rest of the required topology. // Other properties are zero initialised. - inline solidParticle + solidParticle ( const polyMesh& mesh, const vector& position, const label celli = -1 - ); + ) + : + particle(mesh, position, celli), + d_(0), + U_(Zero) + {} //- Construct from components - inline solidParticle + solidParticle ( const polyMesh& mesh, const barycentric& coordinates, @@ -149,7 +169,12 @@ public: const label tetPti, const scalar d, const vector& U - ); + ) + : + particle(mesh, coordinates, celli, tetFacei, tetPti), + d_(d), + U_(U) + {} //- Construct from Istream solidParticle @@ -187,19 +212,19 @@ public: // Member Functions - // Access + // Access - //- Return diameter - inline scalar d() const; + //- Return diameter + scalar d() const noexcept { return d_; } - //- Return velocity - inline const vector& U() const; + //- Return velocity + const vector& U() const noexcept { return U_; } - // Tracking + // Tracking - //- Move - bool move(solidParticleCloud&, trackingData&, const scalar); + //- Move + bool move(solidParticleCloud&, trackingData&, const scalar); // Patch interactions @@ -249,10 +274,6 @@ template<> struct is_contiguous : std::true_type {}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "solidParticleI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/lagrangian/solidParticle/solidParticleI.H b/src/lagrangian/solidParticle/solidParticleI.H deleted file mode 100644 index ed4f251ec6..0000000000 --- a/src/lagrangian/solidParticle/solidParticleI.H +++ /dev/null @@ -1,118 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -inline Foam::solidParticle::trackingData::trackingData -( - const solidParticleCloud& spc, - const interpolationCellPoint& rhoInterp, - const interpolationCellPoint& UInterp, - const interpolationCellPoint& nuInterp, - const vector& g -) -: - particle::trackingData(spc), - rhoInterp_(rhoInterp), - UInterp_(UInterp), - nuInterp_(nuInterp), - g_(g) -{} - - -inline Foam::solidParticle::solidParticle -( - const polyMesh& mesh, - const vector& position, - const label celli -) -: - particle(mesh, position, celli), - d_(0), - U_(Zero) -{} - - -inline Foam::solidParticle::solidParticle -( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const scalar d, - const vector& U -) -: - particle(mesh, coordinates, celli, tetFacei, tetPti), - d_(d), - U_(U) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline const Foam::interpolationCellPoint& -Foam::solidParticle::trackingData::rhoInterp() const -{ - return rhoInterp_; -} - - -inline const Foam::interpolationCellPoint& -Foam::solidParticle::trackingData::UInterp() const -{ - return UInterp_; -} - - -inline const Foam::interpolationCellPoint& -Foam::solidParticle::trackingData::nuInterp() const -{ - return nuInterp_; -} - -inline const Foam::vector& Foam::solidParticle::trackingData::g() const -{ - return g_; -} - - -inline Foam::scalar Foam::solidParticle::d() const -{ - return d_; -} - - -inline const Foam::vector& Foam::solidParticle::U() const -{ - return U_; -} - - -// ************************************************************************* // diff --git a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H index f1895e7ca8..a4ae212678 100644 --- a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H +++ b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H @@ -36,8 +36,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef trackedParticle_H -#define trackedParticle_H +#ifndef Foam_trackedParticle_H +#define Foam_trackedParticle_H #include "bitSet.H" #include "particle.H" @@ -64,7 +64,7 @@ class trackedParticle : public particle { - // Private data + // Private Data //- Start point to track from point start_; @@ -141,8 +141,8 @@ public: const label k ); - //- Construct from a position and a cell, searching for the rest of the - // required topology + //- Construct from a position and a cell, + //- searching for the rest of the required topology trackedParticle ( const polyMesh& mesh, @@ -193,52 +193,28 @@ public: // Member Functions //- Point to track from - point& start() - { - return start_; - } + point& start() noexcept { return start_; } //- Point to track to - point& end() - { - return end_; - } + point& end() noexcept { return end_; } //- Transported label - label i() const - { - return i_; - } + label i() const noexcept { return i_; } //- Transported label - label& i() - { - return i_; - } + label& i() noexcept { return i_; } //- Transported label - label j() const - { - return j_; - } + label j() const noexcept { return j_; } //- Transported label - label& j() - { - return j_; - } + label& j() noexcept { return j_; } //- Transported label - label k() const - { - return k_; - } + label k() const noexcept { return k_; } //- Transported label - label& k() - { - return k_; - } + label& k() noexcept { return k_; } diff --git a/src/parallel/reconstruct/reconstruct/passivePositionParticle.H b/src/parallel/reconstruct/reconstruct/passivePositionParticle.H index ebf685f1f6..a4edb8de68 100644 --- a/src/parallel/reconstruct/reconstruct/passivePositionParticle.H +++ b/src/parallel/reconstruct/reconstruct/passivePositionParticle.H @@ -38,8 +38,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef passivePositionParticle_H -#define passivePositionParticle_H +#ifndef Foam_passivePositionParticle_H +#define Foam_passivePositionParticle_H #include "particle.H" #include "IOstream.H" @@ -82,7 +82,6 @@ public: location_(position()) {} - //- Construct from components (supplied location) passivePositionParticle ( @@ -98,7 +97,6 @@ public: location_(position) {} - //- Construct from Istream passivePositionParticle ( @@ -165,39 +163,39 @@ public: // Member Functions - //- Return current particle position - inline const point& location() const + //- The cached particle position + const point& location() const noexcept + { + return location_; + } + + //- Write the particle position and cell id + // Uses cached location() instead of calculated position() + virtual void writePosition(Ostream& os) const + { + if (os.format() == IOstream::ASCII) { - return location_; + os << location() << token::SPACE << cell(); + } + else + { + positionsCompat1706 p; + + const size_t s = + ( + offsetof(positionsCompat1706, facei) + - offsetof(positionsCompat1706, position) + ); + + p.position = location(); + p.celli = cell(); + + os.write(reinterpret_cast(&p.position), s); } - //- Write the particle position and cell id - virtual void writePosition(Ostream& os) const - { - // Use cached location() instead of calculated position() - if (os.format() == IOstream::ASCII) - { - os << location() << token::SPACE << cell(); - } - else - { - positionsCompat1706 p; - - const size_t s = - ( - offsetof(positionsCompat1706, facei) - - offsetof(positionsCompat1706, position) - ); - - p.position = location(); - p.celli = cell(); - - os.write(reinterpret_cast(&p.position), s); - } - - // Check state of Ostream - os.check(FUNCTION_NAME); - } + // Check state of Ostream + os.check(FUNCTION_NAME); + } };