v0.9.0
LegendrePolynomial.cpp
Go to the documentation of this file.
1 /** \file LegendrePolynomial.cpp
2  * \brief Implementation of base for Legendre polynomials
3  */
4 
5 /**
6  * MoFEM is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
18  **/
19 
20 namespace MoFEM {
21 
23  const MOFEMuuid &uuid, BaseFunctionUnknownInterface **iface) const {
24 
26  *iface = NULL;
27  if (uuid == IDD_LEGENDRE_BASE_FUNCTION) {
28  *iface = const_cast<LegendrePolynomialCtx *>(this);
30  } else {
31  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "wrong interference");
32  }
34  CHKERRG(ierr);
36 }
37 
39  const MOFEMuuid &uuid, BaseFunctionUnknownInterface **iface) const {
40 
42  *iface = NULL;
43  if (uuid == IDD_LEGENDRE_BASE_FUNCTION) {
44  *iface = const_cast<LegendrePolynomial *>(this);
46  } else {
47  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "wrong interference");
48  }
49  ierr = BaseFunction::query_interface(uuid, iface);
50  CHKERRG(ierr);
52 }
53 
56  boost::shared_ptr<BaseFunctionCtx> ctx_ptr) {
57 
60  ierr = ctx_ptr->query_interface(IDD_LEGENDRE_BASE_FUNCTION, &iface);
61  CHKERRG(ierr);
62  LegendrePolynomialCtx *ctx = reinterpret_cast<LegendrePolynomialCtx *>(iface);
63  ctx->baseFunPtr->resize(pts.size2(), ctx->P + 1, false);
64  ctx->baseDiffFunPtr->resize(pts.size2(), ctx->dIm * (ctx->P + 1), false);
65  double *l = NULL;
66  double *diff_l = NULL;
67  for (unsigned int gg = 0; gg < pts.size2(); gg++) {
68  if (ctx->baseFunPtr)
69  l = &((*ctx->baseFunPtr)(gg, 0));
70  if (ctx->baseDiffFunPtr)
71  diff_l = &((*ctx->baseDiffFunPtr)(gg, 0));
72  ierr = (ctx->basePolynomialsType0)(ctx->P, pts(0, gg), ctx->diffS, l,
73  diff_l, ctx->dIm);
74  CHKERRG(ierr);
75  }
77 }
78 
79 } // namespace MoFEM
PetscErrorCode(* basePolynomialsType0)(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
MoFEMErrorCode getValue(MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
MoFEM interface unique ID.
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, BaseFunctionUnknownInterface **iface) const
boost::shared_ptr< MatrixDouble > baseFunPtr
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, MoFEM::BaseFunctionUnknownInterface **iface) const
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:74
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:544
static const MOFEMuuid IDD_LEGENDRE_BASE_FUNCTION
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, BaseFunctionUnknownInterface **iface) const
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
boost::shared_ptr< MatrixDouble > baseDiffFunPtr
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, BaseFunctionUnknownInterface **iface) const
Class used to give arguments to Legendre base functions.