Commit 1b76ff60 authored by Mark Olesen's avatar Mark Olesen
Browse files

BUG: vtkCloud suppresses output for empty clouds (closes #866)

- the original intention was to avoid vtp output when the clouds are
  empty anyhow. However, it is useful for post-processing to have
  clouds with zero parcels (eg, before the start of injection).

  Pruning of empty clouds is now an option in the vtkCloud dictionary
  controls, with the default being false (no pruning). This represents
  a non-breaking change in behaviour since it generates more output
  than previously.

  Example,
  {
      type    vtkCloud;
      //- Suppress writing of empty clouds (default: false)
      prune   true;
  }
parent baba0069
......@@ -139,7 +139,7 @@ bool Foam::functionObjects::vtkCloud::writeCloud
label nTotParcels = pointsPtr->size();
reduce(nTotParcels, sumOp<label>());
if (!nTotParcels)
if (pruneEmpty_ && !nTotParcels)
{
return false;
}
......@@ -331,6 +331,7 @@ Foam::functionObjects::vtkCloud::vtkCloud
writeOpts_(vtk::formatType::INLINE_BASE64),
printf_(),
useVerts_(false),
pruneEmpty_(false),
selectClouds_(),
selectFields_(),
dirName_("VTK"),
......@@ -396,6 +397,7 @@ bool Foam::functionObjects::vtkCloud::read(const dictionary& dict)
// useTimeName_ = dict.lookupOrDefault<bool>("useTimeName", false);
useVerts_ = dict.lookupOrDefault<bool>("cellData", false);
pruneEmpty_ = dict.lookupOrDefault<bool>("prune", false);
//
......
......@@ -59,6 +59,7 @@ Usage
directory | The output directory name | no | VTK
width | Padding width for file name | no | 8
format | ascii or binary format | no | binary
prune | suppress writing of empty clouds | no | false
writePrecision | write precision in ascii | no | same as IOstream
\endtable
......@@ -125,6 +126,9 @@ class vtkCloud
//- Write lagrangian as cell data (verts) instead of point data
bool useVerts_;
//- Suppress writing of empty clouds
bool pruneEmpty_;
//- Requested names of clouds to process
wordRes selectClouds_;
......
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
restore0Dir
runApplication blockMesh
runApplication topoSet
runApplication createBaffles -overwrite
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar
#------------------------------------------------------------------------------
......@@ -51,5 +51,9 @@ maxCo 1.0;
maxDeltaT 1;
functions
{
#include "vtkCloud"
}
// ************************************************************************* //
......@@ -26,10 +26,7 @@ preserveFaceZones
coeffs
{
n (2 2 1);
//delta 0.001; // default=0.001
//order xyz; // default=xzy
dataFile "";
n (2 2 1);
}
// ************************************************************************* //
// -*- C++ -*-
cloudWrite
{
type vtkCloud;
libs ("liblagrangianFunctionObjects.so");
log true;
writeControl writeTime;
// cloud reactingCloud1;
clouds ( ".*" );
// Fields to output (words or regex)
fields ( U T d "Y.*" );
//- Output format (ascii | binary) - default = binary
// format binary;
// format ascii;
// writePrecision 12;
//- Suppress writing of empty clouds - default = false
// prune true;
//- Output directory name - default = "VTK"
// directory "VTK";
}
// ************************************************************************* //
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