本文整理汇总了C++中Ostream::setf方法的典型用法代码示例。如果您正苦于以下问题:C++ Ostream::setf方法的具体用法?C++ Ostream::setf怎么用?C++ Ostream::setf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ostream
的用法示例。
在下文中一共展示了Ostream::setf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: base
void Foam::ensightSetWriter<Type>::write
(
const coordSet& points,
const wordList& valueSetNames,
const List<const Field<Type>*>& valueSets,
Ostream& os
) const
{
const fileName base(os.name().lessExt());
const fileName meshFile(base + ".mesh");
// Write .case file
os << "FORMAT" << nl
<< "type: ensight gold" << nl
<< nl
<< "GEOMETRY" << nl
<< "model: 1 " << meshFile.name().c_str() << nl
<< nl
<< "VARIABLE"
<< nl;
forAll(valueSetNames, setI)
{
fileName dataFile(base + ".***." + valueSetNames[setI]);
os.setf(ios_base::left);
os << pTraits<Type>::typeName
<< " per node: 1 "
<< setw(15) << valueSetNames[setI]
<< " " << dataFile.name().c_str()
<< nl;
}
示例2: ensightFileName
void ensightField
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
const ensightMesh& eMesh,
const fileName& postProcPath,
const word& prepend,
const label timeIndex,
const bool binary,
Ostream& ensightCaseFile
)
{
Info<< "Converting field " << vf.name() << endl;
word timeFile = prepend + itoa(timeIndex);
const fvMesh& mesh = eMesh.mesh();
const Time& runTime = mesh.time();
const cellSets& meshCellSets = eMesh.meshCellSets();
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
const wordList& allPatchNames = eMesh.allPatchNames();
const wordHashSet& patchNames = eMesh.patchNames();
const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims();
const List<faceSets>& faceZoneFaceSets = eMesh.faceZoneFaceSets();
const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
const HashTable<ensightMesh::nFacePrimitives>&
nFaceZonePrims = eMesh.nFaceZonePrims();
const labelList& tets = meshCellSets.tets;
const labelList& pyrs = meshCellSets.pyrs;
const labelList& prisms = meshCellSets.prisms;
const labelList& wedges = meshCellSets.wedges;
const labelList& hexes = meshCellSets.hexes;
const labelList& polys = meshCellSets.polys;
ensightStream* ensightFilePtr = NULL;
if (Pstream::master())
{
// set the filename of the ensight file
fileName ensightFileName(timeFile + "." + vf.name());
if (binary)
{
ensightFilePtr = new ensightBinaryStream
(
postProcPath/ensightFileName,
runTime
);
}
else
{
ensightFilePtr = new ensightAsciiStream
(
postProcPath/ensightFileName,
runTime
);
}
}
ensightStream& ensightFile = *ensightFilePtr;
if (patchNames.empty())
{
eMesh.barrier();
if (Pstream::master())
{
if (timeIndex == 0)
{
ensightCaseFile.setf(ios_base::left);
ensightCaseFile
<< pTraits<Type>::typeName
<< " per element: 1 "
<< setw(15) << vf.name()
<< (' ' + prepend + "***." + vf.name()).c_str()
<< nl;
}
ensightFile.write(pTraits<Type>::typeName);
ensightFile.writePartHeader(1);
}
writeField
(
"hexa8",
map(vf, hexes, wedges),
ensightFile
);
writeField
(
"penta6",
Field<Type>(vf, prisms),
ensightFile
);
writeField
(
//.........这里部分代码省略.........
示例3:
void Foam::functionObjects::writeFile::initStream(Ostream& os) const
{
os.setf(ios_base::scientific, ios_base::floatfield);
os.width(charWidth());
}
示例4:
void Foam::functionObjectFile::initStream(Ostream& os) const
{
os.setf(ios_base::scientific, ios_base::floatfield);
// os.precision(IOstream::defaultPrecision());
os.width(charWidth());
}