dune-fem  2.4.1-rc
temporary.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_FUNCTION_LOCALFUNCTION_TEMPORARY_HH
2 #define DUNE_FEM_FUNCTION_LOCALFUNCTION_TEMPORARY_HH
3 
4 #include <dune/common/dynvector.hh>
6 
7 
8 namespace Dune
9 {
10 
11  namespace Fem
12  {
13 
14  // internal forward declarations
15  // -----------------------------
16 
17  template< class DiscreteFunctionSpace, class DoFVector >
19 
20  template< class DiscreteFunctionSpace, class Dof >
22 
23 
36  template< class DiscreteFunctionSpace, class DofVector >
38  : public LocalFunction < typename DiscreteFunctionSpace :: BasisFunctionSetType, DofVector >
39  {
42 
43  public:
46 
49 
52 
55 
56  /* \copydoc Dune::Fem::LocalFunction :: localDofVector */
58 
73  explicit BasicTemporaryLocalFunction ( const DiscreteFunctionSpaceType &dfSpace,
74  const LocalDofVectorType &dofVector = LocalDofVectorType() )
75  : BaseType( dofVector ),
76  dfSpace_( dfSpace )
77  {
78  localDofVector().reserve( DiscreteFunctionSpaceType::localBlockSize * dfSpace_.blockMapper().maxNumDofs() );
79  }
80 
94  BasicTemporaryLocalFunction ( const DiscreteFunctionSpaceType &dfSpace, const EntityType &entity,
95  const LocalDofVectorType &dofVector = LocalDofVectorType() )
96  : BaseType( dofVector ),
97  dfSpace_( dfSpace )
98  {
99  localDofVector().reserve( DiscreteFunctionSpaceType::localBlockSize * dfSpace_.blockMapper().maxNumDofs() );
100  init( entity );
101  }
102 
115  void init ( const EntityType &entity )
116  {
117  BaseType::init( dfSpace_.basisFunctionSet( entity ) );
118  }
119 
120  protected:
121  const DiscreteFunctionSpaceType &dfSpace_;
122  };
123 
124 
140  template< class DiscreteFunctionSpace, class Dof = typename DiscreteFunctionSpace::RangeFieldType >
142  : public BasicTemporaryLocalFunction< DiscreteFunctionSpace, Dune::DynamicVector< Dof > >
143  {
146 
147  public:
150 
152  typedef typename BaseType :: DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
153 
168  explicit TemporaryLocalFunction ( const DiscreteFunctionSpaceType &dfSpace )
169  : BaseType( dfSpace ) {}
170 
184  TemporaryLocalFunction ( const DiscreteFunctionSpaceType &dfSpace, const EntityType &entity )
185  : BaseType( dfSpace, entity ){}
186  };
187 
188  } // namespace Fem
189 
190 } // namespace Dune
191 
192 #endif // #ifndef DUNE_FEM_FUNCTION_LOCALFUNCTION_TEMPORARY_HH
BaseType::LocalDofVectorType LocalDofVectorType
type of LocalDofVector
Definition: temporary.hh:54
const DiscreteFunctionSpaceType & dfSpace_
Definition: temporary.hh:121
A temporary function carrying values for one entity.
Definition: temporary.hh:21
TemporaryLocalFunction(const DiscreteFunctionSpaceType &dfSpace)
constructor creating a local function without binding it to an entity
Definition: temporary.hh:168
A temporary function carrying values for one entity.
Definition: temporary.hh:18
DiscreteFunctionSpace DiscreteFunctionSpaceType
type of the discrete function space
Definition: temporary.hh:45
BaseType::EntityType EntityType
type of Entity
Definition: temporary.hh:48
interface for local functions
Definition: localfunction.hh:41
void init(const EntityType &entity)
initialize the local function for an entity
Definition: temporary.hh:115
BasisFunctionSetType::EntityType EntityType
type of the entity, the local function lives on is given by the space
Definition: localfunction.hh:59
Definition: coordinate.hh:4
BaseType::BasisFunctionSetType BasisFunctionSetType
type of BasisFunctionSet
Definition: temporary.hh:51
const EntityType & entity() const
obtain the entity, this local function lives on
Definition: localfunction.hh:285
BaseType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of the discrete function space
Definition: temporary.hh:152
BaseType::EntityType EntityType
type of Entity
Definition: temporary.hh:149
LocalDofVector LocalDofVectorType
type of local Dof Vector
Definition: localfunction.hh:50
BasicTemporaryLocalFunction(const DiscreteFunctionSpaceType &dfSpace, const EntityType &entity, const LocalDofVectorType &dofVector=LocalDofVectorType())
constructor creating a local function and binding it to an entity
Definition: temporary.hh:94
void init(const BasisFunctionSetType &basisFunctionSet)
Definition: localfunction.hh:288
BasicTemporaryLocalFunction(const DiscreteFunctionSpaceType &dfSpace, const LocalDofVectorType &dofVector=LocalDofVectorType())
constructor creating a local function without binding it to an entity
Definition: temporary.hh:73
discrete function space
TemporaryLocalFunction(const DiscreteFunctionSpaceType &dfSpace, const EntityType &entity)
constructor creating a local function and binding it to an entity
Definition: temporary.hh:184
Definition: basisfunctionset/basisfunctionset.hh:31
const LocalDofVectorType & localDofVector() const
return const reference to local Dof Vector
Definition: localfunction.hh:386