BUG: sampleDict: missing type

This commit is contained in:
mattijs 2012-12-05 15:21:00 +00:00
parent db50024d44
commit 9ccd5809b8
21 changed files with 194 additions and 294 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -104,60 +104,50 @@ int main(int argc, char *argv[])
polyMeshDir = polyMesh::meshSubDir;
}
autoPtr<IOobject> meshDictIoPtr;
IOobject meshDictIO
(
dictName,
runTime.constant(),
polyMeshDir,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (args.optionFound("dict"))
{
const fileName dictPath = args["dict"];
meshDictIoPtr.set
meshDictIO = IOobject
(
new IOobject
(
(
isDir(dictPath)
? dictPath/dictName
: dictPath
),
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
}
else
{
meshDictIoPtr.set
(
new IOobject
(
dictName,
runTime.constant(),
polyMeshDir,
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
isDir(dictPath)
? dictPath/dictName
: dictPath
),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
}
if (!meshDictIoPtr->headerOk())
if (!meshDictIO.headerOk())
{
FatalErrorIn(args.executable())
<< "Cannot open mesh description file\n "
<< meshDictIoPtr->objectPath()
<< meshDictIO.objectPath()
<< nl
<< exit(FatalError);
}
Info<< "Creating block mesh from\n "
<< meshDictIoPtr->objectPath() << endl;
<< meshDictIO.objectPath() << endl;
blockMesh::verbose(true);
IOdictionary meshDict(meshDictIoPtr());
IOdictionary meshDict(meshDictIO);
blockMesh blocks(meshDict, regionName);

View File

@ -1241,8 +1241,7 @@ int main(int argc, char *argv[])
#include "addRegionOption.H"
#include "addOverwriteOption.H"
argList::addOption("dict", "name", "specify alternative dictionary");
#include "addDictOption.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createNamedMesh.H"
@ -1263,19 +1262,14 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.optionFound("overwrite");
const word dictName
(args.optionLookupOrDefault<word>("dict", "extrudeToRegionMeshDict"));
IOdictionary dict
(
IOobject
(
dictName,
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED
)
);
const word dictName("extrudeToRegionMeshDict");
#include "setSystemMeshDictionaryIO.H"
IOdictionary dict(dictIO);
// Point generator
autoPtr<extrudeModel> model(extrudeModel::New(dict));

View File

@ -117,14 +117,9 @@ int main(int argc, char *argv[])
"Makes internal faces into boundary faces.\n"
"Does not duplicate points."
);
#include "addDictOption.H"
#include "addOverwriteOption.H"
argList::addOption
(
"dict",
"file",
"specify alternative dictionary for the createBaffles description"
);
#include "addDictOption.H"
#include "addRegionOption.H"
#include "setRootCase.H"
#include "createTime.H"
@ -136,14 +131,8 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
const word dictName
(
args.optionLookupOrDefault<word>
(
"dict",
"createBafflesDict"
)
);
const word dictName("createBafflesDict");
#include "setSystemMeshDictionaryIO.H"
Switch internalFacesOnly(false);
@ -152,17 +141,7 @@ int main(int argc, char *argv[])
PtrList<faceSelection> selectors;
{
Info<< "Reading baffle criteria from " << dictName << nl << endl;
IOdictionary dict
(
IOobject
(
dictName,
mesh.time().system(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
IOdictionary dict(dictIO);
dict.lookup("internalFacesOnly") >> internalFacesOnly;
noFields = dict.lookupOrDefault("noFields", false);

View File

@ -505,13 +505,7 @@ int main(int argc, char *argv[])
{
#include "addOverwriteOption.H"
#include "addRegionOption.H"
argList::addOption
(
"dict",
"word",
"name of dictionary to provide patch information"
);
#include "addDictOption.H"
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
@ -521,38 +515,20 @@ int main(int argc, char *argv[])
const bool overwrite = args.optionFound("overwrite");
word dictName
(
args.optionLookupOrDefault<word>("dict", "createPatchDict")
);
#include "createNamedPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
const word dictName("createPatchDict");
#include "setSystemMeshDictionaryIO.H"
Info<< "Reading " << dictName << nl << endl;
IOdictionary dict
(
IOobject
(
dictName,
runTime.system(),
(
meshRegionName != polyMesh::defaultRegion
? meshRegionName
: word::null
),
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
IOdictionary dict(dictIO);
// Whether to synchronise points
const Switch pointSync(dict.lookup("pointSync"));
#include "createNamedPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
const polyBoundaryMesh& patches = mesh.boundaryMesh();

View File

@ -298,12 +298,7 @@ int main(int argc, char *argv[])
#include "addOverwriteOption.H"
#include "addRegionOption.H"
argList::addBoolOption
(
"dict",
"refine according to system/refineMeshDict"
);
#include "addDictOption.H"
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
@ -327,19 +322,12 @@ int main(int argc, char *argv[])
if (readDict)
{
Info<< "Refining according to refineMeshDict" << nl << endl;
const word dictName("refineMeshDict");
#include "setSystemMeshDictionaryIO.H"
refineDict = IOdictionary
(
IOobject
(
"refineMeshDict",
runTime.system(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
Info<< "Refining according to " << dictName << nl << endl;
refineDict = IOdictionary(dictIO);
const word setName(refineDict.lookup("set"));

View File

@ -614,11 +614,7 @@ int main(int argc, char *argv[])
# include "addRegionOption.H"
# include "addOverwriteOption.H"
# include "addTimeOptions.H"
argList::addBoolOption
(
"dict",
"renumber according to system/renumberMeshDict"
);
# include "addDictOption.H"
argList::addBoolOption
(
"frontWidth",
@ -700,23 +696,13 @@ int main(int argc, char *argv[])
if (readDict)
{
Info<< "Renumber according to renumberMeshDict." << nl << endl;
const word dictName("renumberMeshDict");
#include "setSystemMeshDictionaryIO.H"
renumberDictPtr.reset
(
new IOdictionary
(
IOobject
(
"renumberMeshDict",
runTime.system(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
)
);
const IOdictionary renumberDict = renumberDictPtr();
Info<< "Renumber according to " << dictName << nl << endl;
renumberDictPtr.reset(new IOdictionary(dictIO));
const IOdictionary& renumberDict = renumberDictPtr();
renumberPtr = renumberMethod::New(renumberDict);

View File

@ -155,12 +155,7 @@ int main(int argc, char *argv[])
"select a mesh subset based on a provided cellSet and/or"
" selection criteria"
);
argList::addBoolOption
(
"dict",
"read mesh subset selection criteria"
" from system/subsetMeshDict"
);
#include "addDictOption.H"
argList::addOption
(
"cellSet",
@ -210,18 +205,10 @@ int main(int argc, char *argv[])
PtrList<cellSelection> selectors;
if (useDict)
{
Info<< "Reading selection criteria from subsetMeshDict" << nl << endl;
IOdictionary dict
(
IOobject
(
"subsetMeshDict",
mesh.time().system(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
const word dictName("subsetMeshDict");
#include "setSystemMeshDictionaryIO.H"
Info<< "Reading selection criteria from " << dictName << nl << endl;
IOdictionary dict(dictIO);
const dictionary& selectionsDict = dict.subDict("selections");

View File

@ -193,12 +193,7 @@ polyMesh::readUpdateState meshReadUpdate(polyMesh& mesh)
int main(int argc, char *argv[])
{
timeSelector::addOptions(true, false);
argList::addOption
(
"dict",
"file",
"specify an alternative dictionary for the topoSet dictionary"
);
#include "addDictOption.H"
#include "addRegionOption.H"
argList::addBoolOption
(
@ -216,41 +211,11 @@ int main(int argc, char *argv[])
const bool noSync = args.optionFound("noSync");
const word dictName("topoSetDict");
fileName dictPath = dictName;
if (args.optionFound("dict"))
{
dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;
}
}
#include "setSystemMeshDictionaryIO.H"
Info<< "Reading " << dictName << "\n" << endl;
IOdictionary topoSetDict
(
(
args.optionFound("dict")
? IOobject
(
dictPath,
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
: IOobject
(
dictName,
runTime.system(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
)
);
IOdictionary topoSetDict(dictIO);
// Read set construct info from dictionary
PtrList<dictionary> actions(topoSetDict.lookup("actions"));

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,12 +49,7 @@ int main(int argc, char *argv[])
"noWrite",
"suppress writing results"
);
Foam::argList::addOption
(
"dict",
"name",
"dictionary to use"
);
# include "addDictOption.H"
if (argc < 2)
{

View File

@ -1,16 +1,9 @@
word dictName(args.optionLookupOrDefault<word>("dict", "particleTrackDict"));
const word dictName("particleTrackDict");
IOdictionary propsDict
(
IOobject
(
dictName,
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED
)
);
#include "setConstantMeshDictionaryIO.H"
IOdictionary propsDict(dictIO);
word cloudName(propsDict.lookup("cloudName"));
List<word> userFields(propsDict.lookup("fields"));
List<word> userFields(propsDict.lookup("fields"));

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -113,7 +113,7 @@ int main(int argc, char *argv[])
argList::noParallel();
timeSelector::addOptions();
#include "addRegionOption.H"
argList::validOptions.insert("dict", "");
#include "addDictOption.H"
#include "setRootCase.H"

View File

@ -65,7 +65,6 @@ namespace Foam
IOobject
(
args["dict"],
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED
)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -97,37 +97,82 @@ int main(int argc, char *argv[])
{
timeSelector::addOptions();
#include "addRegionOption.H"
argList::addOption
(
"dict",
"word",
"name of dictionary to provide sample information"
);
#include "addDictOption.H"
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
#include "createNamedMesh.H"
word sampleDict(args.optionLookupOrDefault<word>("dict", "sampleDict"));
const word dictName("sampleDict");
IOsampledSets sSets
(
sampledSets::typeName,
mesh,
sampleDict,
IOobject::MUST_READ_IF_MODIFIED,
true
);
autoPtr<IOsampledSets> sSetsPtr;
autoPtr<IOsampledSurfaces> sSurfsPtr;
IOsampledSurfaces sSurfs
(
sampledSurfaces::typeName,
mesh,
sampleDict,
IOobject::MUST_READ_IF_MODIFIED,
true
);
if (args.optionFound("dict"))
{
// Construct from fileName
fileName dictPath = args["dict"];
if (isDir(dictPath))
{
dictPath = dictPath / dictName;
}
sSetsPtr.reset
(
new IOsampledSets
(
sampledSets::typeName,
mesh,
dictPath,
IOobject::MUST_READ_IF_MODIFIED,
true
)
);
sSurfsPtr.reset
(
new IOsampledSurfaces
(
sampledSurfaces::typeName,
mesh,
dictPath,
IOobject::MUST_READ_IF_MODIFIED,
true
)
);
}
else
{
// Construct from name in system() directory
sSetsPtr.reset
(
new IOsampledSets
(
sampledSets::typeName,
mesh,
dictName,
IOobject::MUST_READ_IF_MODIFIED,
true
)
);
sSurfsPtr.reset
(
new IOsampledSurfaces
(
sampledSurfaces::typeName,
mesh,
dictName,
IOobject::MUST_READ_IF_MODIFIED,
true
)
);
}
IOsampledSets& sSets = sSetsPtr();
IOsampledSurfaces& sSurfs = sSurfsPtr();
forAll(timeDirs, timeI)
{

View File

@ -140,6 +140,7 @@ sets
patchSeed
{
type patchSeed;
patches (".*Wall.*");
// Number of points to seed. Divided amongst all processors according
// to fraction of patches they hold.

View File

@ -680,35 +680,17 @@ int main(int argc, char *argv[])
);
argList::noParallel();
argList::addOption
(
"dict",
"word",
"specify alternative dictionary for the feature extraction information"
);
# include "addDictOption.H"
# include "setRootCase.H"
# include "createTime.H"
word dictName
(
args.optionLookupOrDefault<word>("dict", "surfaceFeatureExtractDict")
);
const word dictName("surfaceFeatureExtractDict");
# include "setSystemRunTimeDictionaryIO.H"
Info<< "Reading " << dictName << nl << endl;
IOdictionary dict
(
IOobject
(
dictName,
runTime.system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
const IOdictionary dict(dictIO);
forAllConstIter(dictionary, dict, iter)
{

View File

@ -97,7 +97,6 @@ int main(int argc, char *argv[])
"geometry scaling factor on output"
);
#include "addDictOption.H"
argList::addOption
(
"from",

View File

@ -103,12 +103,7 @@ int main(int argc, char *argv[])
"factor",
"geometry scaling factor on output - default is 1"
);
argList::addOption
(
"dict",
"file",
"specify an alternative dictionary for constant/coordinateSystems"
);
#include "addDictOption.H"
argList::addOption
(
"from",

View File

@ -103,12 +103,7 @@ int main(int argc, char *argv[])
"factor",
"geometry scaling factor on output - default is 1"
);
argList::addOption
(
"dict",
"file",
"specify an alternative dictionary for constant/coordinateSystems"
);
#include "addDictOption.H"
argList::addOption
(
"from",

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,7 +46,7 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
(
const word& outputFilterName,
const objectRegistry& obr,
const fileName& dictName,
const word& dictName,
const IOobject::readOption rOpt,
const bool readFromFiles
)
@ -66,6 +66,30 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
{}
template<class OutputFilter>
Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
(
const word& outputFilterName,
const objectRegistry& obr,
const fileName& dictName,
const IOobject::readOption rOpt,
const bool readFromFiles
)
:
IOdictionary
(
IOobject
(
dictName,
obr,
rOpt,
IOobject::NO_WRITE
)
),
OutputFilter(outputFilterName, obr, *this, readFromFiles)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class OutputFilter>

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -89,7 +89,19 @@ public:
(
const word& outputFilterName,
const objectRegistry&,
const fileName& dictName = OutputFilter::typeName() + "Dict",
const word& dictName = OutputFilter::typeName() + "Dict",
const IOobject::readOption rOpt = IOobject::MUST_READ_IF_MODIFIED,
const bool loadFromFile = false
);
//- Construct for given objectRegistry and dictionary
// Dictionary read from full path.
// Allow the possibility to load fields from files
IOOutputFilter
(
const word& outputFilterName,
const objectRegistry&,
const fileName& dictName,
const IOobject::readOption rOpt = IOobject::MUST_READ_IF_MODIFIED,
const bool loadFromFile = false
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -68,12 +68,7 @@ int main(int argc, char *argv[])
"noFlow",
"suppress creating flow models (execFlowFunctionObjects only)"
);
Foam::argList::addOption
(
"dict",
"name",
"dictionary to use"
);
#include "addDictOption.H"
#include "setRootCase.H"
#include "createTime.H"