38#ifndef Foam_particleTracksSampler_H
39#define Foam_particleTracksSampler_H
70 label maxPositions_ = 10000;
98 return origParcelAddr_;
104 return origParcelAddr_.totalSize();
116 origParcelAddr_.
reset(origParcelCounts);
126 const label sampleFreq,
133 stride_ =
max(1, sampleFreq);
135 nTracks_ = (origParcelAddr_.totalSize()/stride_);
161 const UList<Type>& values,
162 List<DynamicList<Type>>& trackValues
label maxTracks(propsDict.getOrDefault< label >("maxTracks", -1))
label maxPositions(propsDict.get< label >("maxPositions"))
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A HashTable similar to std::unordered_map.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
static void gatherInplace(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, List< Type > &fld, const int tag=UPstream::msgType(), UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking)
Inplace collect in processor order on master (== procIDs[0]).
void reset(label localSize, const label comm=UPstream::worldComm, const bool parallel=UPstream::parRun())
Reset from local size, using gather/broadcast with default/specified communicator if parallel.
Registry of regIOobjects.
Helper class when generating particle tracks. The interface is fairly rudimentary.
labelField origProcIds_
The originating processor ids.
void resetCloud(const label localCloudSize)
const globalIndex & parcelAddr() const noexcept
The original parcel addressing.
void reset(const labelUList &origParcelCounts)
Define the orig parcel mappings.
label setSampleRate(const label sampleFreq, const label maxPositions, const label maxTracks=-1)
Set the sampling stride, upper limits.
label nParticle() const
Total number of particles.
label nTracks() const noexcept
Number of tracks to generate.
void createTrackField(const UList< Type > &values, List< DynamicList< Type > > &trackValues) const
void gatherInplace(List< Type > &fld) const
label setTrackFields(const objectRegistry &obr, HashTable< List< DynamicList< Type > > > &fieldTable) const
labelField origParcelIds_
The originating parcel ids.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Field< label > labelField
Specialisation of Field<T> for label.
UList< label > labelUList
A UList of labels.
Dispatch tag: Construct 'one-sided' from local sizes, using gather but no broadcast.