v0.16.3
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MoFEM::EdgePolynomialBase Struct Reference

Calculate base functions on tetrahedral. More...

#include "src/approximation/EdgePolynomialBase.hpp"

Inheritance diagram for MoFEM::EdgePolynomialBase:
[legend]
Collaboration diagram for MoFEM::EdgePolynomialBase:
[legend]

Public Member Functions

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 
 EdgePolynomialBase ()=default
 
virtual ~EdgePolynomialBase ()=default
 
MoFEMErrorCode getValue (MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
 
- Public Member Functions inherited from MoFEM::BaseFunction
virtual MoFEMErrorCode getValue (MatrixDouble &pts_x, MatrixDouble &pts_t, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
 
- Public Member Functions inherited from MoFEM::BaseFunctionUnknownInterface
virtual ~BaseFunctionUnknownInterface ()=default
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface.
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface.
 
virtual ~UnknownInterface ()=default
 

Private Member Functions

MoFEMErrorCode getValueH1 (MatrixDouble &pts)
 
MoFEMErrorCode getValueH1AinsworthBase (MatrixDouble &pts)
 
MoFEMErrorCode getValueH1DemkowiczBase (MatrixDouble &pts)
 
MoFEMErrorCode getValueH1BernsteinBezierBase (MatrixDouble &pts)
 
MoFEMErrorCode getValueL2 (MatrixDouble &pts)
 
MoFEMErrorCode getValueL2AinsworthBase (MatrixDouble &pts)
 
MoFEMErrorCode getValueL2DemkowiczBase (MatrixDouble &pts)
 
MoFEMErrorCode getValueHdiv (MatrixDouble &pts)
 
MoFEMErrorCode getValueHcurl (MatrixDouble &pts)
 
MoFEMErrorCode getValueHcurlAinsworthBase (MatrixDouble &pts)
 
MoFEMErrorCode getValueHcurlDemkowiczBase (MatrixDouble &pts)
 

Private Attributes

EntPolynomialBaseCtx * cTx
 
VectorDouble L
 
VectorDouble diffL
 

Additional Inherited Members

- Public Types inherited from MoFEM::BaseFunction
using DofsSideMap = multi_index_container< DofsSideMapData, indexed_by< ordered_non_unique< tag< TypeSide_mi_tag >, composite_key< DofsSideMapData, member< DofsSideMapData, EntityType, &DofsSideMapData::type >, member< DofsSideMapData, int, &DofsSideMapData::side > > >, ordered_unique< tag< EntDofIdx_mi_tag >, member< DofsSideMapData, int, &DofsSideMapData::dof > > > >
 Map entity stype and side to element/entity dof index.
 
- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version.
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version.
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version.
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version.
 

Detailed Description

Calculate base functions on tetrahedral.

Definition at line 19 of file EdgePolynomialBase.hpp.

Constructor & Destructor Documentation

◆ EdgePolynomialBase()

MoFEM::EdgePolynomialBase::EdgePolynomialBase ( )
default

◆ ~EdgePolynomialBase()

virtual MoFEM::EdgePolynomialBase::~EdgePolynomialBase ( )
virtualdefault

Member Function Documentation

◆ getValue()

MoFEMErrorCode EdgePolynomialBase::getValue ( MatrixDouble &  pts,
boost::shared_ptr< BaseFunctionCtx >  ctx_ptr 
)
virtual

Reimplemented from MoFEM::BaseFunction.

Definition at line 15 of file EdgePolynomialBase.cpp.

16 {
18
20
21 int nb_gauss_pts = pts.size2();
22 if (!nb_gauss_pts)
24
25 if (pts.size1() < 1)
26 SETERRQ(
27 PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
28 "Wrong dimension of pts, should be at least 1 row with coordinates");
29
30 const FieldApproximationBase base = cTx->bAse;
31 EntitiesFieldData &data = cTx->dAta;
32
34 if (cTx->copyNodeBase == LASTBASE) {
35 data.dataOnEntities[MBVERTEX][0].getN(base).resize(nb_gauss_pts, 2,
36 false);
38 &*data.dataOnEntities[MBVERTEX][0].getN(base).data().begin(),
39 &pts(0, 0), nb_gauss_pts);
40 } else
41 data.dataOnEntities[MBVERTEX][0].getN(base) =
42 data.dataOnEntities[MBVERTEX][0].getN(cTx->copyNodeBase);
43
44 if (data.dataOnEntities[MBVERTEX][0].getN(base).size1() !=
45 (unsigned int)nb_gauss_pts)
46 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
47 "Base functions or nodes has wrong number of integration points "
48 "for base %s",
50
51 data.dataOnEntities[MBVERTEX][0].getDiffN(base).resize(nb_gauss_pts, 2 * 1,
52 false);
53 for (auto gg = 0; gg != nb_gauss_pts; ++gg)
54 std::copy(Tools::diffShapeFunMBEDGE.begin(),
56 &data.dataOnEntities[MBVERTEX][0].getDiffN(base)(gg, 0));
57 }
58
59 switch (cTx->sPace) {
60 case H1:
62 case HDIV:
64 case HCURL:
66 case L2:
68 default:
69 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
70 }
71
73}
FieldApproximationBase
approximation base
Definition definitions.h:58
@ LASTBASE
Definition definitions.h:69
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
Definition definitions.h:64
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ L2
field with C-1 continuity
Definition definitions.h:88
@ H1
continuous field
Definition definitions.h:85
@ HCURL
field with continuous tangents
Definition definitions.h:86
@ HDIV
field with continuous normal traction
Definition definitions.h:87
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
static const char *const ApproximationBaseNames[]
Definition definitions.h:72
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
PetscErrorCode ShapeMBEDGE(double *N, const double *G_X, int DIM)
Definition fem_tools.c:761
MoFEMErrorCode getValueHdiv(MatrixDouble &pts)
MoFEMErrorCode getValueHcurl(MatrixDouble &pts)
MoFEMErrorCode getValueL2(MatrixDouble &pts)
EntPolynomialBaseCtx * cTx
MoFEMErrorCode getValueH1(MatrixDouble &pts)
Class used to pass element data to calculate base functions on tet,triangle,edge.
const FieldApproximationBase copyNodeBase
const FieldApproximationBase bAse
data structure for finite element entity
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
static constexpr std::array< double, 2 > diffShapeFunMBEDGE
Definition Tools.hpp:68
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ getValueH1()

