dune-fem 2.8.0
Loading...
Searching...
No Matches
blockvectordiscretefunction/blockvectordiscretefunction.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_BLOCKVECTORDISCRETEFUNCTION_HH
2#define DUNE_FEM_BLOCKVECTORDISCRETEFUNCTION_HH
3
4#include <memory>
5#include <string>
6#include <utility>
7
14
15namespace Dune
16{
17 namespace Fem
18 {
19
20 template< typename DiscreteFunctionSpace, typename BlockVector >
21 class BlockVectorDiscreteFunction;
22
23
24
36
37
38
45 template< typename DiscreteFunctionSpace, typename BlockVector >
47 : public DefaultDiscreteFunctionTraits< DiscreteFunctionSpace, BlockVector >
48 {
51 };
52
53
54
55
62 template< typename DiscreteFunctionSpace, typename BlockVector >
64 : public DiscreteFunctionDefault< BlockVectorDiscreteFunction< DiscreteFunctionSpace, BlockVector > >,
66 {
70
71 public:
75 typedef BlockVector BlockVectorType;
78
79 using BaseType::assign;
80 using BaseType::name;
81
88 BlockVectorDiscreteFunction ( const std::string& name,
91 : BaseType( name, space ),
92 memObject_(),
94 {}
95
101 BlockVectorDiscreteFunction ( const std::string& name,
103 : BaseType( name, space ),
104 memObject_(),
106 {}
107
110 : BaseType( "copy of "+other.name(), other.space() ),
111 memObject_(),
113 {
114 assign( other );
115 }
116
119 : BaseType( static_cast< BaseType && >( other ) ),
120 memObject_( std::move( other.memObject_ ) ),
121 dofVector_( other.dofVector_ )
122 {}
123
125 ThisType& operator= ( const ThisType& ) = delete;
127
129 const DofVectorType &dofVector () const
130 {
131 return dofVector_;
132 }
133
136 {
137 return dofVector_;
138 }
139
142 {
143 if( memObject_ )
144 memObject_->enableDofCompression();
145 }
146
147 protected:
149 {
150 std::pair< DofStorageInterface*, DofVectorType* > memPair(
151 allocateManagedDofStorage< DofVectorType >( space.gridPart().grid(), space.blockMapper() ) );
152
153 memObject_.reset( memPair.first );
154 return *memPair.second;
155 }
156
157 std::unique_ptr< DofStorageInterface > memObject_;
159 };
160
161 } // namespace Fem
162} // namespace Dune
163
164#endif // #ifndef DUNE_FEM_BLOCKVECTORDISCRETEFUNCTION_HH
STL namespace.
Definition: bindguard.hh:11
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:66
ThisType & operator=(const ThisType &)=delete
DofVectorType & dofVector()
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:135
std::unique_ptr< DofStorageInterface > memObject_
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:157
BlockVectorDiscreteFunction(ThisType &&other)
Move constructor.
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:118
DofVectorType & allocateDofStorage(const DiscreteFunctionSpaceType &space)
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:148
const DofVectorType & dofVector() const
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:129
BlockVector BlockVectorType
type for the class which implements the block vector
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:75
DiscreteFunctionSpace DiscreteFunctionSpaceType
type for the discrete function space this function lives in
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:73
const std::string & name() const
obtain the name of the discrete function
Definition: common/discretefunction.hh:691
BlockVectorType DofVectorType
type for the class which implements the block vector (which is the dof vector)
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:77
DofVectorType & dofVector_
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:158
BlockVectorDiscreteFunction(const std::string &name, const DiscreteFunctionSpaceType &space, DofVectorType &dofVector)
Constructor to use if the vector storing the dofs (which is a block vector) already exists.
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:88
BlockVectorDiscreteFunction(const std::string &name, const DiscreteFunctionSpaceType &space)
Constructor to use if the vector storing the dofs does not exist yet.
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:101
void enableDofCompression()
Enable this discrete function for dof compression, i.e. during grid changes a dof compression is done...
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:141
void assign(const DiscreteFunctionInterface< DFType > &g)
Definition: discretefunction_inline.hh:132
BlockVectorDiscreteFunction(const ThisType &other)
Copy constructor.
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:109
Tag for discrete functions using block vectors.
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:35
MutableLocalFunction< DiscreteFunctionType > LocalFunctionType
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:50
BlockVectorDiscreteFunction< DiscreteFunctionSpace, BlockVector > DiscreteFunctionType
Definition: blockvectordiscretefunction/blockvectordiscretefunction.hh:49
Traits class for a DiscreteFunction.
Definition: common/discretefunction.hh:61
Definition: common/discretefunction.hh:584
const DiscreteFunctionSpaceType & space() const
obtain a reference to the corresponding DiscreteFunctionSpace
Definition: common/discretefunction.hh:709
const std::string & name() const
obtain the name of the discrete function
Definition: common/discretefunction.hh:691
void assign(const DiscreteFunctionInterface< DFType > &g)
Definition: discretefunction_inline.hh:132
Definition: common/discretefunction.hh:1081
Definition: common/scalarproducts.hh:73
discrete function space