1#ifndef DUNE_FEM_MANAGEDVECTORFUNCTION_HH
2#define DUNE_FEM_MANAGEDVECTORFUNCTION_HH
7#include <dune/fem/function/vectorfunction/vectorfunction.hh>
8#include <dune/fem/space/common/dofmanager.hh>
9#include <dune/fem/space/mapper/nonblockmapper.hh>
22 template<
class DofContainer,
class DiscreteFunctionSpace >
25 typedef MutableBlockVector< DofContainer, DiscreteFunctionSpace::localBlockSize > DofVector;
26 auto result =
allocateManagedDofStorage( space.gridPart().grid(), space.blockMapper(),
static_cast< DofVector *
>(
nullptr ) );
27 interface_.reset( result.first );
28 return result.second->array();
31 void enableDofCompression ()
34 interface_->enableDofCompression();
38 std::unique_ptr< DofStorageInterface > interface_;
49 class ManagedDiscreteFunction
52 public VectorDiscreteFunction< DiscreteFunctionSpace, Vector >
54 typedef VectorDiscreteFunction< DiscreteFunctionSpace, Vector > BaseType;
55 typedef ManagedDiscreteFunction< BaseType > ThisType;
60 typedef typename BaseType :: DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
61 typedef typename BaseType :: DofVectorType DofVectorType;
62 typedef typename BaseType :: DofContainerType DofContainerType;
64 typedef typename DiscreteFunctionSpaceType :: GridPartType :: GridType GridType;
66 using BaseType :: name;
68 ManagedDiscreteFunction (
const std::string &name,
const DiscreteFunctionSpaceType &dfSpace )
69 : BaseType( name, dfSpace, MemObject::allocate< DofContainerType >( dfSpace ) )
72 explicit ManagedDiscreteFunction (
const BaseType &other )
73 : BaseType( other.name(), other.space(), MemObject::allocate< DofContainerType >( other.space() ) )
78 ManagedDiscreteFunction (
const ThisType &other )
79 : BaseType( other.name(), other.space(), MemObject::allocate< DofContainerType >( other.space() ) )
84 ManagedDiscreteFunction ( ThisType && ) =
default;
86 void enableDofCompression () { MemObject::enableDofCompression(); }
forward declaration
Definition: discretefunction.hh:51
static std::pair< DofStorageInterface *, DofStorageType * > allocateManagedDofStorage(const GridType &grid, const MapperType &mapper, const DofStorageType *=0)
default implementation for creating a managed dof storage
Definition: dofmanager.hh:578
Dune namespace.
Definition: alignedallocator.hh:13
void assign(T &dst, const T &src, bool mask)
masked Simd assignment (scalar version)
Definition: simd.hh:447