MoFEMErrorCode EdgePolynomialBase::getValueH1 ( MatrixDouble &  pts)
private

Definition at line 75 of file EdgePolynomialBase.cpp.

75 {
77
78 switch (cTx->bAse) {
82 break;
85 break;
88 break;
89 default:
90 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "Not implemented");
91 }
92
94}
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
@ AINSWORTH_LOBATTO_BASE
Definition definitions.h:62
@ DEMKOWICZ_JACOBI_BASE
Definition definitions.h:66
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
MoFEMErrorCode getValueH1AinsworthBase(MatrixDouble &pts)
MoFEMErrorCode getValueH1DemkowiczBase(MatrixDouble &pts)
MoFEMErrorCode getValueH1BernsteinBezierBase(MatrixDouble &pts)

◆ getValueH1AinsworthBase()

MoFEMErrorCode EdgePolynomialBase::getValueH1AinsworthBase ( MatrixDouble &  pts)
private

Definition at line 226 of file EdgePolynomialBase.cpp.

226 {
228
229 EntitiesFieldData &data = cTx->dAta;
230 const FieldApproximationBase base = cTx->bAse;
231 PetscErrorCode (*base_polynomials)(int p, double s, double *diff_s, double *L,
232 double *diffL, const int dim) =
234
235 int nb_gauss_pts = pts.size2();
236
237 const int side_number = 0;
238 int sense = data.dataOnEntities[MBEDGE][side_number].getSense();
239 int order = data.dataOnEntities[MBEDGE][side_number].getOrder();
240 data.dataOnEntities[MBEDGE][side_number].getN(base).resize(
241 nb_gauss_pts, NBEDGE_H1(order), false);
242 data.dataOnEntities[MBEDGE][side_number].getDiffN(base).resize(
243 nb_gauss_pts, NBEDGE_H1(order), false);
244
245 data.dataOnEntities[MBEDGE][side_number].getN(base).clear();
246 data.dataOnEntities[MBEDGE][side_number].getDiffN(base).clear();
247
248 L.resize(NBEDGE_H1(order), false);
249 diffL.resize(NBEDGE_H1(order), false);
250
251 if (data.dataOnEntities[MBEDGE][side_number].getOrder() > 1) {
252
253#ifndef NDEBUG
254 if (sense != 1 && sense != -1)
255 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
256 "Wrong sense of edge, should be 1 or -1");
257#endif
258
259 for (int gg = 0; gg != nb_gauss_pts; gg++) {
260
261 double s = (2. * pts(0, gg) - 1) * sense; // from [-1..1] * sense
262 double diff_s = 2. * sense; // oriented s = s(xi), ds/dxi = 2 * sense
263
264 // calculate Legendre polynomials at integration points
265 CHKERR base_polynomials(NBEDGE_H1(order) - 1, s, &diff_s,
266 &*L.data().begin(), &*diffL.data().begin(), 1);
267
268 for (unsigned int pp = 0;
269 pp < data.dataOnEntities[MBEDGE][side_number].getN(base).size2();
270 pp++) {
271
272 // Calculate edge shape functions N0*N1*L(p), where N0 and N1 are nodal
273 // shape functions
274 double v = data.dataOnEntities[MBVERTEX][0].getN(base)(gg, 0) *
275 data.dataOnEntities[MBVERTEX][0].getN(base)(gg, 1);
276 data.dataOnEntities[MBEDGE][side_number].getN(base)(gg, pp) = v * L(pp);
277
278 // Calculate derivative edge shape functions
279 // dN/dksi = dN0/dxi*N1*L + N0*dN1/ksi*L + N0*N1*dL/dxi
280 data.dataOnEntities[MBEDGE][side_number].getDiffN(base)(gg, pp) =
281 ((-1.) * data.dataOnEntities[MBVERTEX][0].getN(base)(gg, 1) +
282 data.dataOnEntities[MBVERTEX][0].getN(base)(gg, 0) * (+1.)) *
283 L(pp) +
284 v * diffL(pp);
285 }
286 }
287 }
288
290}
constexpr int order
#define NBEDGE_H1(P)
Number of base function on edge for H1 space.
const double v
phase velocity of light in medium (cm/ns)
PetscErrorCode(* basePolynomialsType0)(int p, double s, double *diff_s, double *L, double *diffL, const int dim)

