dune-fem  2.4.1-rc
combinedspace/combineddiscretefunctionspace.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_COMBINEDDISCRETFUNCTIONSPACE_HH
2 #define DUNE_FEM_COMBINEDDISCRETFUNCTIONSPACE_HH
3 
4 #include <algorithm>
5 
6 #include <dune/common/math.hh>
7 #include <dune/common/typetraits.hh>
8 #include <dune/grid/common/grid.hh>
9 
11 
12 
13 namespace Dune
14 {
15 
16  namespace Fem
17  {
18 
32  template< class DFSpace1, class DFSpace2 >
34  : public TupleDiscreteFunctionSpace< DFSpace1, DFSpace2 >
35  {
38 
39  public:
41  typedef DFSpace1 DiscreteFunctionSpaceType1;
42  typedef DFSpace2 DiscreteFunctionSpaceType2;
43 
45  enum { polynomialOrder1 = DiscreteFunctionSpaceType1::polynomialOrder,
46  polynomialOrder2 = DiscreteFunctionSpaceType2::polynomialOrder,
48 
49  template< int newDimRange >
51  {
53  typedef typename ThisType::template ToNewFunctionSpace< NewFunctionSpaceType > :: Type Type;
54  };
55 
56  template< class NewFunctionSpace >
58  {
59  typedef typename std::conditional< (NewFunctionSpace::dimRange == 1),
60  typename DiscreteFunctionSpaceType1::template ToNewDimRange< 1 >::Type,
62  >::type Type;
63  };
64 
65  // type of gridPart
67 
74  explicit CombinedDiscreteFunctionSpace ( GridPartType &gridPart,
75  const InterfaceType commInterface = InteriorBorder_All_Interface,
76  const CommunicationDirection commDirection = ForwardCommunication )
77  DUNE_DEPRECATED_MSG( "CombinedDiscreteFunctionSpace is Deprecated, us the more general TupleDiscreteFunctionSpace instead." )
78  : BaseType( gridPart, commInterface, commDirection )
79  {}
80 
81  // forbid the copy constructor
82  CombinedDiscreteFunctionSpace ( const ThisType & ) = delete;
83 
87  const DiscreteFunctionSpaceType1 &space1 () const
88  {
89  return BaseType::template subDiscreteFunctionSpace< 0 >();
90  }
91 
95  const DiscreteFunctionSpaceType2 &space2 () const
96  {
97  return BaseType::template subDiscreteFunctionSpace< 1 >();
98  }
99  };
100 
101 
103  template< class DFunctionSpaceImp1,
104  class DFunctionSpaceImp2,
105  class NewFunctionSpace >
107  DFunctionSpaceImp1, DFunctionSpaceImp2 >, NewFunctionSpace >
108  {
109  private:
110  static const int dimRange1 = DFunctionSpaceImp1::dimRange;
111  static const int dimRange2 = DFunctionSpaceImp2::dimRange;
112  static const int newDimRange = NewFunctionSpace::dimRange;
113 
114  static const int newDimRange1 = (newDimRange * dimRange1)/( dimRange1 + dimRange2 );
115  static const int newDimRange2 = (newDimRange * dimRange2)/( dimRange1 + dimRange2 );
116 
118  typedef typename DFunctionSpaceImp1::template ToNewDimRange< newDimRange1 >::Type Type1;
119  typedef typename DFunctionSpaceImp2::template ToNewDimRange< newDimRange2 >::Type Type2;
120 
121  public:
122  typedef typename conditional< (newDimRange == 1), Type1,
124  };
125 
126 
127  // DefaultLocalRestrictProlong for CombinedDiscreteFunctionSpace
128 
129  template< class SP1, class SP2 >
131  : public TupleLocalRestrictProlong< SP1, SP2 >
132  {
135 
136  public:
138  : BaseType( space.space1(), space.space2() )
139  {}
140  };
141 
142  } // namespace Fem
143 
144 } // namespace Dune
145 
146 #endif // #ifndef DUNE_FEM_COMBINDEDDISCRETFUNCTIONSPACE_HH
DFSpaceIdentifier type() const
get the type of this discrete function space
Definition: combinedspace/generic.hh:128
Definition: combinedspace/combineddiscretefunctionspace.hh:130
Definition: tuplespace.hh:29
conditional< (newDimRange==1), Type1, CombinedDiscreteFunctionSpace< Type1, Type2 > >::type Type
Definition: combinedspace/combineddiscretefunctionspace.hh:123
Traits::GridPartType GridPartType
Definition: tuplespace.hh:236
ThisType::template ToNewFunctionSpace< NewFunctionSpaceType >::Type Type
Definition: combinedspace/combineddiscretefunctionspace.hh:53
Definition: combinedspace/combineddiscretefunctionspace.hh:47
Definition: discretefunctionspace.hh:126
Definition: combinedspace/combineddiscretefunctionspace.hh:50
DFSpace1 DiscreteFunctionSpaceType1
types of Discrete Subspace
Definition: combinedspace/combineddiscretefunctionspace.hh:41
ToNewDimRangeFunctionSpace< typename BaseType::FunctionSpaceType, newDimRange >::Type NewFunctionSpaceType
Definition: combinedspace/combineddiscretefunctionspace.hh:52
Combined discrete function space.
Definition: combinedspace/combineddiscretefunctionspace.hh:33
const DiscreteFunctionSpaceType1 & space1() const
obtain the first subspace
Definition: combinedspace/combineddiscretefunctionspace.hh:87
Definition: combinedspace/combineddiscretefunctionspace.hh:57
DFSpace2 DiscreteFunctionSpaceType2
Definition: combinedspace/combineddiscretefunctionspace.hh:42
CombinedDiscreteFunctionSpace(GridPartType &gridPart, const InterfaceType commInterface=InteriorBorder_All_Interface, const CommunicationDirection commDirection=ForwardCommunication)
constructor
Definition: combinedspace/combineddiscretefunctionspace.hh:74
const DiscreteFunctionSpaceType2 & space2() const
obtain the second subspace
Definition: combinedspace/combineddiscretefunctionspace.hh:95
Definition: tuplelocalrestrictprolong.hh:32
Definition: coordinate.hh:4
Definition: combinedspace/combineddiscretefunctionspace.hh:46
std::conditional< (NewFunctionSpace::dimRange==1), typename DiscreteFunctionSpaceType1::template ToNewDimRange< 1 >::Type, typename DifferentDiscreteFunctionSpace< ThisType, NewFunctionSpace >::Type >::type Type
Definition: combinedspace/combineddiscretefunctionspace.hh:62
Definition: combinedspace/combineddiscretefunctionspace.hh:45
BaseType::GridPartType GridPartType
Definition: combinedspace/combineddiscretefunctionspace.hh:66
Definition: common/localrestrictprolong.hh:16
DefaultLocalRestrictProlong(const CombinedDiscreteFunctionSpace< SP1, SP2 > &space)
Definition: combinedspace/combineddiscretefunctionspace.hh:137
convert functions space to space with new dim range
Definition: functionspace.hh:246