8 #include <dune/common/exceptions.hh>
9 #include <dune/common/hybridutilities.hh>
10 #include <dune/grid/common/gridfactory.hh>
31 template <
class T,
int N>
34 for (
int i = 0; i < N; ++i) {
35 if (std::abs(lhs[i] - rhs[i]) < std::numeric_limits<T>::epsilon())
37 return lhs[i] < rhs[i];
47 std::vector<std::uint64_t>
const& )
50 uniquePoints_.clear();
53 for (
auto const& p : points) {
54 auto b = uniquePoints_.emplace(std::make_pair(p,idx));
63 std::vector<std::int64_t>
const& offsets,
64 std::vector<std::int64_t>
const& connectivity)
66 assert(points_ !=
nullptr);
68 for (std::size_t i = 0; i < types.size(); ++i) {
72 int nNodes = offsets[i] - (i == 0 ? 0 : offsets[i-1]);
74 std::vector<unsigned int> vtk_cell; vtk_cell.reserve(nNodes);
75 for (
int j = 0; j < nNodes; ++j) {
76 std::size_t v_j = connectivity[idx++];
77 std::size_t new_idx = uniquePoints_[(*points_)[v_j]];
78 vtk_cell.push_back(new_idx);
81 if (cellType.noPermutation()) {
82 factory().insertElement(type,vtk_cell);
85 std::vector<unsigned int> cell(nNodes);
86 for (
int j = 0; j < nNodes; ++j)
87 cell[j] = vtk_cell[cellType.permutation(j)];
88 factory().insertElement(type,cell);
94 std::vector<GlobalCoordinate>
const* points_ =
nullptr;
95 std::map<GlobalCoordinate, std::size_t, CoordLess> uniquePoints_;
Definition: datacollectorinterface.hh:9
DiscontinuousGridCreator(GridFactory< Grid > &) -> DiscontinuousGridCreator< Grid >
GeometryType to_geometry(std::uint8_t cell)
Definition: types.cc:145
Definition: function.hh:17
Base class for grid creators in a CRTP style.
Definition: gridcreatorinterface.hh:25
typename Grid::template Codim< 0 >::Entity::Geometry::GlobalCoordinate GlobalCoordinate
Definition: gridcreatorinterface.hh:28
GridFactory< Grid > & factory()
Return the associated GridFactory.
Definition: gridcreatorinterface.hh:77
Definition: discontinuousgridcreator.hh:24
void insertElementsImpl(std::vector< std::uint8_t > const &types, std::vector< std::int64_t > const &offsets, std::vector< std::int64_t > const &connectivity)
Definition: discontinuousgridcreator.hh:62
void insertVerticesImpl(std::vector< GlobalCoordinate > const &points, std::vector< std::uint64_t > const &)
Definition: discontinuousgridcreator.hh:46
typename Super::GlobalCoordinate GlobalCoordinate
Definition: discontinuousgridcreator.hh:27
GridFactory< Grid > & factory()
Return the associated GridFactory.
Definition: gridcreatorinterface.hh:77
Definition: discontinuousgridcreator.hh:30
bool operator()(FieldVector< T, N > const &lhs, FieldVector< T, N > const &rhs) const
Definition: discontinuousgridcreator.hh:32
Mapping of Dune geometry types to VTK cell types.
Definition: types.hh:191