gridfamily.hh 4.58 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

#include <dune/grid/common/grid.hh>
Praetorius, Simon's avatar
Praetorius, Simon committed
7
#include <dune/curvedgeometry/curvedgeometry.hh>
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <dune/curvedsurfacegrid/capabilities.hh>
#include <dune/curvedsurfacegrid/entity.hh>
#include <dune/curvedsurfacegrid/entityseed.hh>
#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>

namespace Dune
{

  /** \brief namespace containing the implementations of CurvedSurfaceGrid
Praetorius, Simon's avatar
Praetorius, Simon committed
22
   *  \ingroup CurvedGeo
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
23
   */
Praetorius, Simon's avatar
Praetorius, Simon committed
24
  namespace CGeo
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
25
26
27
28
  {
    // GridFamily
    // ----------

29
    template< class HG, class CF, int order, class Allocator >
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
30
31
32
33
    struct GridFamily
    {
      struct Traits
      {
34
        using Grid = CurvedSurfaceGrid<HG, CF, order, Allocator>;
Praetorius, Simon's avatar
Praetorius, Simon committed
35
        using HostGrid = HG;
36
        using CoordFunction = CF;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
37

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

40
41
        static const int dimension = HostGrid::dimension;
        static const int dimensionworld = CoordFunction::dimRange;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
42

43
44
45
46
        using LeafIntersection
          = Dune::Intersection<const Grid, CGeo::Intersection<const Grid, typename HostGrid::LeafIntersection>>;
        using LevelIntersection
          = Dune::Intersection<const Grid, CGeo::Intersection<const Grid, typename HostGrid::LevelIntersection>>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
47

Praetorius, Simon's avatar
Praetorius, Simon committed
48
49
50
51
        using LeafIntersectionIterator
          = Dune::IntersectionIterator<const Grid, CGeo::IntersectionIterator<const Grid, typename HostGrid::LeafIntersectionIterator>, CGeo::Intersection<const Grid, typename HostGrid::LeafIntersection> >;
        using LevelIntersectionIterator
          = Dune::IntersectionIterator<const Grid, CGeo::IntersectionIterator<const Grid, typename HostGrid::LevelIntersectionIterator >, CGeo::Intersection<const Grid, typename HostGrid::LevelIntersection> >;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
52

53
54
        using HierarchicIterator
          = Dune::EntityIterator<0, const Grid, CGeo::HierarchicIterator<const Grid>>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
55
56
57
58

        template< int codim >
        struct Codim
        {
Praetorius, Simon's avatar
Praetorius, Simon committed
59
          template < int mydim, int cdim, class GridImpl >
60
61
          using GeometryImplTemplate = Dune::LagrangeCurvedGeometry<ctype,mydim,cdim,order>;

Praetorius, Simon's avatar
Praetorius, Simon committed
62
63
          // geometry types
          using GeometryImpl = GeometryImplTemplate<dimension-codim, dimensionworld, const Grid>;
64
65
          using Geometry
            = Dune::Geometry<dimension-codim, dimensionworld, const Grid, GeometryImplTemplate>;
Praetorius, Simon's avatar
Praetorius, Simon committed
66
          using LocalGeometry = typename HostGrid::template Codim<codim>::LocalGeometry;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
67

Praetorius, Simon's avatar
Praetorius, Simon committed
68
69
70
          // entity types
          using EntityImpl = CGeo::Entity<codim, dimension, const Grid>;
          using Entity = Dune::Entity<codim, dimension, const Grid, CGeo::Entity>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
71

Praetorius, Simon's avatar
Praetorius, Simon committed
72
          using EntitySeed = Dune::EntitySeed<const Grid, CGeo::EntitySeed<codim, const Grid> >;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
73
74
75
76

          template< PartitionIteratorType pitype >
          struct Partition
          {
77
78
            using LeafIteratorImp
              = CGeo::Iterator<typename HostGrid::LeafGridView, codim, pitype, const Grid>;
Praetorius, Simon's avatar
Praetorius, Simon committed
79
            using LeafIterator = Dune::EntityIterator<codim, const Grid, LeafIteratorImp>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
80

81
82
            using LevelIteratorImp
              = CGeo::Iterator<typename HostGrid::LevelGridView, codim, pitype, const Grid>;
Praetorius, Simon's avatar
Praetorius, Simon committed
83
            using LevelIterator = Dune::EntityIterator<codim, const Grid, LevelIteratorImp>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
84
85
          };

Praetorius, Simon's avatar
Praetorius, Simon committed
86
87
          using LeafIterator = typename Partition< All_Partition >::LeafIterator;
          using LevelIterator = typename Partition< All_Partition >::LevelIterator;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
88
89
        };

Praetorius, Simon's avatar
Praetorius, Simon committed
90
91
92
        // index-sets
        using LeafIndexSet = CGeo::IndexSet<const Grid, typename HostGrid::Traits::LeafIndexSet>;
        using LevelIndexSet = CGeo::IndexSet<const Grid, typename HostGrid::Traits::LevelIndexSet>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
93

Praetorius, Simon's avatar
Praetorius, Simon committed
94
95
96
        // id-sets
        using GlobalIdSet = CGeo::IdSet<const Grid, typename HostGrid::Traits::GlobalIdSet>;
        using LocalIdSet = CGeo::IdSet<const Grid, typename HostGrid::Traits::LocalIdSet>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
97

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

Praetorius, Simon's avatar
Praetorius, Simon committed
100
        // grid views
101
102
103
104
        using LeafGridView
          = Dune::GridView<CGeo::GridViewTraits<typename HostGrid::LeafGridView, CF, order, Allocator>>;
        using LevelGridView
          = Dune::GridView<CGeo::GridViewTraits<typename HostGrid::LevelGridView, CF, order, Allocator>>;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
105
106
107
      };
    };

Praetorius, Simon's avatar
Praetorius, Simon committed
108
  } // namespace CGeo
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
109
110
} // namespace Dune

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