ENH: simplify construction of zero-sized Clouds

- use Foam::zero as a dispatch tag

FIX: return moleculeCloud::constProps() List by reference not copy

STYLE: range-for when iterating cloud parcels

STYLE: more consistent typedefs / declarations for Clouds
This commit is contained in:
Mark Olesen
2023-12-13 11:07:13 +01:00
parent 0352a224b7
commit c9a9309b8c
46 changed files with 377 additions and 502 deletions

View File

@ -329,7 +329,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
: :
radiationModel(typeName, T), radiationModel(typeName, T),
mode_(powerDistNames_.get("mode", *this)), mode_(powerDistNames_.get("mode", *this)),
DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()), DTRMCloud_(mesh_, Foam::zero{}, "DTRMCloud"), // Empty cloud
nParticles_(0), nParticles_(0),
ndTheta_(get<label>("nTheta")), ndTheta_(get<label>("nTheta")),
ndr_(get<label>("nr")), ndr_(get<label>("nr")),
@ -427,7 +427,7 @@ Foam::radiation::laserDTRM::laserDTRM
: :
radiationModel(typeName, dict, T), radiationModel(typeName, dict, T),
mode_(powerDistNames_.get("mode", *this)), mode_(powerDistNames_.get("mode", *this)),
DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()), DTRMCloud_(mesh_, Foam::zero{}, "DTRMCloud"), // Empty cloud
nParticles_(0), nParticles_(0),
ndTheta_(get<label>("nTheta")), ndTheta_(get<label>("nTheta")),
ndr_(get<label>("nr")), ndr_(get<label>("nr")),

View File

@ -1,3 +1,3 @@
Test-passiveParticle.C Test-passiveParticle.cxx
EXE = $(FOAM_USER_APPBIN)/Test-passiveParticle EXE = $(FOAM_USER_APPBIN)/Test-passiveParticle

View File

@ -24,7 +24,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application Application
testPassiveParticle Test-passiveParticle
Description Description
Test cloud of passive particles. Test cloud of passive particles.
@ -50,12 +50,8 @@ int main(int argc, char *argv[])
{ {
// Start with empty cloud // Start with empty cloud
passiveParticleCloud particles passiveParticleCloud particles(mesh, Foam::zero{}, cloudName);
(
mesh,
cloudName,
IDLList<passiveParticle>()
);
Pout<< "Starting particles:" << particles.size() << endl; Pout<< "Starting particles:" << particles.size() << endl;
Pout<< "Adding a particle." << endl; Pout<< "Adding a particle." << endl;

View File

@ -227,19 +227,21 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
pBufs.finishedSends(); pBufs.finishedSends();
// The cloud name
const word cloudName = lpi.name();
{ {
// Temporarily rename original cloud so we can construct a new one // Temporarily rename original cloud so we can construct a new one
// (to distribute the positions) without getting a duplicate // (to distribute the positions) without getting a duplicate
// registration warning // registration warning
const word cloudName = lpi.name();
lpi.rename(cloudName + "_old"); lpi.rename(cloudName + "_old");
// New cloud on tgtMesh // New empty cloud on tgtMesh
passivePositionParticleCloud lagrangianPositions passivePositionParticleCloud lagrangianPositions
( (
tgtMesh_, tgtMesh_,
cloudName, Foam::zero{},
IDLList<passivePositionParticle>() cloudName
); );
// Retrieve from receive buffers // Retrieve from receive buffers
@ -310,11 +312,11 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
// ).objectPath() // ).objectPath()
// ); // );
//} //}
// Restore cloud name
lpi.rename(cloudName);
} }
// Restore cloud name
lpi.rename(cloudName);
// The constructMap is in linear (processor) order // The constructMap is in linear (processor) order
return autoPtr<mapDistributeBase>::New return autoPtr<mapDistributeBase>::New

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd. Copyright (C) 2017-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,6 +34,7 @@ namespace Foam
defineTemplateTypeNameAndDebug(Cloud<passivePositionParticle>, 0); defineTemplateTypeNameAndDebug(Cloud<passivePositionParticle>, 0);
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::passivePositionParticleCloud::passivePositionParticleCloud Foam::passivePositionParticleCloud::passivePositionParticleCloud
@ -52,15 +53,4 @@ Foam::passivePositionParticleCloud::passivePositionParticleCloud
} }
Foam::passivePositionParticleCloud::passivePositionParticleCloud
(
const polyMesh& mesh,
const word& cloudName,
const IDLList<passivePositionParticle>& particles
)
:
Cloud<passivePositionParticle>(mesh, cloudName, particles)
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenCFD Ltd. Copyright (C) 2017-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef passivePositionParticleCloud_H #ifndef Foam_passivePositionParticleCloud_H
#define passivePositionParticleCloud_H #define Foam_passivePositionParticleCloud_H
#include "Cloud.H" #include "Cloud.H"
#include "passivePositionParticle.H" #include "passivePositionParticle.H"
@ -53,23 +53,21 @@ class passivePositionParticleCloud
: :
public Cloud<passivePositionParticle> public Cloud<passivePositionParticle>
{ {
// Private Member Functions
//- No copy construct
passivePositionParticleCloud
(
const passivePositionParticleCloud&
) = delete;
//- No copy assignment
void operator=(const passivePositionParticleCloud&) = delete;
public: public:
//- Type of parcel within the cloud
typedef passivePositionParticle parcelType;
//- No copy construct
passivePositionParticleCloud(const passivePositionParticleCloud&) = delete;
//- No copy assignment
void operator=(const passivePositionParticleCloud&) = delete;
// Constructors // Constructors
//- Construct given mesh //- Read construct
explicit passivePositionParticleCloud explicit passivePositionParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -77,13 +75,16 @@ public:
bool readFields = true bool readFields = true
); );
//- Construct from mesh, cloud name, and a list of particles //- Construct without particles
passivePositionParticleCloud passivePositionParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
const word& cloudName, const Foam::zero,
const IDLList<passivePositionParticle>& particles const word& cloudName = cloud::defaultName
); )
:
Cloud<passivePositionParticle>(mesh, Foam::zero{}, cloudName)
{}
}; };

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef unmappedPassivePositionParticleCloud_H #ifndef Foam_unmappedPassivePositionParticleCloud_H
#define unmappedPassivePositionParticleCloud_H #define Foam_unmappedPassivePositionParticleCloud_H
#include "passivePositionParticleCloud.H" #include "passivePositionParticleCloud.H"
@ -54,12 +54,11 @@ class unmappedPassivePositionParticleCloud
: :
public passivePositionParticleCloud public passivePositionParticleCloud
{ {
public: public:
// Constructors // Constructors
//- Construct given mesh //- Read construct
explicit unmappedPassivePositionParticleCloud explicit unmappedPassivePositionParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -70,15 +69,15 @@ public:
passivePositionParticleCloud(mesh, cloudName, readFields) passivePositionParticleCloud(mesh, cloudName, readFields)
{} {}
//- Construct from mesh, cloud name, and a list of particles //- Construct without particles
unmappedPassivePositionParticleCloud unmappedPassivePositionParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
const word& cloudName, const Foam::zero,
const IDLList<passivePositionParticle>& particles const word& cloudName = cloud::defaultName
) )
: :
passivePositionParticleCloud(mesh, cloudName, particles) passivePositionParticleCloud(mesh, Foam::zero{}, cloudName)
{} {}
@ -89,7 +88,7 @@ public:
// Member Functions // Member Functions
//- Switch off remapping of cells of particles when //- Switch off remapping of cells of particles when
// mesh topology changes //- mesh topology changes
virtual void autoMap(const mapPolyMesh&) virtual void autoMap(const mapPolyMesh&)
{} {}

