v0.8.23
JacobiPolynomial.cpp
Go to the documentation of this file.
1 /** \file legendrepolynomial.cpp
2  * \brief implementation of multi-grid solver for p- adaptivity
3  *
4  * MoFEM is free software: you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the
6  * Free Software Foundation, either version 3 of the License, or (at your
7  * option) any later version.
8  *
9  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12  * License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
16  */
17 
18 namespace MoFEM {
19 
22  MoFEM::UnknownInterface **iface) const {
24  *iface = NULL;
25  if (uuid == IDD_JACOBI_BASE_FUNCTION) {
26  *iface = const_cast<JacobiPolynomialCtx *>(this);
28  } else {
29  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "wrong interference");
30  }
32  CHKERRG(ierr);
34 }
35 
38  MoFEM::UnknownInterface **iface) const {
40  *iface = NULL;
41  if (uuid == IDD_JACOBI_BASE_FUNCTION) {
42  *iface = const_cast<JacobiPolynomial *>(this);
44  } else {
45  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "wrong interference");
46  }
47  ierr = BaseFunction::query_interface(uuid, iface);
48  CHKERRG(ierr);
50 }
51 
52 template <class TYPE>
54  TYPE *ctx) {
56  ctx->baseFunPtr->resize(pts_x.size2(), ctx->P + 1, false);
57  ctx->baseDiffFunPtr->resize(pts_x.size2(), ctx->dIm * (ctx->P + 1), false);
58  if (pts_x.size1() != pts_t.size1() || pts_x.size2() != pts_t.size2()) {
59  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
60  "Inconsistent size of arguments");
61  }
62  double *l = NULL;
63  double *diff_l = NULL;
64  for (unsigned int gg = 0; gg < pts_x.size2(); gg++) {
65  if (ctx->baseFunPtr)
66  l = &((*ctx->baseFunPtr)(gg, 0));
67  if (ctx->baseDiffFunPtr)
68  diff_l = &((*ctx->baseDiffFunPtr)(gg, 0));
69  ierr = (ctx->basePolynomialsType1)(ctx->P, ctx->aLpha, pts_x(0, gg),
70  pts_t(0, gg), ctx->diffX, ctx->diffT, l,
71  diff_l, ctx->dIm);
72  CHKERRG(ierr);
73  }
75 }
76 
79  boost::shared_ptr<BaseFunctionCtx> ctx_ptr) {
82  CHKERR ctx_ptr->query_interface(IDD_JACOBI_BASE_FUNCTION, &iface);
83  JacobiPolynomialCtx *ctx = reinterpret_cast<JacobiPolynomialCtx *>(iface);
84  CHKERR get_value(pts_x, pts_t, ctx);
86 }
87 
90  MoFEM::UnknownInterface **iface) const {
92  *iface = NULL;
94  *iface = const_cast<IntegratedJacobiPolynomialCtx *>(this);
96  } else {
97  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "wrong interference");
98  }
100  CHKERRG(ierr);
102 }
103 
105  const MOFEMuuid &uuid, MoFEM::UnknownInterface **iface) const {
107  *iface = NULL;
109  *iface = const_cast<IntegratedJacobiPolynomial *>(this);
111  } else {
112  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "wrong interference");
113  }
114  ierr = BaseFunction::query_interface(uuid, iface);
115  CHKERRG(ierr);
117 }
118 
120  MatrixDouble &pts_x, MatrixDouble &pts_t,
121  boost::shared_ptr<BaseFunctionCtx> ctx_ptr) {
124  CHKERR ctx_ptr->query_interface(IDD_INTEGRATED_JACOBI_BASE_FUNCTION, &iface);
126  reinterpret_cast<IntegratedJacobiPolynomialCtx *>(iface);
127  CHKERR get_value(pts_x, pts_t, ctx);
129 }
130 
131 } // namespace MoFEM
static const MOFEMuuid IDD_INTEGRATED_JACOBI_BASE_FUNCTION
MoFEMErrorCode getValue(MatrixDouble &pts_x, MatrixDouble &pts_t, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
MoFEM interface unique ID.
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, MoFEM::UnknownInterface **iface) const
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:500
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:77
base class for all interface classes
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, MoFEM::UnknownInterface **iface) const
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:543
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:507
Class used to give arguments to Legendre base functions.
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
static const MOFEMuuid IDD_JACOBI_BASE_FUNCTION
MoFEMErrorCode getValue(MatrixDouble &pts_x, MatrixDouble &pts_t, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
#define CHKERR
Inline error check.
Definition: definitions.h:595
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, MoFEM::UnknownInterface **iface) const
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, MoFEM::UnknownInterface **iface) const
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, MoFEM::UnknownInterface **iface) const
static MoFEMErrorCode get_value(MatrixDouble &pts_x, MatrixDouble &pts_t, TYPE *ctx)
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, MoFEM::UnknownInterface **iface) const