本文整理汇总了C++中IOdictionary类的典型用法代码示例。如果您正苦于以下问题:C++ IOdictionary类的具体用法?C++ IOdictionary怎么用?C++ IOdictionary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IOdictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void Foam::InjectionModel<CloudType>::writeProps()
{
if (owner_.db().time().outputTime())
{
IOdictionary propsDict
(
IOobject
(
"injectionProperties",
owner_.db().time().timeName(),
"uniform"/cloud::prefix/owner_.name(),
owner_.db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
propsDict.add("massInjected", massInjected_);
propsDict.add("nInjections", nInjections_);
propsDict.add("parcelsAddedTotal", parcelsAddedTotal_);
propsDict.add("timeStep0", timeStep0_);
propsDict.regIOobject::write();
}
}
示例2: solver
Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
(
const fvMesh& mesh
)
{
IOdictionary chemistryPropertiesDict
(
IOobject
(
"chemistryProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
const word solver(chemistryPropertiesDict.lookup("chemistrySolver"));
wordList models = fvMeshConstructorTablePtr_->sortedToc();
wordHashSet validModels;
forAll(models, i)
{
label delim = models[i].find('<');
validModels.insert(models[i](0, delim));
}
示例3: main
int main(int argc, char *argv[])
{
// Create global variable for the run
#include "setRootCase.H"
#include "createTime.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
IOdictionary nestingControlDict
(
IOobject
(
"nestingControlDict",
runTime.system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
true
)
);
// load the master case
word masterName(Foam::fvMesh::defaultRegion);
Info << nl << "Load case: " << masterName << nl << endl;
masterPimpleSolver masterSolver(masterName,runTime);
// load the nested cases
wordList allNestedCases(nestingControlDict.lookup("allNestedCases"));
List< nestedBlendDsPimpleSolver* > allNestedSolvers(allNestedCases.size());
forAll (allNestedCases,i)
{
word namei = allNestedCases[i];
Info << nl << "Load case: " << namei << nl << endl;
allNestedSolvers[i] = new nestedBlendDsPimpleSolver(namei,runTime,true);
};
示例4: main
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
IOdictionary meshDict
(
IOobject
(
"meshDict",
runTime.system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
IOdictionary decomposeParDict
(
IOobject
(
"decomposeParDict",
runTime.system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
const label nProcessors
(
readLabel(decomposeParDict.lookup("numberOfSubdomains"))
);
for(label procI=0;procI<nProcessors;++procI)
{
fileName file("processor");
std::ostringstream ss;
ss << procI;
file += ss.str();
Info << "Creating " << file << endl;
// create a directory for processor data
mkDir(runTime.path()/file);
// generate constant directories
mkDir(runTime.path()/"constant");
// copy the contents of the const directory into processor*
cp(runTime.path()/"constant", runTime.path()/file);
// generate 0 directories
mkDir(runTime.path()/file/"0");
}
Info << "End\n" << endl;
return 0;
}
示例5: monitorFunctionFrom
Foam::monitorFunctionFromVorticity::monitorFunctionFromVorticity
(
const IOdictionary& dict
)
:
monitorFunctionFrom(dict),
monBaseMin_(dict.lookup("monitorBaseMin")),
monBaseMax_(dict.lookup("monitorBaseMax")),
monitorMax_(readScalar(dict.lookup("monitorMax")))
{}
示例6: dynamicFvMeshTypeName
Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
{
// Enclose the creation of the dynamicMesh to ensure it is
// deleted before the dynamicFvMesh is created otherwise the dictionary
// is entered in the database twice
IOdictionary dynamicMeshDict
(
IOobject
(
"dynamicMeshDict",
io.time().constant(),
io.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
word dynamicFvMeshTypeName(dynamicMeshDict.lookup("dynamicFvMesh"));
Info<< "Selecting dynamicFvMesh " << dynamicFvMeshTypeName << endl;
dlLibraryTable::open
(
dynamicMeshDict,
"dynamicFvMeshLibs",
IOobjectConstructorTablePtr_
);
if (!IOobjectConstructorTablePtr_)
{
FatalErrorIn
(
"dynamicFvMesh::New(const IOobject&)"
) << "dynamicFvMesh table is empty"
<< exit(FatalError);
}
IOobjectConstructorTable::iterator cstrIter =
IOobjectConstructorTablePtr_->find(dynamicFvMeshTypeName);
if (cstrIter == IOobjectConstructorTablePtr_->end())
{
FatalErrorIn
(
"dynamicFvMesh::New(const IOobject&)"
) << "Unknown dynamicFvMesh type " << dynamicFvMeshTypeName
<< endl << endl
<< "Valid dynamicFvMesh types are :" << endl
<< IOobjectConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<dynamicFvMesh>(cstrIter()(io));
}
示例7: solverTypeName
Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
{
IOdictionary solverDict
(
IOobject
(
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
Istream& msData = solverDict.lookup("solver");
word solverTypeName(msData);
Info << "Selecting motion solver: " << solverTypeName << endl;
dlLibraryTable::open
(
solverDict,
"motionSolverLibs",
dictionaryConstructorTablePtr_
);
if (!dictionaryConstructorTablePtr_)
{
FatalErrorIn
(
"motionSolver::New(const polyMesh& mesh)"
) << "solver table is empty"
<< exit(FatalError);
}
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(solverTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"motionSolver::New(const polyMesh& mesh)"
) << "Unknown solver type " << solverTypeName
<< endl << endl
<< "Valid solver types are: " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<motionSolver>(cstrIter()(mesh, msData));
}
示例8: dynamicFvMeshTypeName
Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
{
// Note: - do not register the dictionary since dynamicFvMeshes themselves
// do this.
// - defaultRegion (region0) gets loaded from constant, other ones
// get loaded from constant/<regionname>. Normally we'd use
// polyMesh::dbDir() but we haven't got a polyMesh yet ...
IOdictionary dict
(
IOobject
(
"dynamicMeshDict",
io.time().constant(),
(io.name() == polyMesh::defaultRegion ? "" : io.name()),
io.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
const word dynamicFvMeshTypeName(dict.lookup("dynamicFvMesh"));
Info<< "Selecting dynamicFvMesh " << dynamicFvMeshTypeName << endl;
const_cast<Time&>(io.time()).libs().open
(
dict,
"dynamicFvMeshLibs",
IOobjectConstructorTablePtr_
);
if (!IOobjectConstructorTablePtr_)
{
FatalErrorInFunction
<< "dynamicFvMesh table is empty"
<< exit(FatalError);
}
IOobjectConstructorTable::iterator cstrIter =
IOobjectConstructorTablePtr_->find(dynamicFvMeshTypeName);
if (cstrIter == IOobjectConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown dynamicFvMesh type "
<< dynamicFvMeshTypeName << nl << nl
<< "Valid dynamicFvMesh types are :" << endl
<< IOobjectConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<dynamicFvMesh>(cstrIter()(io));
}
示例9: idList
void Foam::moleculeCloud::buildConstProps()
{
Info<< nl << "Reading moleculeProperties dictionary." << endl;
const List<word>& idList(pot_.idList());
constPropList_.setSize(idList.size());
const List<word>& siteIdList(pot_.siteIdList());
IOdictionary moleculePropertiesDict
(
IOobject
(
"moleculeProperties",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
forAll(idList, i)
{
const word& id(idList[i]);
const dictionary& molDict(moleculePropertiesDict.subDict(id));
List<word> siteIdNames = molDict.lookup("siteIds");
List<label> siteIds(siteIdNames.size());
forAll(siteIdNames, sI)
{
const word& siteId = siteIdNames[sI];
siteIds[sI] = findIndex(siteIdList, siteId);
if (siteIds[sI] == -1)
{
FatalErrorIn("moleculeCloud.C") << nl
<< siteId << " site not found."
<< nl << abort(FatalError);
}
}
molecule::constantProperties& constProp = constPropList_[i];
constProp = molecule::constantProperties(molDict);
constProp.siteIds() = siteIds;
}
}
示例10: main
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
// Reading faMeshDefinition dictionary
IOdictionary faMeshDefinition
(
IOobject
(
"faMeshDefinition",
runTime.constant(),
"faMesh",
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
wordList polyMeshPatches
(
faMeshDefinition.lookup("polyMeshPatches")
);
dictionary bndDict = faMeshDefinition.subDict("boundary");
wordList faPatchNames = bndDict.toc();
List<faPatchData> faPatches(faPatchNames.size()+1);
forAll (faPatchNames, patchI)
{
dictionary curPatchDict =
bndDict.subDict(faPatchNames[patchI]);
faPatches[patchI].name_ = faPatchNames[patchI];
faPatches[patchI].type_ =
word(curPatchDict.lookup("type"));
faPatches[patchI].ownPolyPatchID_ =
mesh.boundaryMesh().findPatchID
(
word(curPatchDict.lookup("ownerPolyPatch"))
);
faPatches[patchI].ngbPolyPatchID_ =
mesh.boundaryMesh().findPatchID
(
word(curPatchDict.lookup("neighbourPolyPatch"))
);
}
示例11: readScalar
void Foam::reducedUnits::setRefValues
(
const IOdictionary& reducedUnitsDict
)
{
refLength_ = readScalar(reducedUnitsDict.lookup("refLength"));
refTime_ = readScalar(reducedUnitsDict.lookup("refTime"));
refMass_ = readScalar(reducedUnitsDict.lookup("refMass"));
calcRefValues();
}
示例12: mesh_
Foam::coalCloudList::coalCloudList
(
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
const SLGThermo& slgThermo
)
:
PtrList<coalCloud>(),
mesh_(rho.mesh())
{
IOdictionary props
(
IOobject
(
"coalCloudList",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ
)
);
const wordHashSet cloudNames(wordList(props.lookup("clouds")));
setSize(cloudNames.size());
label i = 0;
forAllConstIter(wordHashSet, cloudNames, iter)
{
const word& name = iter.key();
Info<< "creating cloud: " << name << endl;
set
(
i++,
new coalCloud
(
name,
rho,
U,
g,
slgThermo
)
);
Info<< endl;
}
}
示例13: main
int main(int argc, char* argv[])
{
// ------
// create PtrList from dictionary
// ------
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
IOdictionary dict
(
IOobject
(
"testDict",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
true
)
);
PtrList<myLib> ptl3
(
dict.lookup("group"),
myLib::iNew()
);
Info << ptl3 << endl;
Info << nl << "Display member name:" << endl;
forAll(ptl3, i)
{
Info << ptl3[i].name() << endl;
}
Info << nl << "Display member ID:" << endl;
forAll(ptl3, i)
{
Info << ptl3[i].ID() << endl;
}
return 0;
}
示例14: displacementMotionSolver
Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
(
const polyMesh& mesh,
const IOdictionary& dict
)
:
displacementMotionSolver(mesh, dict, dict.lookup("solver")),
fvMotionSolver(mesh),
cellDisplacement_
(
IOobject
(
"cellDisplacement",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvMesh_,
dimensionedVector
(
"cellDisplacement",
pointDisplacement().dimensions(),
Zero
),
cellMotionBoundaryTypes<vector>(pointDisplacement().boundaryField())
),
diffusivityPtr_
(
motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
)
{}
示例15: flameletType
Foam::autoPtr<Foam::flameletModel> Foam::flameletModel::New
(
volScalarField& rho,
volVectorField& U,
volScalarField& Su,
volScalarField& Sigma,
volScalarField& b,
psiuReactionThermo& thermo,
compressible::turbulenceModel& turbulence,
IOdictionary& mdData
)
{
const word flameletType(mdData.lookup("flameletModel"));
Info<< "Selecting flamelet diffusion: " << flameletType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(flameletType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"flameletModel::New("
"const IOdictionary& dict)"
) << "Unknown diffusion type "
<< flameletType << nl << nl
<< "Valid diffusion types are :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<flameletModel>
(cstrIter()(rho, U, Su, Sigma, b, thermo, turbulence, mdData));
}