View File

@ -133,6 +133,7 @@ void mapLagrangian(const meshToMesh0& meshToMesh0Interp)
cloudDir, cloudDir,
false false
); );
Info<< " read " << sourceParcels.size() Info<< " read " << sourceParcels.size()
<< " parcels from source mesh." << endl; << " parcels from source mesh." << endl;
@ -140,8 +141,8 @@ void mapLagrangian(const meshToMesh0& meshToMesh0Interp)
passiveParticleCloud targetParcels passiveParticleCloud targetParcels
( (
meshTarget, meshTarget,
cloudDir, Foam::zero{},
IDLList<passiveParticle>() cloudDir
); );
passiveParticle::trackingData td(targetParcels); passiveParticle::trackingData td(targetParcels);

View File

@ -129,6 +129,7 @@ void mapLagrangian(const meshToMesh& interp)
cloudDir, cloudDir,
false false
); );
Info<< " read " << sourceParcels.size() Info<< " read " << sourceParcels.size()
<< " parcels from source mesh." << endl; << " parcels from source mesh." << endl;
@ -136,8 +137,8 @@ void mapLagrangian(const meshToMesh& interp)
passiveParticleCloud targetParcels passiveParticleCloud targetParcels
( (
meshTarget, meshTarget,
cloudDir, Foam::zero{},
IDLList<passiveParticle>() cloudDir
); );
passiveParticle::trackingData td(targetParcels); passiveParticle::trackingData td(targetParcels);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd. Copyright (C) 2016-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,6 +37,7 @@ namespace Foam
} }
const Foam::word Foam::cloud::prefix("lagrangian"); const Foam::word Foam::cloud::prefix("lagrangian");
Foam::word Foam::cloud::defaultName("defaultCloud"); Foam::word Foam::cloud::defaultName("defaultCloud");
const Foam::Enum<Foam::cloud::geometryType> const Foam::Enum<Foam::cloud::geometryType>
@ -51,7 +52,7 @@ Foam::cloud::geometryTypeNames
Foam::cloud::cloud(const objectRegistry& obr) Foam::cloud::cloud(const objectRegistry& obr)
: :
cloud(obr, defaultName) cloud(obr, cloud::defaultName)
{} {}
@ -61,12 +62,13 @@ Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName)
( (
IOobject IOobject
( (
cloudName, (cloudName.empty() ? cloud::defaultName : cloudName),
obr.time().timeName(), obr.time().timeName(),
prefix, cloud::prefix,
obr, obr,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
) )
) )
{} {}

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef cloud_H #ifndef Foam_cloud_H
#define cloud_H #define Foam_cloud_H
#include "objectRegistry.H" #include "objectRegistry.H"
#include "Enum.H" #include "Enum.H"
@ -59,16 +59,6 @@ class cloud
: :
public objectRegistry public objectRegistry
{ {
// Private Member Functions
//- No copy construct
cloud(const cloud&) = delete;
//- No copy assignment
void operator=(const cloud&) = delete;
public: public:
//- Cloud geometry type (internal or IO representations) //- Cloud geometry type (internal or IO representations)
@ -78,11 +68,11 @@ public:
POSITIONS //!< positions POSITIONS //!< positions
}; };
//- Named enumerations "coordinates", "positions"
static const Enum<geometryType> geometryTypeNames; static const Enum<geometryType> geometryTypeNames;
//- Runtime type information // Static Data Members
TypeName("cloud");
//- The prefix to local: %lagrangian //- The prefix to local: %lagrangian
static const word prefix; static const word prefix;
@ -91,12 +81,25 @@ public:
static word defaultName; static word defaultName;
//- Runtime type information
TypeName("cloud");
// Generated Methods
//- No copy construct
cloud(const cloud&) = delete;
//- No copy assignment
void operator=(const cloud&) = delete;
// Constructors // Constructors
//- Construct for given objectRegistry and default cloud name //- Construct for given objectRegistry. Uses default cloud name
explicit cloud(const objectRegistry& obr); explicit cloud(const objectRegistry& obr);
//- Construct for given objectRegistry and named cloud instance //- Construct for given objectRegistry and named cloud
cloud(const objectRegistry& obr, const word& cloudName); cloud(const objectRegistry& obr, const word& cloudName);
@ -139,7 +142,7 @@ public:
//- Locate an IOField within object registry //- Locate an IOField within object registry
// \return nullptr if not found or wrong type // \return nullptr if not found or wrong type
template<class Type> template<class Type>
inline static const IOField<Type>* findIOField static const IOField<Type>* findIOField
( (
const word& fieldName, const word& fieldName,
const objectRegistry& obr const objectRegistry& obr
@ -150,7 +153,7 @@ public:
//- Locate the "position" IOField within object registry //- Locate the "position" IOField within object registry
// \return nullptr if not found or wrong type // \return nullptr if not found or wrong type
inline static const IOField<point>* findIOPosition static const IOField<point>* findIOPosition
( (
const objectRegistry& obr const objectRegistry& obr
) )
@ -161,7 +164,7 @@ public:
//- Lookup an IOField within object registry //- Lookup an IOField within object registry
// Fatal if not found or wrong type // Fatal if not found or wrong type
template<class Type> template<class Type>
inline static const IOField<Type>& lookupIOField static const IOField<Type>& lookupIOField
( (
const word& fieldName, const word& fieldName,
const objectRegistry& obr const objectRegistry& obr

View File

@ -61,13 +61,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
DebugInFunction << "nPatchFaces: " << globalWalls.totalSize() << endl; DebugInFunction << "nPatchFaces: " << globalWalls.totalSize() << endl;
// Construct cloud // Start with empty cloud
Cloud<findCellParticle> cloud Cloud<findCellParticle> cloud(mesh_, Foam::zero{}, cloud::defaultName);
(
mesh_,
cloud::defaultName,
IDLList<findCellParticle>()
);
// Add particles to track to sample locations // Add particles to track to sample locations
nPatchFaces = 0; nPatchFaces = 0;

View File

@ -47,13 +47,8 @@ namespace functionObjects
void Foam::functionObjects::streamLine::track() void Foam::functionObjects::streamLine::track()
{ {
IDLList<streamLineParticle> initialParticles; // Start with empty cloud
streamLineParticleCloud particles streamLineParticleCloud particles(mesh_, Foam::zero{}, cloudName_);
(
mesh_,
cloudName_,
initialParticles
);
const sampledSet& seedPoints = sampledSetPoints(); const sampledSet& seedPoints = sampledSetPoints();

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,15 +54,4 @@ Foam::streamLineParticleCloud::streamLineParticleCloud
} }
Foam::streamLineParticleCloud::streamLineParticleCloud
(
const polyMesh& mesh,
const word& cloudName,
const IDLList<streamLineParticle>& particles
)
:
Cloud<streamLineParticle>(mesh, cloudName, particles)
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2022 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -56,22 +56,19 @@ class streamLineParticleCloud
{ {
public: public:
//- Type of parcel the cloud was instantiated for //- Type of parcel within the cloud
typedef streamLineParticle parcelType; typedef streamLineParticle parcelType;
//- No copy construct
streamLineParticleCloud(const streamLineParticleCloud&) = delete;
// Generated Methods //- No copy assignment
void operator=(const streamLineParticleCloud&) = delete;
//- No copy construct
streamLineParticleCloud(const streamLineParticleCloud&) = delete;
//- No copy assignment
void operator=(const streamLineParticleCloud&) = delete;
// Constructors // Constructors
//- Construct given mesh //- Read construct
explicit streamLineParticleCloud explicit streamLineParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -79,13 +76,16 @@ public:
bool readFields = true bool readFields = true
); );
//- Construct from mesh, cloud name, and a list of particles //- Construct without particles
streamLineParticleCloud streamLineParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
const word& cloudName, const Foam::zero,
const IDLList<streamLineParticle>& particles const word& cloudName = cloud::defaultName
); )
:
Cloud<streamLineParticle>(mesh, Foam::zero{}, cloudName)
{}
}; };