◆ getValueH1BernsteinBezierBase()

MoFEMErrorCode EdgePolynomialBase::getValueH1BernsteinBezierBase ( MatrixDouble &  pts)
private

Definition at line 97 of file EdgePolynomialBase.cpp.

97 {
99
100 EntitiesFieldData &data = cTx->dAta;
101 const std::string &field_name = cTx->fieldName;
102 const int nb_gauss_pts = pts.size2();
103
104 auto get_alpha = [field_name](auto &data) -> MatrixInt & {
105 auto &ptr = data.getBBAlphaIndicesSharedPtr(field_name);
106 if (!ptr)
107 ptr.reset(new MatrixInt());
108 return *ptr;
109 };
110
111 auto get_base = [field_name](auto &data) -> MatrixDouble & {
112 auto &ptr = data.getBBNSharedPtr(field_name);
113 if (!ptr)
114 ptr.reset(new MatrixDouble());
115 return *ptr;
116 };
117
118 auto get_diff_base = [field_name](auto &data) -> MatrixDouble & {
119 auto &ptr = data.getBBDiffNSharedPtr(field_name);
120 if (!ptr)
121 ptr.reset(new MatrixDouble());
122 return *ptr;
123 };
124
125 if (data.dataOnEntities[MBVERTEX].size() != 1 ||
126 data.dataOnEntities[MBEDGE].size() != 1)
127 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
128 "Wrong size ent of ent data");
129 auto &vert_ent_data = data.dataOnEntities[MBVERTEX][0];
130 auto &edge_ent_data = data.dataOnEntities[MBEDGE][0];
131
132 if (vert_ent_data.getN(NOBASE).size1() != (unsigned int)nb_gauss_pts)
133 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
134 "Base functions or nodes has wrong number of integration points "
135 "for base %s",
137 auto &lambda = vert_ent_data.getN(NOBASE);
138
139 // The BB base is not hierarchical, so mixing degrees between the vertices
140 // and the edge loses completeness. H1 requires the edge order on the edge
141 // (when it carries DOFs) and vertex degrees between one and that order.
142 auto &node_order = vert_ent_data.getBBNodeOrder();
143 if (node_order.size() != 2)
144 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
145 "Wrong number of vertex orders for BB base: %d",
146 static_cast<int>(node_order.size()));
147 const bool edge_has_h1 = data.spacesOnEntities[MBEDGE].test(H1);
148 const int edge_order = edge_has_h1 ? edge_ent_data.getOrder() : 0;
149 const int order = std::max({node_order[0], node_order[1], edge_order});
150 if (order < 1)
151 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
152 "Bernstein-Bezier H1 base requires approximation order >= 1");
153 if (static_cast<size_t>(order) >=
155 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
156 "Bernstein-Bezier order %d exceeds the supported maximum %d", order,
157 static_cast<int>(
159 1);
160 for (int n = 0; n != 2; ++n)
161 if (node_order[n] < 1)
162 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
163 "Bernstein-Bezier H1 base requires vertex order between 1 and "
164 "the element order %d; vertex %d has order %d",
165 order, n, node_order[n]);
166 if (NBEDGE_H1(order) && edge_has_h1 && edge_order != order)
167 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
168 "Bernstein-Bezier base in H1 space requires uniform approximation "
169 "order on the element: edge has order %d, element order is %d. "
170 "BB functions are not hierarchical, so mixed degrees do not span "
171 "a complete polynomial space. Set one order for the whole H1 "
172 "field (L2 fields are not restricted).",
173 edge_order, order);
174
175 auto &vert_get_n = get_base(vert_ent_data);
176 auto &vert_get_diff_n = get_diff_base(vert_ent_data);
177 vert_get_n.resize(nb_gauss_pts, 2, false);
178 vert_get_diff_n.resize(nb_gauss_pts, 2, false);
179 vert_get_n.clear();
180 vert_get_diff_n.clear();
181
182 auto &vertex_alpha = get_alpha(vert_ent_data);
183 vertex_alpha.resize(2, 2, false);
184 vertex_alpha(0, 0) = node_order[0];
185 vertex_alpha(0, 1) = 0;
186 vertex_alpha(1, 0) = 0;
187 vertex_alpha(1, 1) = node_order[1];
188
190 1, nb_gauss_pts, vertex_alpha.size1(), &vertex_alpha(0, 0), &lambda(0, 0),
191 Tools::diffShapeFunMBEDGE.data(), &vert_get_n(0, 0),
192 &vert_get_diff_n(0, 0));
193 std::array<double, 2> f = {boost::math::factorial<double>(node_order[0]),
194 boost::math::factorial<double>(node_order[1])};
195
196 for (int g = 0; g != nb_gauss_pts; ++g)
197 for (int n = 0; n != 2; ++n) {
198 vert_get_n(g, n) *= f[n];
199 vert_get_diff_n(g, n) *= f[n];
200 }
201
202 // Edge interior functions. Without H1 on the edge, or without edge DOFs,
203 // leave empty matrices and no alpha indices for this field.
204 const int nb_dofs = edge_has_h1 ? NBEDGE_H1(edge_order) : 0;
205 auto &edge_get_n = get_base(edge_ent_data);
206 auto &edge_get_diff_n = get_diff_base(edge_ent_data);
207 edge_get_n.resize(nb_gauss_pts, nb_dofs, false);
208 edge_get_diff_n.resize(nb_gauss_pts, nb_dofs, false);
209
210 if (nb_dofs) {
211 auto &edge_alpha = get_alpha(edge_ent_data);
212 edge_alpha.resize(nb_dofs, 2, false);
214 &edge_alpha(0, 0));
216 edge_order, nb_gauss_pts, edge_alpha.size1(), &edge_alpha(0, 0),
217 &lambda(0, 0), Tools::diffShapeFunMBEDGE.data(), &edge_get_n(0, 0),
218 &edge_get_diff_n(0, 0));
219 } else {
220 edge_ent_data.getBBAlphaIndicesSharedPtr(field_name).reset();
221 }
222
224}
@ NOBASE
Definition definitions.h:59
static double lambda
const double n
refractive index of diffusive medium
UBlasMatrix< double > MatrixDouble
Definition Types.hpp:77
UBlasMatrix< int > MatrixInt
Definition Types.hpp:76
constexpr auto field_name
constexpr double g
static MoFEMErrorCode baseFunctionsEdge(const int N, const int gdim, const int n_alpha, const int *alpha, const double *lambda, const double *grad_lambda, double *base, double *grad_base)
static MoFEMErrorCode generateIndicesEdgeEdge(const int N, int *alpha)
static constexpr size_t MaxBernsteinBezierOrder
std::array< std::bitset< LASTSPACE >, MBMAXTYPE > spacesOnEntities
spaces on entity types

