utilities: Rationalised and standardised the handling of the -dict option

This commit is contained in:
Henry Weller
2021-03-05 13:42:46 +00:00
parent d4d21c9c04
commit cf552e6343
16 changed files with 197 additions and 142 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,6 +45,7 @@ Description
#include "MeshedSurfaces.H"
#include "globalIndex.H"
#include "cellSet.H"
#include "systemDict.H"
#include "extrudedMesh.H"
#include "extrudeModel.H"
@ -266,7 +267,7 @@ int main(int argc, char *argv[])
#include "addDictOption.H"
#include "setRootCase.H"
#include "createTimeExtruded.H"
#include "createTime.H"
// Get optional regionName
word regionName;
@ -275,30 +276,16 @@ int main(int argc, char *argv[])
{
regionDir = regionName;
Info<< "Create mesh " << regionName << " for time = "
<< runTimeExtruded.timeName() << nl << endl;
<< runTime.timeName() << nl << endl;
}
else
{
regionName = fvMesh::defaultRegion;
Info<< "Create mesh for time = "
<< runTimeExtruded.timeName() << nl << endl;
<< runTime.timeName() << nl << endl;
}
const word dictName
(
args.optionLookupOrDefault<word>("dict", "extrudeMeshDict")
);
IOdictionary dict
(
IOobject
(
dictName,
runTimeExtruded.system(),
runTimeExtruded,
IOobject::MUST_READ_IF_MODIFIED
)
);
const dictionary dict(systemDict("extrudeMeshDict", args, runTime));
// Point generator
autoPtr<extrudeModel> model(extrudeModel::New(dict));
@ -376,13 +363,6 @@ int main(int argc, char *argv[])
<< " on mesh " << sourceCasePath << nl
<< endl;
Time runTime
(
Time::controlDictName,
sourceRootDir,
sourceCaseDir
);
#include "createMesh.H"
const polyBoundaryMesh& patches = mesh.boundaryMesh();
@ -711,8 +691,8 @@ int main(int argc, char *argv[])
IOobject
(
regionName,
runTimeExtruded.constant(),
runTimeExtruded,
runTime.constant(),
runTime,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
@ -795,8 +775,8 @@ int main(int argc, char *argv[])
IOobject
(
extrudedMesh::defaultRegion,
runTimeExtruded.constant(),
runTimeExtruded
runTime.constant(),
runTime
),
fMesh,
model()
@ -1040,7 +1020,7 @@ int main(int argc, char *argv[])
}
}
mesh.setInstance(runTimeExtruded.constant());
mesh.setInstance(runTime.constant());
Info<< "Writing mesh to " << mesh.localObjectPath() << nl << endl;
if (!mesh.write())

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -126,6 +126,7 @@ Notes:
#include "fvMeshTools.H"
#include "OBJstream.H"
#include "PatchTools.H"
#include "systemDict.H"
using namespace Foam;
@ -1406,11 +1407,7 @@ int main(int argc, char *argv[])
bool overwrite = args.optionFound("overwrite");
const word dictName("extrudeToRegionMeshDict");
#include "setSystemMeshDictionaryIO.H"
IOdictionary dict(dictIO);
const dictionary dict(systemDict("extrudeToRegionMeshDict", args, mesh));
// Point generator

View File

@ -58,6 +58,7 @@ Description
#include "globalIndex.H"
#include "IOmanip.H"
#include "fvMeshTools.H"
#include "systemDict.H"
using namespace Foam;
@ -731,9 +732,7 @@ int main(int argc, char *argv[])
// Read meshing dictionary
const word dictName("snappyHexMeshDict");
#include "setSystemMeshDictionaryIO.H"
const IOdictionary meshDict(dictIO);
const dictionary meshDict(systemDict("snappyHexMeshDict", args, mesh));
// all surface geometry