View File

@ -142,12 +142,11 @@ void Foam::functionObjects::wallBoundedStreamLine::track()
// Find nearest wall particle for the seedPoints // Find nearest wall particle for the seedPoints
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IDLList<wallBoundedStreamLineParticle> initialParticles;
wallBoundedStreamLineParticleCloud particles wallBoundedStreamLineParticleCloud particles
( (
mesh_, mesh_,
cloudName_, Foam::zero{},
initialParticles cloudName_
); );
{ {

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -52,15 +53,4 @@ Foam::wallBoundedStreamLineParticleCloud::wallBoundedStreamLineParticleCloud
} }
Foam::wallBoundedStreamLineParticleCloud::wallBoundedStreamLineParticleCloud
(
const polyMesh& mesh,
const word& cloudName,
const IDLList<wallBoundedStreamLineParticle>& particles
)
:
Cloud<wallBoundedStreamLineParticle>(mesh, cloudName, particles)
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,7 +28,7 @@ Class
Foam::wallBoundedStreamLineParticleCloud Foam::wallBoundedStreamLineParticleCloud
Description Description
A Cloud of streamLine particles A Cloud of wall-bounded streamLine particles
SourceFiles SourceFiles
streamLineCloud.C streamLineCloud.C
@ -56,10 +56,9 @@ class wallBoundedStreamLineParticleCloud
{ {
public: public:
//- Type of parcel the cloud was instantiated for //- Type of parcel within the cloud
typedef wallBoundedStreamLineParticle parcelType; typedef wallBoundedStreamLineParticle parcelType;
// Generated Methods // Generated Methods
//- No copy construct //- No copy construct
@ -74,7 +73,7 @@ public:
// Constructors // Constructors
//- Construct given mesh //- Read construct
explicit wallBoundedStreamLineParticleCloud explicit wallBoundedStreamLineParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -82,13 +81,16 @@ public:
bool readFields = true bool readFields = true
); );
//- Construct from mesh, cloud name, and a list of particles //- Construct without particles
wallBoundedStreamLineParticleCloud wallBoundedStreamLineParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
const word& cloudName, const Foam::zero,
const IDLList<wallBoundedStreamLineParticle>& particles const word& cloudName = cloud::defaultName
); )
:
Cloud<wallBoundedStreamLineParticle>(mesh, Foam::zero{}, cloudName)
{}
}; };

