5#ifndef DUNE_RAVIARTTHOMASPREBASIS_HH
6#define DUNE_RAVIARTTHOMASPREBASIS_HH
13#include <dune/localfunctions/utility/polynomialbasis.hh>
17 template < GeometryType::Id geometryId,
class Field >
20 template <
unsigned int dim,
class Field>
21 struct RTPreBasisFactory
23 typedef MonomialBasisProvider<dim,Field> MBasisFactory;
24 typedef typename MBasisFactory::Object MBasis;
25 typedef StandardEvaluator<MBasis> EvalMBasis;
26 typedef PolynomialBasisWithMatrix<EvalMBasis,SparseCoeffMatrix<Field,dim> > Basis;
28 typedef const Basis Object;
29 typedef std::size_t Key;
31 template <
unsigned int dd,
class FF>
32 struct EvaluationBasisFactory
34 typedef MonomialBasisProvider<dd,FF> Type;
36 template< GeometryType::Id geometryId >
37 static Object *create (
const Key &order )
39 RTVecMatrix<geometryId,Field> vecMatrix(order);
40 MBasis *mbasis = MBasisFactory::template create<geometryId>(order+1);
41 typename std::remove_const<Object>::type *tmBasis =
new typename std::remove_const<Object>::type(*mbasis);
42 tmBasis->fill(vecMatrix);
45 static void release( Object *
object ) {
delete object; }
48 template <GeometryType::Id geometryId,
class Field>
52 static const unsigned int dim = geometry.dim();
53 typedef MultiIndex<dim,Field> MI;
54 typedef MonomialBasis<geometryId,MI> MIBasis;
55 RTVecMatrix(std::size_t order)
77 MIBasis basis(order+1);
78 FieldVector< MI, dim > x;
85 for(
unsigned int i = 0; i < dim; ++i )
87 std::vector< MI > val( basis.size() );
90 basis.evaluate( x, val );
95 unsigned int notHomogen = 0;
97 notHomogen = basis.sizes()[order-1];
100 unsigned int homogen = basis.sizes()[order]-notHomogen;
121 row_ = (notHomogen*dim+homogen*(dim+1))*dim;
122 mat_ =
new Field*[row_];
128 for (
unsigned int i=0; i<notHomogen+homogen; ++i)
130 for (
unsigned int r=0; r<dim; ++r)
132 for (
unsigned int rr=0; rr<dim; ++rr)
135 mat_[row] =
new Field[col_];
136 for (
unsigned int j=0; j<col_; ++j)
150 for (
unsigned int i=0; i<homogen; ++i)
152 for (
unsigned int r=0; r<dim; ++r)
155 mat_[row] =
new Field[col_];
156 for (
unsigned int j=0; j<col_; ++j)
163 MI xval = val[notHomogen+i];
165 for (w=homogen+notHomogen; w<val.size(); ++w)
173 assert(w<val.size());
181 for (
unsigned int i=0; i<rows(); ++i) {
187 unsigned int cols()
const {
191 unsigned int rows()
const {
195 template <
class Vector>
196 void row(
const unsigned int row, Vector &vec )
const
198 const unsigned int N = cols();
199 assert( vec.size() == N );
200 for (
unsigned int i=0; i<N; ++i)
203 unsigned int row_,col_;
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Dune namespace.
Definition: alignedallocator.hh:13
void field_cast(const F1 &f1, F2 &f2)
a helper class to cast from one field to another
Definition: field.hh:159
A unique label for each type of element that can occur in a grid.