48 int main(
int argc,
char *argv[])
58 #include "createFields.H"
62 const fileName vtkPath(runTime.rootPath()/runTime.globalCaseName()/
"VTK");
65 Info<<
"Scanning times to determine track data for cloud " <<
cloudName
71 runTime.setTime(
timeDirs[timeI], timeI);
72 Info<<
"Time = " << runTime.userTimeName() <<
endl;
76 Info<<
" Reading particle positions" <<
endl;
80 <<
" particles" <<
endl;
84 label origId = iter().origId();
85 label origProc = iter().origProc();
87 if (origProc >= maxIds.size())
89 maxIds.setSize(origProc+1, -1);
92 maxIds[origProc] =
max(maxIds[origProc], origId);
98 Info<<
"Detected particles originating from " << maxNProcs
99 <<
" processors." <<
nl <<
endl;
101 maxIds.setSize(maxNProcs, -1);
111 Info<<
" Found " << numIds[proci] <<
" particles originating"
112 <<
" from processor " << proci <<
endl;
119 for (
label i = 0; i < numIds.
size()-1; i++)
121 startIds[i+1] += startIds[i] + numIds[i];
123 label nParticle = startIds.
last() + numIds[startIds.size()-1];
132 Info<<
"\nGenerating " << nTracks <<
" particle tracks for cloud "
137 runTime.setTime(
timeDirs[timeI], timeI);
138 Info<<
"Time = " << runTime.userTimeName() <<
endl;
147 Info<<
" Reading particle positions" <<
endl;
176 forAll(allPositions, proci)
178 forAll(allPositions[proci], i)
181 startIds[allOrigProcs[proci][i]]
182 + allOrigIds[proci][i];
189 allTracks[trackId].append
191 allPositions[proci][i]
206 allTrack.
append(allTracks[trackI]);
211 <<
" format to " << vtkPath <<
nl <<
endl;
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
T & last()
Return the last element of the list.
static bool master(const label communicator=0)
Am I the master process.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Holds list of sampling positions.
A class for handling file names.
A Cloud of passive particles.
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options.
static const word null
An empty word.
int main(int argc, char *argv[])
static instantList timeDirs
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorField pointField
pointField is a vectorField.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Foam::argList args(argc, argv)
IOdictionary propsDict(systemDict("particleTracksDict", args, runTime))
label sampleFrequency(propsDict.lookup< label >("sampleFrequency"))
word setFormat(propsDict.lookup< word >("setFormat"))
label maxPositions(propsDict.lookup< label >("maxPositions"))
const word cloudName(propsDict.lookup("cloudName"))