本文整理汇总了C++中std::ofstream::flags方法的典型用法代码示例。如果您正苦于以下问题:C++ ofstream::flags方法的具体用法?C++ ofstream::flags怎么用?C++ ofstream::flags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::ofstream
的用法示例。
在下文中一共展示了ofstream::flags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addvector
/*!Add a field*/
void addvector(const string& nameoffield, Fem2D::Mesh* mesh, const KN<double>&val, const KN<double>&val2)
{
_ofdata.flags(std::ios_base::scientific);
_ofdata.precision(15);
_ofdata << "<DataArray type=\"Float32\" Name=\"";
_ofdata << nameoffield<<"\" NumberOfComponents=\"3\" format=\"ascii\">";
_ofdata << std::endl;
for(int i=0;i<val.size();++i) _ofdata<<checkprecision(val[i])<< " " << checkprecision(val2[i]) << " " << 0.0 << std::endl;
_ofdata << "</DataArray>" << std::endl;
_ofdata.flush();
}
示例2: addmesh
void addmesh(Fem2D::Mesh* mesh)
{
Fem2D::Mesh& Th(*mesh);
_vecmesh.push_back(mesh);
_ofdata.flags(std::ios_base::scientific);
_ofdata.precision(15);
_ofdata << "<?xml version=\"1.0\"?>" << std::endl;
_ofdata << "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">" ;
_ofdata << std::endl;
_ofdata << "<UnstructuredGrid>" ; _ofdata << std::endl;
_ofdata << "<Piece NumberOfPoints=\"" << Th.nv << "\" NumberOfCells=\"" << Th.nt << "\">";
_ofdata << std::endl;
_ofdata << "<Points>" << std::endl;
_ofdata << "<DataArray type=\"Float32\" Name=\"Position\" NumberOfComponents=\"3\" format=\"ascii\">";
_ofdata << std::endl;
for(int k=0;k<Th.nv;++k) _ofdata << Th(k).x<<" "<<Th(k).y<< " " << 0.0 << std::endl;
_ofdata << "</DataArray>" << std::endl;
_ofdata << "</Points>" << std::endl;
_ofdata << "<Cells>" << std::endl;
_ofdata << "<DataArray type=\"Int32\" Name=\"connectivity\" NumberOfComponents=\"1\" format=\"ascii\">";
_ofdata << std::endl;
for(int i=0;i<Th.nt;++i)
for (int j=0; j <3; j++) _ofdata << Th(i,j) << " " ;
_ofdata << std::endl;
_ofdata << "</DataArray>" << std::endl;
_ofdata << "<DataArray type=\"Int32\" Name=\"offsets\" NumberOfComponents=\"1\" format=\"ascii\">";
_ofdata << std::endl;
for(int i=0;i<Th.nt;++i) _ofdata << 3+3*(i) << " ";
_ofdata << std::endl;
_ofdata << "</DataArray>" << std::endl;
_ofdata << "<DataArray type=\"UInt8\" Name=\"types\" NumberOfComponents=\"1\" format=\"ascii\">" ;
_ofdata<< std::endl;
for(int i=0;i<Th.nt;++i) _ofdata << 5 << " ";
_ofdata << std::endl;
_ofdata << "</DataArray>" << std::endl;
_ofdata << "</Cells>" << std::endl;
_ofdata << "<PointData >" << endl;
}