73 int main(
int argc,
char *argv[])
79 "Utility to reorder the patches of a case.\n"
90 "specify the list of patch names in the new order"
97 "specify the reference case path"
104 "specify the reference case mesh in the meshes directory"
111 "specify the reference mesh region"
134 const fileName caseDirReference = referenceCasePath.
name();
136 const string caseDirOrig =
getEnv(
"FOAM_CASE");
137 const string caseNameOrig =
getEnv(
"FOAM_CASENAME");
138 setEnv(
"FOAM_CASE", rootDirReference/caseDirReference,
true);
139 setEnv(
"FOAM_CASENAME", caseDirReference,
true);
140 Time referenceRunTime
147 setEnv(
"FOAM_CASE", caseDirOrig,
true);
148 setEnv(
"FOAM_CASENAME", caseNameOrig,
true);
158 referenceMeshDir =
"meshes"/
args[
"referenceMesh"];
164 referenceMeshDir /=
args[
"referenceRegion"];
173 referenceRunTime.constant(),
181 if (ioObj.headerOk())
185 referencePatchNames.
setSize(patchEntries.size());
189 referencePatchNames[
patchi] = patchEntries[
patchi].keyword();
195 <<
"Cannot find or read the boundary file for reference mesh "
197 <<
" " << referenceCasePath/referenceMeshDir
204 <<
"Reference patch order not specified"
231 <<
"Number of reference patches " << referencePatchNames.
size()
232 <<
" is not equal to the number of patches in the mesh "
242 const label oldPatchi =
247 newToOldPatches[
patchi] = oldPatchi;
252 <<
"Cannot find reference patch " << referencePatchNames[
patchi]
253 <<
" in the mesh which has patches "
#define forAll(list, i)
Loop across all elements in list.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static word controlDictName
The default control dictionary name (normally "controlDict")
static bool & parRun()
Is this a parallel run?
label size() const
Return the number of elements in the UPtrList.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
static void addNote(const string &)
Add extra notes for the usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
fileName path() const
Return the path to the caseName.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
A class for handling file names.
word name() const
Return file name (part beyond last /)
fileName & toAbsolute()
Convert from relative to absolute.
fileName path() const
Return directory path name (part before last /)
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
virtual void reorderPatches(const labelUList &newToOld, const bool validBoundary)
Reorder and trim existing patches. If validBoundary the new.
Foam::polyBoundaryMeshEntries.
label findIndex(const word &patchName) const
Find patch index given a name.
wordList names() const
Return the list of patch names.
const fileName & facesInstance() const
Return the current instance directory for faces.
const fileName & pointsInstance() const
Return the current instance directory for points.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
void setInstance(const fileName &)
Set the instance for mesh files.
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
static instantList selectIfPresent(Time &runTime, const argList &args)
If any time option provided return the set of times (as select0)
Templated form of IOobject providing type information for file reading and header type checking.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool setEnv(const word &name, const std::string &value, const bool overwrite)
Set an environment variable.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
string getEnv(const word &)
Return environment variable of given name.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
Foam::argList args(argc, argv)