◆ getValueH1DemkowiczBase()

MoFEMErrorCode EdgePolynomialBase::getValueH1DemkowiczBase ( MatrixDouble &  pts)
private

Definition at line 292 of file EdgePolynomialBase.cpp.

292 {
294
295 EntitiesFieldData &data = cTx->dAta;
296 const FieldApproximationBase base = cTx->bAse;
297
298 int nb_gauss_pts = pts.size2();
299
300 const int side_number = 0;
301 int order = data.dataOnEntities[MBEDGE][side_number].getOrder();
302
303 data.dataOnEntities[MBEDGE][side_number].getN(base).resize(
304 nb_gauss_pts, NBEDGE_H1(order), false);
305 data.dataOnEntities[MBEDGE][side_number].getDiffN(base).resize(
306 nb_gauss_pts, NBEDGE_H1(order), false);
307
308 data.dataOnEntities[MBEDGE][side_number].getN(base).clear();
309 data.dataOnEntities[MBEDGE][side_number].getDiffN(base).clear();
310
311 double diff_shape[] = {-1, 1};
312 MatrixDouble shape(nb_gauss_pts, 2);
313
314 if (NBEDGE_L2(order)) {
315 for (int gg = 0; gg != nb_gauss_pts; gg++) {
316 const double mu0 = 1.0 - pts(0, gg); // pts ranges over [0, 1]
317 const double mu1 = pts(0, gg);
318 shape(gg, 0) = mu0;
319 shape(gg, 1) = mu1;
320 }
321
323 order, &*shape.data().begin(), diff_shape,
324 &*data.dataOnEntities[MBEDGE][side_number].getN(base).data().begin(),
325 &*data.dataOnEntities[MBEDGE][side_number]
326 .getDiffN(base)
327 .data()
328 .begin(),
329 nb_gauss_pts);
330 }
331
333}
#define NBEDGE_L2(P)
Number of base functions on edge from L2 space.
MoFEMErrorCode H1_BubbleShapeFunctions_ONSEGMENT(int p, double *N, double *diffN, double *bubbleN, double *diff_bubbleN, int nb_integration_pts)

