本文整理汇总了C++中DataType::number_of_series方法的典型用法代码示例。如果您正苦于以下问题:C++ DataType::number_of_series方法的具体用法?C++ DataType::number_of_series怎么用?C++ DataType::number_of_series使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataType
的用法示例。
在下文中一共展示了DataType::number_of_series方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write_explicit_surface_vtk
void write_explicit_surface_vtk(const levelset<GridTraitsType, LevelSetTraitsType>& l, const std::string& filename, const DataType& Data, typename LevelSetTraitsType::value_type eps=0.) {
//this function etracts the surface using the marching cubes algorithm and writes it to the specified file using vtk-file format
//the parameter eps is forwarded to the surface extraction function
const int D=GridTraitsType::dimensions;
Surface<D> s;
typename GetActivePointType<typename LevelSetTraitsType::size_type, DataType>::result ActivePointList;
extract(l, s, eps, ActivePointList);
std::ofstream f(filename.c_str());
f << "# vtk DataFile Version 2.0" << std::endl;
f << D << "D Surface" << std::endl;
f << "ASCII" << std::endl;
f << "DATASET UNSTRUCTURED_GRID" << std::endl;
f << "POINTS " << s.Nodes.size() << " float" << std::endl;
//!print positions
for (unsigned int i=0;i<s.Nodes.size();i++) {
for (int j=0;j<D;j++) f << static_cast<float>(s.Nodes[i][j]) << " ";
if (D==2) f << "0. ";
f<< std::endl;
}
f << "CELLS " << s.Elements.size() << " " << ((D+1)*s.Elements.size()) << std::endl;
for (unsigned int i=0;i<s.Elements.size();i++) {
f << D << " ";
for (int j=0;j<D;j++) f<< s.Elements[i][j] << " ";
f << std::endl;
}
f << "CELL_TYPES " << s.Elements.size() << std::endl;
for (unsigned int i=0;i<s.Elements.size();i++) {
f<< ((D==3)?"5":"3") << std::endl;
}
//output data
f << "POINT_DATA " << s.Nodes.size() << std::endl;
for (int k=0;k<Data.number_of_series();++k) {
if (Data.get_series_output(k)) {
f << "SCALARS " << Data.get_series_label(k) << " " << Data.get_series_type(k) << " 1" << std::endl;
f << "LOOKUP_TABLE default" << std::endl;
for (unsigned int i=0;i<s.Nodes.size();i++) {
f << Data.get_series_data(ActivePointList[i],k) << std::endl;
}
}
}
f.close();
}
示例2: write_explicit_surface_opendx
void write_explicit_surface_opendx(const levelset<GridTraitsType, LevelSetTraitsType>& l, const std::string& filename, const DataType& Data, typename LevelSetTraitsType::value_type eps=0.) {
//this function etracts the surface using the marching cubes algorithm and writes it to the specified file using OpenDX-file format
//the parameter eps is forwarded to the surface extraction function
const int D=GridTraitsType::dimensions;
Surface<D> s;
typename GetActivePointType<typename LevelSetTraitsType::size_type, DataType>::result ActivePointList;
extract(l, s, eps, ActivePointList);
std::ofstream f(filename.c_str());
//!print positions
f<< "object \"positions\" class array type float rank 1 shape " << D << " items "<< s.Nodes.size() <<" data follows" << std::endl;
for (unsigned int i=0;i<s.Nodes.size();i++) {
for (int j=0;j<D;j++) f << static_cast<float>(s.Nodes[i][j]) << " ";
f<< std::endl;
}
//! print connections
f << "object \"connections\" class array type int rank 1 shape " << D << " items "<< s.Elements.size() <<" data follows" << std::endl;
for (unsigned int i=0;i<s.Elements.size();i++) {
for (int j=0;j<D;j++) f<< s.Elements[i][j] << " ";
f << std::endl;
}
if (D==2)
f << "attribute \"element type\" string \"lines\"" << std::endl;
else if (D==3)
f << "attribute \"element type\" string \"triangles\"" << std::endl;
f << "attribute \"ref\" string \"positions\"" << std::endl;
//output data
for (int k=0;k<Data.number_of_series();++k) {
if (Data.get_series_output(k)) {
f << "object \"" << Data.get_series_label(k) << "_data\" class array type " << Data.get_series_type(k) << " rank 0 items " << s.Nodes.size() << " data follows" << std::endl;
for (unsigned int i=0;i<s.Nodes.size();i++) {
f << Data.get_series_data(ActivePointList[i],k) << std::endl;
}
f << "attribute \"dep\" string \"positions\"" << std::endl;
}
}
//! print profile
f << "object \"profile\" class field" << std::endl;
f << " component \"positions\" value \"positions\"" << std::endl;
f << " component \"connections\" value \"connections\"" << std::endl;
for (int k=0;k<Data.number_of_series();++k) {
if (Data.get_series_output(k)) {
f << "object \""<< Data.get_series_label(k) << "\" class field" << std::endl;
f << " component \"positions\" value \"positions\"" << std::endl;
f << " component \"connections\" value \"connections\"" << std::endl;
f << " component \"data\" value \"" << Data.get_series_label(k) << "_data\"" << std::endl;
}
}
f << "end" << std::endl;
f.close();
}