#pragma once #include #include #include #include #include #include #include #include namespace Dune { namespace Vtk { // create a distributed grid in parallel. Currently only supported by ALUGrid template struct ParallelGridCreator : public DerivedGridCreator, ParallelGridCreator> { using Self = ParallelGridCreator; using Super = DerivedGridCreator, Self>; using GlobalCoordinate = typename Super::GlobalCoordinate; using VertexId = VertexId_t>; // The GridFactory must support insertion of global vertex IDs static_assert(Std::is_detected, GlobalCoordinate, VertexId>{}, ""); public: using Super::Super; void insertVerticesImpl (std::vector const& points, std::vector const& point_ids) { assert(point_ids.size() == points.size()); for (std::size_t i = 0; i < points.size(); ++i) this->factory().insertVertex(points[i], VertexId(point_ids[i])); } void insertPiecesImpl (std::vector const& pieces) { if (int(pieces.size()) == this->comm().size()) { VtkReader pieceReader(this->factory()); pieceReader.read(pieces[this->comm().rank()], true); } } }; // deduction guides template ParallelGridCreator(GridFactory&) -> ParallelGridCreator; } // end namespace Vtk } // end namespace Dune