v0.14.0
LobattoPolynomial.cpp
Go to the documentation of this file.
1 /** \file LobattoPolynomial.cpp
2  * \brief implementation of multi-grid solver for p- adaptivity
3  */
4 
5 
6 
7 namespace MoFEM {
8 
10 LobattoPolynomialCtx::query_interface(boost::typeindex::type_index type_index,
11  UnknownInterface **iface) const {
12  *iface = const_cast<LobattoPolynomialCtx *>(this);
13  return 0;
14 }
15 
17 LobattoPolynomial::query_interface(boost::typeindex::type_index type_index,
18  UnknownInterface **iface) const {
19  *iface = const_cast<LobattoPolynomial *>(this);
20  return 0;
21 }
22 
25  boost::shared_ptr<BaseFunctionCtx> ctx_ptr) {
26 
28  auto ctx = ctx_ptr->getInterface<LobattoPolynomialCtx>();
29  // Polynomial order start from 2nd order
30  ctx->baseFunPtr->resize(pts.size2(), ctx->P + 1, false);
31  ctx->baseDiffFunPtr->resize(pts.size2(), ctx->dIm * (ctx->P + 1), false);
32  double *l = NULL;
33  double *diff_l = NULL;
34  for (unsigned int gg = 0; gg < pts.size2(); gg++) {
35  if (ctx->baseFunPtr)
36  l = &((*ctx->baseFunPtr)(gg, 0));
37  if (ctx->baseDiffFunPtr)
38  diff_l = &((*ctx->baseDiffFunPtr)(gg, 0));
39  ierr = (ctx->basePolynomialsType0)(ctx->P, pts(0, gg), ctx->diffS, l,
40  diff_l, ctx->dIm);
41  CHKERRG(ierr);
42  }
44 }
45 
47  boost::typeindex::type_index type_index, UnknownInterface **iface) const {
48  *iface = const_cast<KernelLobattoPolynomialCtx *>(this);
49  return 0;
50 }
51 
53  boost::typeindex::type_index type_index, UnknownInterface **iface) const {
54  *iface = const_cast<KernelLobattoPolynomial *>(this);
55  return 0;
56 }
57 
60  boost::shared_ptr<BaseFunctionCtx> ctx_ptr) {
61 
63  auto ctx = ctx_ptr->getInterface<KernelLobattoPolynomialCtx>();
64  ctx->baseFunPtr->resize(pts.size2(), ctx->P + 1, false);
65  ctx->baseDiffFunPtr->resize(pts.size2(), ctx->dIm * (ctx->P + 1), false);
66  double *l = NULL;
67  double *diff_l = NULL;
68  for (unsigned int gg = 0; gg < pts.size2(); gg++) {
69  if (ctx->baseFunPtr)
70  l = &((*ctx->baseFunPtr)(gg, 0));
71  if (ctx->baseDiffFunPtr)
72  diff_l = &((*ctx->baseDiffFunPtr)(gg, 0));
73  ierr = (ctx->basePolynomialsType0)(ctx->P, pts(0, gg), ctx->diffS, l,
74  diff_l, ctx->dIm);
75  CHKERRG(ierr);
76  }
78 }
79 
80 } // namespace MoFEM
UBlasMatrix< double >
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::LobattoPolynomial
Calculating Lobatto base functions.
Definition: LobattoPolynomial.hpp:35
MoFEM::KernelLobattoPolynomialCtx::query_interface
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Definition: LobattoPolynomial.cpp:46
MoFEM::KernelLobattoPolynomial::getValue
MoFEMErrorCode getValue(MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
Definition: LobattoPolynomial.cpp:59
MoFEM::LegendrePolynomialCtx::baseFunPtr
boost::shared_ptr< MatrixDouble > baseFunPtr
Definition: LegendrePolynomial.hpp:25
MoFEM::LobattoPolynomialCtx::query_interface
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Definition: LobattoPolynomial.cpp:10
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::LobattoPolynomial::getValue
MoFEMErrorCode getValue(MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
Definition: LobattoPolynomial.cpp:24
MoFEM::KernelLobattoPolynomialCtx
Class used to give arguments to Kernel Lobatto base functions.
Definition: LobattoPolynomial.hpp:51
MoFEM::LobattoPolynomialCtx
Class used to give arguments to Lobatto base functions.
Definition: LobattoPolynomial.hpp:17
MoFEM::UnknownInterface
base class for all interface classes
Definition: UnknownInterface.hpp:34
MoFEM::LobattoPolynomial::query_interface
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Definition: LobattoPolynomial.cpp:17
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
MoFEM::KernelLobattoPolynomial::query_interface
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Definition: LobattoPolynomial.cpp:52
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
MoFEM::KernelLobattoPolynomial
Calculating Lobatto base functions.
Definition: LobattoPolynomial.hpp:69
CHKERRG
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:496
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21