mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
use new IOobject constructor: blockMesh, surfaceCoordinateSystemTransform(beta)
This commit is contained in:
@ -78,10 +78,10 @@ int main(int argc, char *argv[])
|
|||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
|
const word dictName("blockMeshDict");
|
||||||
|
|
||||||
word regionName;
|
word regionName;
|
||||||
fileName polyMeshDir;
|
fileName polyMeshDir;
|
||||||
word dictName("blockMeshDict");
|
|
||||||
fileName dictPath(runTime.constant());
|
|
||||||
|
|
||||||
if (args.options().found("region"))
|
if (args.options().found("region"))
|
||||||
{
|
{
|
||||||
@ -98,55 +98,58 @@ int main(int argc, char *argv[])
|
|||||||
polyMeshDir = polyMesh::meshSubDir;
|
polyMeshDir = polyMesh::meshSubDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName dictLocal = polyMeshDir;
|
autoPtr<IOobject> meshDictIoPtr;
|
||||||
|
|
||||||
if (args.options().found("dict"))
|
if (args.options().found("dict"))
|
||||||
{
|
{
|
||||||
wordList elems(fileName(args.options()["dict"]).components());
|
fileName dictPath(args.options()["dict"]);
|
||||||
dictName = elems[elems.size()-1];
|
|
||||||
dictPath = elems[0];
|
|
||||||
dictLocal = "";
|
|
||||||
|
|
||||||
if (elems.size() == 1)
|
meshDictIoPtr.set
|
||||||
{
|
(
|
||||||
dictPath = ".";
|
new IOobject
|
||||||
}
|
(
|
||||||
else if (elems.size() > 2)
|
( dictPath.isDir() ? dictPath/dictName : dictPath ),
|
||||||
{
|
runTime,
|
||||||
dictLocal = fileName(SubList<word>(elems, elems.size()-2, 1));
|
IOobject::MUST_READ,
|
||||||
}
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
meshDictIoPtr.set
|
||||||
|
(
|
||||||
|
new IOobject
|
||||||
|
(
|
||||||
|
dictName,
|
||||||
|
runTime.constant(),
|
||||||
|
polyMeshDir,
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool writeTopo = args.options().found("blockTopology");
|
if (!meshDictIoPtr->headerOk())
|
||||||
|
|
||||||
IOobject meshDictIo
|
|
||||||
(
|
|
||||||
dictName,
|
|
||||||
dictPath,
|
|
||||||
dictLocal,
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!meshDictIo.headerOk())
|
|
||||||
{
|
{
|
||||||
FatalErrorIn(args.executable())
|
FatalErrorIn(args.executable())
|
||||||
<< "Cannot open mesh description file\n "
|
<< "Cannot open mesh description file\n "
|
||||||
<< meshDictIo.objectPath()
|
<< meshDictIoPtr->objectPath()
|
||||||
<< nl
|
<< nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl << "Creating block mesh from\n "
|
Info<< nl << "Creating block mesh from\n "
|
||||||
<< meshDictIo.objectPath() << nl << endl;
|
<< meshDictIoPtr->objectPath() << nl << endl;
|
||||||
|
|
||||||
IOdictionary meshDict(meshDictIo);
|
|
||||||
|
|
||||||
|
IOdictionary meshDict(meshDictIoPtr());
|
||||||
blockMesh blocks(meshDict);
|
blockMesh blocks(meshDict);
|
||||||
|
|
||||||
if (writeTopo)
|
|
||||||
|
if (args.options().found("blockTopology"))
|
||||||
{
|
{
|
||||||
// Write mesh as edges.
|
// Write mesh as edges.
|
||||||
{
|
{
|
||||||
|
|||||||
@ -78,56 +78,61 @@ int main(int argc, char *argv[])
|
|||||||
Time runTime(args.rootPath(), args.caseName());
|
Time runTime(args.rootPath(), args.caseName());
|
||||||
const stringList& params = args.additionalArgs();
|
const stringList& params = args.additionalArgs();
|
||||||
|
|
||||||
word dictName("coordinateSystems");
|
const word dictName("coordinateSystems");
|
||||||
fileName dictPath(runTime.constant());
|
|
||||||
fileName dictLocal;
|
|
||||||
|
|
||||||
if (args.options().found("dict"))
|
|
||||||
{
|
|
||||||
wordList elems(fileName(args.options()["dict"]).components());
|
|
||||||
dictName = elems[elems.size()-1];
|
|
||||||
dictPath = elems[0];
|
|
||||||
dictLocal = "";
|
|
||||||
|
|
||||||
if (elems.size() == 1)
|
|
||||||
{
|
|
||||||
dictPath = ".";
|
|
||||||
}
|
|
||||||
else if (elems.size() > 2)
|
|
||||||
{
|
|
||||||
dictLocal = fileName(SubList<word>(elems, elems.size()-2, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
autoPtr<coordinateSystem> fromCsys;
|
autoPtr<coordinateSystem> fromCsys;
|
||||||
autoPtr<coordinateSystem> toCsys;
|
autoPtr<coordinateSystem> toCsys;
|
||||||
|
|
||||||
if (args.options().found("from") || args.options().found("to"))
|
if (args.options().found("from") || args.options().found("to"))
|
||||||
{
|
{
|
||||||
IOobject csDictIo
|
autoPtr<IOobject> csDictIoPtr;
|
||||||
(
|
|
||||||
dictName,
|
|
||||||
dictPath,
|
|
||||||
dictLocal,
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!csDictIo.headerOk())
|
if (args.options().found("dict"))
|
||||||
|
{
|
||||||
|
fileName dictPath(args.options()["dict"]);
|
||||||
|
|
||||||
|
csDictIoPtr.set
|
||||||
|
(
|
||||||
|
new IOobject
|
||||||
|
(
|
||||||
|
( dictPath.isDir() ? dictPath/dictName : dictPath ),
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
csDictIoPtr.set
|
||||||
|
(
|
||||||
|
new IOobject
|
||||||
|
(
|
||||||
|
dictName,
|
||||||
|
runTime.constant(),
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!csDictIoPtr->headerOk())
|
||||||
{
|
{
|
||||||
FatalErrorIn(args.executable())
|
FatalErrorIn(args.executable())
|
||||||
<< "Cannot open coordinateSystems file\n "
|
<< "Cannot open coordinateSystems file\n "
|
||||||
<< csDictIo.objectPath() << nl
|
<< csDictIoPtr->objectPath() << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
coordinateSystems csLst(csDictIo);
|
coordinateSystems csLst(csDictIoPtr());
|
||||||
|
|
||||||
if (args.options().found("from"))
|
if (args.options().found("from"))
|
||||||
{
|
{
|
||||||
word csName(args.options()["from"]);
|
const word csName(args.options()["from"]);
|
||||||
|
|
||||||
label csId = csLst.find(csName);
|
label csId = csLst.find(csName);
|
||||||
if (csId < 0)
|
if (csId < 0)
|
||||||
@ -143,7 +148,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (args.options().found("to"))
|
if (args.options().found("to"))
|
||||||
{
|
{
|
||||||
word csName(args.options()["to"]);
|
const word csName(args.options()["to"]);
|
||||||
|
|
||||||
label csId = csLst.find(csName);
|
label csId = csLst.find(csName);
|
||||||
if (csId < 0)
|
if (csId < 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user