diff --git a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C b/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C index 761ca5b447..7cd8fb9dd2 100644 --- a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C +++ b/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C @@ -56,7 +56,7 @@ Foam::trackedParticle::trackedParticle bool readFields ) : - ExactParticle(c, is) + ExactParticle(c, is, readFields) { if (readFields) { diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index 72e1b1f818..e3e0b4f63f 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -42,15 +42,12 @@ Foam::Cloud::Cloud ) : cloud(pMesh), - IDLList(particles), + IDLList(), polyMesh_(pMesh), - allFaces_(pMesh.faces()), - points_(pMesh.points()), - cellFaces_(pMesh.cells()), - allFaceCentres_(pMesh.faceCentres()), - owner_(pMesh.faceOwner()), - neighbour_(pMesh.faceNeighbour()) -{} + particleCount_(0) +{ + IDLList::operator=(particles); +} template @@ -62,19 +59,31 @@ Foam::Cloud::Cloud ) : cloud(pMesh, cloudName), - IDLList(particles), + IDLList(), polyMesh_(pMesh), - allFaces_(pMesh.faces()), - points_(pMesh.points()), - cellFaces_(pMesh.cells()), - allFaceCentres_(pMesh.faceCentres()), - owner_(pMesh.faceOwner()), - neighbour_(pMesh.faceNeighbour()) -{} + particleCount_(0) +{ + IDLList::operator=(particles); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +Foam::label Foam::Cloud::getNewParticleID() const +{ + label id = particleCount_++; + + if (id == labelMax) + { + WarningIn("Cloud::getNewParticleID() const") + << "Particle counter has overflowed. This might cause problems" + << " when reconstructing particle tracks." << endl; + } + return id; +} + + template void Foam::Cloud::addParticle(ParticleType* pPtr) { diff --git a/src/lagrangian/basic/Cloud/Cloud.H b/src/lagrangian/basic/Cloud/Cloud.H index e298affe7d..626042e68a 100644 --- a/src/lagrangian/basic/Cloud/Cloud.H +++ b/src/lagrangian/basic/Cloud/Cloud.H @@ -50,6 +50,9 @@ namespace Foam template class Cloud; +template +class IOPosition; + template Ostream& operator<< ( @@ -71,12 +74,9 @@ class Cloud // Private data const polyMesh& polyMesh_; - const faceList& allFaces_; - const vectorField& points_; - const cellList& cellFaces_; - const vectorField& allFaceCentres_; - const unallocLabelList& owner_; - const unallocLabelList& neighbour_; + + //- Overall count of particles ever created. Never decreases. + mutable label particleCount_; //- Temporary storage for addressing. Used in findFaces. mutable DynamicList