View File

@ -59,6 +59,25 @@ void Foam::Cloud<ParticleType>::checkPatches() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType>
Foam::Cloud<ParticleType>::Cloud
(
const polyMesh& pMesh,
const Foam::zero,
const word& cloudName
)
:
cloud(pMesh, cloudName),
polyMesh_(pMesh),
geometryType_(cloud::geometryType::COORDINATES)
{
checkPatches();
(void)polyMesh_.tetBasePtIs();
(void)polyMesh_.oldCellCentres();
}
template<class ParticleType> template<class ParticleType>
Foam::Cloud<ParticleType>::Cloud Foam::Cloud<ParticleType>::Cloud
( (
@ -67,21 +86,8 @@ Foam::Cloud<ParticleType>::Cloud
const IDLList<ParticleType>& particles const IDLList<ParticleType>& particles
) )
: :
cloud(pMesh, cloudName), Cloud<ParticleType>(pMesh, Foam::zero{}, cloudName)
IDLList<ParticleType>(),
polyMesh_(pMesh),
labels_(),
globalPositionsPtr_(),
geometryType_(cloud::geometryType::COORDINATES)
{ {
checkPatches();
(void)polyMesh_.oldCellCentres();
// Ask for the tetBasePtIs to trigger all processors to build
// them, otherwise, if some processors have no particles then
// there is a comms mismatch.
(void)polyMesh_.tetBasePtIs();
if (particles.size()) if (particles.size())
{ {
IDLList<ParticleType>::operator=(particles); IDLList<ParticleType>::operator=(particles);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd. Copyright (C) 2017-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -67,7 +67,7 @@ class Cloud
public cloud, public cloud,
public IDLList<ParticleType> public IDLList<ParticleType>
{ {
// Private data // Private Data
//- Reference to the mesh database //- Reference to the mesh database
const polyMesh& polyMesh_; const polyMesh& polyMesh_;
@ -130,6 +130,14 @@ public:
// Constructors // Constructors
//- Construct without particles
Cloud
(
const polyMesh& mesh,
const Foam::zero,
const word& cloudName
);
//- Construct from mesh and a list of particles //- Construct from mesh and a list of particles
Cloud Cloud
( (
@ -138,12 +146,12 @@ public:
const IDLList<ParticleType>& particles const IDLList<ParticleType>& particles
); );
//- Construct from mesh by reading from file with given cloud instance //- Read construct from file(s) with given cloud instance.
// Optionally disable checking of class name for post-processing
Cloud Cloud
( (
const polyMesh& pMesh, const polyMesh& pMesh,
const word& cloudName, const word& cloudName,
//! Disable checking of class name (eg, for post-processing)
const bool checkClass = true const bool checkClass = true
); );
@ -153,7 +161,7 @@ public:
// Access // Access
//- Return the polyMesh reference //- Return the polyMesh reference
const polyMesh& pMesh() const const polyMesh& pMesh() const noexcept
{ {
return polyMesh_; return polyMesh_;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017, 2020 OpenFOAM Foundation Copyright (C) 2011-2017, 2020 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd. Copyright (C) 2017-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -49,7 +49,7 @@ void Foam::Cloud<ParticleType>::readCloudUniformProperties()
time().timeName(), time().timeName(),
"uniform"/cloud::prefix/name(), "uniform"/cloud::prefix/name(),
db(), db(),
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER IOobject::NO_REGISTER
); );
@ -104,6 +104,7 @@ void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const
labelList np(Pstream::nProcs(), Zero); labelList np(Pstream::nProcs(), Zero);
np[Pstream::myProcNo()] = ParticleType::particleCount_; np[Pstream::myProcNo()] = ParticleType::particleCount_;
// FIXME: replace with Pstream::allGatherList(np);
Pstream::listCombineReduce(np, maxEqOp<label>()); Pstream::listCombineReduce(np, maxEqOp<label>());
uniformPropsDict.add uniformPropsDict.add
@ -114,9 +115,8 @@ void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const
forAll(np, i) forAll(np, i)
{ {
word procName("processor" + Foam::name(i)); const word procName("processor" + Foam::name(i));
uniformPropsDict.add(procName, dictionary()); uniformPropsDict.subDictOrAdd(procName).add("particleCount", np[i]);
uniformPropsDict.subDict(procName).add("particleCount", np[i]);
} }
uniformPropsDict.writeObject uniformPropsDict.writeObject
@ -169,17 +169,8 @@ Foam::Cloud<ParticleType>::Cloud
const bool checkClass const bool checkClass
) )
: :
cloud(pMesh, cloudName), Cloud<ParticleType>(pMesh, Foam::zero{}, cloudName)
polyMesh_(pMesh),
labels_(),
cellWallFacesPtr_(),
geometryType_(cloud::geometryType::COORDINATES)
{ {
checkPatches();
(void)polyMesh_.tetBasePtIs();
(void)polyMesh_.oldCellCentres();
initCloud(checkClass); initCloud(checkClass);
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd. Copyright (C) 2017-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -72,18 +72,18 @@ bool Foam::IOPosition<CloudType>::writeData(Ostream& os) const
{ {
case cloud::geometryType::COORDINATES: case cloud::geometryType::COORDINATES:
{ {
forAllConstIters(cloud_, iter) for (const auto& p : cloud_)
{ {
iter().writeCoordinates(os); p.writeCoordinates(os);
os << nl; os << nl;
} }
break; break;
} }
case cloud::geometryType::POSITIONS: case cloud::geometryType::POSITIONS:
{ {
forAllConstIters(cloud_, iter) for (const auto& p : cloud_)
{ {
iter().writePosition(os); p.writePosition(os);
os << nl; os << nl;
} }
break; break;

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef IOPosition_H #ifndef Foam_IOPosition_H
#define IOPosition_H #define Foam_IOPosition_H
#include "cloud.H" #include "cloud.H"
#include "regIOobject.H" #include "regIOobject.H"
@ -55,7 +55,7 @@ class IOPosition
: :
public regIOobject public regIOobject
{ {
// Private data // Private Data
cloud::geometryType geometryType_; cloud::geometryType geometryType_;
@ -65,7 +65,7 @@ class IOPosition
public: public:
// Static data // Static Data
//- Runtime type name information. Use cloud type. //- Runtime type name information. Use cloud type.
virtual const word& type() const virtual const word& type() const
@ -77,7 +77,7 @@ public:
// Constructors // Constructors
//- Construct from cloud //- Construct from cloud
IOPosition explicit IOPosition
( (
const CloudType& c, const CloudType& c,
cloud::geometryType geomType = cloud::geometryType::COORDINATES cloud::geometryType geomType = cloud::geometryType::COORDINATES

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef indexedParticleCloud_H #ifndef Foam_indexedParticleCloud_H
#define indexedParticleCloud_H #define Foam_indexedParticleCloud_H
#include "Cloud.H" #include "Cloud.H"
#include "indexedParticle.H" #include "indexedParticle.H"
@ -53,26 +53,38 @@ class indexedParticleCloud
: :
public Cloud<indexedParticle> public Cloud<indexedParticle>
{ {
// Private Member Functions
//- No copy construct
indexedParticleCloud(const indexedParticleCloud&) = delete;
//- No copy assignment
void operator=(const indexedParticleCloud&) = delete;
public: public:
//- Type of parcel within the cloud
typedef indexedParticle parcelType;
//- No copy construct
indexedParticleCloud(const indexedParticleCloud&) = delete;
//- No copy assignment
void operator=(const indexedParticleCloud&) = delete;
// Constructors // Constructors
//- Construct given mesh //- Read construct
explicit indexedParticleCloud explicit indexedParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
const word& cloudName = cloud::defaultName, const word& cloudName = cloud::defaultName,
bool readFields = true bool readFields = true
); );
//- Construct without particles
explicit indexedParticleCloud
(
const polyMesh& mesh,
const Foam::zero,
const word& cloudName = cloud::defaultName
)
:
Cloud<indexedParticle>(mesh, Foam::zero{}, cloudName)
{}
}; };

View File

@ -27,11 +27,14 @@ License
#include "injectedParticleCloud.H" #include "injectedParticleCloud.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineNamedTemplateTypeNameAndDebug(Cloud<injectedParticle>, 0); defineNamedTemplateTypeNameAndDebug(Cloud<injectedParticle>, 0);
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::injectedParticleCloud::injectedParticleCloud Foam::injectedParticleCloud::injectedParticleCloud
@ -62,12 +65,6 @@ Foam::injectedParticleCloud::injectedParticleCloud
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::injectedParticleCloud::~injectedParticleCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::injectedParticleCloud::readObjects(const objectRegistry& obr) void Foam::injectedParticleCloud::readObjects(const objectRegistry& obr)

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef injectedParticleCloud_H #ifndef Foam_injectedParticleCloud_H
#define injectedParticleCloud_H #define Foam_injectedParticleCloud_H
#include "Cloud.H" #include "Cloud.H"
#include "injectedParticle.H" #include "injectedParticle.H"
@ -46,7 +46,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class injectedParticleCloud Declaration Class injectedParticleCloud Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -55,30 +54,39 @@ class injectedParticleCloud
: :
public Cloud<injectedParticle> public Cloud<injectedParticle>
{ {
private:
// Private Member Functions
//- No copy construct
injectedParticleCloud(const injectedParticleCloud&) = delete;
//- No copy assignment
void operator=(const injectedParticleCloud&) = delete;
public: public:
//- Type of parcel within the cloud
typedef injectedParticle parcelType;
//- No copy construct
injectedParticleCloud(const injectedParticleCloud&) = delete;
//- No copy assignment
void operator=(const injectedParticleCloud&) = delete;
// Constructors // Constructors
//- Construct from mesh and cloud name //- Read construct
injectedParticleCloud injectedParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
const word& name, const word& cloudName,
const bool readFields = true const bool readFields = true
); );
//- Construct without particles
injectedParticleCloud
(
const polyMesh& mesh,
const Foam::zero,
const word& cloudName = cloud::defaultName
)
:
Cloud<injectedParticle>(mesh, Foam::zero{}, cloudName)
{}
//- Copy constructor with new name //- Copy constructor with new name
injectedParticleCloud(const injectedParticleCloud& c, const word& name); injectedParticleCloud(const injectedParticleCloud& c, const word& name);
@ -93,18 +101,16 @@ public:
//- Destructor //- Destructor
virtual ~injectedParticleCloud(); virtual ~injectedParticleCloud() = default;
// Member Functions // Member Functions
// I-O //- Read particle fields as objects from the obr registry
virtual void readObjects(const objectRegistry& obr);
//- Read particle fields as objects from the obr registry //- Write particle fields as objects into the obr registry
virtual void readObjects(const objectRegistry& obr); virtual void writeObjects(objectRegistry& obr) const;
//- Write particle fields as objects into the obr registry
virtual void writeObjects(objectRegistry& obr) const;
}; };

View File

@ -52,15 +52,4 @@ Foam::passiveParticleCloud::passiveParticleCloud
} }
Foam::passiveParticleCloud::passiveParticleCloud
(
const polyMesh& mesh,
const word& cloudName,
const IDLList<passiveParticle>& particles
)
:
Cloud<passiveParticle>(mesh, cloudName, particles)
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef passiveParticleCloud_H #ifndef Foam_passiveParticleCloud_H
#define passiveParticleCloud_H #define Foam_passiveParticleCloud_H
#include "Cloud.H" #include "Cloud.H"
#include "passiveParticle.H" #include "passiveParticle.H"
@ -54,20 +54,21 @@ class passiveParticleCloud
: :
public Cloud<passiveParticle> public Cloud<passiveParticle>
{ {
// Private Member Functions
//- No copy construct
passiveParticleCloud(const passiveParticleCloud&) = delete;
//- No copy assignment
void operator=(const passiveParticleCloud&) = delete;
public: public:
//- Type of parcel within the cloud
typedef passiveParticle parcelType;
//- No copy construct
passiveParticleCloud(const passiveParticleCloud&) = delete;
//- No copy assignment
void operator=(const passiveParticleCloud&) = delete;
// Constructors // Constructors
//- Construct given mesh //- Read construct
explicit passiveParticleCloud explicit passiveParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -75,13 +76,16 @@ public:
bool readFields = true bool readFields = true
); );
//- Construct from mesh, cloud name, and a list of particles //- Construct without particles
passiveParticleCloud passiveParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
const word& cloudName, const Foam::zero,
const IDLList<passiveParticle>& particles const word& cloudName = cloud::defaultName
); )
:
Cloud<passiveParticle>(mesh, Foam::zero{}, cloudName)
{}
}; };

View File

@ -92,10 +92,8 @@ void Foam::HeatTransferCoeff<CloudType>::postEvolve
const_cast<typename parcelType::trackingData&>(td); const_cast<typename parcelType::trackingData&>(td);
label parceli = 0; label parceli = 0;
forAllConstIters(c, parcelIter) for (const parcelType& p : c)
{ {
const parcelType& p = parcelIter();
scalar Ts, rhos, mus, Pr, kappas; scalar Ts, rhos, mus, Pr, kappas;
p.template calcSurfaceValues<CloudType> p.template calcSurfaceValues<CloudType>
( (

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -85,10 +85,8 @@ void Foam::KinematicReynoldsNumber<CloudType>::postEvolve
Re.resize(c.size()); Re.resize(c.size());
label parceli = 0; label parceli = 0;
forAllConstIters(c, parcelIter) for (const parcelType& p : c)
{ {
const parcelType& p = parcelIter();
Re[parceli++] = p.Re(td); Re[parceli++] = p.Re(td);
} }

View File

@ -87,10 +87,8 @@ void Foam::KinematicWeberNumber<CloudType>::postEvolve
We.resize(c.size()); We.resize(c.size());
label parceli = 0; label parceli = 0;
forAllConstIters(c, parcelIter) for (const parcelType& p : c)
{ {
const parcelType& p = parcelIter();
We[parceli++] = p.We(td, sigma_); We[parceli++] = p.We(td, sigma_);
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,10 +92,8 @@ void Foam::NusseltNumber<CloudType>::postEvolve
const_cast<typename parcelType::trackingData&>(td); const_cast<typename parcelType::trackingData&>(td);
label parceli = 0; label parceli = 0;
forAllConstIters(c, parcelIter) for (const parcelType& p : c)
{ {
const parcelType& p = parcelIter();
scalar Ts, rhos, mus, Pr, kappas; scalar Ts, rhos, mus, Pr, kappas;
p.template calcSurfaceValues<CloudType> p.template calcSurfaceValues<CloudType>
( (

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2022 OpenCFD Ltd. Copyright (C) 2022-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,10 +92,8 @@ void Foam::ParticleDose<CloudType>::postEvolve
const auto& G = mesh.lookupObject<volScalarField>(GName_); const auto& G = mesh.lookupObject<volScalarField>(GName_);
label parceli = 0; label parceli = 0;
forAllConstIters(c, parcelIter) for (const parcelType& p : c)
{ {
const parcelType& p = parcelIter();
D[parceli] += G[p.cell()]*mesh.time().deltaTValue(); D[parceli] += G[p.cell()]*mesh.time().deltaTValue();
parceli++; parceli++;
} }

View File

@ -93,10 +93,8 @@ void Foam::ReactingWeberNumber<CloudType>::postEvolve
const auto& rhoInterp = td.rhoInterp(); const auto& rhoInterp = td.rhoInterp();
label parceli = 0; label parceli = 0;
forAllConstIters(c, parcelIter) for (const parcelType& p : c)
{ {
const parcelType& p = parcelIter();
const auto& coords = p.coordinates(); const auto& coords = p.coordinates();
const auto& tetIs = p.currentTetIndices(); const auto& tetIs = p.currentTetIndices();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -89,10 +89,8 @@ void Foam::ThermoReynoldsNumber<CloudType>::postEvolve
const_cast<typename parcelType::trackingData&>(td); const_cast<typename parcelType::trackingData&>(td);
label parceli = 0; label parceli = 0;
forAllConstIters(c, parcelIter) for (const parcelType& p : c)
{ {
const parcelType& p = parcelIter();
scalar Ts, rhos, mus, Pr, kappas; scalar Ts, rhos, mus, Pr, kappas;
p.template calcSurfaceValues<CloudType> p.template calcSurfaceValues<CloudType>
( (

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef moleculeCloud_H #ifndef Foam_moleculeCloud_H
#define moleculeCloud_H #define Foam_moleculeCloud_H
#include "Cloud.H" #include "Cloud.H"
#include "molecule.H" #include "molecule.H"
@ -133,18 +133,22 @@ class moleculeCloud
const molecule::constantProperties& cP const molecule::constantProperties& cP
); );
//- No copy construct
moleculeCloud(const moleculeCloud&) = delete;
//- No copy assignment
void operator=(const moleculeCloud&) = delete;
public: public:
//- Type of parcel within the cloud
typedef molecule parcelType;
//- No copy construct
moleculeCloud(const moleculeCloud&) = delete;
//- No copy assignment
void operator=(const moleculeCloud&) = delete;
// Constructors // Constructors
//- Construct given mesh and potential references //- Read construct given mesh and potential references
moleculeCloud moleculeCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -152,7 +156,7 @@ public:
bool readFields = true bool readFields = true
); );
//- Construct given mesh, potential and mdInitialiseDict //- Read construct given mesh, potential and mdInitialiseDict
moleculeCloud moleculeCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -178,19 +182,32 @@ public:
// Access // Access
inline const polyMesh& mesh() const; // Same as pMesh()
const polyMesh& mesh() const noexcept { return mesh_; }
inline const potential& pot() const; const potential& pot() const { return pot_; }
inline const List<DynamicList<molecule*>>& cellOccupancy() const; const List<DynamicList<molecule*>>& cellOccupancy() const
{
return cellOccupancy_;
}
inline const InteractionLists<molecule>& il() const; const InteractionLists<molecule>& il() const
{
return il_;
}
inline const List<molecule::constantProperties> constProps() const; const List<molecule::constantProperties>& constProps() const
{
return constPropList_;
}
inline const molecule::constantProperties& constProps(label id) const; const molecule::constantProperties& constProps(label id) const
{
return constPropList_[id];
}
inline Random& rndGen(); Random& rndGen() { return rndGen_; }
// Member Operators // Member Operators

View File

@ -338,52 +338,4 @@ inline Foam::vector Foam::moleculeCloud::equipartitionAngularMomentum
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::polyMesh& Foam::moleculeCloud::mesh() const
{
return mesh_;
}
inline const Foam::potential& Foam::moleculeCloud::pot() const
{
return pot_;
}
inline const Foam::List<Foam::DynamicList<Foam::molecule*>>&
Foam::moleculeCloud::cellOccupancy() const
{
return cellOccupancy_;
}
inline const Foam::InteractionLists<Foam::molecule>&
Foam::moleculeCloud::il() const
{
return il_;
}
inline const Foam::List<Foam::molecule::constantProperties>
Foam::moleculeCloud::constProps() const
{
return constPropList_;
}
inline const Foam::molecule::constantProperties&
Foam::moleculeCloud::constProps(label id) const
{
return constPropList_[id];
}
inline Foam::Random& Foam::moleculeCloud::rndGen()
{
return rndGen_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -31,14 +31,13 @@ Description
A Cloud of solid particles A Cloud of solid particles
SourceFiles SourceFiles
solidParticleCloudI.H
solidParticleCloud.C solidParticleCloud.C
solidParticleCloudIO.C solidParticleCloudIO.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef solidParticleCloud_H #ifndef Foam_solidParticleCloud_H
#define solidParticleCloud_H #define Foam_solidParticleCloud_H
#include "Cloud.H" #include "Cloud.H"
#include "solidParticle.H" #include "solidParticle.H"
@ -60,7 +59,7 @@ class solidParticleCloud
: :
public Cloud<solidParticle> public Cloud<solidParticle>
{ {
// Private data // Private Data
const fvMesh& mesh_; const fvMesh& mesh_;
@ -71,20 +70,21 @@ class solidParticleCloud
scalar mu_; scalar mu_;
// Private Member Functions
//- No copy construct
solidParticleCloud(const solidParticleCloud&) = delete;
//- No copy assignment
void operator=(const solidParticleCloud&) = delete;
public: public:
//- Type of parcel within the cloud
typedef solidParticle parcelType;
//- No copy construct
solidParticleCloud(const solidParticleCloud&) = delete;
//- No copy assignment
void operator=(const solidParticleCloud&) = delete;
// Constructors // Constructors
//- Construct given mesh //- Read construct
explicit solidParticleCloud explicit solidParticleCloud
( (
const fvMesh& mesh, const fvMesh& mesh,
@ -95,20 +95,20 @@ public:
// Member Functions // Member Functions
// Access // Access
inline const fvMesh& mesh() const; const fvMesh& mesh() const { return mesh_; }
inline scalar rhop() const; scalar rhop() const noexcept { return rhop_; }
inline scalar e() const; scalar e() const noexcept { return e_; }
inline scalar mu() const; scalar mu() const noexcept { return mu_; }
// Edit // Edit
//- Move the particles under the influence of the given //- Move the particles under the influence of the given
// gravitational acceleration //- gravitational acceleration
void move(const dimensionedVector& g); void move(const dimensionedVector& g);
}; };
@ -118,10 +118,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "solidParticleCloudI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,53 +1 @@
/*---------------------------------------------------------------------------*\ #warning File removed - left for old dependency check only
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::fvMesh& Foam::solidParticleCloud::mesh() const
{
return mesh_;
}
inline Foam::scalar Foam::solidParticleCloud::rhop() const
{
return rhop_;
}
inline Foam::scalar Foam::solidParticleCloud::e() const
{
return e_;
}
inline Foam::scalar Foam::solidParticleCloud::mu() const
{
return mu_;
}
// ************************************************************************* //

View File

@ -337,8 +337,8 @@ void Foam::meshRefinement::markFeatureCellLevel
Cloud<trackedParticle> startPointCloud Cloud<trackedParticle> startPointCloud
( (
mesh_, mesh_,
"startPointCloud", Foam::zero{},
IDLList<trackedParticle>() "startPointCloud"
); );
@ -492,12 +492,8 @@ void Foam::meshRefinement::markFeatureCellLevel
} }
Cloud<trackedParticle> cloud // Start with empty cloud
( Cloud<trackedParticle> cloud(mesh_, Foam::zero{}, "featureCloud");
mesh_,
"featureCloud",
IDLList<trackedParticle>()
);
if (debug&meshRefinement::FEATURESEEDS) if (debug&meshRefinement::FEATURESEEDS)
{ {

View File

@ -44,7 +44,7 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
) )
: :
procMesh_(procMesh), procMesh_(procMesh),
positions_(procMesh, cloudName, IDLList<passiveParticle>()), positions_(procMesh, Foam::zero{}, cloudName), // Empty cloud
particleIndices_(lagrangianPositions.size()) particleIndices_(lagrangianPositions.size())
{ {
label pi = 0; label pi = 0;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -58,11 +58,12 @@ Foam::label Foam::lagrangianReconstructor::reconstructPositions
const word& cloudName const word& cloudName
) const ) const
{ {
// Start with empty cloud
passivePositionParticleCloud lagrangianPositions passivePositionParticleCloud lagrangianPositions
( (
mesh_, mesh_,
cloudName, Foam::zero{},
IDLList<passivePositionParticle>() cloudName
); );
forAll(procMeshes_, meshi) forAll(procMeshes_, meshi)
@ -78,10 +79,8 @@ Foam::label Foam::lagrangianReconstructor::reconstructPositions
// - written in the old format // - written in the old format
passivePositionParticleCloud lpi(procMeshes_[meshi], cloudName, false); passivePositionParticleCloud lpi(procMeshes_[meshi], cloudName, false);
forAllConstIters(lpi, iter) for (const passivePositionParticle& ppi : lpi)
{ {
const passivePositionParticle& ppi = *iter;
const label mappedCell = const label mappedCell =
( (
(ppi.cell() >= 0) (ppi.cell() >= 0)

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -52,15 +52,4 @@ Foam::passivePositionParticleCloud::passivePositionParticleCloud
} }
Foam::passivePositionParticleCloud::passivePositionParticleCloud
(
const polyMesh& mesh,
const word& cloudName,
const IDLList<passivePositionParticle>& particles
)
:
Cloud<passivePositionParticle>(mesh, cloudName, particles)
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef passivePositionParticleCloud_H #ifndef Foam_passivePositionParticleCloud_H
#define passivePositionParticleCloud_H #define Foam_passivePositionParticleCloud_H
#include "Cloud.H" #include "Cloud.H"
#include "passivePositionParticle.H" #include "passivePositionParticle.H"
@ -53,21 +53,21 @@ class passivePositionParticleCloud
: :
public Cloud<passivePositionParticle> public Cloud<passivePositionParticle>
{ {
// Private Member Functions
//- No copy construct
passivePositionParticleCloud(const passivePositionParticleCloud&) =
delete;
//- No copy assignment
void operator=(const passivePositionParticleCloud&) = delete;
public: public:
//- Type of parcel within the cloud
typedef passivePositionParticle parcelType;
//- No copy construct
passivePositionParticleCloud(const passivePositionParticleCloud&) = delete;
//- No copy assignment
void operator=(const passivePositionParticleCloud&) = delete;
// Constructors // Constructors
//- Construct given mesh //- Read construct
explicit passivePositionParticleCloud explicit passivePositionParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -75,13 +75,16 @@ public:
bool readFields = true bool readFields = true
); );
//- Construct from mesh, cloud name, and a list of particles //- Construct without particles
passivePositionParticleCloud passivePositionParticleCloud
( (
const polyMesh& mesh, const polyMesh& mesh,
const word& cloudName, const Foam::zero,
const IDLList<passivePositionParticle>& particles const word& cloudName = cloud::defaultName
); )
:
Cloud<passivePositionParticle>(mesh, Foam::zero{}, cloudName)
{}
}; };

View File

@ -42,6 +42,15 @@ Foam::word Foam::surfaceRegistry::defaultName("default");
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceRegistry::surfaceRegistry
(
const objectRegistry& obr
)
:
surfaceRegistry(obr, surfaceRegistry::defaultName)
{}
Foam::surfaceRegistry::surfaceRegistry Foam::surfaceRegistry::surfaceRegistry
( (
const objectRegistry& obr, const objectRegistry& obr,
@ -52,12 +61,13 @@ Foam::surfaceRegistry::surfaceRegistry
( (
IOobject IOobject
( (
(surfName.size() ? surfName : defaultName), (surfName.empty() ? surfaceRegistry::defaultName : surfName),
obr.time().timeName(), obr.time().timeName(),
prefix, surfaceRegistry::prefix,
obr, obr,
IOobjectOption::NO_READ, IOobjectOption::NO_READ,
IOobjectOption::NO_WRITE IOobjectOption::NO_WRITE,
IOobjectOption::REGISTER
) )
) )
{} {}

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef surfaceRegistry_H #ifndef Foam_surfaceRegistry_H
#define surfaceRegistry_H #define Foam_surfaceRegistry_H
#include "objectRegistry.H" #include "objectRegistry.H"
@ -53,20 +53,9 @@ class surfaceRegistry
: :
public objectRegistry public objectRegistry
{ {
// Private Member Functions
//- No copy construct
surfaceRegistry(const surfaceRegistry&) = delete;
//- No copy assignment
surfaceRegistry& operator=(const surfaceRegistry&) = delete;
public: public:
//- Runtime type information // Static Data Members
TypeName("surfaceRegistry");
//- The prefix to local: %surfaces //- The prefix to local: %surfaces
static const word prefix; static const word prefix;
@ -75,19 +64,30 @@ public:
static word defaultName; static word defaultName;
//- Runtime type information
TypeName("surfaceRegistry");
// Generated Methods
//- No copy construct
surfaceRegistry(const surfaceRegistry&) = delete;
//- No copy assignment
surfaceRegistry& operator=(const surfaceRegistry&) = delete;
// Constructors // Constructors
//- Construct for the given objectRegistry and named surface //- Construct for given objectRegistry. Uses default surface name
surfaceRegistry explicit surfaceRegistry(const objectRegistry& obr);
(
const objectRegistry& obr, //- Construct for given objectRegistry and named surface
const word& surfName = word::null surfaceRegistry(const objectRegistry& obr, const word& surfName);
);
//- Destructor //- Destructor
virtual ~surfaceRegistry() = default; virtual ~surfaceRegistry() = default;
}; };