gridfamily.hh 5.3 KB
Newer Older
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
1
2
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
Praetorius, Simon's avatar
Praetorius, Simon committed
3
4
#ifndef DUNE_CURVED_SURFACE_GRID_GRIDFAMILY_HH
#define DUNE_CURVED_SURFACE_GRID_GRIDFAMILY_HH
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
5

6
7
#include <type_traits>

Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
8
9
10
11
#include <dune/grid/common/grid.hh>
#include <dune/curvedsurfacegrid/capabilities.hh>
#include <dune/curvedsurfacegrid/entity.hh>
#include <dune/curvedsurfacegrid/entityseed.hh>
12
#include <dune/curvedsurfacegrid/geometry.hh>
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
13
14
15
16
17
18
#include <dune/curvedsurfacegrid/gridview.hh>
#include <dune/curvedsurfacegrid/intersection.hh>
#include <dune/curvedsurfacegrid/intersectioniterator.hh>
#include <dune/curvedsurfacegrid/iterator.hh>
#include <dune/curvedsurfacegrid/idset.hh>
#include <dune/curvedsurfacegrid/indexsets.hh>
19
#include <dune/curvedsurfacegrid/localgeometrywrapper.hh>
20
#include <dune/curvedsurfacegrid/gridfunctions/gridfunction.hh>
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
21
22
23
24
25

namespace Dune
{

  /** \brief namespace containing the implementations of CurvedSurfaceGrid
Praetorius, Simon's avatar
Praetorius, Simon committed
26
   *  \ingroup CurvedGeo
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
27
   */
28
  namespace Curved
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
29
  {
30
31
32
    template< class GF >
    struct DimRange
    {
33
      using EntitySet = typename GF::EntitySet;
34
35
36
      using Range = std::result_of_t<GF(typename EntitySet::GlobalCoordinate)>;
      using RawRange = std::decay_t<Range>;
      static const int value = RawRange::size();
37
38
    };

Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
39
40
41
    // GridFamily
    // ----------

42
    template< class GF, int order >
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
43
44
45
46
    struct GridFamily
    {
      struct Traits
      {
47
        using Grid = CurvedSurfaceGrid<GF,order>;
48
        using HostGrid = GridOf_t<GF>;
49
50

        using GridFunction = GF;
51
        using LocalFunction = std::decay_t<decltype(localFunction(std::declval<GF const&>()))>;
52

Praetorius, Simon's avatar
Praetorius, Simon committed
53
        using ctype = typename HostGrid::ctype;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
54

55
        static const int dimension = HostGrid::dimension;
56
        static const int dimensionworld = DimRange<GridFunction>::value;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
57

58
        using LeafIntersection
59
          = Dune::Intersection<const Grid, Curved::Intersection<const Grid, typename HostGrid::LeafIntersection>>;
60
        using LevelIntersection
61
          = Dune::Intersection<const Grid, Curved::Intersection<const Grid, typename HostGrid::LevelIntersection>>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
62

Praetorius, Simon's avatar
Praetorius, Simon committed
63
        using LeafIntersectionIterator
64
          = Dune::IntersectionIterator<const Grid, Curved::IntersectionIterator<const Grid, typename HostGrid::LeafIntersectionIterator>, Curved::Intersection<const Grid, typename HostGrid::LeafIntersection> >;
Praetorius, Simon's avatar
Praetorius, Simon committed
65
        using LevelIntersectionIterator
66
          = Dune::IntersectionIterator<const Grid, Curved::IntersectionIterator<const Grid, typename HostGrid::LevelIntersectionIterator >, Curved::Intersection<const Grid, typename HostGrid::LevelIntersection> >;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
67

68
        using HierarchicIterator
69
          = Dune::EntityIterator<0, const Grid, Curved::HierarchicIterator<const Grid>>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
70
71
72
73

        template< int codim >
        struct Codim
        {
74
75
          using LocalGeometry = typename HostGrid::template Codim<codim>::LocalGeometry;

76
          using LocalTransformation = std::conditional_t<(codim == 0),
77
            DefaultLocalGeometry<ctype, dimension, dimension>,
78
            Curved::LocalGeometryWrapper<LocalGeometry>>;
79

Praetorius, Simon's avatar
Praetorius, Simon committed
80
          template < int mydim, int cdim, class GridImpl >
81
          using GeometryImplTemplate
82
            = Curved::Geometry<ctype, mydim, cdim, LocalFunction, LocalTransformation, order>;
83

Praetorius, Simon's avatar
Praetorius, Simon committed
84
85
          // geometry types
          using GeometryImpl = GeometryImplTemplate<dimension-codim, dimensionworld, const Grid>;
86
          using Geometry = Dune::Geometry<dimension-codim, dimensionworld, const Grid, GeometryImplTemplate>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
87

Praetorius, Simon's avatar
Praetorius, Simon committed
88
          // entity types
89
90
          using EntityImpl = Curved::Entity<codim, dimension, const Grid>;
          using Entity = Dune::Entity<codim, dimension, const Grid, Curved::Entity>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
91

92
          using EntitySeed = Dune::EntitySeed<const Grid, Curved::EntitySeed<codim, const Grid> >;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
93
94
95
96

          template< PartitionIteratorType pitype >
          struct Partition
          {
97
            using LeafIteratorImp
98
              = Curved::Iterator<typename HostGrid::LeafGridView, codim, pitype, const Grid>;
Praetorius, Simon's avatar
Praetorius, Simon committed
99
            using LeafIterator = Dune::EntityIterator<codim, const Grid, LeafIteratorImp>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
100

101
            using LevelIteratorImp
102
              = Curved::Iterator<typename HostGrid::LevelGridView, codim, pitype, const Grid>;
Praetorius, Simon's avatar
Praetorius, Simon committed
103
            using LevelIterator = Dune::EntityIterator<codim, const Grid, LevelIteratorImp>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
104
105
          };

Praetorius, Simon's avatar
Praetorius, Simon committed
106
107
          using LeafIterator = typename Partition< All_Partition >::LeafIterator;
          using LevelIterator = typename Partition< All_Partition >::LevelIterator;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
108
109
        };

Praetorius, Simon's avatar
Praetorius, Simon committed
110
        // index-sets
111
112
        using LeafIndexSet = Curved::IndexSet<const Grid, typename HostGrid::Traits::LeafIndexSet>;
        using LevelIndexSet = Curved::IndexSet<const Grid, typename HostGrid::Traits::LevelIndexSet>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
113

Praetorius, Simon's avatar
Praetorius, Simon committed
114
        // id-sets
115
116
        using GlobalIdSet = Curved::IdSet<const Grid, typename HostGrid::Traits::GlobalIdSet>;
        using LocalIdSet = Curved::IdSet<const Grid, typename HostGrid::Traits::LocalIdSet>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
117

Praetorius, Simon's avatar
Praetorius, Simon committed
118
        using CollectiveCommunication = typename HostGrid::Traits::CollectiveCommunication;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
119

Praetorius, Simon's avatar
Praetorius, Simon committed
120
        // grid views
121
        using LeafGridView
122
          = Dune::GridView<Curved::GridViewTraits<typename HostGrid::LeafGridView, GF, order>>;
123
        using LevelGridView
124
          = Dune::GridView<Curved::GridViewTraits<typename HostGrid::LevelGridView, GF, order>>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
125
126
127
      };
    };

128
  } // namespace Curved
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
129
130
} // namespace Dune

Praetorius, Simon's avatar
Praetorius, Simon committed
131
#endif // DUNE_CURVED_SURFACE_GRID_GRIDFAMILY_HH