DUNE-FEM (unstable)

temporary.hh
1#ifndef DUNE_FEM_FUNCTION_LOCALFUNCTION_TEMPORARY_HH
2#define DUNE_FEM_FUNCTION_LOCALFUNCTION_TEMPORARY_HH
3
6
7#include <dune/fem/function/localfunction/localfunction.hh>
8#include <dune/fem/common/intersectionside.hh>
9
10
11namespace Dune
12{
13
14 namespace Fem
15 {
16
17 // internal forward declarations
18 // -----------------------------
19
20 template< class DiscreteFunctionSpace, class DoFVector >
21 class BasicTemporaryLocalFunction;
22
23 template< class DiscreteFunctionSpace, class Dof >
24 class TemporaryLocalFunction;
25
26
39 template< class DiscreteFunctionSpace, class DofVector >
41 : public LocalFunction < typename DiscreteFunctionSpace :: BasisFunctionSetType, DofVector >
42 {
45
46 public:
49
52
55
58
59 /* \copydoc Dune::Fem::LocalFunction :: localDofVector */
61
77 const LocalDofVectorType &dofVector = LocalDofVectorType() )
78 : BaseType( dofVector ),
79 dfSpace_( dfSpace )
80 {
81 localDofVector().reserve( DiscreteFunctionSpaceType::localBlockSize * dfSpace_.blockMapper().maxNumDofs() );
82 }
83
98 const LocalDofVectorType &dofVector = LocalDofVectorType() )
99 : BaseType( dofVector ),
100 dfSpace_( dfSpace )
101 {
102 localDofVector().reserve( DiscreteFunctionSpaceType::localBlockSize * dfSpace_.blockMapper().maxNumDofs() );
103 init( entity );
104 }
105
118 void init ( const EntityType &entity )
119 {
120 BaseType::init( dfSpace_.basisFunctionSet( entity ) );
121 }
122
135 void bind ( const EntityType &entity ) { init( entity ); }
136
139 void unbind ()
140 {
142 }
143
159 template <class IntersectionType>
160 void bind(const IntersectionType &intersection, IntersectionSide side)
161 {
162 // store local copy to avoid problems with casting to temporary types
163 const EntityType entity = side==IntersectionSide::in? intersection.inside(): intersection.outside();
164 bind( entity );
165 }
166
170 {
171 return dfSpace_;
172 }
173
174 protected:
175 const DiscreteFunctionSpaceType &dfSpace_;
176 };
177
178
195 template< class DiscreteFunctionSpace, class Dof >
196 class TemporaryLocalFunction;
197 }
198
199 template< class DiscreteFunctionSpace, class Dof >
200 struct FieldTraits< Fem::TemporaryLocalFunction<DiscreteFunctionSpace,Dof> >
201 : public FieldTraits< Dof >
202 {};
203
204 namespace Fem
205 {
206 template< class DiscreteFunctionSpace, class Dof = typename DiscreteFunctionSpace::RangeFieldType >
208 : public BasicTemporaryLocalFunction< DiscreteFunctionSpace, Dune::DynamicVector< Dof > >
209 {
212
213 public:
216
219
235 : BaseType( dfSpace ) {}
236
251 : BaseType( dfSpace, entity ){}
252 };
253
254 } // namespace Fem
255
256} // namespace Dune
257
258#endif // #ifndef DUNE_FEM_FUNCTION_LOCALFUNCTION_TEMPORARY_HH
discrete function space
Wrapper class for entities.
Definition: entity.hh:66
A temporary function carrying values for one entity.
Definition: temporary.hh:42
const LocalDofVectorType & localDofVector() const
return const reference to local Dof Vector
Definition: localfunction.hh:424
const DiscreteFunctionSpaceType & space() const
return discrete function space this local function belongs to
Definition: temporary.hh:169
void bind(const IntersectionType &intersection, IntersectionSide side)
initialize the local function for an entity adjacent to the intersection
Definition: temporary.hh:160
BaseType::EntityType EntityType
type of Entity
Definition: temporary.hh:51
BaseType::LocalDofVectorType LocalDofVectorType
type of LocalDofVector
Definition: temporary.hh:57
DiscreteFunctionSpace DiscreteFunctionSpaceType
type of the discrete function space
Definition: temporary.hh:48
BasicTemporaryLocalFunction(const DiscreteFunctionSpaceType &dfSpace, const LocalDofVectorType &dofVector=LocalDofVectorType())
constructor creating a local function without binding it to an entity
Definition: temporary.hh:76
void init(const EntityType &entity)
initialize the local function for an entity
Definition: temporary.hh:118
void bind(const EntityType &entity)
initialize the local function for an entity
Definition: temporary.hh:135
BaseType::BasisFunctionSetType BasisFunctionSetType
type of BasisFunctionSet
Definition: temporary.hh:54
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:97
void unbind()
Unbinds a local function from an entity.
Definition: temporary.hh:139
interface for local functions
Definition: localfunction.hh:77
const LocalDofVectorType & localDofVector() const
return const reference to local Dof Vector
Definition: localfunction.hh:424
void init(const EntityType &entity)
initialize the local function for an entity
Definition: localfunction.hh:446
BasisFunctionSet BasisFunctionSetType
type of basis function set
Definition: localfunction.hh:83
const EntityType & entity() const
obtain the entity, this local function lives on
Definition: localfunction.hh:305
void unbind()
clears the local function by removing the basisFunctionSet
Definition: localfunction.hh:467
BasisFunctionSetType::EntityType EntityType
type of the entity, the local function lives on is given by the space
Definition: localfunction.hh:95
LocalDofVector LocalDofVectorType
type of local Dof Vector
Definition: localfunction.hh:86
A temporary function carrying values for one entity.
Definition: temporary.hh:209
BaseType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of the discrete function space
Definition: temporary.hh:218
BaseType::EntityType EntityType
type of Entity
Definition: temporary.hh:215
TemporaryLocalFunction(const DiscreteFunctionSpaceType &dfSpace, const EntityType &entity)
constructor creating a local function and binding it to an entity
Definition: temporary.hh:250
TemporaryLocalFunction(const DiscreteFunctionSpaceType &dfSpace)
constructor creating a local function without binding it to an entity
Definition: temporary.hh:234
This file implements a dense vector with a dynamic size.
Type traits to determine the type of reals (when working with complex numbers)
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)