dune-fem  2.8-git
hpdg/anisotropic.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_ANISOTROPIC_HH
2 #define DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_ANISOTROPIC_HH
3 
4 #include <algorithm>
5 #include <utility>
6 
7 #include <dune/grid/common/gridenums.hh>
8 
14 
17 
18 #include "blockmapper.hh"
19 #include "space.hh"
20 
21 namespace Dune
22 {
23 
24  namespace Fem
25  {
26 
27  namespace hpDG
28  {
29 
30  // Internal forward declaration
31  // ----------------------------
32 
33  template< class FunctionSpace, class GridPart, int order, class Storage = Fem::CachingStorage >
34  class AnisotropicDiscontinuousGalerkinSpace;
35 
36 
37 
38 #ifndef DOXYGEN
39 
40  // AnisotropicDiscontinuousGalerkinSpaceTraits
41  // -------------------------------------------
42 
43  template< class FunctionSpace, class GridPart, int order, class Storage >
44  struct AnisotropicDiscontinuousGalerkinSpaceTraits
45  {
46  using DiscreteFunctionSpaceType = hpDG::AnisotropicDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage >;
47 
48  using FunctionSpaceType = FunctionSpace;
49 
50  using GridPartType = GridPart;
51 
52  using BasisFunctionSetsType = hpDG::AnisotropicBasisFunctionSets< FunctionSpaceType, GridPartType, order, Storage >;
53  using BasisFunctionSetType = typename BasisFunctionSetsType::BasisFunctionSetType;
54 
55  static const int codimension = BasisFunctionSetType::EntityType::codimension;
56 
57  using BlockMapperType = hpDG::DiscontinuousGalerkinBlockMapper< GridPartType, BasisFunctionSetsType >;
58  static const int localBlockSize = BasisFunctionSetsType::localBlockSize;
59 
60  typedef Hybrid::IndexRange< int, localBlockSize > LocalBlockIndices;
61 
62  template< class DiscreteFunction, class Operation = Dune::Fem::DFCommunicationOperation::Copy >
63  struct CommDataHandle
64  {
65  using OperationType = Operation;
67  };
68  };
69 
70 #endif // #ifndef DOXYGEN
71 
72 
73 
74  // AnisotropicDiscontinuousGalerkinSpace
75  // --------------------------------
76 
86  template< class FunctionSpace, class GridPart, int order, class Storage >
88  : public hpDG::DiscontinuousGalerkinSpace< AnisotropicDiscontinuousGalerkinSpaceTraits< FunctionSpace, GridPart, order, Storage > >
89  {
91 
92  public:
94  using EntityType = typename BaseType::EntityType;
96  typedef typename BaseType::KeyType KeyType;
97 
99  const Dune::InterfaceType interface = Dune::InteriorBorder_All_Interface,
100  const Dune::CommunicationDirection direction = Dune::ForwardCommunication )
101  : BaseType( gridPart, BasisFunctionSetsType(), defaultKey(), interface, direction )
102  {}
103 
105  const typename BaseType::KeyType key,
106  const Dune::InterfaceType interface = Dune::InteriorBorder_All_Interface,
107  const Dune::CommunicationDirection direction = Dune::ForwardCommunication )
108  : BaseType( gridPart, BasisFunctionSetsType(), key, interface, direction )
109  {}
110 
112  const std::vector<int>& key,
113  const Dune::InterfaceType interface = Dune::InteriorBorder_All_Interface,
114  const Dune::CommunicationDirection direction = Dune::ForwardCommunication )
115  : BaseType( gridPart, BasisFunctionSetsType(), convert(key), interface, direction )
116  {}
117 
118  template <class Function,
119  std::enable_if_t<
120  std::is_arithmetic<
121  decltype(Function(std::declval<const EntityType>()))>::value,int> i=0>
123  const Dune::InterfaceType interface = Dune::InteriorBorder_All_Interface,
124  const Dune::CommunicationDirection direction = Dune::ForwardCommunication )
125  : BaseType( gridPart, BasisFunctionSetsType(), defaultKey(), function, interface, direction )
126  {}
127 
128  private:
129  KeyType convert( const std::vector<int>& v ) const
130  {
131  KeyType key;
132  assert( key.size() == v.size() );
133  for( unsigned int i=0; i<key.size(); ++i )
134  key[ i ] = v[ i ];
135  return key;
136  }
137 
138  static KeyType defaultKey ()
139  {
140  KeyType key;
141  std::fill( key.begin(), key.end(), order );
142  return key;
143  }
144  };
145 
146  } // namespace hpDG
147 
148 
149 
150 #ifndef DOXYGEN
151 
152  // DefaultLocalRestrictProlong
153  // ---------------------------
154 
155  template< class FunctionSpace, class GridPart, int order, class Storage >
156  class DefaultLocalRestrictProlong< hpDG::AnisotropicDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage > >
157  : public DiscontinuousGalerkinLocalRestrictProlong< hpDG::AnisotropicDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage >, false >
158  {
159  using BaseType = DiscontinuousGalerkinLocalRestrictProlong< hpDG::AnisotropicDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage >, false >;
160 
161  public:
162  explicit DefaultLocalRestrictProlong ( const typename BaseType::DiscreteFunctionSpaceType &space )
163  : BaseType( space )
164  {}
165  };
166 
167 
168 #endif //#ifndef DOXYGEN
169 
170  } // namespace Fem
171 
172 } // namespace Dune
173 
174 #endif // #ifndef DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_ANISOTROPIC_HH
Definition: bindguard.hh:11
Abstract class representing a function.
Definition: common/function.hh:50
Default communication handler for discrete functions.
Definition: defaultcommhandler.hh:29
Implementation of an -adaptive discrete function space using anisotropic product Legendre polynomials...
Definition: hpdg/anisotropic.hh:89
AnisotropicDiscontinuousGalerkinSpace(GridPartType &gridPart, const typename BaseType::KeyType key, const Dune::InterfaceType interface=Dune::InteriorBorder_All_Interface, const Dune::CommunicationDirection direction=Dune::ForwardCommunication)
Definition: hpdg/anisotropic.hh:104
typename BaseType::BasisFunctionSetsType BasisFunctionSetsType
Definition: hpdg/anisotropic.hh:95
BaseType::KeyType KeyType
Definition: hpdg/anisotropic.hh:96
AnisotropicDiscontinuousGalerkinSpace(GridPartType &gridPart, const Dune::InterfaceType interface=Dune::InteriorBorder_All_Interface, const Dune::CommunicationDirection direction=Dune::ForwardCommunication)
Definition: hpdg/anisotropic.hh:98
AnisotropicDiscontinuousGalerkinSpace(GridPartType &gridPart, Function function, const Dune::InterfaceType interface=Dune::InteriorBorder_All_Interface, const Dune::CommunicationDirection direction=Dune::ForwardCommunication)
Definition: hpdg/anisotropic.hh:122
typename BaseType::EntityType EntityType
Definition: hpdg/anisotropic.hh:94
AnisotropicDiscontinuousGalerkinSpace(GridPartType &gridPart, const std::vector< int > &key, const Dune::InterfaceType interface=Dune::InteriorBorder_All_Interface, const Dune::CommunicationDirection direction=Dune::ForwardCommunication)
Definition: hpdg/anisotropic.hh:111
typename BaseType::GridPartType GridPartType
Definition: hpdg/anisotropic.hh:93
Generic implementation of a -adaptive discontinuous finite element space.
Definition: hpdg/space.hh:46
typename Traits::BasisFunctionSetsType BasisFunctionSetsType
basis function sets type
Definition: hpdg/space.hh:56
typename BasisFunctionSetsType::KeyType KeyType
key type identifying a basis function set
Definition: hpdg/space.hh:58
const KeyType & key(const EntityType &entity) const
get identifiying basis function set key assigned to given entity
Definition: hpdg/space.hh:231