3#ifndef DUNE_RAVIARTTHOMASPREBASIS_HH
4#define DUNE_RAVIARTTHOMASPREBASIS_HH
11#include <dune/localfunctions/utility/polynomialbasis.hh>
15 template < GeometryType::Id geometryId,
class Field >
18 template <
unsigned int dim,
class Field>
19 struct RTPreBasisFactory
21 typedef MonomialBasisProvider<dim,Field> MBasisFactory;
22 typedef typename MBasisFactory::Object MBasis;
23 typedef StandardEvaluator<MBasis> EvalMBasis;
24 typedef PolynomialBasisWithMatrix<EvalMBasis,SparseCoeffMatrix<Field,dim> > Basis;
26 typedef const Basis Object;
27 typedef std::size_t Key;
29 template <
unsigned int dd,
class FF>
30 struct EvaluationBasisFactory
32 typedef MonomialBasisProvider<dd,FF> Type;
34 template< GeometryType::Id geometryId >
35 static Object *create (
const Key &order )
37 RTVecMatrix<geometryId,Field> vecMatrix(order);
38 MBasis *mbasis = MBasisFactory::template create<geometryId>(order+1);
39 typename std::remove_const<Object>::type *tmBasis =
new typename std::remove_const<Object>::type(*mbasis);
40 tmBasis->fill(vecMatrix);
43 static void release( Object *
object ) {
delete object; }
46 template <GeometryType::Id geometryId,
class Field>
50 static const unsigned int dim = geometry.dim();
51 typedef MultiIndex<dim,Field> MI;
52 typedef MonomialBasis<geometryId,MI> MIBasis;
53 RTVecMatrix(std::size_t order)
75 MIBasis basis(order+1);
76 FieldVector< MI, dim > x;
83 for(
unsigned int i = 0; i < dim; ++i )
85 std::vector< MI > val( basis.size() );
88 basis.evaluate( x, val );
93 unsigned int notHomogen = 0;
95 notHomogen = basis.sizes()[order-1];
98 unsigned int homogen = basis.sizes()[order]-notHomogen;
119 row_ = (notHomogen*dim+homogen*(dim+1))*dim;
120 mat_ =
new Field*[row_];
126 for (
unsigned int i=0; i<notHomogen+homogen; ++i)
128 for (
unsigned int r=0; r<dim; ++r)
130 for (
unsigned int rr=0; rr<dim; ++rr)
133 mat_[row] =
new Field[col_];
134 for (
unsigned int j=0; j<col_; ++j)
148 for (
unsigned int i=0; i<homogen; ++i)
150 for (
unsigned int r=0; r<dim; ++r)
153 mat_[row] =
new Field[col_];
154 for (
unsigned int j=0; j<col_; ++j)
161 MI xval = val[notHomogen+i];
163 for (w=homogen+notHomogen; w<val.size(); ++w)
171 assert(w<val.size());
179 for (
unsigned int i=0; i<rows(); ++i) {
185 unsigned int cols()
const {
189 unsigned int rows()
const {
193 template <
class Vector>
194 void row(
const unsigned int row, Vector &vec )
const
196 const unsigned int N = cols();
197 assert( vec.size() == N );
198 for (
unsigned int i=0; i<N; ++i)
201 unsigned int row_,col_;
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:130
Dune namespace.
Definition: alignedallocator.hh:11
void field_cast(const F1 &f1, F2 &f2)
a helper class to cast from one field to another
Definition: field.hh:157
A unique label for each type of element that can occur in a grid.