dune-grid-glue 2.8.0
Loading...
Searching...
No Matches
merger.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_GRIDGLUE_MERGING_MERGER_HH
4#define DUNE_GRIDGLUE_MERGING_MERGER_HH
5
6#include <vector>
7
8#include <dune/common/fvector.hh>
9#include <dune/geometry/type.hh>
10
12
13namespace Dune {
14namespace GridGlue {
15
23template <class ctype, int grid1Dim, int grid2Dim, int dimworld>
24class Merger
25{
26public:
27
29 typedef Dune::FieldVector<ctype, grid1Dim> Grid1Coords;
30
32 typedef Dune::FieldVector<ctype, grid2Dim> Grid2Coords;
33
35 typedef Dune::FieldVector<ctype, dimworld> WorldCoords;
36
38
52 virtual void build(const std::vector<Dune::FieldVector<ctype,dimworld> >& grid1_coords,
53 const std::vector<unsigned int>& grid1_elements,
54 const std::vector<Dune::GeometryType>& grid1_element_types,
55 const std::vector<Dune::FieldVector<ctype,dimworld> >& grid2_coords,
56 const std::vector<unsigned int>& grid2_elements,
57 const std::vector<Dune::GeometryType>& grid2_element_types) = 0;
58
62 unsigned int nSimplices() const
63 { return intersectionList()->size(); }
64
65 virtual void clear() = 0;
66
72 virtual std::shared_ptr<IntersectionList> intersectionList() const = 0;
73
77 template<int n>
78 unsigned int parents(unsigned int idx) const {
79 return intersectionList()->template parents<n>(idx);
80 }
81
88 template<int n>
89 unsigned int parent(unsigned int idx, unsigned int parId = 0) const
90 {
91 return intersectionList()->template parent<n>(idx, parId);
92 }
93
102 template<int n>
103 auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId = 0) const
104 {
105 return intersectionList()->template corner<n>(idx, corner, parId);
106 }
107
112 unsigned int counter;
113};
114
115} /* namespace GridGlue */
116} /* namespace Dune */
117
118#endif
Definition: gridglue.hh:35
Definition: intersectionlist.hh:132
Abstract base for all classes that take extracted grids and build sets of intersections.
Definition: merger.hh:25
unsigned int parent(unsigned int idx, unsigned int parId=0) const
get index of grid-n's parent simplex for given merged grid simplex
Definition: merger.hh:89
virtual void clear()=0
Dune::FieldVector< ctype, dimworld > WorldCoords
the coordinate type used in this interface
Definition: merger.hh:35
Dune::FieldVector< ctype, grid1Dim > Grid1Coords
the local coordinate type for the grid1 coordinates
Definition: merger.hh:29
unsigned int counter
Counts the number of times the computeIntersection method has been called.
Definition: merger.hh:112
auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId=0) const
get the grid-n parent's simplex local coordinates for a particular merged grid simplex corner (parent...
Definition: merger.hh:103
virtual void build(const std::vector< Dune::FieldVector< ctype, dimworld > > &grid1_coords, const std::vector< unsigned int > &grid1_elements, const std::vector< Dune::GeometryType > &grid1_element_types, const std::vector< Dune::FieldVector< ctype, dimworld > > &grid2_coords, const std::vector< unsigned int > &grid2_elements, const std::vector< Dune::GeometryType > &grid2_element_types)=0
builds the merged grid
unsigned int nSimplices() const
get the number of simplices in the merged grid The indices are then in 0..nSimplices()-1
Definition: merger.hh:62
virtual std::shared_ptr< IntersectionList > intersectionList() const =0
unsigned int parents(unsigned int idx) const
Definition: merger.hh:78
Dune::FieldVector< ctype, grid2Dim > Grid2Coords
the local coordinate type for the grid2 coordinates
Definition: merger.hh:32