| 1 |
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
// vi: set et ts=4 sw=2 sts=2: |
| 3 |
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root |
| 4 |
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception |
| 5 |
#ifndef DUNE_LAGRANGECOEFFICIENTS_HH |
| 6 |
#define DUNE_LAGRANGECOEFFICIENTS_HH |
| 7 |
|
| 8 |
#include <vector> |
| 9 |
|
| 10 |
#include <dune/common/fvector.hh> |
| 11 |
|
| 12 |
#include <dune/geometry/type.hh> |
| 13 |
|
| 14 |
#include <dune/localfunctions/utility/field.hh> |
| 15 |
#include <dune/localfunctions/common/localkey.hh> |
| 16 |
|
| 17 |
namespace Dune |
| 18 |
{ |
| 19 |
|
| 20 |
template< template <class,unsigned int> class LP, |
| 21 |
unsigned int dim, class F> |
| 22 |
struct LagrangeCoefficientsFactory |
| 23 |
{ |
| 24 |
static const unsigned int dimension = dim; |
| 25 |
const typedef LP<F,dim> Object; |
| 26 |
typedef std::size_t Key; |
| 27 |
|
| 28 |
template< GeometryType::Id geometryId > |
| 29 |
static Object *create ( const Key &order ) |
| 30 |
{ |
| 31 |
if (order == 0 || !Object::template supports<geometryId>(order)) |
| 32 |
return 0; |
| 33 |
typedef typename std::remove_const<Object>::type LagrangeCoefficients; |
| 34 |
LagrangeCoefficients *object = new LagrangeCoefficients(order); |
| 35 |
if ( !object->template build<geometryId>() ) |
| 36 |
{ |
| 37 |
delete object; |
| 38 |
object = nullptr; |
| 39 |
} |
| 40 |
return object; |
| 41 |
} |
| 42 |
static void release( Object *object ) { delete object; } |
| 43 |
}; |
| 44 |
|
| 45 |
} |
| 46 |
|
| 47 |
#endif // DUNE_LAGRANGECOEFFICIENTS_HH |