STYLE: restrict vtkCloud output names to use time-index (issue #866)

- this provides easily sortable names.

  The time information is available via the corresponding .series
  file, which can also be loaded directly with ParaView 5.5 or later.

  For further redundancy, time information is saved in the first XML
  comment inside of the .vtp files. For example,

      <!-- cloud=limestoneCloud1 time=0.005 index=200 -->
This commit is contained in:
Mark Olesen
2018-06-19 17:08:25 +02:00
parent ce0623ca31
commit 18f3fadf9c
2 changed files with 18 additions and 15 deletions

View File

@ -330,7 +330,6 @@ Foam::functionObjects::vtkCloud::vtkCloud
fvMeshFunctionObject(name, runTime, dict),
writeOpts_(vtk::formatType::INLINE_BASE64),
printf_(),
useTimeName_(false),
useVerts_(false),
selectClouds_(),
selectFields_(),
@ -394,7 +393,7 @@ bool Foam::functionObjects::vtkCloud::read(const dictionary& dict)
printf_ = "%0" + std::to_string(padWidth) + "d";
}
useTimeName_ = dict.lookupOrDefault<bool>("timeName", false);
// useTimeName_ = dict.lookupOrDefault<bool>("useTimeName", false);
useVerts_ = dict.lookupOrDefault<bool>("cellData", false);
@ -436,11 +435,18 @@ bool Foam::functionObjects::vtkCloud::write()
return true; // skip - not available
}
// const word timeDesc =
// (
// useTimeName_
// ? time_.timeName()
// : printf_.empty()
// ? Foam::name(time_.timeIndex())
// : word::printf(printf_, time_.timeIndex())
// );
const word timeDesc =
(
useTimeName_
? time_.timeName()
: printf_.empty()
printf_.empty()
? Foam::name(time_.timeIndex())
: word::printf(printf_, time_.timeIndex())
);

View File

@ -28,7 +28,8 @@ Group
grpUtilitiesFunctionObjects
Description
This functionObject writes cloud(s) in VTK format.
This functionObject writes cloud(s) in VTK PolyData format
(.vtp extension) with the time information saved in a '.series' file.
Example of function object specification:
\verbatim
@ -38,11 +39,11 @@ Description
libs ("liblagrangianFunctionObjects.so");
writeControl writeTime;
writeInterval 1;
format binary;
format ascii;
cloud myCloud;
width 12;
fields (T U rho);
width 4; // file-padding
}
\endverbatim
@ -57,20 +58,19 @@ Usage
cellData | Emit cellData instead of pointData | no | false
directory | The output directory name | no | VTK
width | Padding width for file name | no | 8
timeName | Use time-name instead of time-index | no | false
format | ascii or binary format | no | binary
writePrecision | write precision in ascii | no | same as IOstream
\endtable
The output filename and fields are added to the cloud's \c OutputProperties
dictionary. For the previous example specification:
The output filename and fields are added to the functionObjectProperties
information. For the previous example specification:
\verbatim
cloudWrite1
{
myCloud
{
file "<case>/VTK/myCloud_00001.vtp";
file "<case>/VTK/myCloud_0001.vtp";
fields (T U rho);
}
}
@ -122,9 +122,6 @@ class vtkCloud
//- The printf format for zero-padding names
string printf_;
//- Use time-name instead of time-index
bool useTimeName_;
//- Write lagrangian as cell data (verts) instead of point data
bool useVerts_;