1 #ifndef DUNE_FEM_ADAPTIVEFUNCTION_HH 2 #define DUNE_FEM_ADAPTIVEFUNCTION_HH 9 #include <dune/common/typetraits.hh> 33 template <
class DiscreteFunctionSpace>
36 template<
typename DiscreteFunctionSpace >
39 SimpleBlockVector< StaticArray< typename DiscreteFunctionSpace::RangeFieldType > , DiscreteFunctionSpace::localBlockSize > >
45 template <
class DiscreteFunctionSpace>
57 using BaseType::assign;
62 const DiscreteFunctionSpaceType &space )
63 : BaseType( name, space ),
65 dofVector_( allocateDofStorage( space ) )
70 const DiscreteFunctionSpaceType &space,
72 : BaseType( name, space ),
74 dofVector_( allocateDofStorageWrapper( space.blockMapper().size() * DofVectorType::blockSize, data ) )
79 const DiscreteFunctionSpaceType &space,
80 DofVectorType& dofVector )
81 : BaseType( name, space ),
83 dofVector_( dofVector )
88 : BaseType(
"copy of " + other.name(), other.space() ),
90 dofVector_( allocateDofStorage( other.space() ) )
96 const DofType*
leakPointer()
const {
return dofVector().data(); }
99 const DofVectorType&
dofVector()
const {
return dofVector_; }
106 memObject_->enableDofCompression();
115 DofVectorType dofVector_;
116 typedef typename DofVectorType :: SizeType SizeType;
123 : array_( size, const_cast< DofType* >(v) ),
124 dofVector_( array_ ),
128 const std::string&
name ()
const {
return name_; }
137 int size ()
const {
return dofVector_.size(); }
150 memObject_.reset( dsw );
159 std::string name(
"deprecated");
161 std::pair< DofStorageInterface*, DofVectorType* > memPair
163 name, (MutableDofVectorType *) 0 );
166 memObject_.reset( memPair.first );
167 return *(memPair.second);
179 #endif // #ifndef DUNE_FEM_ADAPTIVEFUNCTION_HH
DofVectorType & dofVector_
Definition: adaptivefunction/adaptivefunction.hh:173
void enableDofCompression()
do nothing here since we are using StaticArray
Definition: adaptivefunction/adaptivefunction.hh:134
std::unique_ptr< DofStorageInterface > memObject_
Definition: adaptivefunction/adaptivefunction.hh:171
AdaptiveDiscreteFunction< DiscreteFunctionSpace > DiscreteFunctionType
Definition: adaptivefunction/adaptivefunction.hh:41
Traits class for a DiscreteFunction.
Definition: discretefunction.hh:60
const std::string & name() const
returns name of dof storage
Definition: adaptivefunction/adaptivefunction.hh:128
Definition: adaptivefunction/adaptivefunction.hh:34
static std::pair< DofStorageInterface *, DofStorageType * > allocateManagedDofStorage(const GridType &grid, const MapperType &mapper, const std::string &name, const DofStorageType *=0)
default implementation for creating a managed dof storage
Definition: dofmanager.hh:610
DofVectorType & allocateDofStorage(const DiscreteFunctionSpaceType &space)
Definition: adaptivefunction/adaptivefunction.hh:157
DofVectorType & dofVector()
Definition: adaptivefunction/adaptivefunction.hh:98
Definition: discretefunction.hh:63
wrapper class to create fake DofStorage from DofType*
Definition: adaptivefunction/adaptivefunction.hh:112
This file implements a dense vector with a dynamic size.
Definition: defaultblockvectors.hh:455
const DofType * leakPointer() const
Definition: adaptivefunction/adaptivefunction.hh:96
DofStorageWrapper(const SizeType size, const DofType *v)
Definition: adaptivefunction/adaptivefunction.hh:121
DofVectorType & getArray()
return array
Definition: adaptivefunction/adaptivefunction.hh:131
BaseType::DofVectorType DofVectorType
Definition: adaptivefunction/adaptivefunction.hh:54
AdaptiveDiscreteFunction(const AdaptiveDiscreteFunction &other)
Definition: adaptivefunction/adaptivefunction.hh:87
Definition: coordinate.hh:4
Interface class for a dof storage object to be stored in discrete functions.
Definition: dofmanager.hh:282
AdaptiveDiscreteFunction(const std::string &name, const DiscreteFunctionSpaceType &space, const DofType *data)
Definition: adaptivefunction/adaptivefunction.hh:69
BaseType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of discrete function space
Definition: discretefunction.hh:571
int size() const
return array's size
Definition: adaptivefunction/adaptivefunction.hh:137
Definition: discretefunction.hh:1034
DofType * leakPointer()
Definition: adaptivefunction/adaptivefunction.hh:95
void enableDofCompression()
Enable this discrete function for dof compression, i.e. during grdi changes a dof compression is done...
Definition: adaptivefunction/adaptivefunction.hh:103
AdaptiveDiscreteFunction(const std::string &name, const DiscreteFunctionSpaceType &space)
Definition: adaptivefunction/adaptivefunction.hh:61
Traits::DofVectorType DofVectorType
type of DofVector
Definition: discretefunction.hh:596
BaseType::DofType DofType
Definition: discretefunction.hh:613
MutableBlockVector< MutableArray< DofType >, DiscreteFunctionSpaceType::localBlockSize > MutableDofVectorType
Definition: adaptivefunction/adaptivefunction.hh:59
DofVectorType & allocateDofStorageWrapper(const size_t size, const DofType *v)
Definition: adaptivefunction/adaptivefunction.hh:143
MutableLocalFunction< DiscreteFunctionType > LocalFunctionType
Definition: adaptivefunction/adaptivefunction.hh:42
const DofVectorType & dofVector() const
Definition: adaptivefunction/adaptivefunction.hh:99
AdaptiveDiscreteFunction(const std::string &name, const DiscreteFunctionSpaceType &space, DofVectorType &dofVector)
Definition: adaptivefunction/adaptivefunction.hh:78
BaseType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
Definition: adaptivefunction/adaptivefunction.hh:53
BaseType::DofType DofType
Definition: adaptivefunction/adaptivefunction.hh:55