diff --git a/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H b/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H index 76e8084b80..0177c810bc 100644 --- a/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H +++ b/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,10 @@ SourceFiles namespace Foam { +// Forward Declarations +class passivePositionParticle; +Ostream& operator<<(Ostream& os, const passivePositionParticle& ppi); + /*---------------------------------------------------------------------------*\ Class passivePositionParticle Declaration \*---------------------------------------------------------------------------*/ @@ -51,7 +55,7 @@ class passivePositionParticle : public passiveParticle { - // Private member data + // Private Member Data //- Cached position point position_; @@ -74,6 +78,19 @@ public: position_(position()) {} + //- Construct from a position and a cell. + // Searches for the rest of the required topology. + passivePositionParticle + ( + const polyMesh& mesh, + const vector& position, + const label celli = -1 + ) + : + passiveParticle(mesh, position, celli), + position_(position) + {} + //- Construct as copy passivePositionParticle(const passivePositionParticle& p) : @@ -88,8 +105,7 @@ public: } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/basic/indexedParticle/indexedParticle.H b/src/lagrangian/basic/indexedParticle/indexedParticle.H index 09fe60aec8..61ba5c792a 100644 --- a/src/lagrangian/basic/indexedParticle/indexedParticle.H +++ b/src/lagrangian/basic/indexedParticle/indexedParticle.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -63,6 +63,21 @@ public: // Constructors + //- Construct from a position and a cell. + // Searches for the rest of the required topology. + // Other properties are zero initialised. + indexedParticle + ( + const polyMesh& mesh, + const vector& position, + const label celli = -1, + const label index = 0 + ) + : + particle(mesh, position, celli), + index_(index) + {} + //- Construct from components indexedParticle ( @@ -103,7 +118,7 @@ public: } - // Member functions + // Member Functions label index() const { diff --git a/src/lagrangian/basic/injectedParticle/injectedParticle.H b/src/lagrangian/basic/injectedParticle/injectedParticle.H index 2d68154234..0ccc544903 100644 --- a/src/lagrangian/basic/injectedParticle/injectedParticle.H +++ b/src/lagrangian/basic/injectedParticle/injectedParticle.H @@ -108,6 +108,16 @@ public: // Constructors + //- Construct from a position and a cell. + // Searches for the rest of the required topology. + // Other properties are zero initialised. + inline injectedParticle + ( + const polyMesh& mesh, + const vector& position, + const label celli = -1 + ); + //- Construct from components inline injectedParticle ( diff --git a/src/lagrangian/basic/injectedParticle/injectedParticleI.H b/src/lagrangian/basic/injectedParticle/injectedParticleI.H index 2c4c05a413..df935d2740 100644 --- a/src/lagrangian/basic/injectedParticle/injectedParticleI.H +++ b/src/lagrangian/basic/injectedParticle/injectedParticleI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,6 +26,22 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +inline Foam::injectedParticle::injectedParticle +( + const polyMesh& mesh, + const vector& position, + const label celli +) +: + particle(mesh, position, celli), + position_(position), + tag_(0), + soi_(0), + d_(0), + U_(Zero) +{} + + inline Foam::injectedParticle::injectedParticle ( const polyMesh& mesh, diff --git a/src/lagrangian/basic/particle/particle.H b/src/lagrangian/basic/particle/particle.H index d28f566df3..877a4c960a 100644 --- a/src/lagrangian/basic/particle/particle.H +++ b/src/lagrangian/basic/particle/particle.H @@ -366,16 +366,16 @@ public: const label tetPti ); - //- Construct from a position and a cell, searching for the rest of the - // required topology + //- Construct from a position and a cell. + // Searches for the rest of the required topology. particle ( const polyMesh& mesh, const vector& position, - const label celli + const label celli = -1 ); - //- Construct from components + //- Construct from position components particle ( const polyMesh& mesh, @@ -408,8 +408,7 @@ public: return autoPtr::New(*this); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/basic/passiveParticle/passiveParticle.H b/src/lagrangian/basic/passiveParticle/passiveParticle.H index b80989e7ce..b6acec3254 100644 --- a/src/lagrangian/basic/passiveParticle/passiveParticle.H +++ b/src/lagrangian/basic/passiveParticle/passiveParticle.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -73,18 +73,19 @@ public: {} - //- Construct from a position and a cell, searching for the rest of the - // required topology + //- Construct from a position and a cell. + // Searches for the rest of the required topology. passiveParticle ( const polyMesh& mesh, const vector& position, - const label celli + const label celli = -1 ) : particle(mesh, position, celli) {} + //- Construct from Istream passiveParticle ( @@ -97,12 +98,14 @@ public: particle(mesh, is, readFields, newFormat) {} + //- Construct as copy passiveParticle(const passiveParticle& p) : particle(p) {} + //- Construct and return a clone virtual autoPtr clone() const { @@ -110,8 +113,7 @@ public: } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; @@ -125,13 +127,9 @@ public: autoPtr operator()(Istream& is) const { - return autoPtr - ( - new passiveParticle(mesh_, is, true) - ); + return autoPtr::New(mesh_, is, true); } }; - }; diff --git a/src/lagrangian/solidParticle/solidParticle.H b/src/lagrangian/solidParticle/solidParticle.H index fbd2f621a4..a7eb274ad0 100644 --- a/src/lagrangian/solidParticle/solidParticle.H +++ b/src/lagrangian/solidParticle/solidParticle.H @@ -51,11 +51,9 @@ SourceFiles namespace Foam { +// Forward Declarations + class solidParticleCloud; - - -// Forward declaration of friend functions and operators - class solidParticle; Ostream& operator<<(Ostream&, const solidParticle&); @@ -69,7 +67,7 @@ class solidParticle : public particle { - // Private data + // Private Data //- Diameter scalar d_; @@ -131,6 +129,16 @@ public: // Constructors + //- Construct from a position and a cell + // Searches for the rest of the required topology. + // Other properties are zero initialised. + inline solidParticle + ( + const polyMesh& mesh, + const vector& position, + const label celli = -1 + ); + //- Construct from components inline solidParticle ( @@ -158,8 +166,7 @@ public: return autoPtr(new solidParticle(*this)); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; @@ -173,10 +180,7 @@ public: autoPtr operator()(Istream& is) const { - return autoPtr - ( - new solidParticle(mesh_, is, true) - ); + return autoPtr::New(mesh_, is, true); } }; diff --git a/src/lagrangian/solidParticle/solidParticleI.H b/src/lagrangian/solidParticle/solidParticleI.H index b19e33aa7d..8ae51457ca 100644 --- a/src/lagrangian/solidParticle/solidParticleI.H +++ b/src/lagrangian/solidParticle/solidParticleI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -44,6 +44,19 @@ inline Foam::solidParticle::trackingData::trackingData {} +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,