◆ getValueHcurl()

MoFEMErrorCode EdgePolynomialBase::getValueHcurl ( MatrixDouble &  pts)
private

Definition at line 488 of file EdgePolynomialBase.cpp.

488 {
490
491 switch (cTx->bAse) {
497 default:
498 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "Not implemented");
499 }
500
502}
MoFEMErrorCode getValueHcurlDemkowiczBase(MatrixDouble &pts)
MoFEMErrorCode getValueHcurlAinsworthBase(MatrixDouble &pts)

◆ getValueHcurlAinsworthBase()

MoFEMErrorCode EdgePolynomialBase::getValueHcurlAinsworthBase ( MatrixDouble &  pts)
private

Definition at line 409 of file EdgePolynomialBase.cpp.

409 {
411
412 EntitiesFieldData &data = cTx->dAta;
413 const FieldApproximationBase base = cTx->bAse;
414
415 PetscErrorCode (*base_polynomials)(int p, double s, double *diff_s, double *L,
416 double *diffL, const int dim) =
418
419 int nb_gauss_pts = pts.size2();
420 if (data.spacesOnEntities[MBEDGE].test(HCURL)) {
421
422 if (data.dataOnEntities[MBEDGE].size() != 1)
423 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
424
425 int sense = data.dataOnEntities[MBEDGE][0].getSense();
426 int order = data.dataOnEntities[MBEDGE][0].getOrder();
427 int nb_dofs =
428 NBEDGE_AINSWORTH_HCURL(data.dataOnEntities[MBEDGE][0].getOrder());
429 data.dataOnEntities[MBEDGE][0].getN(base).resize(nb_gauss_pts, 3 * nb_dofs,
430 false);
431 data.dataOnEntities[MBEDGE][0].getDiffN(base).resize(nb_gauss_pts, 0,
432 false);
433
435 sense, order, &data.dataOnEntities[MBVERTEX][0].getN(base)(0, 0),
436 &*data.dataOnEntities[MBVERTEX][0].getDiffN(base).data().begin(),
437 &*data.dataOnEntities[MBEDGE][0].getN(base).data().begin(), nullptr,
438 nb_gauss_pts, base_polynomials);
439
440 } else {
441 data.dataOnEntities[MBEDGE][0].getN(base).resize(nb_gauss_pts, 0, false);
442 data.dataOnEntities[MBEDGE][0].getDiffN(base).resize(nb_gauss_pts, 0,
443 false);
444 }
445
447}
#define NBEDGE_AINSWORTH_HCURL(P)
MoFEMErrorCode Hcurl_Ainsworth_EdgeBaseFunctions_MBTET_ON_EDGE(int sense, int p, double *N, double *diffN, double *edgeN, double *diff_edgeN, int nb_integration_pts, PetscErrorCode(*base_polynomials)(int p, double s, double *diff_s, double *L, double *diffL, const int dim))
Edge based H-curl base functions on edge.
Definition Hcurl.cpp:175

