Commit 5969f162 authored by Andrew Heather's avatar Andrew Heather
Browse files

updates

parent eb94b1c7
......@@ -26,6 +26,8 @@ Application
particleTracks
Description
Generates a VTK file of particle tracks for cases that were computed using
a tracked-parcel-type cloud
\*---------------------------------------------------------------------------*/
......@@ -54,6 +56,8 @@ int main(int argc, char *argv[])
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "Scanning times to determine track data" << nl << endl;
labelList maxIds(Pstream::nProcs(), -1);
forAll(timeDirs, timeI)
{
......@@ -90,8 +94,6 @@ int main(int argc, char *argv[])
Pstream::listCombineScatter(maxIds);
labelList numIds = maxIds + 1;
Info<< "numIds = " << numIds << endl;
// calc starting ids for particles on each processor
List<label> startIds(numIds.size(), 0);
for (label i = 0; i < numIds.size()-1; i++)
......@@ -155,17 +157,20 @@ int main(int argc, char *argv[])
Info<< " Reading particle positions" << endl;
Cloud<passiveParticle> myCloud(mesh, cloudName, false);
pointField positions(myCloud.size(), vector::zero);
label i = 0;
forAllConstIter(Cloud<passiveParticle>, myCloud, iter)
{
positions[i++] = iter().position();
}
Info<< " Reading particle id" << endl;
IOField<label> id(idHeader);
Info<< " Reading particle origProc" << endl;
IOField<label> origProc(origProcHeader);
// collect the track data on the master processor
label i = 0;
List<pointField> allPositions(Pstream::nProcs());
allPositions[Pstream::myProcNo()] = positions;
allPositions[Pstream::myProcNo()].setSize(myCloud.size());
forAllConstIter(Cloud<passiveParticle>, myCloud, iter)
{
allPositions[Pstream::myProcNo()][i++] = iter().position();
}
Pstream::gatherList(allPositions);
List<labelList> allIds(Pstream::nProcs());
......@@ -176,6 +181,7 @@ int main(int argc, char *argv[])
allOrigProcs[Pstream::myProcNo()] = origProc;
Pstream::gatherList(allOrigProcs);
Info<< " Constructing tracks" << nl << endl;
if (Pstream::master())
{
forAll(allPositions, procI)
......@@ -200,16 +206,16 @@ int main(int argc, char *argv[])
}
}
}
else
{
Info<< " No particles read" << nl << endl;
}
}
else
{
Info<< " No particles read" << nl << endl;
}
}
if (Pstream::master())
{
Info<< "Writing particle tracks" << nl << endl;
Info<< "\nWriting particle tracks" << nl << endl;
OFstream vtkTracks("particleTracks.vtk");
......@@ -221,11 +227,11 @@ int main(int argc, char *argv[])
}
vtkTracks
<< "# vtk DataFile Version 2.0\n"
<< "# vtk DataFile Version 2.0" << nl
<< "particleTracks" << nl
<< "ASCII\n"
<< "DATASET POLYDATA\n"
<< "POINTS " << nPoints << " float\n";
<< "ASCII" << nl
<< "DATASET POLYDATA" << nl
<< "POINTS " << nPoints << " float" << nl;
// Write track points to file
forAll(allTracks, trackI)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment