本文整理汇总了C++中word::size方法的典型用法代码示例。如果您正苦于以下问题:C++ word::size方法的具体用法?C++ word::size怎么用?C++ word::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类word
的用法示例。
在下文中一共展示了word::size方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tfield
bool Foam::functionObjects::regionFunctionObject::store
(
word& fieldName,
const tmp<ObjectType>& tfield,
bool cacheable
)
{
if (cacheable && fieldName == tfield().name())
{
WarningInFunction
<< "Cannot store cache-able field with the named used in the cache."
<< nl
<< " Either choose a different name or cache the field"
<< " and use the 'writeObjects' functionObject."
<< endl;
return false;
}
if
(
fieldName.size()
&& obr_.foundObject<ObjectType>(fieldName)
)
{
const ObjectType& field =
(
obr_.lookupObject<ObjectType>(fieldName)
);
// If there is a result field already registered assign to the new
// result field otherwise transfer ownership of the new result field to
// the object registry
if (&field != &tfield())
{
const_cast<ObjectType&>(field) = tfield;
}
else
{
obr_.objectRegistry::store(tfield.ptr());
}
}
else
{
if (fieldName.size() && fieldName != tfield().name())
{
tfield.ref().rename(fieldName);
}
else
{
fieldName = tfield().name();
}
obr_.objectRegistry::store(tfield.ptr());
}
return true;
}
示例2: surfaceRegistry
Foam::surfMesh::surfMesh(const IOobject& io, const word& surfName)
:
surfaceRegistry(io.db(), (surfName.size() ? surfName : io.name())),
Allocator
(
IOobject
(
"points",
time().findInstance(meshDir(), "points"),
meshSubDir,
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
IOobject
(
"faces",
time().findInstance(meshDir(), "faces"),
meshSubDir,
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
IOobject
(
"surfZones",
time().findInstance(meshDir(), "surfZones"),
meshSubDir,
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
MeshReference(this->storedIOFaces(), this->storedIOPoints())
{}
示例3: home
Foam::fileName Foam::home(const word& userName)
{
struct passwd* pw;
if (userName.size())
{
pw = getpwnam(userName.c_str());
}
else
{
char* env = getenv("HOME");
if (env != NULL)
{
return fileName(env);
}
pw = getpwuid(getuid());
}
if (pw != NULL)
{
return pw->pw_dir;
}
else
{
return fileName::null;
}
}
示例4: currentSet
// Construct from components
Foam::vtkMesh::vtkMesh
(
const IOobject& io,
const word& setName
)
:
fvMesh(io),
subsetMesh_
(
IOobject
(
"subset",
io.time().constant(),
*this,
IOobject::NO_READ,
IOobject::NO_WRITE
),
*this
),
setName_(setName)
{
if (setName.size())
{
// Read cellSet using whole mesh
cellSet currentSet(*this, setName_);
// Set current subset
subsetMesh_.setLargeCellSubset(currentSet);
}
}
示例5:
Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName)
:
objectRegistry
(
IOobject
(
(cloudName.size() ? cloudName : defaultName),
obr.time().timeName(),
prefix,
obr,
IOobject::NO_READ,
IOobject::AUTO_WRITE
)
)
{
if (isA<polyMesh>(obr))
{
if (debug)
{
Pout<< "cloud: Initialising polyMesh nGeometricD" << endl;
}
// initialise mesh dimensions - needed for parallel runs
// due to lazy evaluation of valid mesh dimensions
const polyMesh& mesh = dynamic_cast<const polyMesh&>(obr);
const_cast<polyMesh&>(mesh).nGeometricD();
}
}
示例6: execute
bool Foam::primitiveEntry::expandFunction
(
const word& keyword,
const dictionary& parentDict,
Istream& is
)
{
word functionName = keyword(1, keyword.size()-1);
return functionEntry::execute(functionName, parentDict, *this, is);
}
示例7: name
Foam::fileName Foam::fileFormats::surfaceFormatsCore::localMeshFileName
(
const word& surfName
)
{
const word name(surfName.size() ? surfName : surfaceRegistry::defaultName);
return fileName
(
surfaceRegistry::prefix/name/surfMesh::meshSubDir
/ name + "." + nativeExt
);
}
示例8:
Foam::cloud::cloud(const objectRegistry& obr, const word& cloudName)
:
objectRegistry
(
IOobject
(
( cloudName.size() ? cloudName : defaultName ),
obr.time().timeName(),
prefix,
obr,
IOobject::NO_READ,
IOobject::AUTO_WRITE
)
)
{}
示例9:
Foam::surfaceRegistry::surfaceRegistry
(
const objectRegistry& obr,
const word& surfName
)
:
objectRegistry
(
IOobject
(
( surfName.size() ? surfName : defaultName ),
obr.time().timeName(),
prefix,
obr,
IOobject::NO_READ,
IOobject::NO_WRITE
)
)
{}
示例10: currentSet
// Construct from components
Foam::vtkMesh::vtkMesh
(
fvMesh& baseMesh,
const word& setName
)
:
baseMesh_(baseMesh),
subsetter_(baseMesh),
setName_(setName)
{
if (setName.size())
{
// Read cellSet using whole mesh
cellSet currentSet(baseMesh_, setName_);
// Set current subset
subsetter_.setLargeCellSubset(currentSet);
}
}
示例11: order
void Foam::hierarchGeomDecomp::setDecompOrder()
{
const word order(geomDecomDict_.lookup("order"));
if (order.size() != 3)
{
FatalIOErrorIn
(
"hierarchGeomDecomp::hierarchGeomDecomp"
"(const dictionary& decompositionDict)",
decompositionDict_
) << "number of characters in order (" << order << ") != 3"
<< exit(FatalIOError);
}
for (label i = 0; i < 3; ++i)
{
if (order[i] == 'x')
{
decompOrder_[i] = 0;
}
else if (order[i] == 'y')
{
decompOrder_[i] = 1;
}
else if (order[i] == 'z')
{
decompOrder_[i] = 2;
}
else
{
FatalIOErrorIn
(
"hierarchGeomDecomp::hierarchGeomDecomp"
"(const dictionary& decompositionDict)",
decompositionDict_
) << "Illegal decomposition order " << order << endl
<< "It should only contain x, y or z" << exit(FatalError);
}
}
}
示例12: name
void Foam::MeshedSurfaceProxy<Face>::write
(
const Time& t,
const word& surfName
) const
{
// the surface name to be used
word name(surfName.size() ? surfName : surfaceRegistry::defaultName);
if (debug)
{
Info<< "MeshedSurfaceProxy::write"
"(const Time&, const word&) : "
"writing to " << name
<< endl;
}
// the local location
const fileName objectDir
(
t.timePath()/surfaceRegistry::prefix/name/surfMesh::meshSubDir
);
if (!isDir(objectDir))
{
mkDir(objectDir);
}
// write surfMesh/points
{
pointIOField io
(
IOobject
(
"points",
t.timeName(),
surfMesh::meshSubDir,
t,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
OFstream os
(
objectDir/io.name(),
t.writeFormat(),
IOstream::currentVersion,
t.writeCompression()
);
io.writeHeader(os);
os << this->points();
io.writeEndDivider(os);
}
// write surfMesh/faces
{
faceCompactIOList io
(
IOobject
(
"faces",
t.timeName(),
surfMesh::meshSubDir,
t,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
OFstream os
(
objectDir/io.name(),
t.writeFormat(),
IOstream::currentVersion,
t.writeCompression()
);
io.writeHeader(os);
if (this->useFaceMap())
{
// this is really a bit annoying (and wasteful) but no other way
os << reorder(this->faceMap(), this->faces());
}
else
{
os << this->faces();
}
io.writeEndDivider(os);
}
//.........这里部分代码省略.........
示例13: if
Foam::string& Foam::stringOps::inplaceExpand
(
string& s,
const dictionary& dict,
const bool allowEnvVars,
const bool allowEmpty,
const char sigil
)
{
string::size_type begVar = 0;
// Expand $VAR or ${VAR}
// Repeat until nothing more is found
while
(
(begVar = s.find(sigil, begVar)) != string::npos
&& begVar < s.size()-1
)
{
if (begVar == 0 || s[begVar-1] != '\\')
{
if (s[begVar+1] == '{')
{
// Recursive variable expansion mode
label stringStart = begVar;
begVar += 2;
string varValue
(
expand
(
s,
begVar,
dict,
allowEnvVars,
allowEmpty
)
);
s.std::string::replace
(
stringStart,
begVar - stringStart + 1,
varValue
);
begVar = stringStart+varValue.size();
}
else
{
string::iterator iter = s.begin() + begVar + 1;
// more generous in accepting keywords than for env variables
string::size_type endVar = begVar;
while
(
iter != s.end()
&&
(
isalnum(*iter)
|| *iter == '.'
|| *iter == ':'
|| *iter == '_'
)
)
{
++iter;
++endVar;
}
const word varName
(
s.substr
(
begVar + 1,
endVar - begVar
),
false
);
string varValue
(
getVariable
(
varName,
dict,
allowEnvVars,
allowEmpty
)
);
s.std::string::replace
(
begVar,
varName.size()+1,
varValue
);
begVar += varValue.size();
}
}
else
//.........这里部分代码省略.........
示例14: 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 "
//.........这里部分代码省略.........