#pragma once #include #include #include #include #include #include #include #include #include #include #include namespace Dune { template void VtkStructuredGridWriter ::writeSerialFile (std::ofstream& out) const { std::vector offsets; // pos => offset this->writeHeader(out, "StructuredGrid"); auto const& wholeExtent = dataCollector_->wholeExtent(); out << "\n"; dataCollector_->writeLocalPiece([&out](auto const& extent) { out << "\n"; }); // Write point coordinates out << "\n"; this->writePoints(out, offsets); out << "\n"; // Write data associated with grid points out << "getNames(pointData_) << ">\n"; for (auto const& v : pointData_) this->writeData(out, offsets, v, Super::POINT_DATA); out << "\n"; // Write data associated with grid cells out << "getNames(cellData_) << ">\n"; for (auto const& v : cellData_) this->writeData(out, offsets, v, Super::CELL_DATA); out << "\n"; out << "\n"; out << "\n"; this->writeAppended(out, offsets); out << ""; } template void VtkStructuredGridWriter ::writeParallelFile (std::ofstream& out, std::string const& pfilename, int /*size*/) const { this->writeHeader(out, "PStructuredGrid"); auto const& wholeExtent = dataCollector_->wholeExtent(); out << "ghostLevel() << "\"" << " WholeExtent=\"" << Vtk::join(wholeExtent.begin(), wholeExtent.end()) << "\"" << ">\n"; // Write points out << "\n"; out << "\n"; out << "\n"; // Write data associated with grid points out << "getNames(pointData_) << ">\n"; for (auto const& v : pointData_) { out << "\n"; } out << "\n"; // Write data associated with grid cells out << "getNames(cellData_) << ">\n"; for (auto const& v : cellData_) { out << "\n"; } out << "\n"; // Write piece file references dataCollector_->writePieces([&out,pfilename,ext=this->fileExtension()](int p, auto const& extent, bool write_extent) { std::string piece_source = pfilename + "_p" + std::to_string(p) + "." + ext; out << "\n"; }); out << "\n"; out << ""; } template void VtkStructuredGridWriter ::writeGridAppended (std::ofstream& out, std::vector& blocks) const { assert(is_a(format_, Vtk::APPENDED) && "Function should by called only in appended mode!\n"); // write points Vtk::mapDataTypes(datatype_, headertype_, [&](auto f, auto h) { using F = typename decltype(f)::type; using H = typename decltype(h)::type; blocks.push_back(this->template writeValuesAppended(out, dataCollector_->template points())); }); } } // end namespace Dune