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

#include <dune/grid/common/grid.hh>
#include <dune/curvedsurfacegrid/capabilities.hh>
#include <dune/curvedsurfacegrid/entity.hh>
#include <dune/curvedsurfacegrid/entityseed.hh>
10
//#include <dune/curvedsurfacegrid/geometry.hh>
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
11
12
13
14
15
16
17
#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>

18
19
#include <dune/curvedgeometry/curvedgeometry.hh>

Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
namespace Dune
{

  /** \brief namespace containing the implementations of CurvedSurfaceGrid
   *  \ingroup crvsrf
   */
  namespace crvsrf
  {

    // ExportParams
    // ------------

    template< class HG, class CF >
    class ExportParams
    {
      static const bool isCoordFunction = GeoGrid::isCoordFunctionInterface< typename CF::Interface >::value;
      static_assert(isCoordFunction, "Invalid CoordFunction.");

    public:
      typedef HG HostGrid;
      typedef CF CoordFunction;
    };



    // GridFamily
    // ----------

48
    template< class HG, class CF, int order, class Allocator >
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
49
50
51
52
    struct GridFamily
    {
      struct Traits
      {
53
        typedef CurvedSurfaceGrid< HG, CF, order, Allocator > Grid;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

        typedef HG HostGrid;
        typedef CF CoordFunction;

        typedef typename HostGrid::ctype ctype;

        static const int dimension = HostGrid::dimension;
        static const int dimensionworld = CoordFunction::dimRange;

        typedef Dune::Intersection< const Grid, crvsrf::Intersection< const Grid, typename HostGrid::LeafIntersection > > LeafIntersection;
        typedef Dune::Intersection< const Grid, crvsrf::Intersection< const Grid, typename HostGrid::LevelIntersection > > LevelIntersection;

        typedef Dune::IntersectionIterator
        < const Grid, crvsrf::IntersectionIterator< const Grid, typename HostGrid::LeafIntersectionIterator >, crvsrf::Intersection< const Grid, typename HostGrid::LeafIntersection > >
        LeafIntersectionIterator;
        typedef Dune::IntersectionIterator
        < const Grid, crvsrf::IntersectionIterator< const Grid, typename HostGrid::LevelIntersectionIterator >, crvsrf::Intersection< const Grid, typename HostGrid::LevelIntersection > >
        LevelIntersectionIterator;

        typedef Dune::EntityIterator< 0, const Grid, crvsrf::HierarchicIterator< const Grid > >
        HierarchicIterator;

        template< int codim >
        struct Codim
        {
79
80
81
82
83
          template <int mydim, int cdim, class GridImpl>
          using GeometryImplTemplate = Dune::LagrangeCurvedGeometry<ctype,mydim,cdim,order>;

          typedef GeometryImplTemplate< dimension-codim, dimensionworld, const Grid > GeometryImpl;
          typedef Dune::Geometry< dimension-codim, dimensionworld, const Grid, GeometryImplTemplate > Geometry;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
          typedef typename HostGrid::template Codim< codim >::LocalGeometry LocalGeometry;

          typedef crvsrf::Entity< codim, dimension, const Grid > EntityImpl;
          typedef Dune::Entity< codim, dimension, const Grid, crvsrf::Entity > Entity;

          typedef Dune::EntitySeed< const Grid, crvsrf::EntitySeed< codim, const Grid > > EntitySeed;

          template< PartitionIteratorType pitype >
          struct Partition
          {
            typedef crvsrf::Iterator< typename HostGrid::LeafGridView, codim, pitype, const Grid > LeafIteratorImp;
            typedef Dune::EntityIterator< codim, const Grid, LeafIteratorImp > LeafIterator;

            typedef crvsrf::Iterator< typename HostGrid::LevelGridView, codim, pitype, const Grid > LevelIteratorImp;
            typedef Dune::EntityIterator< codim, const Grid, LevelIteratorImp > LevelIterator;
          };

          typedef typename Partition< All_Partition >::LeafIterator LeafIterator;
          typedef typename Partition< All_Partition >::LevelIterator LevelIterator;
        };

        typedef crvsrf::IndexSet< const Grid, typename HostGrid::Traits::LeafIndexSet > LeafIndexSet;
        typedef crvsrf::IndexSet< const Grid, typename HostGrid::Traits::LevelIndexSet > LevelIndexSet;

        typedef crvsrf::IdSet< const Grid, typename HostGrid::Traits::GlobalIdSet >
        GlobalIdSet;
        typedef crvsrf::IdSet< const Grid, typename HostGrid::Traits::LocalIdSet >
        LocalIdSet;

        typedef typename HostGrid::Traits::CollectiveCommunication CollectiveCommunication;

115
116
        typedef Dune::GridView< crvsrf::GridViewTraits< typename HostGrid::LeafGridView, CoordFunction, order,  Allocator > > LeafGridView;
        typedef Dune::GridView< crvsrf::GridViewTraits< typename HostGrid::LevelGridView, CoordFunction, order, Allocator > > LevelGridView;
Stenger, Florian's avatar
v0.1.0  
Stenger, Florian committed
117
118
119
120
121
122
123
124
      };
    };

  } // namespace crvsrf

} // namespace Dune

#endif // #ifndef DUNE_CRVSRF_GRIDFAMILY_HH