23 boost::shared_ptr<BaseFunctionCtx> ctx_ptr) {
27 ctx->
baseFunPtr->resize(pts.size2(), ctx->P + 1,
false);
28 ctx->baseDiffFunPtr->resize(pts.size2(), ctx->dIm * (ctx->P + 1),
false);
30 double *diff_l = NULL;
31 for (
unsigned int gg = 0; gg < pts.size2(); gg++) {
33 l = &((*ctx->baseFunPtr)(gg, 0));
34 if (ctx->baseDiffFunPtr)
35 diff_l = &((*ctx->baseDiffFunPtr)(gg, 0));
36 ierr = (ctx->basePolynomialsType0)(ctx->P, pts(0, gg), ctx->diffS,
l,
70template <
typename Scalar,
typename DsScalar>
88 if (diffL !=
nullptr && diff_s ==
nullptr)
90 "diff_s == NULL while diffL requested");
96 for (
int d = 0; d < dim; ++d)
97 diffL[d * (p + 1) + 0] = Scalar(0);
105 for (
int d = 0; d < dim; ++d)
106 diffL[d * (p + 1) + 1] =
static_cast<Scalar
>(diff_s[d]);
112 for (
int l = 1;
l < p; ++
l) {
113 const Scalar
A = Scalar((2.0 *
l + 1.0) / (
l + 1.0));
114 const Scalar
B = Scalar(
double(
l) / (
l + 1.0));
116 L[
l + 1] =
A * s *
L[
l] -
B *
L[
l - 1];
119 for (
int d = 0; d < dim; ++d) {
120 const Scalar ds =
static_cast<Scalar
>(diff_s[d]);
122 diffL[d * (p + 1) + (
l + 1)] =
123 A * (ds *
L[
l] + s * diffL[d * (p + 1) +
l]) -
124 B * diffL[d * (p + 1) + (
l - 1)];
133 double *diffL,
int dim) {
138 std::complex<double> *diff_s,
139 std::complex<double> *
L,
140 std::complex<double> *diffL,
int dim) {
141 return Legendre_polynomials_T<std::complex<double>, std::complex<double>>(
142 p, s, diff_s,
L, diffL, dim);
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
MoFEMErrorCode Legendre_polynomials_T(int p, Scalar &s, DsScalar *diff_s, Scalar *L, Scalar *diffL, int dim)
Calculate Legendre approximation basis.
PetscErrorCode Legendre_polynomials(int p, double s, double *diff_s, double *L, double *diffL, int dim)
Calculate Legendre approximation basis.
FTensor::Index< 'l', 3 > l
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
Context class for Legendre basis function arguments.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
boost::shared_ptr< MatrixDouble > baseFunPtr
Pointer to base function matrix.
Class for calculating Legendre basis functions.
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
MoFEMErrorCode getValue(MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
Evaluate Legendre basis functions at given points.
base class for all interface classes
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.