93 if (nameList[i] == name)
104 int main(
int argc,
char *argv[])
112 "write in ASCII format instead of 'C Binary'" 117 "write values in nodes" 122 "suppress writing any patches" 128 "specify particular patches to write - eg '(outlet \"inlet.*\")'. " 129 "An empty list suppresses writing the internalMesh." 135 "specify faceZones to write - eg '( slice \"mfp-.*\" )'." 141 "specify fields to export (all by default) - eg '( \"U.*\" )'." 147 "specify cellZone to write" 170 const label nVolFieldTypes = 5;
171 const word volFieldTypes[] =
177 volTensorField::typeName
186 if (
isDir(ensightDir))
199 OFstream *ensightCaseFilePtr = NULL;
202 fileName caseFileName = prepend +
"case";
203 Info<<
nl <<
"write case: " << caseFileName.c_str() <<
endl;
208 ensightDir/caseFileName,
214 <<
"type: ensight gold" <<
nl <<
nl;
217 OFstream& ensightCaseFile = *ensightCaseFilePtr;
246 Info<<
"Converting cellZone " << cellZoneName
247 <<
" only (puts outside faces into patch " 248 << mesh.boundaryMesh()[0].name()
250 const cellZone& cz = mesh.cellZones()[cellZoneName];
252 meshSubsetter.setLargeCellSubset(c0, 0);
258 meshSubsetter.hasSubMesh()
259 ? meshSubsetter.subMesh()
260 : meshSubsetter.baseMesh()
271 runTime.setTime(Times.
last(), Times.
size()-1);
279 Info<<
"Detected a moving mesh (multiple polyMesh/points files)." 280 <<
" Writing meshes for every timestep." <<
endl;
287 word geomFileName = prepend +
"0000";
292 geomFileName = prepend +
"****";
298 << (geomFileName +
".mesh").c_str() <<
nl;
305 runTime.setTime(Times[timeI], timeI);
322 IOobject* positionsPtr = cloudObjs.lookup(
word(
"positions"));
326 allCloudNames.
insert(cloudDirs[cloudI]);
352 allCloudFields.
find(cloudIter.key());
358 runTime.setTime(Times[timeI], timeI);
371 if (obj.
name() !=
"positions")
384 label nTimeSteps = 0;
388 runTime.setTime(Times[timeIndex], timeIndex);
393 Info<<
"Translating time = " << runTime.timeName() <<
nl;
396 if (timeIndex != 0 && meshSubsetter.hasSubMesh())
398 Info<<
"Converting cellZone " << cellZoneName
399 <<
" only (puts outside faces into patch " 400 << mesh.boundaryMesh()[0].name()
402 const cellZone& cz = mesh.cellZones()[cellZoneName];
404 meshSubsetter.setLargeCellSubset(c0, 0);
431 ensightCaseFile<<
nl <<
"VARIABLE" <<
nl;
438 for (
label i=0; i<nVolFieldTypes; i++)
440 wordList fieldNames = objects.names(volFieldTypes[i]);
444 const word& fieldName = fieldNames[j];
465 mesh.time().timeName(),
504 ensightField<sphericalTensor>
519 ensightField<symmTensor>
531 else if (volFieldTypes[i] == volTensorField::typeName)
555 const word& cloudName = cloudIter.key();
563 bool cloudExists = inFileNameList(currentCloudDirs, cloudName);
575 const word& fieldName = fieldIter.key();
576 const word& fieldType = fieldIter();
581 mesh.time().timeName(),
590 ensightCloudField<scalar>
603 ensightCloudField<vector>
616 Info<<
"Unable to convert field type " << fieldType
617 <<
" for field " << fieldName <<
endl;
627 delete ensightCaseFilePtr;
A HashTable with keys but without contents.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
List of IOobjects with searching and retrieving facilities.
static const char *const typeName
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Foam::tmp< Foam::GeometricField< Type, Foam::fvPatchField, Foam::volMesh > > volField(const Foam::fvMeshSubset &, const Foam::GeometricField< Type, Foam::fvPatchField, Foam::volMesh > &vf)
Wrapper to get hold of the field or the subsetted field.
void size(const label)
Override size to be inconsistent with allocated storage.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
void ensightParticlePositions(const polyMesh &mesh, const fileName &dataDir, const fileName &subDir, const word &cloudName, IOstream::streamFormat format)
const word cloudName(propsDict.lookup("cloudName"))
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
IOobject fieldObject(fieldNames[var2field[nVar]], runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE)
const fileName & rootPath() const
Return root path.
bool insert(const Key &key)
Insert a new entry.
const word & headerClassName() const
Return name of the class name read from header.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
bool optionFound(const word &opt) const
Return true if the named option is found.
A class for handling words, derived from string.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
const fileName & globalCaseName() const
Return case name.
An STL-conforming hash table.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
bool rmDir(const fileName &)
Remove a dirctory and its contents.
Istream and Ostream manipulators taking arguments.
static const word prefix
The prefix to local: lagrangian.
Post-processing mesh subset tool. Given the original mesh and the list of selected cells...
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
A collection of cell labels.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
bool headerOk()
Read and check header info.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
List< wordRe > wordReList
A List of wordRe (word or regular expression)
readUpdateState
Enumeration defining the state of the mesh after a read update.
T & last()
Return the last element of the list.
Foam::argList args(argc, argv)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
fileNameList readDir(const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true)
Read a directory and return the entries as a string list.
const word & name() const
Return name.
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.