94 if (nameList[i] == name)
105 int main(
int argc,
char *argv[])
113 "write in ASCII format instead of 'C Binary'" 118 "write values in nodes" 123 "suppress writing any patches" 129 "specify particular patches to write - eg '(outlet \"inlet.*\")'. " 130 "An empty list suppresses writing the internalMesh." 136 "specify faceZones to write - eg '( slice \"mfp-.*\" )'." 142 "specify fields to export (all by default) - eg '( \"U.*\" )'." 148 "specify cellZone to write" 171 const label nVolFieldTypes = 5;
172 const word volFieldTypes[] =
178 volTensorField::typeName
187 if (
isDir(ensightDir))
200 OFstream *ensightCaseFilePtr =
nullptr;
203 fileName caseFileName = prepend +
"case";
204 Info<<
nl <<
"write case: " << caseFileName.c_str() <<
endl;
209 ensightDir/caseFileName,
215 <<
"type: ensight gold" <<
nl <<
nl;
218 OFstream& ensightCaseFile = *ensightCaseFilePtr;
247 Info<<
"Converting cellZone " << cellZoneName
248 <<
" only (puts outside faces into patch " 249 << mesh.boundaryMesh()[0].name()
251 const cellZone& cz = mesh.cellZones()[cellZoneName];
253 meshSubsetter.setLargeCellSubset(c0, 0);
259 meshSubsetter.hasSubMesh()
260 ? meshSubsetter.subMesh()
261 : meshSubsetter.baseMesh()
272 runTime.setTime(Times.
last(), Times.
size()-1);
280 Info<<
"Detected a moving mesh (multiple polyMesh/points files)." 281 <<
" Writing meshes for every timestep." <<
endl;
288 word geomFileName = prepend +
"0000";
293 geomFileName = prepend +
"****";
299 << (geomFileName +
".mesh").c_str() <<
nl;
306 runTime.setTime(Times[timeI], timeI);
323 IOobject* positionsPtr = cloudObjs.lookup(
word(
"positions"));
327 allCloudNames.
insert(cloudDirs[cloudI]);
353 allCloudFields.
find(cloudIter.key());
359 runTime.setTime(Times[timeI], timeI);
372 if (obj.
name() !=
"positions")
385 label nTimeSteps = 0;
389 runTime.setTime(Times[timeIndex], timeIndex);
394 Info<<
"Translating time = " << runTime.timeName() <<
nl;
397 if (timeIndex != 0 && meshSubsetter.hasSubMesh())
399 Info<<
"Converting cellZone " << cellZoneName
400 <<
" only (puts outside faces into patch " 401 << mesh.boundaryMesh()[0].name()
403 const cellZone& cz = mesh.cellZones()[cellZoneName];
405 meshSubsetter.setLargeCellSubset(c0, 0);
432 ensightCaseFile<<
nl <<
"VARIABLE" <<
nl;
439 for (
label i=0; i<nVolFieldTypes; i++)
445 const word& fieldName = fieldNames[j];
466 mesh.time().timeName(),
505 ensightField<sphericalTensor>
520 ensightField<symmTensor>
532 else if (volFieldTypes[i] == volTensorField::typeName)
556 const word& cloudName = cloudIter.key();
564 bool cloudExists = inFileNameList(currentCloudDirs, cloudName);
576 const word& fieldName = fieldIter.key();
577 const word& fieldType = fieldIter();
582 mesh.time().timeName(),
592 ensightCloudField<scalar>
605 ensightCloudField<vector>
618 Info<<
"Unable to convert field type " << fieldType
619 <<
" for field " << fieldName <<
endl;
629 delete ensightCaseFilePtr;
A HashTable with keys but without contents.
#define forAll(list, i)
Loop across all elements in list.
const word & name() const
Return name.
A class for handling file names.
List of IOobjects with searching and retrieving facilities.
const fileName & globalCaseName() const
Return case name.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
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...
const fileName & rootPath() const
Return root path.
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.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
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)
IOobject fieldObject(fieldNames[var2field[nVar]], runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE)
bool insert(const Key &key)
Insert a new entry.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
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 isDir(const fileName &, const bool followLink=true)
Does the name exist as a directory in the file system?
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.
fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true)
Read a directory and return the entries as a string list.
An STL-conforming hash table.
bool rmDir(const fileName &)
Remove a directory 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.
bool headerOk()
Read header of local object without type-checking.
const word cloudName(propsDict.lookup("cloudName"))
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)
const word & headerClassName() const
Return name of the class name read from header.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.