◆ getValueHcurlDemkowiczBase()

MoFEMErrorCode EdgePolynomialBase::getValueHcurlDemkowiczBase ( MatrixDouble &  pts)
private

Definition at line 450 of file EdgePolynomialBase.cpp.

450 {
452
453 EntitiesFieldData &data = cTx->dAta;
454 const FieldApproximationBase base = cTx->bAse;
455
456 int nb_gauss_pts = pts.size2();
457 if (data.spacesOnEntities[MBEDGE].test(HCURL)) {
458
459 if (data.dataOnEntities[MBEDGE].size() != 1)
460 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
461 "No data structure to store base functions");
462
463 int sense = data.dataOnEntities[MBEDGE][0].getSense();
464 int order = data.dataOnEntities[MBEDGE][0].getOrder();
465 int nb_dofs =
466 NBEDGE_DEMKOWICZ_HCURL(data.dataOnEntities[MBEDGE][0].getOrder());
467 data.dataOnEntities[MBEDGE][0].getN(base).resize(nb_gauss_pts, 3 * nb_dofs,
468 false);
469 data.dataOnEntities[MBEDGE][0].getDiffN(base).resize(nb_gauss_pts, 0,
470 false);
471 if (nb_dofs) {
473 sense, order, &data.dataOnEntities[MBVERTEX][0].getN(base)(0, 0),
474 &*data.dataOnEntities[MBVERTEX][0].getDiffN(base).data().begin(),
475 &*data.dataOnEntities[MBEDGE][0].getN(base).data().begin(), NULL,
476 nb_gauss_pts);
477 }
478 } else {
479
480 data.dataOnEntities[MBEDGE][0].getN(base).resize(nb_gauss_pts, 0, false);
481 data.dataOnEntities[MBEDGE][0].getDiffN(base).resize(nb_gauss_pts, 0,
482 false);
483 }
484
486}
#define NBEDGE_DEMKOWICZ_HCURL(P)
MoFEMErrorCode Hcurl_Demkowicz_EdgeBaseFunctions_MBEDGE(int sense, int p, double *n, double *diff_n, double *phi, double *diff_phi, int nb_integration_pts)
Edge based H-curl base functions on edge.
Definition Hcurl.cpp:2155

◆ getValueHdiv()

