Go to the documentation of this file.
143 #include "readFields.H"
144 #include "writeVolFields.H"
145 #include "writeDimFields.H"
146 #include "writePointFields.H"
150 #undef foamToEnsight_useTimeIndex
152 using namespace Foam;
156 int main(
int argc,
char *argv[])
160 "Translate OpenFOAM data to Ensight format with individual parts"
161 " for cellZones, unzoned cells and patches"
174 "Write in ASCII format instead of 'C Binary'"
180 "Starting index for consecutive number of Ensight data/ files."
181 " Ignore the time index contained in the uniform/time file."
188 "Sub-directory name for Ensight output (default: 'EnSight')"
193 "Suppress removal of existing EnSight output directory"
199 "Width of Ensight data subdir"
204 "Use zero-gradient cell values on patches"
210 "Force interpolation of values to nodes"
216 "Suppress writing any patches"
223 "Suppress writing the internal mesh"
228 "Suppress writing any cellZones"
233 "Suppress writing lagrangian positions and fields"
240 "Suppress conversion of pointFields, disable -nodeValues"
245 "Suppress writing the geometry."
246 " Can be useful for converting partial results for a static geometry"
261 "Specify single patch or multiple patches to write\n"
262 "Eg, 'inlet' or '(outlet \"inlet.*\")'"
268 "Exclude single or multiple patches from writing\n"
269 "Eg, 'outlet' or '( inlet \".*Wall\" )'"
276 "Specify single or multiple faceZones to write\n"
277 "Eg, 'cells' or '( slice \"mfp-.*\" )'."
283 "Specify single or multiple fields to write (all by default)\n"
284 "Eg, 'T' or '( \"U.*\" )'"
290 "Specify single or multiple cellZones to write\n"
291 "Eg, 'cells' or '( slice \"mfp-.*\" )'."
326 const bool doBoundary = !
args.
found(
"no-boundary");
327 const bool doInternal = !
args.
found(
"no-internal");
328 const bool doCellZones = !
args.
found(
"no-cellZones");
329 const bool doLagrangian = !
args.
found(
"no-lagrangian");
330 const bool doPointValues = !
args.
found(
"no-point-data");
331 const bool nearCellValue =
args.
found(
"nearCellValue") && doBoundary;
334 label indexingNumber(0);
339 bool doGeometry = !
args.
found(
"no-mesh");
343 Info<<
"Using neighbouring cell value instead of patch value"
348 Info<<
"Point fields and interpolated point data"
349 <<
" disabled with the '-no-point-data' option"
359 caseOpts.nodeValues(doPointValues &&
args.
found(
"nodeValues"));
361 caseOpts.overwrite(!
args.
found(
"no-overwrite"));
417 Info<<
"Converting " << timeDirs.size() <<
" time steps" <<
nl;
430 <<
timer.cpuTimeIncrement() <<
" s, "
439 if (!fieldPatterns.empty())
450 objects.filterClasses
452 [](
const word& clsName)
460 wordList objectNames(objects.sortedNames());
465 testedObjectNames = objectNames;
470 Info<<
"has moving mesh: ignoring '-no-mesh' option" <<
endl;
479 #include "getTimeIndex.H"
481 ensCase.setTime(timeDirs[timei],
timeIndex);
494 if (timei == 0 || moving)
510 #include "convertVolumeFields.H"
513 #include "convertLagrangian.H"
516 <<
timer.cpuTimeIncrement() <<
" s, "
523 <<
timer.elapsedCpuTime() <<
" s, "
bool useCellZones() const
Using cellZones?
bool useBoundaryMesh() const
Using boundary?
Encapsulation of volume meshes for writing in ensight format. It manages cellZones,...
A class for handling words, derived from Foam::string.
A class for handling file names.
static word defaultRegion
Return the default region name.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
label checkData(const fvMesh &mesh, const instantList &timeDirs, wordList &objectNames)
Check if fields are good to use (available at all times)
static word timeName(const scalar t, const int precision=precision_)
const wordRes & faceZoneSelection() const
Selection of faceZones. Empty if unspecified.
static void addNote(const string ¬e)
Add extra notes for the usage information.
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
Specify an alias for the option name.
int peak() const
Peak memory (VmPeak in /proc/PID/status) at last update()
bool readListIfPresent(const word &optName, List< T > &list) const
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
#define forAll(list, i)
Loop across all elements in list.
label filterObjects(const UnaryPredicate &pred, const bool pruning=false)
Filter to retain or prune given object names.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
word format(conversionProperties.get< word >("format"))
const memInfo & update()
Update according to /proc/PID/status and /proc/memory contents.
bool useInternalMesh() const
Using internal?
const wordRes & cellZoneSelection() const
Selection of faceZones. Empty if unspecified.
messageStream Info
Information stream (uses stdout - output is on the master only)
Istream and Ostream manipulators taking arguments.
static void setAdvanced(const word &optName, bool advanced=true)
Set an existing option as being 'advanced' or normal.
const wordList point
Standard point field types (scalar, vector, tensor, etc)
Starts timing CPU usage and return elapsed time from start.
streamFormat
Data format (ascii | binary)
A collection of functions for writing volField content in ensight format.
Memory usage information for the current process, and the system memory that is free.
List of IOobjects with searching and retrieving facilities.
static bool master(const label communicator=0)
Am I the master process.
readUpdateState
Enumeration defining the state of the mesh after a read update.
Supports writing of ensight cases as well as providing common factory methods to open new files.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
const wordRes & patchSelection() const
Selection of patches. Empty if unspecified.
Configuration options for the ensightMesh.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
Implements a timeout mechanism via sigalarm.
A List of wordRe with additional matching capabilities.
fileName globalPath() const
Return the full path to the global case.
A collection of functions for writing clouds as ensight file content.
Configuration options for the ensightCase.
List< T > getList(const label index) const
Get a List of values from the argument at index.
void print(Ostream &os) const
Report values.
int size() const
Memory size (VmSize in /proc/PID/status) at last update()
static instantList select0(Time &runTime, const argList &args)
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Foam::argList args(argc, argv)
Header files for all the primitive types that Fields are instantiated for.
const fileName & globalCaseName() const
Return global case name.
static bool isAbsolute(const std::string &str)
Return true if string starts with a '/'.
const wordRes & patchExclude() const
Selection of black listed patches. Empty if unspecified.
bool found(const word &optName) const
Return true if the named option is found.