| 88 | |
| 89 | template<int DIM> |
| 90 | class GlobalInterfaceSpaceD : public GlobalInterfaceSpace |
| 91 | { |
| 92 | Array<bool> nitsche_facet; |
| 93 | |
| 94 | class InterfaceFE : public FiniteElement |
| 95 | { |
| 96 | protected: |
| 97 | const GlobalInterfaceSpaceD<DIM> * fes; |
| 98 | ELEMENT_TYPE et; |
| 99 | public: |
| 100 | InterfaceFE (const GlobalInterfaceSpaceD<DIM> * afes, |
| 101 | ELEMENT_TYPE _et) |
| 102 | : FiniteElement(afes->GetNDof(), afes->order), fes(afes), |
| 103 | et(_et) |
| 104 | { ; } |
| 105 | |
| 106 | static int GetDim() { return DIM; } |
| 107 | |
| 108 | ELEMENT_TYPE ElementType() const { return et; } |
| 109 | void CalcShape(const BaseMappedIntegrationPoint& mip, |
| 110 | BareSliceVector<double> shapes) const |
| 111 | { |
| 112 | int order = fes->GetOrder(); |
| 113 | if constexpr(DIM ==1) |
| 114 | { |
| 115 | if(fes->polar) |
| 116 | throw Exception("Polar coordinates need 2 dimensional mapping!"); |
| 117 | double phi = fes->mapping -> Evaluate(mip); |
| 118 | if(fes->periodic[0]) |
| 119 | { |
| 120 | shapes(0) = 1; |
| 121 | for (int i = 1; i <= order; i++) |
| 122 | { |
| 123 | shapes(2*i-1) = cos(i*phi); |
| 124 | shapes(2*i ) = sin(i*phi); |
| 125 | } |
| 126 | } |
| 127 | else |
| 128 | { |
| 129 | LegendrePolynomial (order, -1 + 2 * phi, shapes); |
| 130 | } |
| 131 | } |
| 132 | else // DIM == 2 |
| 133 | { |
| 134 | Vec<2, double> phi; |
| 135 | fes->mapping->Evaluate(mip, FlatVector<double>(2, &phi[0])); |
| 136 | if(fes->polar) |
| 137 | { |
| 138 | ArrayMem<double, 20> shapeu(order/2+1), shapev(2*order); |
| 139 | LegendrePolynomial(order/2, -1 + 2 * phi[0]*phi[0], |
| 140 | shapeu); |
| 141 | for(auto i : Range(1, order+1)) |
| 142 | { |
| 143 | shapev[2*(i-1)] = cos(i*phi[1]); |
| 144 | shapev[2*(i-1)+1] = sin(i*phi[1]); |
| 145 | } |
| 146 | int j = 0; |
| 147 | for(auto k : Range(order/2 + 1)) |