MoFEMErrorCode EdgePolynomialBase::getValueHdiv ( MatrixDouble &  pts)
private

Definition at line 403 of file EdgePolynomialBase.cpp.

403 {
404 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
405 "Make no sense, unless problem is 2d (2d not implemented yet)");
406}

◆ getValueL2()

MoFEMErrorCode EdgePolynomialBase::getValueL2 ( MatrixDouble &  pts)
private

Definition at line 335 of file EdgePolynomialBase.cpp.

335 {
337
338 switch (cTx->bAse) {
344 default:
345 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "Not implemented");
346 }
347
349}
MoFEMErrorCode getValueL2AinsworthBase(MatrixDouble &pts)
MoFEMErrorCode getValueL2DemkowiczBase(MatrixDouble &pts)

◆ getValueL2AinsworthBase()

MoFEMErrorCode EdgePolynomialBase::getValueL2AinsworthBase ( MatrixDouble &  pts)
private

Definition at line 351 of file EdgePolynomialBase.cpp.

351 {
353
354 EntitiesFieldData &data = cTx->dAta;
356
357 PetscErrorCode (*base_polynomials)(int p, double s, double *diff_s, double *L,
358 double *diffL, const int dim) =
360
361 if(base == AINSWORTH_LOBATTO_BASE)
362 base_polynomials = Lobatto_polynomials;
363
364 int nb_gauss_pts = pts.size2();
365
366 constexpr int side_number = 0;
367 int order = data.dataOnEntities[MBEDGE][side_number].getOrder();
368
369 data.dataOnEntities[MBEDGE][side_number].getN(base).resize(
370 nb_gauss_pts, NBEDGE_L2(order), false);
371 data.dataOnEntities[MBEDGE][side_number].getDiffN(base).resize(
372 nb_gauss_pts, NBEDGE_L2(order), false);
373
374 auto *fun_n =
375 &*data.dataOnEntities[MBEDGE][side_number].getN(base).data().begin();
376 auto *diff_fun_n =
377 &*data.dataOnEntities[MBEDGE][side_number].getDiffN(base).data().begin();
378
379 if (NBEDGE_L2(order)) {
380
381 double diff_mu = 2;
382 double l[NBEDGE_L2(order)];
383 double diff_l[NBEDGE_L2(order)];
384 for (int gg = 0; gg != nb_gauss_pts; gg++) {
385 double mu = 2 * pts(0, gg) - 1;
386 CHKERR base_polynomials(order, mu, &diff_mu, l, diff_l, 1);
387 int qd_shift = NBEDGE_L2(order) * gg;
388 for (int n = 0; n != NBEDGE_L2(order); n++) {
389 fun_n[qd_shift + n] = l[n];
390 diff_fun_n[qd_shift + n] = diff_l[n];
391 }
392 }
393
394 }
395
397}
PetscErrorCode Lobatto_polynomials(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
Calculate Lobatto basis functions .
FTensor::Index< 'l', 3 > l

◆ getValueL2DemkowiczBase()

MoFEMErrorCode EdgePolynomialBase::getValueL2DemkowiczBase ( MatrixDouble &  pts)
private

Definition at line 399 of file EdgePolynomialBase.cpp.

399 {
400 return getValueL2AinsworthBase(pts);
401}

◆ query_interface()

MoFEMErrorCode EdgePolynomialBase::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const
virtual

Reimplemented from MoFEM::BaseFunction.

Definition at line 8 of file EdgePolynomialBase.cpp.

9 {
10 *iface = const_cast<EdgePolynomialBase *>(this);
11 return 0;
12}
Calculate base functions on tetrahedral.

Member Data Documentation

◆ cTx

EntPolynomialBaseCtx* MoFEM::EdgePolynomialBase::cTx
private

Definition at line 31 of file EdgePolynomialBase.hpp.

◆ diffL

VectorDouble MoFEM::EdgePolynomialBase::diffL
private

Definition at line 33 of file EdgePolynomialBase.hpp.

◆ L

VectorDouble MoFEM::EdgePolynomialBase::L
private

Definition at line 33 of file EdgePolynomialBase.hpp.


The documentation for this struct was generated from the following files: