21template <
class GV,
class DC>
22void StructuredGridWriter<GV,DC>
26 this->writeHeader(out,
"StructuredGrid");
28 auto const& wholeExtent = dataCollector_->wholeExtent();
29 out <<
"<StructuredGrid WholeExtent=\"" <<
Vtk::join(wholeExtent.begin(), wholeExtent.end()) <<
"\">\n";
31 dataCollector_->writeLocalPiece([&out](
auto const& extent) {
32 out <<
"<Piece Extent=\"" <<
Vtk::join(extent.begin(), extent.end()) <<
"\">\n";
37 this->writePoints(out, offsets);
41 out <<
"<PointData" << this->getNames(pointData_) <<
">\n";
42 for (
auto const& v : pointData_)
43 this->writeData(out, offsets, v, Super::POINT_DATA);
44 out <<
"</PointData>\n";
47 out <<
"<CellData" << this->getNames(cellData_) <<
">\n";
48 for (
auto const& v : cellData_)
49 this->writeData(out, offsets, v, Super::CELL_DATA);
50 out <<
"</CellData>\n";
53 out <<
"</StructuredGrid>\n";
55 this->writeAppended(out, offsets);
60template <
class GV,
class DC>
61void StructuredGridWriter<GV,DC>
64 this->writeHeader(out,
"PStructuredGrid");
66 auto const& wholeExtent = dataCollector_->wholeExtent();
67 out <<
"<PStructuredGrid"
68 <<
" GhostLevel=\"" << dataCollector_->ghostLevel() <<
"\""
69 <<
" WholeExtent=\"" <<
Vtk::join(wholeExtent.begin(), wholeExtent.end()) <<
"\""
75 <<
" type=\"" <<
to_string(datatype_) <<
"\""
76 <<
" NumberOfComponents=\"3\""
78 out <<
"</PPoints>\n";
81 out <<
"<PPointData" << this->getNames(pointData_) <<
">\n";
82 for (
auto const& v : pointData_) {
84 <<
" Name=\"" << v.name() <<
"\""
85 <<
" type=\"" <<
to_string(v.dataType()) <<
"\""
86 <<
" NumberOfComponents=\"" << v.numComponents() <<
"\""
89 out <<
"</PPointData>\n";
92 out <<
"<PCellData" << this->getNames(cellData_) <<
">\n";
93 for (
auto const& v : cellData_) {
95 <<
" Name=\"" << v.name() <<
"\""
96 <<
" type=\"" <<
to_string(v.dataType()) <<
"\""
97 <<
" NumberOfComponents=\"" << v.numComponents() <<
"\""
100 out <<
"</PCellData>\n";
103 dataCollector_->writePieces([&out,pfilename,ext=this->fileExtension()](
int p,
auto const& extent,
bool write_extent)
106 out <<
"<Piece Source=\"" << piece_source <<
"\"";
108 out <<
" Extent=\"" <<
Vtk::join(extent.begin(), extent.end()) <<
"\"";
112 out <<
"</PStructuredGrid>\n";
117template <
class GV,
class DC>
118void StructuredGridWriter<GV,DC>
124 Vtk::mapDataTypes<std::is_floating_point, std::is_integral>(datatype_, headertype_,
125 [&](
auto f,
auto h) {
126 using F =
typename decltype(f)::type;
127 using H =
typename decltype(h)::type;
128 blocks.
push_back(this->
template writeValuesAppended<H>(out, dataCollector_->template points<F>()));
Definition datacollector.hh:19
constexpr bool is_a(E a, Integer b)
Definition enum.hh:11
std::string to_string(Vtk::FormatTypes)
Definition types.cc:13
std::string join(InputIter first, InputIter end, std::string sep=" ")
Join all entries in the range [first,end) into a single string separated by sep
Definition string.hh:111