dune-vtk 2.12
Loading...
Searching...
No Matches
parallelgridcreator.hh
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string>
5#include <vector>
6
7#include <dune/grid/common/gridfactory.hh>
13
14namespace Dune::Vtk
15{
16 // create a distributed grid in parallel. Currently only supported by ALUGrid
17 template <class Grid>
19 : public DerivedGridCreator<ContinuousGridCreator<Grid>, ParallelGridCreator<Grid>>
20 {
25
26 // The GridFactory must support insertion of global vertex IDs
28
29 public:
30
31 using Super::Super;
32
34 std::vector<std::uint64_t> const& point_ids)
35 {
36 assert(point_ids.size() == points.size());
37 for (std::size_t i = 0; i < points.size(); ++i)
38 this->factory().insertVertex(points[i], VertexId(point_ids[i]));
39 }
40
42 {
43 if (int(pieces.size()) == this->comm().size()) {
44 VtkReader<Grid, Self> pieceReader(this->factory());
45 pieceReader.read(pieces[this->comm().rank()], true);
46 }
47 }
48 };
49
50 // deduction guides
51 template <class Grid>
54
55} // end namespace Dune::Vtk
Definition writer.hh:16
typename Impl::VertexIdType< GF >::type VertexId_t
Definition gridcreators/common.hh:20
typename detected_or< nonesuch, Op, Args... >::value_t is_detected
virtual void insertVertex(const FieldVector< ctype, dimworld > &pos)
GridFactory< Grid > & factory()
Return the associated GridFactory.
Definition gridcreatorinterface.hh:75
auto comm() const
Return the mpi collective communicator.
Definition gridcreatorinterface.hh:87
Definition derivedgridcreator.hh:17
typename Super::GlobalCoordinate GlobalCoordinate
Definition derivedgridcreator.hh:21
GridCreatorInterface< typename GridCreator::Grid, Derived > Super
Definition derivedgridcreator.hh:19
Definition parallelgridcreator.hh:20
void insertPiecesImpl(std::vector< std::string > const &pieces)
Definition parallelgridcreator.hh:41
typename Super::GlobalCoordinate GlobalCoordinate
Definition parallelgridcreator.hh:23
void insertVerticesImpl(std::vector< GlobalCoordinate > const &points, std::vector< std::uint64_t > const &point_ids)
Definition parallelgridcreator.hh:33
VertexId_t< GridFactory< Grid > > VertexId
Definition parallelgridcreator.hh:24
File-Reader for Vtk unstructured .vtu files.
Definition vtkreader.hh:37
void read(std::string const &filename, bool fillCreator=true)
Read the grid from file with filename into the GridCreator.
Definition vtkreader.impl.hh:20
T size(T... args)