| 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_LOCALFUNCTIONS_BREZZIDOUGLASMARINI1_CUBE3D_LOCALINTERPOLATION_HH |
| 6 |
#define DUNE_LOCALFUNCTIONS_BREZZIDOUGLASMARINI1_CUBE3D_LOCALINTERPOLATION_HH |
| 7 |
|
| 8 |
#include <vector> |
| 9 |
|
| 10 |
#include <dune/geometry/quadraturerules.hh> |
| 11 |
|
| 12 |
namespace Dune |
| 13 |
{ |
| 14 |
|
| 15 |
/** |
| 16 |
* \brief First order Brezzi-Douglas-Marini shape functions on the reference |
| 17 |
* hexahedron. |
| 18 |
* |
| 19 |
* \tparam LB corresponding LocalBasis giving traits |
| 20 |
* |
| 21 |
* \ingroup BrezziDouglasMariniImpl |
| 22 |
* \nosubgrouping |
| 23 |
*/ |
| 24 |
template<class LB> |
| 25 |
class BDM1Cube3DLocalInterpolation |
| 26 |
{ |
| 27 |
|
| 28 |
public: |
| 29 |
//! \brief Standard constructor |
| 30 |
BDM1Cube3DLocalInterpolation() |
| 31 |
{ |
| 32 |
sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0; |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* \brief Make set number s, where 0 <= s < 64 |
| 37 |
* |
| 38 |
* \param s Edge orientation indicator |
| 39 |
*/ |
| 40 |
BDM1Cube3DLocalInterpolation(unsigned int s) |
| 41 |
{ |
| 42 |
sign0 = sign1 = sign2 = sign3 = sign4 = sign5 = 1.0; |
| 43 |
if (s & 1) |
| 44 |
{ |
| 45 |
sign0 = -1.0; |
| 46 |
} |
| 47 |
if (s & 2) |
| 48 |
{ |
| 49 |
sign1 = -1.0; |
| 50 |
} |
| 51 |
if (s & 4) |
| 52 |
{ |
| 53 |
sign2 = -1.0; |
| 54 |
} |
| 55 |
if (s & 8) |
| 56 |
{ |
| 57 |
sign3 = -1.0; |
| 58 |
} |
| 59 |
if (s & 16) |
| 60 |
{ |
| 61 |
sign4 = -1.0; |
| 62 |
} |
| 63 |
if (s & 32) |
| 64 |
{ |
| 65 |
sign5 = -1.0; |
| 66 |
} |
| 67 |
|
| 68 |
n0[0] = -1.0; |
| 69 |
n0[1] = 0.0; |
| 70 |
n0[2] = 0.0; |
| 71 |
n1[0] = 1.0; |
| 72 |
n1[1] = 0.0; |
| 73 |
n1[2] = 0.0; |
| 74 |
n2[0] = 0.0; |
| 75 |
n2[1] = -1.0; |
| 76 |
n2[2] = 0.0; |
| 77 |
n3[0] = 0.0; |
| 78 |
n3[1] = 1.0; |
| 79 |
n3[2] = 0.0; |
| 80 |
n4[0] = 0.0; |
| 81 |
n4[1] = 0.0; |
| 82 |
n4[2] = -1.0; |
| 83 |
n5[0] = 0.0; |
| 84 |
n5[1] = 0.0; |
| 85 |
n5[2] = 1.0; |
| 86 |
} |
| 87 |
|
| 88 |
/** |
| 89 |
* \brief Interpolate a given function with shape functions |
| 90 |
* |
| 91 |
* \tparam F Function type for function which should be interpolated |
| 92 |
* \tparam C Coefficient type |
| 93 |
* \param f function which should be interpolated |
| 94 |
* \param out return value, vector of coefficients |
| 95 |
*/ |
| 96 |
template<typename F, typename C> |
| 97 |
void interpolate(const F& f, std::vector<C>& out) const |
| 98 |
{ |
| 99 |
// f gives v*outer normal at a point on the edge! |
| 100 |
typedef typename LB::Traits::RangeFieldType Scalar; |
| 101 |
//typedef typename LB::Traits::DomainFieldType Vector; |
| 102 |
|
| 103 |
DUNE_THROW( NotImplemented, "Interpolation for BDM1Cube3D finite elements is not implemented." ); |
| 104 |
|
| 105 |
out.resize(18); |
| 106 |
std::fill(out.begin(), out.end(), 0.0); |
| 107 |
|
| 108 |
const int qOrder = 4; |
| 109 |
const QuadratureRule<Scalar,1>& rule = QuadratureRules<Scalar,1>::rule(GeometryTypes::cube(1), qOrder); |
| 110 |
|
| 111 |
for (typename QuadratureRule<Scalar,1>::const_iterator it = rule.begin(); |
| 112 |
it != rule.end(); ++it) |
| 113 |
{ |
| 114 |
// TODO: write interpolation |
| 115 |
} |
| 116 |
} |
| 117 |
|
| 118 |
private: |
| 119 |
typename LB::Traits::RangeFieldType sign0, sign1, sign2, sign3, sign4, sign5; |
| 120 |
typename LB::Traits::DomainType n0, n1, n2, n3, n4, n5; |
| 121 |
}; |
| 122 |
} // end namespace Dune |
| 123 |
#endif // DUNE_LOCALFUNCTIONS_BREZZIDOUGLASMARINI1_CUBE3D_LOCALINTERPOLATION_HH |