69 ok[i] = ok[i] || fieldOk<label>(cloudObjs,
userFields[i]);
70 ok[i] = ok[i] || fieldOk<scalar>(cloudObjs,
userFields[i]);
71 ok[i] = ok[i] || fieldOk<vector>(cloudObjs,
userFields[i]);
72 ok[i] = ok[i] || fieldOk<sphericalTensor>(cloudObjs,
userFields[i]);
73 ok[i] = ok[i] || fieldOk<symmTensor>(cloudObjs,
userFields[i]);
74 ok[i] = ok[i] || fieldOk<tensor>(cloudObjs,
userFields[i]);
87 <<
"' unavailable" <<
endl;
112 int main(
int argc,
char *argv[])
124 #include "createFields.H"
128 const fileName vtkPath(runTime.rootPath()/runTime.globalCaseName()/
"VTK");
135 runTime.setTime(
timeDirs[timeI], timeI);
136 Info<<
"Time = " << runTime.userTimeName() <<
endl;
138 const fileName vtkTimePath(vtkPath/runTime.name());
141 Info<<
" Reading particle positions" <<
endl;
149 <<
" particles" <<
endl;
151 particles.setSize(ppc.size());
156 particles.set(i++, ppc.remove(&iter()));
166 trackTableType trackTable;
169 const label origProc = particles[i].origProc();
170 const label origId = particles[i].origId();
172 const trackTableType::const_iterator& iter =
173 trackTable.find(
labelPair(origProc, origId));
175 if (iter == trackTable.end())
177 particleToTrack[i] = nTracks;
178 trackTable.insert(
labelPair(origProc, origId), nTracks);
183 particleToTrack[i] = iter();
195 Info<<
"\n Generating " << nTracks <<
" tracks" <<
endl;
199 forAll(particleToTrack, i)
201 const label trackI = particleToTrack[i];
202 trackLengths[trackI]++;
211 const label length = trackLengths[i];
212 agePerTrack[i].setSize(length);
213 particleMap[i].setSize(length);
227 readParticleField<scalar>(
"age", cloudObjs);
233 forAll(particleToTrack, i)
235 const label trackI = particleToTrack[i];
236 const label sampleI = trackSamples[trackI];
237 agePerTrack[trackI][sampleI] = age[i];
238 particleMap[trackI][sampleI] = i;
239 trackSamples[trackI]++;
247 OFstream os(vtkTimePath/
"particleTracks.vtk");
249 Info<<
"\n Writing particle tracks to " << os.name() <<
endl;
253 os <<
"# vtk DataFile Version 2.0" <<
nl
254 <<
"particleTracks" <<
nl
256 <<
"DATASET POLYDATA" <<
nl
257 <<
"POINTS " <<
nPoints <<
" float" <<
nl;
264 agePerTrack[i].sort();
266 const labelList& ids = agePerTrack[i].indices();
274 sortedIds[j] = particleIds[ids[j]];
276 particleIds = sortedIds;
281 const label localId = particleIds[j];
283 particles[localId].position(mesh);
284 os <<
pos.x() <<
' ' <<
pos.y() <<
' ' <<
pos.z()
293 Info<<
"\n Writing track lines" <<
endl;
294 os <<
"\nLINES " << nTracks <<
' ' <<
nPoints + nTracks <<
nl;
301 os << particleMap[i].size() <<
nl;
305 os <<
' ' << globalPtI++;
307 if (((j + 1) % 10 == 0) && (j != 0))
321 <<
"FIELD attributes " << nFields <<
nl;
325 processFields<label>(os, particleMap,
userFields, cloudObjs);
326 processFields<scalar>(os, particleMap,
userFields, cloudObjs);
327 processFields<vector>(os, particleMap,
userFields, cloudObjs);
328 processFields<sphericalTensor>
330 processFields<symmTensor>
332 processFields<tensor>(os, particleMap,
userFields, cloudObjs);
#define forAll(list, i)
Loop across all elements in list.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
An STL-conforming hash table.
List of IOobjects with searching and retrieving facilities.
void size(const label)
Override size to be inconsistent with allocated storage.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
static bool master(const label communicator=0)
Am I the master process.
static void noParallel()
Remove the parallel options.
static const word prefix
The prefix to local: lagrangian.
A class for handling file names.
A Cloud of passive particles.
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.
A class for managing temporary objects.
void clear() const
If object pointer points to valid object:
int main(int argc, char *argv[])
static instantList timeDirs
dimensionedScalar pos(const dimensionedScalar &ds)
Pair< label > labelPair
Label pair.
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.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
void writeVTK(OFstream &os, const Type &value)
Foam::argList args(argc, argv)
const word cloudName(propsDict.lookup("cloudName"))
List< word > userFields(propsDict.lookup("fields"))