1#ifndef DUNE_FEM_GRIDPART_COMMON_GRIDPART2GRIDVIEW_HH
2#define DUNE_FEM_GRIDPART_COMMON_GRIDPART2GRIDVIEW_HH
4#warning "This header should not be needed anymore. Remove it from the include list!"
10#include <dune/grid/common/gridenums.hh>
11#include <dune/grid/common/gridview.hh>
16#ifdef USING_DUNE_PYTHON
21 template<
class Gr
id >
22 inline static void addGridModificationListener (
const Grid &grid );
29 template<
class Gr
idPart >
30 class GridPart2GridViewImpl;
33 template<
class Gr
idPart >
34 struct GridPart2GridViewTraits
36 typedef GridPart2GridViewImpl< GridPart > GridViewImp;
38 typedef typename GridPart::GridType Grid;
39 typedef typename GridPart::IndexSetType IndexSet;
40 typedef typename GridPart::IntersectionIteratorType IntersectionIterator;
44 typedef typename GridPart::CommunicationType Communication;
48 :
public Grid::Traits::template Codim< codim >
50 typedef typename GridPart::template Codim< codim >::EntityType Entity;
52 typedef typename GridPart::template Codim< codim >::GeometryType Geometry;
53 typedef typename GridPart::template Codim< codim >::LocalGeometryType LocalGeometry;
55 template< PartitionIteratorType pitype >
58 typedef typename GridPart::template Codim< codim >::template Partition< pitype >::IteratorType Iterator;
61 typedef typename Partition< All_Partition >::Iterator Iterator;
64 static const bool conforming = GridPart::Traits::conforming;
68 template<
class Gr
idPart >
69 class GridPart2GridViewImpl
71 typedef GridPart2GridViewImpl< GridPart > ThisType;
74 typedef typename GridPart::ctype ctype;
76 typedef GridPart GridPartType;
78 typedef GridPart2GridViewTraits< GridPartType > Traits;
81 typedef typename Traits::Grid Grid;
84 typedef typename Traits::IndexSet IndexSet;
87 typedef typename Traits::Intersection Intersection;
90 typedef typename Traits::IntersectionIterator IntersectionIterator;
93 typedef typename Traits::Communication Communication;
98 :
public Traits::template
Codim< codim >
101 enum { conforming = Traits::conforming };
103 enum { dimension = GridPartType::dimension };
104 enum { dimensionworld = GridPartType::dimensionworld };
106 explicit GridPart2GridViewImpl (
const GridPartType &gridPart )
107 : gridPartStorage_(nullptr)
108 , gridPart_( &gridPart )
110 template<
class... Args,
111 std::enable_if_t< std::is_constructible< GridPartType, Args..., ThisType* >::value,
int > = 0 >
112 GridPart2GridViewImpl( Args &&... args )
113 : gridPartStorage_(new GridPartType(
std::forward< Args >( args )..., this) )
114 , gridPart_(gridPartStorage_.
get())
116#ifdef USING_DUNE_PYTHON
118 FemPy::detail::addGridModificationListener( gridPart().grid() );
122 ~GridPart2GridViewImpl()
125 const Grid &grid ()
const
127 return gridPart().grid();
130 const IndexSet &indexSet ()
const
132 return gridPart().indexSet();
135 int size (
int codim )
const
137 return indexSet().size( codim );
140 int size (
const GeometryType &type )
const
142 return indexSet().size( type );
145 template<
class EntityType>
146 bool contains (
const EntityType& e)
const
148 return indexSet().contains(e);
151 template<
int codim >
152 typename Codim< codim >::Iterator begin ()
const
154 return begin< codim, All_Partition >();
157 template<
int codim, PartitionIteratorType pitype >
158 typename Codim< codim >::template Partition< pitype >::Iterator begin ()
const
160 return gridPart().template begin< codim, pitype >();
163 template<
int codim >
164 typename Codim< codim >::Iterator end ()
const
166 return end< codim, All_Partition >();
169 template<
int codim, PartitionIteratorType pitype >
170 typename Codim< codim >::template Partition< pitype >::Iterator end ()
const
172 return gridPart().template end< codim, pitype >();
175 IntersectionIterator ibegin (
const typename Codim< 0 >::Entity &entity )
const
177 return gridPart().ibegin( entity );
180 IntersectionIterator iend (
const typename Codim< 0 >::Entity &entity )
const
182 return gridPart().iend( entity );
185 const Communication &comm ()
const
187 return gridPart().comm();
190 int overlapSize (
int codim )
const
192 DUNE_THROW( NotImplemented,
"Method ghostSize() not implemented yet" );
195 int ghostSize(
int codim )
const
197 DUNE_THROW( NotImplemented,
"Method ghostSize() not implemented yet" );
200 template<
class DataHandleImp,
class DataType >
201 void communicate ( CommDataHandleIF< DataHandleImp, DataType > &data,
205 gridPart().communicate( data, iftype, dir );
208 const GridPartType &gridPart ()
const {
214 std::shared_ptr<GridPartType> gridPartStorage_;
215 const GridPartType *gridPart_;
220 template<
class Gr
idPart >
221 class GridPart2GridView
222 :
public GridView< GridPart2GridViewTraits< GridPart > >
224 typedef GridPart2GridView< GridPart > ThisType;
225 typedef GridView< GridPart2GridViewTraits< GridPart > > BaseType;
227 typedef typename BaseType::GridViewImp GridViewImp;
230 explicit GridPart2GridView (
const GridPart &gridPart )
231 : BaseType( GridViewImp( gridPart ) )
Dune::Intersection< GridImp, IntersectionImp > Intersection
Type of Intersection this IntersectionIterator points to.
Definition: intersectioniterator.hh:111
A few common exception classes.
@ conforming
Output conforming data.
Definition: common.hh:73
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
constexpr std::bool_constant<((II==value)||...)> contains(std::integer_sequence< T, II... >, std::integral_constant< T, value >)
Checks whether or not a given sequence contains a value.
Definition: integersequence.hh:137
constexpr auto get(std::integer_sequence< T, II... >, std::integral_constant< std::size_t, pos >={})
Return the entry at position pos of the given sequence.
Definition: integersequence.hh:22
Codim Structure.
Definition: gridpart2gridview.hh:99