Go to the documentation of this file.
146 #include "readFields.H"
147 #include "writeVolFields.H"
148 #include "writeDimFields.H"
149 #include "writePointFields.H"
150 #include "writeAreaFields.H"
154 #undef foamToEnsight_useTimeIndex
156 using namespace Foam;
160 int main(
int argc,
char *argv[])
164 "Translate OpenFOAM data to Ensight format with individual parts"
165 " for cellZones, unzoned cells and patches"
178 "Write in ASCII format instead of 'C Binary'"
184 "Starting index for consecutive number of Ensight data/ files."
185 " Ignore the time index contained in the uniform/time file."
192 "Sub-directory name for Ensight output (default: 'EnSight')"
197 "Suppress removal of existing EnSight output directory"
203 "Width of Ensight data subdir"
208 "Use zero-gradient cell values on patches"
214 "Force interpolation of values to nodes"
220 "Suppress writing any patches"
227 "Suppress writing the internal mesh"
232 "Suppress writing any cellZones"
237 "Suppress writing lagrangian positions and fields"
244 "Suppress conversion of pointFields, disable -nodeValues"
249 "Suppress writing the geometry."
250 " Can be useful for converting partial results for a static geometry"
263 "Write finite area fields",
271 "Specify single patch or multiple patches to write\n"
272 "Eg, 'inlet' or '(outlet \"inlet.*\")'"
278 "Exclude single or multiple patches from writing\n"
279 "Eg, 'outlet' or '( inlet \".*Wall\" )'"
286 "Specify single or multiple faceZones to write\n"
287 "Eg, 'cells' or '( slice \"mfp-.*\" )'."
293 "Specify single or multiple fields to write (all by default)\n"
294 "Eg, 'T' or '( \"U.*\" )'"
300 "Specify single or multiple cellZones to write\n"
301 "Eg, 'cells' or '( slice \"mfp-.*\" )'."
318 const bool doBoundary = !
args.
found(
"no-boundary");
319 const bool doInternal = !
args.
found(
"no-internal");
320 const bool doCellZones = !
args.
found(
"no-cellZones");
321 const bool doLagrangian = !
args.
found(
"no-lagrangian");
322 const bool doFiniteArea =
args.
found(
"finite-area");
323 const bool doPointValues = !
args.
found(
"no-point-data");
324 const bool nearCellValue =
args.
found(
"nearCellValue") && doBoundary;
327 label indexingNumber(0);
331 bool doGeometry = !
args.
found(
"no-mesh");
335 Info<<
"Using neighbouring cell value instead of patch value"
340 Info<<
"Point fields and interpolated point data"
341 <<
" disabled with the '-no-point-data' option"
351 caseOpts.nodeValues(doPointValues &&
args.
found(
"nodeValues"));
353 caseOpts.overwrite(!
args.
found(
"no-overwrite"));
408 if (!outputDir.isAbsolute())
420 #include "createMeshAccounting.H"
424 Info<<
"Converting " << timeDirs.size() <<
" time steps" <<
nl;
432 Info<<
"has moving mesh: ignoring '-no-mesh' option" <<
endl;
448 <<
timer.cpuTimeIncrement() <<
" s, "
457 #include "getTimeIndex.H"
489 ensCase.setTime(timeDirs[timei],
timeIndex);
492 ensFaCasePtr->setTime(timeDirs[timei],
timeIndex);
502 ensFaMeshPtr->expire();
503 ensFaMeshPtr->correct();
507 if ((timei == 0 || moving) && doGeometry)
517 if (ensFaCasePtr && ensFaMeshPtr)
535 #include "convertVolumeFields.H"
538 #include "convertAreaFields.H"
541 #include "convertLagrangian.H"
545 <<
timer.cpuTimeIncrement() <<
" s, "
564 <<
timer.elapsedCpuTime() <<
" s, "
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.
const wordRes & patchExclude() const noexcept
Selection of black listed patches. Empty if unspecified.
bool useInternalMesh() const noexcept
Using internal?
const wordRes & faceZoneSelection() const noexcept
Selection of faceZones. Empty if unspecified.
static word timeName(const scalar t, const int precision=precision_)
static void addNote(const string ¬e)
Add extra notes for the usage information.
static bool master(const label communicator=worldComm)
Am I the master process.
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.
virtual Ostream & write(const char c)
Write character.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
A collection of functions for writing areaField content in ensight format.
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.
PtrList< ensightMesh > ensightMeshes(regionNames.size())
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.
List< wordHashSet > availableRegionObjectNames(meshes.size())
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
bool useCellZones() const noexcept
Using cellZones?
Istream and Ostream manipulators taking arguments.
static void setAdvanced(const word &optName, bool advanced=true)
Set an existing option as being 'advanced' or normal.
Starts timing CPU usage and return elapsed time from start.
streamFormat
Data format (ascii | binary)
OBJstream os(runTime.globalPath()/outputName)
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.
const wordRes & patchSelection() const noexcept
Selection of patches. Empty if unspecified.
readUpdateState
Enumeration defining the state of the mesh after a read update.
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.
PtrList< ensightFaMesh > ensightMeshesFa(regionNames.size())
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.
const wordRes & cellZoneSelection() const noexcept
Selection of faceZones. Empty if unspecified.
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.
static const word null
An empty word.
A collection of functions for writing clouds as ensight file content.
bool hasMovingMesh(false)
PtrList< ensightCase > ensightCases(regionNames.size())
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.
bool useBoundaryMesh() const noexcept
Using boundary?
PtrList< ensightCase > ensightCasesFa(regionNames.size())
bool found(const word &optName) const
Return true if the named option is found.