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" 179 "Write in ASCII format instead of 'C Binary'" 185 "Starting index for consecutive number of Ensight data/ files." 186 " Ignore the time index contained in the uniform/time file." 193 "Sub-directory name for Ensight output (default: 'EnSight')" 198 "Suppress removal of existing EnSight output directory" 204 "Width of Ensight data subdir" 209 "Use zero-gradient cell values on patches" 215 "Force interpolation of values to nodes" 221 "Suppress writing any patches" 228 "Suppress writing the internal mesh" 233 "Suppress writing any cellZones" 238 "Suppress writing lagrangian positions and fields" 245 "Suppress conversion of pointFields, disable -nodeValues" 250 "Suppress writing the geometry." 251 " Can be useful for converting partial results for a static geometry" 264 "Suppress output of finite-area mesh/fields",
269 {
"finite-area", 2112},
277 "Specify single patch or multiple patches to write\n" 278 "Eg, 'inlet' or '(outlet \"inlet.*\")'" 284 "Exclude single or multiple patches from writing\n" 285 "Eg, 'outlet' or '( inlet \".*Wall\" )'" 294 "Specify single or multiple faceZones to write\n" 295 "Eg, 'cells' or '( slice \"mfp-.*\" )'." 301 "Specify single or multiple fields to write (all by default)\n" 302 "Eg, 'T' or '( \"U.*\" )'" 308 "Exclude single or multiple fields",
314 "Suppress conversion of fields" 321 "Specify single or multiple cellZones to write\n" 322 "Eg, 'cells' or '( slice \"mfp-.*\" )'." 340 const bool doBoundary = !
args.
found(
"no-boundary");
341 const bool doInternal = !
args.
found(
"no-internal");
342 const bool doCellZones = !
args.
found(
"no-cellZones");
343 const bool doLagrangian = !
args.
found(
"no-lagrangian");
344 const bool doFiniteArea = !
args.
found(
"no-finite-area");
345 const bool doPointValues = !
args.
found(
"no-point-data");
346 const bool nearCellValue =
args.
found(
"nearCellValue") && doBoundary;
349 label indexingNumber(0);
353 bool doGeometry = !
args.
found(
"no-mesh");
357 Info<<
"Using neighbouring cell value instead of patch value" 362 Info<<
"Point fields and interpolated point data" 363 <<
" disabled with the '-no-point-data' option" 373 caseOpts.nodeValues(doPointValues &&
args.
found(
"nodeValues"));
375 caseOpts.overwrite(!
args.
found(
"no-overwrite"));
408 wordRes includedFields, excludedFields;
410 const bool doConvertFields = !
args.
found(
"no-fields");
413 bool resetFilter =
false;
417 Info<<
"Including fields " 423 Info<<
"Excluding fields " 432 else if (doConvertFields)
434 Info<<
"Field conversion disabled with the '-no-fields' option" <<
nl;
458 if (!outputDir.isAbsolute())
469 #include "createMeshAccounting.H" 473 Info<<
"Converting " << timeDirs.
size() <<
" time steps" <<
nl;
481 Info<<
"has moving mesh: ignoring '-no-mesh' option" <<
endl;
497 <<
timer.cpuTimeIncrement() <<
" s, " 506 #include "getTimeIndex.H" 533 ensCase.setTime(timeDirs[timei],
timeIndex);
536 ensFaCasePtr->setTime(timeDirs[timei],
timeIndex);
546 ensFaMeshPtr->expire();
547 ensFaMeshPtr->correct();
551 if ((timei == 0 || moving) && doGeometry)
561 if (ensFaCasePtr && ensFaMeshPtr)
578 #include "convertVolumeFields.H" 581 #include "convertAreaFields.H" 584 #include "convertLagrangian.H" 588 <<
timer.cpuTimeIncrement() <<
" s, " 607 <<
timer.elapsedCpuTime() <<
" s, " const wordRes & cellZoneSelection() const noexcept
Selection of faceZones. Empty if unspecified.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
A class for handling file names.
static void setAdvanced(const word &optName, bool advanced=true)
Set an existing option as being 'advanced' or normal.
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
virtual Ostream & write(const char c) override
Write character.
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
constexpr char nl
The newline '\n' character (0x0a)
Implements a timeout mechanism via sigalarm.
Database for mesh data, solution data, solver performance and other reduced data. ...
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< T > getList(const label index) const
Get a List of values from the argument at index.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
Specify an alias for the option name.
A collection of functions for writing volField content in ensight format.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
A collection of functions for writing clouds as ensight file content.
PtrList< ensightCase > ensightCases(regionNames.size())
#define forAll(list, i)
Loop across all elements in list.
Configuration options for the ensightCase.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
PtrList< ensightFaMesh > ensightMeshesFa(regionNames.size())
List< wordHashSet > availableRegionObjectNames(meshes.size())
A class for handling words, derived from Foam::string.
int64_t peak() const noexcept
Peak memory at last update - (VmPeak in /proc/PID/status)
const wordRes & patchSelection() const noexcept
Selection of patches. Empty if unspecified.
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
PtrList< ensightMesh > ensightMeshes(regionNames.size())
PtrList< ensightCase > ensightCasesFa(regionNames.size())
bool useCellZones() const noexcept
Using cellZones?
A List of wordRe with additional matching capabilities.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
static void ignoreOptionCompat(std::pair< const char *, int > compat, bool expectArg)
Specify an option to be ignored.
bool hasMovingMesh(false)
bool useBoundaryMesh() const noexcept
Using boundary?
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
Istream and Ostream manipulators taking arguments.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
const wordRes & faceZoneSelection() const noexcept
Selection of faceZones. Empty if unspecified.
OBJstream os(runTime.globalPath()/outputName)
bool readListIfPresent(const word &optName, List< T > &list) const
If named option is present, get a List of values treating a single entry like a list of size 1...
Memory usage information for the current process, and the system memory that is free.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options and also set the runTime to the first i...
word format(conversionProperties.get< word >("format"))
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
bool useInternalMesh() const noexcept
Using internal?
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
const wordRes & patchExclude() const noexcept
Selection of black listed patches. Empty if unspecified.
streamFormat
Data format (ascii | binary)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Configuration options for the ensightMesh.
void print(Ostream &os) const
Report values.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
label filterObjects(const UnaryPredicate &pred, const bool pruning=false)
Filter to retain or prune given object names.
A collection of functions for writing areaField content in ensight format.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
readUpdateState
Enumeration defining the state of the mesh after a read update.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Foam::argList args(argc, argv)
int verbose() const noexcept
Return the verbose flag.
bool found(const word &optName) const
Return true if the named option is found.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
int64_t size() const noexcept
Memory size at last update - (VmSize in /proc/PID/status)
fileName globalPath() const
Return the full path to the global case.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Starts timing CPU usage and return elapsed time from start.