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

View File

@ -1241,8 +1241,7 @@ int main(int argc, char *argv[])
#include "addRegionOption.H" #include "addRegionOption.H"
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
argList::addOption("dict", "name", "specify alternative dictionary"); #include "addDictOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createNamedMesh.H" #include "createNamedMesh.H"
@ -1263,19 +1262,14 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
bool overwrite = args.optionFound("overwrite"); bool overwrite = args.optionFound("overwrite");
const word dictName
(args.optionLookupOrDefault<word>("dict", "extrudeToRegionMeshDict"));
IOdictionary dict
( const word dictName("extrudeToRegionMeshDict");
IOobject
( #include "setSystemMeshDictionaryIO.H"
dictName,
runTime.system(), IOdictionary dict(dictIO);
runTime,
IOobject::MUST_READ_IF_MODIFIED
)
);
// Point generator // Point generator
autoPtr<extrudeModel> model(extrudeModel::New(dict)); 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" "Makes internal faces into boundary faces.\n"
"Does not duplicate points." "Does not duplicate points."
); );
#include "addDictOption.H"
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
argList::addOption #include "addDictOption.H"
(
"dict",
"file",
"specify alternative dictionary for the createBaffles description"
);
#include "addRegionOption.H" #include "addRegionOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
@ -136,14 +131,8 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
const word dictName const word dictName("createBafflesDict");
( #include "setSystemMeshDictionaryIO.H"
args.optionLookupOrDefault<word>
(
"dict",
"createBafflesDict"
)
);
Switch internalFacesOnly(false); Switch internalFacesOnly(false);
@ -152,17 +141,7 @@ int main(int argc, char *argv[])
PtrList<faceSelection> selectors; PtrList<faceSelection> selectors;
{ {
Info<< "Reading baffle criteria from " << dictName << nl << endl; Info<< "Reading baffle criteria from " << dictName << nl << endl;
IOdictionary dict IOdictionary dict(dictIO);
(
IOobject
(
dictName,
mesh.time().system(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dict.lookup("internalFacesOnly") >> internalFacesOnly; dict.lookup("internalFacesOnly") >> internalFacesOnly;
noFields = dict.lookupOrDefault("noFields", false); noFields = dict.lookupOrDefault("noFields", false);

View File

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

View File

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

View File

@ -614,11 +614,7 @@ int main(int argc, char *argv[])
# include "addRegionOption.H" # include "addRegionOption.H"
# include "addOverwriteOption.H" # include "addOverwriteOption.H"
# include "addTimeOptions.H" # include "addTimeOptions.H"
argList::addBoolOption # include "addDictOption.H"
(
"dict",
"renumber according to system/renumberMeshDict"
);
argList::addBoolOption argList::addBoolOption
( (
"frontWidth", "frontWidth",
@ -700,23 +696,13 @@ int main(int argc, char *argv[])
if (readDict) if (readDict)
{ {
Info<< "Renumber according to renumberMeshDict." << nl << endl; const word dictName("renumberMeshDict");
#include "setSystemMeshDictionaryIO.H"
renumberDictPtr.reset Info<< "Renumber according to " << dictName << nl << endl;
(
new IOdictionary renumberDictPtr.reset(new IOdictionary(dictIO));
( const IOdictionary& renumberDict = renumberDictPtr();
IOobject
(
"renumberMeshDict",
runTime.system(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
)
);
const IOdictionary renumberDict = renumberDictPtr();
renumberPtr = renumberMethod::New(renumberDict); 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" "select a mesh subset based on a provided cellSet and/or"
" selection criteria" " selection criteria"
); );
argList::addBoolOption #include "addDictOption.H"
(
"dict",
"read mesh subset selection criteria"
" from system/subsetMeshDict"
);
argList::addOption argList::addOption
( (
"cellSet", "cellSet",
@ -210,18 +205,10 @@ int main(int argc, char *argv[])
PtrList<cellSelection> selectors; PtrList<cellSelection> selectors;
if (useDict) if (useDict)
{ {
Info<< "Reading selection criteria from subsetMeshDict" << nl << endl; const word dictName("subsetMeshDict");
IOdictionary dict #include "setSystemMeshDictionaryIO.H"
( Info<< "Reading selection criteria from " << dictName << nl << endl;
IOobject IOdictionary dict(dictIO);
(
"subsetMeshDict",
mesh.time().system(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
const dictionary& selectionsDict = dict.subDict("selections"); const dictionary& selectionsDict = dict.subDict("selections");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -89,7 +89,19 @@ public:
( (
const word& outputFilterName, const word& outputFilterName,
const objectRegistry&, 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 IOobject::readOption rOpt = IOobject::MUST_READ_IF_MODIFIED,
const bool loadFromFile = false const bool loadFromFile = false
); );

View File

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