Go to the documentation of this file.
52 int main(
int argc,
char *argv[])
56 "Generate a legacy VTK file of particle tracks for cases that were"
57 " computed using a tracked-parcel-type cloud"
68 #include "createFields.H"
75 Info<<
"Scanning times to determine track data for cloud " <<
cloudName
84 Info<<
" Reading particle positions" <<
endl;
88 <<
" particles" <<
endl;
92 const label origId =
p.origId();
93 const label origProc =
p.origProc();
95 if (origProc >= maxIds.size())
97 maxIds.setSize(origProc+1, -1);
100 maxIds[origProc] =
max(maxIds[origProc], origId);
106 Info<<
"Detected particles originating from " << maxNProcs
107 <<
" processors." <<
nl <<
endl;
109 maxIds.setSize(maxNProcs, -1);
119 Info<<
" Found " << numIds[proci] <<
" particles originating"
120 <<
" from processor " << proci <<
endl;
127 for (label i = 0; i < numIds.size()-1; i++)
129 startIds[i+1] += startIds[i] + numIds[i];
131 label nParticle = startIds.last() + numIds[startIds.size()-1];
140 Info<<
"\nGenerating " << nTracks <<
" particle tracks for cloud "
153 Info<<
" Reading particle positions" <<
endl;
182 forAll(allPositions, proci)
184 forAll(allPositions[proci], i)
187 startIds[allOrigProcs[proci][i]]
188 + allOrigIds[proci][i];
195 allTracks[trackId].append
197 allPositions[proci][i]
221 tracks[trackI].transfer(allTracks[trackI]);
232 scalarFormatterPtr().getFileName
241 vtkPath/(
"particleTracks." + vtkFile.ext())
245 <<
" format to " << vtkTracks.name()
248 scalarFormatterPtr().write
const fileName & globalCaseName() const
Return global case name.
const label sampleFrequency(propsDict.get< label >("sampleFrequency"))
const word cloudName(propsDict.get< word >("cloud"))
A class for handling file names.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
static constexpr const zero Zero
Global zero (0)
const word setFormat(propsDict.getOrDefault< word >("setFormat", "vtk"))
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static word timeName(const scalar t, const int precision=precision_)
static void addNote(const string ¬e)
Add extra notes for the usage information.
const label maxPositions(propsDict.get< label >("maxPositions"))
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define forAll(list, i)
Loop across all elements in list.
List< word > wordList
A List of words.
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
A Cloud of passive particles.
Holds list of sampling positions.
Output to file stream, using an OSstream.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static bool master(const label communicator=0)
Am I the master process.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
const fileName & rootPath() const
Return root path.
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
static const Vector< Cmpt > zero
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
static instantList select0(Time &runTime, const argList &args)
Foam::argList args(argc, argv)
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
static autoPtr< writer > New(const word &writeFormat)
Return a reference to the selected writer.