lagrangecoefficients.hh
Go to the documentation of this file.00001 #ifndef DUNE_LAGRANGECOEFFICIENTS_HH
00002 #define DUNE_LAGRANGECOEFFICIENTS_HH
00003
00004 #include <vector>
00005
00006 #include <dune/common/fvector.hh>
00007 #include <dune/localfunctions/utility/field.hh>
00008 #include <dune/common/forloop.hh>
00009 #include <dune/grid/common/topologyfactory.hh>
00010
00011 #include <dune/grid/genericgeometry/topologytypes.hh>
00012 #include <dune/grid/genericgeometry/subtopologies.hh>
00013
00014 #include <dune/localfunctions/common/localkey.hh>
00015
00016 namespace Dune
00017 {
00018
00019 template< template <class,unsigned int> class LP, unsigned int dim, class F >
00020 class LagrangeCoefficientsFactory;
00021
00022 template< template <class,unsigned int> class LP,
00023 unsigned int dim, class F>
00024 struct LagrangeCoefficientsFactoryTraits
00025 {
00026 static const unsigned int dimension = dim;
00027 const typedef LP<F,dim> Object;
00028 typedef unsigned int Key;
00029 typedef LagrangeCoefficientsFactory< LP,dim,F > Factory;
00030 };
00031
00032 template< template <class,unsigned int> class LP,
00033 unsigned int dim, class F>
00034 struct LagrangeCoefficientsFactory :
00035 public TopologyFactory< LagrangeCoefficientsFactoryTraits< LP,dim,F> >
00036 {
00037 typedef LagrangeCoefficientsFactoryTraits<LP,dim,F> Traits;
00038 static const unsigned int dimension = dim;
00039 typedef typename Traits::Object Object;
00040 typedef typename Traits::Key Key;
00041
00042 template< class T >
00043 static Object *createObject ( const Key &order )
00044 {
00045 if (order == 0 || !Object::template supports<T>(order))
00046 return 0;
00047 typedef typename remove_const<Object>::type LagrangeCoefficients;
00048 LagrangeCoefficients *object = new LagrangeCoefficients(order);
00049 if ( !object->template build<T>() )
00050 {
00051 delete object;
00052 object = 0;
00053 }
00054 return object;
00055 }
00056 };
00057
00058 }
00059
00060 #endif // DUNE_LAGRANGECOEFFICIENTS_HH