本文整理汇总了C++中word::find方法的典型用法代码示例。如果您正苦于以下问题:C++ word::find方法的具体用法?C++ word::find怎么用?C++ word::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类word
的用法示例。
在下文中一共展示了word::find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: forAll
Foam::autoPtr<Foam::hCombustionThermo> Foam::hCombustionThermo::NewType
(
const fvMesh& mesh,
const word& thermoType
)
{
// get model name, but do not register the dictionary
// otherwise it is registered in the database twice
const word modelType
(
IOdictionary
(
IOobject
(
"thermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).lookup("thermoType")
);
if (modelType.find(thermoType) == string::npos)
{
wordList allModels = fvMeshConstructorTablePtr_->sortedToc();
DynamicList<word> validModels;
forAll(allModels, i)
{
if (allModels[i].find(thermoType) != string::npos)
{
validModels.append(allModels[i]);
}
}
FatalErrorIn
(
"autoPtr<hCombustionThermo> hCombustionThermo::NewType"
"("
"const fvMesh&, "
"const word&"
")"
) << "Inconsistent thermo package selected:" << nl << nl
<< modelType << nl << nl << "Please select a "
<< "thermo package based on " << thermoType
<< ". Valid options include:" << nl << validModels << nl
<< exit(FatalError);
}
示例2: exit
Foam::autoPtr<Foam::combustionModels::psiCombustionModel>
Foam::combustionModels::psiCombustionModel::New
(
const fvMesh& mesh,
const word& combustionProperties,
const word& phaseName
)
{
const word combModelName
(
IOdictionary
(
IOobject
(
IOobject::groupName(combustionProperties, phaseName),
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
).lookup("combustionModel")
);
Info<< "Selecting combustion model " << combModelName << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(combModelName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown psiCombustionModel type "
<< combModelName << endl << endl
<< "Valid combustionModels are : " << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
const word className = combModelName(0, combModelName.find('<'));
return autoPtr<psiCombustionModel>
(
cstrIter()(className, mesh, combustionProperties, phaseName)
);
}
示例3: exit
Foam::autoPtr<Foam::combustionModels::rhoCombustionModel>
Foam::combustionModels::rhoCombustionModel::New
(
const fvMesh& mesh
)
{
const word combTypeName
(
IOdictionary
(
IOobject
(
"combustionProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
).lookup("combustionModel")
);
Info<< "Selecting combustion model " << combTypeName << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(combTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"rhoCombustionModel::New"
) << "Unknown rhoCombustionModel type "
<< combTypeName << endl << endl
<< "Valid combustionModels are : " << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
const label tempOpen = combTypeName.find('<');
const word className = combTypeName(0, tempOpen);
return autoPtr<rhoCombustionModel> (cstrIter()(className, mesh));
}
示例4: userModel
Foam::autoPtr<Foam::solidChemistryModel> Foam::solidChemistryModel::New
(
const fvMesh& mesh
)
{
IOdictionary chemistryPropertiesDict
(
IOobject
(
"chemistryProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
const word userModel(chemistryPropertiesDict.lookup("solidChemistryModel"));
const word ODEModelName(chemistryPropertiesDict.lookup("chemistrySolver"));
const word gasThermoName(chemistryPropertiesDict.lookup("gasThermoModel"));
// construct chemistry model type name by inserting first template argument
const label tempOpen = userModel.find('<');
const label tempClose = userModel.find('>');
const word className = userModel(0, tempOpen);
const word thermoTypeName =
userModel(tempOpen + 1, tempClose - tempOpen - 1);
const word modelType =
ODEModelName + '<' + className
+ '<' + typeName + ',' + thermoTypeName + ',' + gasThermoName + ">>";
if (debug)
{
Info<< "Selecting solidChemistryModel " << modelType << endl;
}
else
{
Info<< "Selecting solidChemistryModel " << userModel + gasThermoName
<< endl;
}
fvMeshConstructorTable::iterator cstrIter =
fvMeshConstructorTablePtr_->find(modelType);
if (cstrIter == fvMeshConstructorTablePtr_->end())
{
if (debug)
{
FatalErrorIn("solidChemistryModel::New(const mesh&)")
<< "Unknown solidChemistryModel type "
<< modelType << nl << nl
<< "Valid solidChemistryModel types are:" << nl
<< fvMeshConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError);
}
else
{
wordList models = fvMeshConstructorTablePtr_->sortedToc();
forAll(models, i)
{
models[i] = models[i].replace(typeName + ',', "");
}
FatalErrorIn("solidChemistryModel::New(const mesh&)")
<< "Unknown solidChemistryModel type "
<< userModel << nl << nl
<< "Valid solidChemistryModel types are:" << nl
<< models << nl
<< exit(FatalError);
}
}
示例5: FatalIOErrorInFunction
void setScoped
(
dictionary& dict,
const word& keyword,
const bool overwrite,
entry* d
)
{
if (keyword[0] == ':')
{
// Go up to top level and recurse to find entries
setScoped
(
const_cast<dictionary&>(dict.topDict()),
keyword.substr(1, keyword.size()-1),
overwrite,
d
);
return;
}
else
{
string::size_type dotPos = keyword.find('.');
if (dotPos == string::npos)
{
// Non-scoped lookup
if (overwrite)
{
dict.set(d);
}
else
{
dict.add(d, false);
}
return;
}
else
{
if (dotPos == 0)
{
// Starting with a '.'. Go up for every 2nd '.' found
const dictionary* dictPtr = &dict;
string::size_type begVar = dotPos + 1;
string::const_iterator iter =
keyword.begin() + begVar;
string::size_type endVar = begVar;
while
(
iter != keyword.end()
&& *iter == '.'
)
{
++iter;
++endVar;
// Go to parent
if (&dictPtr->parent() == &dictionary::null)
{
FatalIOErrorInFunction(dict)
<< "No parent of current dictionary"
<< " when searching for "
<< keyword.substr
(
begVar,
keyword.size() - begVar
)
<< exit(FatalIOError);
}
dictPtr = &dictPtr->parent();
}
setScoped
(
const_cast<dictionary&>(*dictPtr),
keyword.substr(endVar),
overwrite,
d
);
return;
}
else
{
// Extract the first word
word firstWord = keyword.substr(0, dotPos);
const entry* entPtr = dict.lookupScopedEntryPtr
(
firstWord,
false, // Recursive
false
);
if (!entPtr || !entPtr->isDict())
{
FatalIOErrorInFunction(dict)
<< "keyword " << firstWord
<< " is undefined in dictionary "
//.........这里部分代码省略.........
示例6: createPatchMesh
void thermalBaffleFvPatchScalarField::createPatchMesh()
{
const fvMesh& thisMesh = patch().boundaryMesh().mesh();
word regionName = dict_.lookup("regionName");
List<polyPatch*> regionPatches(3);
List<word> patchNames(regionPatches.size());
List<word> patchTypes(regionPatches.size());
List<dictionary> dicts(regionPatches.size());
patchNames[bottomPatchID] = word("bottom");
patchNames[sidePatchID] = word("side");
patchNames[topPatchID] = word("top");
patchTypes[bottomPatchID] = mappedWallPolyPatch::typeName;
patchTypes[topPatchID] = mappedWallPolyPatch::typeName;
if (readBool(dict_.lookup("columnCells")))
{
patchTypes[sidePatchID] = emptyPolyPatch::typeName;
}
else
{
patchTypes[sidePatchID] = polyPatch::typeName;
}
const mappedPatchBase& mpp =
refCast<const mappedPatchBase>(patch().patch());
const word coupleGroup(mpp.coupleGroup());
wordList inGroups(1);
inGroups[0] = coupleGroup;
dicts[bottomPatchID].add("coupleGroup", coupleGroup);
dicts[bottomPatchID].add("inGroups", inGroups);
dicts[bottomPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]);
const label sepPos = coupleGroup.find('_');
const word coupleGroupSlave = coupleGroup(0, sepPos) + "_slave";
inGroups[0] = coupleGroupSlave;
dicts[topPatchID].add("coupleGroup", coupleGroupSlave);
dicts[topPatchID].add("inGroups", inGroups);
dicts[topPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]);
forAll (regionPatches, patchI)
{
dictionary& patchDict = dicts[patchI];
patchDict.set("nFaces", 0);
patchDict.set("startFace", 0);
regionPatches[patchI] = polyPatch::New
(
patchTypes[patchI],
patchNames[patchI],
dicts[patchI],
patchI,
thisMesh.boundaryMesh()
).ptr();
}