146#include "readFields.H"
147#include "writeVolFields.H"
148#include "writeDimFields.H"
149#include "writePointFields.H"
150#include "writeAreaFields.H"
154#undef foamToEnsight_useTimeIndex
160int main(
int argc,
char *argv[])
164 "Translate OpenFOAM data to Ensight format with individual parts"
165 " for cellZones, unzoned cells and patches"
167 timeSelector::addOptions();
170 argList::setAdvanced(
"decomposeParDict");
171 argList::setAdvanced(
"noFunctionObjects");
173 argList::addVerboseOption(
"Additional verbosity");
177 argList::addBoolOption
180 "Write in ASCII format instead of 'C Binary'"
186 "Starting index for consecutive number of Ensight data/ files."
187 " Ignore the time index contained in the uniform/time file."
194 "Sub-directory name for Ensight output (default: 'EnSight')"
196 argList::addBoolOption
199 "Suppress removal of existing EnSight output directory"
205 "Width of Ensight data subdir"
207 argList::addBoolOption
210 "Use zero-gradient cell values on patches"
213 argList::addBoolOption
216 "Force interpolation of values to nodes"
219 argList::addBoolOption
222 "Suppress writing any patches"
224 argList::addOptionCompat(
"no-boundary", {
"noPatches", 1806});
226 argList::addBoolOption
229 "Suppress writing the internal mesh"
231 argList::addBoolOption
234 "Suppress writing any cellZones"
236 argList::addBoolOption
239 "Suppress writing lagrangian positions and fields"
241 argList::addOptionCompat(
"no-lagrangian", {
"noLagrangian", 1806});
243 argList::addBoolOption
246 "Suppress conversion of pointFields, disable -nodeValues"
248 argList::addBoolOption
251 "Suppress writing the geometry."
252 " Can be useful for converting partial results for a static geometry"
262 argList::addBoolOption
265 "Suppress output of finite-area mesh/fields",
268 argList::ignoreOptionCompat
270 {
"finite-area", 2112},
278 "Specify single patch or multiple patches to write\n"
279 "Eg, 'inlet' or '(outlet \"inlet.*\")'"
285 "Exclude single or multiple patches from writing\n"
286 "Eg, 'outlet' or '( inlet \".*Wall\" )'"
289 argList::addOptionCompat(
"exclude-patches", {
"excludePatches", 2112});
295 "Specify single or multiple faceZones to write\n"
296 "Eg, 'cells' or '( slice \"mfp-.*\" )'."
302 "Specify single or multiple fields to write (all by default)\n"
303 "Eg, 'T' or '( \"U.*\" )'"
309 "Exclude single or multiple fields",
312 argList::addBoolOption
315 "Suppress conversion of fields"
322 "Specify single or multiple cellZones to write\n"
323 "Eg, 'cells' or '( slice \"mfp-.*\" )'."
325 argList::addOptionCompat(
"cellZones", {
"cellZone", 1912});
336 ? IOstreamOption::ASCII
337 : IOstreamOption::BINARY
341 const bool doBoundary = !
args.
found(
"no-boundary");
342 const bool doInternal = !
args.
found(
"no-internal");
343 const bool doCellZones = !
args.
found(
"no-cellZones");
344 const bool doLagrangian = !
args.
found(
"no-lagrangian");
345 const bool doFiniteArea = !
args.
found(
"no-finite-area");
346 const bool doPointValues = !
args.
found(
"no-point-data");
347 const bool nearCellValue =
args.
found(
"nearCellValue") && doBoundary;
350 label indexingNumber(0);
354 bool doGeometry = !
args.
found(
"no-mesh");
358 Info<<
"Using neighbouring cell value instead of patch value"
363 Info<<
"Point fields and interpolated point data"
364 <<
" disabled with the '-no-point-data' option"
374 caseOpts.nodeValues(doPointValues &&
args.
found(
"nodeValues"));
376 caseOpts.overwrite(!
args.
found(
"no-overwrite"));
406 writeOpts.
print(Info);
409 wordRes includedFields, excludedFields;
411 const bool doConvertFields = !
args.
found(
"no-fields");
414 bool resetFilter =
false;
418 Info<<
"Including fields "
424 Info<<
"Excluding fields "
433 else if (doConvertFields)
435 Info<<
"Field conversion disabled with the '-no-fields' option" <<
nl;
459 if (!outputDir.isAbsolute())
471 #include "createMeshAccounting.H"
473 if (Pstream::master())
475 Info<<
"Converting " << timeDirs.
size() <<
" time steps" <<
nl;
483 Info<<
"has moving mesh: ignoring '-no-mesh' option" <<
endl;
499 <<
timer.cpuTimeIncrement() <<
" s, "
505 runTime.setTime(timeDirs[timei], timei);
508 #include "getTimeIndex.H"
525 const bool moving = (meshState != polyMesh::UNCHANGED);
535 ensCase.setTime(timeDirs[timei],
timeIndex);
538 ensFaCasePtr->setTime(timeDirs[timei],
timeIndex);
548 ensFaMeshPtr->expire();
549 ensFaMeshPtr->correct();
553 if ((timei == 0 || moving) && doGeometry)
563 if (ensFaCasePtr && ensFaMeshPtr)
567 ensFaMeshPtr->write(
os);
574 objects.filterObjects
580 #include "convertVolumeFields.H"
583 #include "convertAreaFields.H"
586 #include "convertLagrangian.H"
590 <<
timer.cpuTimeIncrement() <<
" s, "
609 <<
timer.elapsedCpuTime() <<
" s, "
Istream and Ostream manipulators taking arguments.
List< wordHashSet > availableRegionObjectNames(meshes.size())
bool hasMovingMesh(false)
List of IOobjects with searching and retrieving facilities.
streamFormat
Data format (ascii | binary)
void size(const label n)
Older name for setAddressableSize.
int verbose() const noexcept
Return the verbose flag.
bool readListIfPresent(const word &optName, List< T > &list) const
bool found(const word &optName) const
Return true if the named option is found.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
List< T > getList(const label index) const
Get a List of values from the argument at index.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
fileName globalPath() const
Return the full path to the global case.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Starts timing CPU usage and return elapsed time from start.
Configuration options for the ensightCase.
Configuration options for the ensightMesh.
bool useBoundaryMesh() const noexcept
Using boundary?
const wordRes & faceZoneSelection() const noexcept
Selection of faceZones. Empty if unspecified.
bool useInternalMesh() const noexcept
Using internal?
void print(Ostream &os) const
Report values.
const wordRes & patchSelection() const noexcept
Selection of patches. Empty if unspecified.
const wordRes & patchExclude() const noexcept
Selection of black listed patches. Empty if unspecified.
bool useCellZones() const noexcept
Using cellZones?
const wordRes & cellZoneSelection() const noexcept
Selection of faceZones. Empty if unspecified.
A class for handling file names.
Memory usage information for the current process, and the system memory that is free.
int peak() const
Peak memory (VmPeak in /proc/PID/status) at last update()
const memInfo & update()
Update according to /proc/PID/status and /proc/memory contents.
int size() const
Memory size (VmSize in /proc/PID/status) at last update()
readUpdateState
Enumeration defining the state of the mesh after a read update.
Implements a timeout mechanism via sigalarm.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
Foam::word regionName(Foam::polyMesh::defaultRegion)
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
A collection of functions for writing areaField content in ensight format.
A collection of functions for writing clouds as ensight file content.
A collection of functions for writing volField content in ensight format.
OBJstream os(runTime.globalPath()/outputName)
Header files for all the primitive types that Fields are instantiated for.
PtrList< ensightCase > ensightCases(regionNames.size())
PtrList< ensightMesh > ensightMeshes(regionNames.size())
PtrList< ensightFaMesh > ensightMeshesFa(regionNames.size())
PtrList< ensightCase > ensightCasesFa(regionNames.size())
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
constexpr char nl
The newline '\n' character (0x0a)
word format(conversionProperties.get< word >("format"))
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.