本文整理汇总了C++中IOobject::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ IOobject::clone方法的具体用法?C++ IOobject::clone怎么用?C++ IOobject::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOobject
的用法示例。
在下文中一共展示了IOobject::clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: forAllConstIter
Foam::searchableSurfaces::searchableSurfaces
(
const IOobject& io,
const dictionary& topDict
)
:
PtrList<searchableSurface>(topDict.size()),
names_(topDict.size()),
regionNames_(topDict.size()),
allSurfaces_(identity(topDict.size()))
{
label surfI = 0;
forAllConstIter(dictionary, topDict, iter)
{
const word& key = iter().keyword();
if (!topDict.isDict(key))
{
FatalErrorIn
(
"searchableSurfaces::searchableSurfaces"
"( const IOobject&, const dictionary&)"
) << "Found non-dictionary entry " << iter()
<< " in top-level dictionary " << topDict
<< exit(FatalError);
}
const dictionary& dict = topDict.subDict(key);
names_[surfI] = key;
dict.readIfPresent("name", names_[surfI]);
// Make IOobject with correct name
autoPtr<IOobject> namedIO(io.clone());
// Note: we would like to e.g. register triSurface 'sphere.stl' as
// 'sphere'. Unfortunately
// no support for having object read from different location than
// their object name. Maybe have stlTriSurfaceMesh which appends .stl
// when reading/writing?
namedIO().rename(key); // names_[surfI]
// Create and hook surface
set
(
surfI,
searchableSurface::New
(
dict.lookup("type"),
namedIO(),
dict
)
);
const searchableSurface& s = operator[](surfI);
// Construct default region names by prepending surface name
// to region name.
const wordList& localNames = s.regions();
wordList& rNames = regionNames_[surfI];
rNames.setSize(localNames.size());
forAll(localNames, regionI)
{
rNames[regionI] = names_[surfI] + '_' + localNames[regionI];
}
// See if dictionary provides any global region names.
if (dict.found("regions"))
{
const dictionary& regionsDict = dict.subDict("regions");
forAllConstIter(dictionary, regionsDict, iter)
{
const word& key = iter().keyword();
if (regionsDict.isDict(key))
{
// Get the dictionary for region iter.keyword()
const dictionary& regionDict = regionsDict.subDict(key);
label index = findIndex(localNames, key);
if (index == -1)
{
FatalErrorIn
(
"searchableSurfaces::searchableSurfaces"
"( const IOobject&, const dictionary&)"
) << "Unknown region name " << key
<< " for surface " << s.name() << endl
<< "Valid region names are " << localNames
<< exit(FatalError);
}
rNames[index] = word(regionDict.lookup("name"));
}
}
}
surfI++;
//.........这里部分代码省略.........