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[] =
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;
394 Info<<
"Translating time = " << runTime.name() <<
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++)
505 ensightField<sphericalTensor>
520 ensightField<symmTensor>
564 bool cloudExists = inFileNameList(currentCloudDirs,
cloudName);
576 const word& fieldName = fieldIter.key();
577 const word& fieldType = fieldIter();
592 ensightCloudField<scalar>
605 ensightCloudField<vector>
618 Info<<
"Unable to convert field type " << fieldType
619 <<
" for field " << fieldName <<
endl;
629 delete ensightCaseFilePtr;
Istream and Ostream manipulators taking arguments.
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
static const char *const typeName
Generic GeometricField class.
A HashTable with keys but without contents.
bool insert(const Key &key)
Insert a new entry.
An STL-conforming hash table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
List of IOobjects with searching and retrieving facilities.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
bool headerOk()
Read header of local object without type-checking.
const word & headerClassName() const
Return name of the class name read from header.
const word & name() const
Return name.
void size(const label)
Override size to be inconsistent with allocated storage.
T & last()
Return the last element of the list.
static bool master(const label communicator=0)
Am I the master process.
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.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
const fileName & rootPath() const
Return root path.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
A collection of cell labels.
static const word prefix
The prefix to local: lagrangian.
A class for handling file names.
Post-processing mesh subset tool. Given the original mesh and the list of selected cells,...
readUpdateState
Enumeration defining the state of the mesh after a read update.
static word defaultRegion
Return the default region name.
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options.
A class for handling words, derived from string.
Foam::tmp< Foam::VolField< Type > > volField(const Foam::fvMeshSubset &, const Foam::VolField< Type > &vf)
Wrapper to get hold of the field or the subsetted field.
int main(int argc, char *argv[])
IOobject fieldObject(fieldNames[var2field[nVar]], runTime.name(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE)
static List< word > fieldNames
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
const word & regionName(const solver ®ion)
void ensightParticlePositions(const polyMesh &mesh, const fileName &dataDir, const fileName &subDir, const word &cloudName, IOstream::streamFormat format)
bool rmDir(const fileName &)
Remove a directory and its contents.
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a directory in the file system?
List< wordRe > wordReList
A List of wordRe (word or regular expression)
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
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.
Foam::argList args(argc, argv)
const word cloudName(propsDict.lookup("cloudName"))