16 boost::shared_ptr<BaseFunctionCtx> ctx_ptr) {
21 int nb_gauss_pts = pts.size2();
28 "Wrong dimension of pts, should be at least 1 row with coordinates");
35 data.
dataOnEntities[MBVERTEX][0].getN(base).resize(nb_gauss_pts, 2,
39 &pts(0, 0), nb_gauss_pts);
45 (
unsigned int)nb_gauss_pts)
47 "Base functions or nodes has wrong number of integration points "
51 data.
dataOnEntities[MBVERTEX][0].getDiffN(base).resize(nb_gauss_pts, 2 * 1,
53 for (
auto gg = 0; gg != nb_gauss_pts; ++gg)
102 const int nb_gauss_pts = pts.size2();
105 auto &ptr = data.getBBAlphaIndicesSharedPtr(
field_name);
119 auto &ptr = data.getBBDiffNSharedPtr(
field_name);
128 "Wrong size ent of ent data");
132 if (vert_ent_data.getN(
NOBASE).size1() != (
unsigned int)nb_gauss_pts)
134 "Base functions or nodes has wrong number of integration points "
142 auto &node_order = vert_ent_data.getBBNodeOrder();
143 if (node_order.size() != 2)
145 "Wrong number of vertex orders for BB base: %d",
146 static_cast<int>(node_order.size()));
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});
152 "Bernstein-Bezier H1 base requires approximation order >= 1");
153 if (
static_cast<size_t>(
order) >=
156 "Bernstein-Bezier order %d exceeds the supported maximum %d",
order,
160 for (
int n = 0;
n != 2; ++
n)
161 if (node_order[
n] < 1)
163 "Bernstein-Bezier H1 base requires vertex order between 1 and "
164 "the element order %d; vertex %d has order %d",
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).",
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);
180 vert_get_diff_n.clear();
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];
190 1, nb_gauss_pts, vertex_alpha.size1(), &vertex_alpha(0, 0), &
lambda(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])};
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];
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);
211 auto &edge_alpha = get_alpha(edge_ent_data);
212 edge_alpha.resize(nb_dofs, 2,
false);
216 edge_order, nb_gauss_pts, edge_alpha.size1(), &edge_alpha(0, 0),
218 &edge_get_diff_n(0, 0));
220 edge_ent_data.getBBAlphaIndicesSharedPtr(
field_name).reset();
231 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
double *
L,
232 double *
diffL,
const int dim) =
235 int nb_gauss_pts = pts.size2();
237 const int side_number = 0;
254 if (sense != 1 && sense != -1)
256 "Wrong sense of edge, should be 1 or -1");
259 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
261 double s = (2. * pts(0, gg) - 1) * sense;
262 double diff_s = 2. * sense;
266 &*
L.data().begin(), &*
diffL.data().begin(), 1);
268 for (
unsigned int pp = 0;
298 int nb_gauss_pts = pts.size2();
300 const int side_number = 0;
311 double diff_shape[] = {-1, 1};
315 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
316 const double mu0 = 1.0 - pts(0, gg);
317 const double mu1 = pts(0, gg);
323 order, &*shape.data().begin(), diff_shape,
324 &*data.
dataOnEntities[MBEDGE][side_number].getN(base).data().begin(),
357 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
double *
L,
358 double *
diffL,
const int dim) =
364 int nb_gauss_pts = pts.size2();
366 constexpr int side_number = 0;
375 &*data.
dataOnEntities[MBEDGE][side_number].getN(base).data().begin();
377 &*data.
dataOnEntities[MBEDGE][side_number].getDiffN(base).data().begin();
384 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
385 double mu = 2 * pts(0, gg) - 1;
389 fun_n[qd_shift +
n] =
l[
n];
390 diff_fun_n[qd_shift +
n] = diff_l[
n];
405 "Make no sense, unless problem is 2d (2d not implemented yet)");
415 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
double *
L,
416 double *
diffL,
const int dim) =
419 int nb_gauss_pts = pts.size2();
429 data.
dataOnEntities[MBEDGE][0].getN(base).resize(nb_gauss_pts, 3 * nb_dofs,
431 data.
dataOnEntities[MBEDGE][0].getDiffN(base).resize(nb_gauss_pts, 0,
437 &*data.
dataOnEntities[MBEDGE][0].getN(base).data().begin(),
nullptr,
438 nb_gauss_pts, base_polynomials);
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,
456 int nb_gauss_pts = pts.size2();
461 "No data structure to store base functions");
467 data.
dataOnEntities[MBEDGE][0].getN(base).resize(nb_gauss_pts, 3 * nb_dofs,
469 data.
dataOnEntities[MBEDGE][0].getDiffN(base).resize(nb_gauss_pts, 0,
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,
FieldApproximationBase
approximation base
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ L2
field with C-1 continuity
@ HCURL
field with continuous tangents
@ HDIV
field with continuous normal traction
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
static const char *const ApproximationBaseNames[]
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
PetscErrorCode Lobatto_polynomials(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
Calculate Lobatto basis functions .
#define NBEDGE_DEMKOWICZ_HCURL(P)
#define NBEDGE_H1(P)
Number of base function on edge for H1 space.
#define NBEDGE_L2(P)
Number of base functions on edge from L2 space.
#define NBEDGE_AINSWORTH_HCURL(P)
const double v
phase velocity of light in medium (cm/ns)
const double n
refractive index of diffusive medium
FTensor::Index< 'l', 3 > l
MoFEMErrorCode H1_BubbleShapeFunctions_ONSEGMENT(int p, double *N, double *diffN, double *bubbleN, double *diff_bubbleN, int nb_integration_pts)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
UBlasMatrix< int > MatrixInt
implementation of Data Operators for Forces and Sources
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.
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.
constexpr auto field_name
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)
Calculate base functions on tetrahedral.
MoFEMErrorCode getValueH1AinsworthBase(MatrixDouble &pts)
MoFEMErrorCode getValue(MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
MoFEMErrorCode getValueH1DemkowiczBase(MatrixDouble &pts)
MoFEMErrorCode getValueHdiv(MatrixDouble &pts)
MoFEMErrorCode getValueL2AinsworthBase(MatrixDouble &pts)
MoFEMErrorCode getValueHcurl(MatrixDouble &pts)
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
MoFEMErrorCode getValueH1BernsteinBezierBase(MatrixDouble &pts)
MoFEMErrorCode getValueL2(MatrixDouble &pts)
MoFEMErrorCode getValueHcurlDemkowiczBase(MatrixDouble &pts)
EntPolynomialBaseCtx * cTx
MoFEMErrorCode getValueHcurlAinsworthBase(MatrixDouble &pts)
MoFEMErrorCode getValueH1(MatrixDouble &pts)
MoFEMErrorCode getValueL2DemkowiczBase(MatrixDouble &pts)
Class used to pass element data to calculate base functions on tet,triangle,edge.
const FieldApproximationBase copyNodeBase
const std::string fieldName
PetscErrorCode(* basePolynomialsType0)(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
const FieldApproximationBase bAse
static constexpr size_t MaxBernsteinBezierOrder
data structure for finite element entity
std::array< std::bitset< LASTSPACE >, MBMAXTYPE > spacesOnEntities
spaces on entity types
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
base class for all interface classes
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.