本文整理汇总了C++中Istream::format方法的典型用法代码示例。如果您正苦于以下问题:C++ Istream::format方法的具体用法?C++ Istream::format怎么用?C++ Istream::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Istream
的用法示例。
在下文中一共展示了Istream::format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParcelType
Foam::WetParcel<ParcelType>::WetParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
ParcelType(mesh, is, readFields),
Vliq_(0.0)
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
Vliq_ = readScalar(is);
}
else
{
is.read
(
reinterpret_cast<char*>(&Vliq_),
sizeof(Vliq_)
);
}
}
// Check state of Istream
is.check
(
"WetParcel<ParcelType>::WetParcel"
"(const polyMesh&, Istream&, bool)"
);
}
示例2:
Foam::ReactingParcel<ParcelType>::ReactingParcel
(
const Cloud<ParcelType>& cloud,
Istream& is,
bool readFields
)
:
ThermoParcel<ParcelType>(cloud, is, readFields),
mass0_(0.0),
Y_(0),
pc_(0.0)
{
if (readFields)
{
const ReactingCloud<ParcelType>& cR =
dynamic_cast<const ReactingCloud<ParcelType>&>(cloud);
const label nMixture = cR.composition().phaseTypes().size();
Y_.setSize(nMixture);
if (is.format() == IOstream::ASCII)
{
is >> mass0_ >> Y_;
}
else
{
示例3: codeDict
bool Foam::functionEntries::codeStream::execute
(
const dictionary& parentDict,
primitiveEntry& entry,
Istream& is
)
{
Info<< "Using #codeStream at line " << is.lineNumber()
<< " in file " << parentDict.name() << endl;
dynamicCode::checkSecurity
(
"functionEntries::codeStream::execute(..)",
parentDict
);
// get code dictionary
// must reference parent for stringOps::expand to work nicely
dictionary codeDict("#codeStream", parentDict, is);
streamingFunctionType function = getFunction(parentDict, codeDict);
// use function to write stream
OStringStream os(is.format());
(*function)(os, parentDict);
// get the entry from this stream
IStringStream resultStream(os.str());
entry.read(parentDict, resultStream);
return true;
}
示例4: readLabel
Foam::KinematicParcel<ParcelType>::KinematicParcel
(
const Cloud<ParcelType>& cloud,
Istream& is,
bool readFields
)
:
Particle<ParcelType>(cloud, is, readFields),
typeId_(0),
nParticle_(0.0),
d_(0.0),
U_(vector::zero),
rho_(0.0),
tTurb_(0.0),
UTurb_(vector::zero),
rhoc_(0.0),
Uc_(vector::zero),
muc_(0.0)
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
typeId_ = readLabel(is);
nParticle_ = readScalar(is);
d_ = readScalar(is);
is >> U_;
rho_ = readScalar(is);
tTurb_ = readScalar(is);
is >> UTurb_;
}
else
{
示例5: varWord
Foam::string Foam::functionEntries::negEntry::negateVariable
(
const dictionary& parentDict,
Istream& is
)
{
// Read variable name as a word including the '$'
const word varWord(is);
if (varWord[0] != '$')
{
FatalIOErrorInFunction
(
parentDict
) << "Expected variable name beginning with a '$' but found '"
<< varWord << "'" << exit(FatalIOError);
return string::null;
}
// Strip the leading '$' from the variable name
const string varName = varWord(1, varWord.size()-1);
// Lookup the variable name in the parent dictionary....
const entry* ePtr = parentDict.lookupScopedEntryPtr(varName, true, false);
if (ePtr && ePtr->isStream())
{
const token variable(ePtr->stream());
// Convert to a string
OStringStream os(is.format());
os << variable;
const string str(os.str());
// Negate
if (str[0] == '-')
{
return str(1, str.size() - 1);
}
else
{
return '-' + str;
}
}
else
{
FatalIOErrorInFunction
(
parentDict
) << "Illegal dictionary variable name " << varName << endl
<< "Valid dictionary entries are " << parentDict.toc()
<< exit(FatalIOError);
return string::null;
}
}
示例6: entry
Foam::primitiveEntry::primitiveEntry(const keyType& key, Istream& is)
:
entry(key),
ITstream
(
is.name() + '.' + key,
tokenList(10),
is.format(),
is.version()
)
{
readEntry(dictionary::null, is);
}
示例7: ParcelType
Foam::KinematicParcel<ParcelType>::KinematicParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
ParcelType(mesh, is, readFields),
active_(false),
typeId_(0),
nParticle_(0.0),
d_(0.0),
dTarget_(0.0),
U_(vector::zero),
f_(vector::zero),
angularMomentum_(vector::zero),
torque_(vector::zero),
rho_(0.0),
age_(0.0),
tTurb_(0.0),
UTurb_(vector::zero),
rhoc_(0.0),
Uc_(vector::zero),
muc_(0.0)
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
active_ = readBool(is);
typeId_ = readLabel(is);
nParticle_ = readScalar(is);
d_ = readScalar(is);
dTarget_ = readScalar(is);
is >> U_;
is >> f_;
is >> angularMomentum_;
is >> torque_;
rho_ = readScalar(is);
age_ = readScalar(is);
tTurb_ = readScalar(is);
is >> UTurb_;
}
else
{
示例8: readScalar
Foam::parcel::parcel
(
const Cloud<parcel>& cloud,
Istream& is,
bool readFields
)
:
Particle<parcel>(cloud, is, readFields),
liquidComponents_
(
(cloud.pMesh().lookupObject<dictionary>("thermophysicalProperties"))
.lookup("liquidComponents")
),
X_(liquidComponents_.size(), 0.0),
tMom_(GREAT)
{
label nX = X_.size();
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
d_ = readScalar(is);
T_ = readScalar(is);
m_ = readScalar(is);
y_ = readScalar(is);
yDot_ = readScalar(is);
ct_ = readScalar(is);
ms_ = readScalar(is);
tTurb_ = readScalar(is);
liquidCore_ = readScalar(is);
injector_ = readScalar(is);
is >> U_;
is >> Uturb_;
is >> n_;
for (label j=0; j<nX; j++)
{
X_[j] = readScalar(is);
}
}
else
{
示例9: ParcelType
Foam::MPPICParcel<ParcelType>::MPPICParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
ParcelType(mesh, is, readFields),
UCorrect_(Zero)
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
is >> UCorrect_;
}
else
{
示例10: particle
Foam::findCellParticle::findCellParticle
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
particle(mesh, is, readFields)
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
is >> displacement_;
data_ = readLabel(is);
}
else
{
示例11: ParcelType
Foam::SprayParcel<ParcelType>::SprayParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
ParcelType(mesh, is, readFields),
d0_(0.0),
position0_(vector::zero),
sigma_(0.0),
mu_(0.0),
liquidCore_(0.0),
KHindex_(0.0),
y_(0.0),
yDot_(0.0),
tc_(0.0),
ms_(0.0),
injector_(1.0),
tMom_(GREAT),
user_(0.0)
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
d0_ = readScalar(is);
is >> position0_;
sigma_ = readScalar(is);
mu_ = readScalar(is);
liquidCore_ = readScalar(is);
KHindex_ = readScalar(is);
y_ = readScalar(is);
yDot_ = readScalar(is);
tc_ = readScalar(is);
ms_ = readScalar(is);
injector_ = readScalar(is);
tMom_ = readScalar(is);
user_ = readScalar(is);
}
else
{
示例12: particle
Foam::trackedParticle::trackedParticle
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
particle(mesh, is, readFields)
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
is >> end_;
level_ = readLabel(is);
i_ = readLabel(is);
j_ = readLabel(is);
}
else
{
示例13: readScalar
Foam::molecule::molecule
(
const Cloud<molecule>& cloud,
Istream& is,
bool readFields
)
:
Particle<molecule>(cloud, is, readFields),
Q_(tensor::zero),
v_(vector::zero),
a_(vector::zero),
pi_(vector::zero),
tau_(vector::zero),
specialPosition_(vector::zero),
potentialEnergy_(0.0),
rf_(tensor::zero),
special_(0),
id_(0),
siteForces_(0),
sitePositions_(0)
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
is >> Q_;
is >> v_;
is >> a_;
is >> pi_;
is >> tau_;
is >> siteForces_;
is >> sitePositions_;
is >> specialPosition_;
potentialEnergy_ = readScalar(is);
is >> rf_;
special_ = readLabel(is);
id_ = readLabel(is);
}
else
{
示例14: ParcelType
Foam::DSMCParcel<ParcelType>::DSMCParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
ParcelType(mesh, is, readFields),
U_(vector::zero),
Ei_(0.0),
typeId_(-1)
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
is >> U_;
Ei_ = readScalar(is);
typeId_ = readLabel(is);
}
else
{
示例15: ParcelType
Foam::ReactingParcel<ParcelType>::ReactingParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields
)
:
ParcelType(mesh, is, readFields),
mass0_(0.0),
Y_(0),
pc_(0.0)
{
if (readFields)
{
DynamicList<scalar> Ymix;
if (is.format() == IOstream::ASCII)
{
is >> mass0_ >> Ymix;
}
else
{