19template <
class GV,
class DC>
20void StructuredGridWriter<GV,DC>
24 this->writeHeader(out,
"StructuredGrid");
26 auto const& wholeExtent = dataCollector_->wholeExtent();
27 out <<
"<StructuredGrid WholeExtent=\"" <<
Vtk::join(wholeExtent.begin(), wholeExtent.end()) <<
"\">\n";
29 dataCollector_->writeLocalPiece([&out](
auto const& extent) {
30 out <<
"<Piece Extent=\"" <<
Vtk::join(extent.begin(), extent.end()) <<
"\">\n";
35 this->writePoints(out, offsets);
39 out <<
"<PointData" << this->getNames(pointData_) <<
">\n";
40 for (
auto const& v : pointData_)
41 this->writeData(out, offsets, v, Super::POINT_DATA);
42 out <<
"</PointData>\n";
45 out <<
"<CellData" << this->getNames(cellData_) <<
">\n";
46 for (
auto const& v : cellData_)
47 this->writeData(out, offsets, v, Super::CELL_DATA);
48 out <<
"</CellData>\n";
51 out <<
"</StructuredGrid>\n";
53 this->writeAppended(out, offsets);
58template <
class GV,
class DC>
59void StructuredGridWriter<GV,DC>
62 this->writeHeader(out,
"PStructuredGrid");
64 auto const& wholeExtent = dataCollector_->wholeExtent();
65 out <<
"<PStructuredGrid"
66 <<
" GhostLevel=\"" << dataCollector_->ghostLevel() <<
"\""
67 <<
" WholeExtent=\"" <<
Vtk::join(wholeExtent.begin(), wholeExtent.end()) <<
"\""
73 <<
" type=\"" <<
to_string(datatype_) <<
"\""
74 <<
" NumberOfComponents=\"3\""
76 out <<
"</PPoints>\n";
79 out <<
"<PPointData" << this->getNames(pointData_) <<
">\n";
80 for (
auto const& v : pointData_) {
82 <<
" Name=\"" << v.name() <<
"\""
83 <<
" type=\"" <<
to_string(v.dataType()) <<
"\""
84 <<
" NumberOfComponents=\"" << v.numComponents() <<
"\""
87 out <<
"</PPointData>\n";
90 out <<
"<PCellData" << this->getNames(cellData_) <<
">\n";
91 for (
auto const& v : cellData_) {
93 <<
" Name=\"" << v.name() <<
"\""
94 <<
" type=\"" <<
to_string(v.dataType()) <<
"\""
95 <<
" NumberOfComponents=\"" << v.numComponents() <<
"\""
98 out <<
"</PCellData>\n";
101 dataCollector_->writePieces([&out,pfilename,ext=this->fileExtension()](
int p,
auto const& extent,
bool write_extent)
104 out <<
"<Piece Source=\"" << piece_source <<
"\"";
106 out <<
" Extent=\"" <<
Vtk::join(extent.begin(), extent.end()) <<
"\"";
110 out <<
"</PStructuredGrid>\n";
115template <
class GV,
class DC>
116void StructuredGridWriter<GV,DC>
122 Vtk::mapDataTypes<std::is_floating_point, std::is_integral>(datatype_, headertype_,
123 [&](
auto f,
auto h) {
124 using F =
typename decltype(f)::type;
125 using H =
typename decltype(h)::type;
126 blocks.
push_back(this->
template writeValuesAppended<H>(out, dataCollector_->template points<F>()));
constexpr bool is_a(E a, Integer b)
Definition enum.hh:9
std::string to_string(Vtk::FormatTypes)
Definition types.cc:11
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:109