Commit 9ccd5809 authored by mattijs's avatar mattijs
Browse files

BUG: sampleDict: missing type

parent db50024d
......@@ -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
(
new IOobject
(
(
isDir(dictPath)
? dictPath/dictName
: dictPath
),
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
}
else
{
meshDictIoPtr.set
meshDictIO = IOobject
(
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);
......
......@@ -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));
......
......@@ -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);
......
......@@ -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"
Info<< "Reading " << dictName << nl << endl;
const word oldInstance = mesh.pointsInstance();
IOdictionary dict
(
IOobject
(
dictName,
runTime.system(),
(
meshRegionName != polyMesh::defaultRegion
? meshRegionName
: word::null
),
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
const word dictName("createPatchDict");
#include "setSystemMeshDictionaryIO.H"
Info<< "Reading " << dictName << nl << endl;
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();
......
......@@ -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"));
......
......@@ -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);
......
......@@ -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");
......
......@@ -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"));
......
......@@ -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)
{
......
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"));
\ No newline at end of file
List<word> userFields(propsDict.lookup("fields"));
......@@ -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"
......
......@@ -65,7 +65,6 @@ namespace Foam
IOobject
(
args["dict"],
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED
)
......
......@@ -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"));
IOsampledSets sSets
(
sampledSets::typeName,
mesh,
sampleDict,
IOobject::MUST_READ_IF_MODIFIED,
true
);
IOsampledSurfaces sSurfs
(
sampledSurfaces::typeName,
mesh,
sampleDict,
IOobject::MUST_READ_IF_MODIFIED,
true
);
const word dictName("sampleDict");
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,
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
(