findBlockMeshDict.H
Go to the documentation of this file.
1 // Search for the appropriate blockMesh dictionary....
2 const word dictName("blockMeshDict");
3 
4 autoPtr<IOdictionary> meshDictPtr;
5 
6 {
7  fileName dictPath;
8 
9  if (args.readIfPresent("dict", dictPath))
10  {
11  // Dictionary specified on the command-line ...
12 
13  if (isDir(dictPath))
14  {
15  dictPath /= dictName;
16  }
17  }
18  else if
19  (
20  exists
21  (
22  runTime.path()/runTime.constant()
23  /regionPath/polyMesh::meshSubDir/dictName
24  )
25  )
26  {
27  // Dictionary present in constant polyMesh directory (old-style)
28 
29  dictPath =
30  runTime.constant()
31  /regionPath/polyMesh::meshSubDir/dictName;
32 
33 
34  // Warn that constant/polyMesh/blockMeshDict was used
35  // instead of system/blockMeshDict
37  << "Using the old blockMeshDict location: "
38  << dictPath << nl
39  << " instead of the default location: "
40  << runTime.system()/regionPath/dictName << nl
41  << endl;
42  }
43  else
44  {
45  // Assume dictionary is to be found in the system directory
46 
47  dictPath = runTime.system()/regionPath/dictName;
48  }
49 
50  IOobject meshDictIO
51  (
52  dictPath,
53  runTime,
54  IOobject::MUST_READ,
55  IOobject::NO_WRITE,
56  false
57  );
58 
59  if (!meshDictIO.typeHeaderOk<IOdictionary>(true))
60  {
62  << meshDictIO.objectPath() << nl
63  << exit(FatalError);
64  }
65 
66  Info<< "Creating block mesh from "
67  << runTime.relativePath(meshDictIO.objectPath()) << endl;
68 
70 }
71 
72 const IOdictionary& meshDict = *meshDictPtr;
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::exists
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
Definition: MSwindows.C:625
meshDictPtr
autoPtr< IOdictionary > meshDictPtr
Definition: findBlockMeshDict.H:4
dictName
const word dictName("blockMeshDict")
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::argList::readIfPresent
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
Definition: argListI.H:296
Foam::argList::executable
const word & executable() const
Name of executable without the path.
Definition: argListI.H:51
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
meshDictIO
IOobject meshDictIO(dictPath, runTime, IOobject::MUST_READ, IOobject::NO_WRITE, false)
Foam::FatalError
error FatalError
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::nl
constexpr char nl
Definition: Ostream.H:385
WarningIn
#define WarningIn(functionName)
Report a warning using Foam::Warning.
Definition: messageStream.H:298
args
Foam::argList args(argc, argv)
meshDict
const IOdictionary & meshDict
Definition: findBlockMeshDict.H:72
Foam::isDir
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition: MSwindows.C:643