v0.14.0
EntPolynomialBaseCtx.cpp
Go to the documentation of this file.
1 /** \file EntPolynomialBaseCtx.cpp
2 \brief Implementation of Ainsworth-Cole H1 base on tetrahedral
3 
4 */
5 
6 
7 
8 using namespace MoFEM;
9 
11 EntPolynomialBaseCtx::query_interface(boost::typeindex::type_index type_index,
12  UnknownInterface **iface) const {
13  *iface = const_cast<EntPolynomialBaseCtx *>(this);
14  return 0;
15 }
16 
18  EntitiesFieldData &data, const FieldSpace space,
19  const FieldContinuity continuity, const FieldApproximationBase base,
20  const FieldApproximationBase copy_node_base)
21  : dAta(data), sPace(space), spaceContinuity(continuity), bAse(base),
22  copyNodeBase(copy_node_base) {
23  ierr = setBase();
24  CHKERRABORT(PETSC_COMM_WORLD, ierr);
25 }
26 
28  EntitiesFieldData &data, const std::string field_name,
29  const FieldSpace space, const FieldContinuity continuity,
30  const FieldApproximationBase base,
31  const FieldApproximationBase copy_node_base)
32  : dAta(data), sPace(space), spaceContinuity(continuity), bAse(base),
33  fieldName(field_name), copyNodeBase(copy_node_base) {
34  ierr = setBase();
35  CHKERRABORT(PETSC_COMM_WORLD, ierr);
36 }
37 
40  switch (bAse) {
42  switch (sPace) {
43  case NOSPACE:
44  case NOFIELD:
45  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Makes no sense");
46  case H1:
47  case HCURL:
48  case HDIV:
49  case L2:
51  break;
52  default:
53  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
54  "Not implemented for this space", FieldSpaceNames[sPace]);
55  }
56  break;
58  switch (sPace) {
59  case NOSPACE:
60  case NOFIELD:
61  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Makes no sense");
62  case H1:
63  case HCURL:
64  case HDIV:
65  case L2:
67  break;
68  default:
69  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
70  "Not implemented for this space", FieldSpaceNames[sPace]);
71  }
72  break;
74  if(fieldName.empty())
75  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Field name not set");
76  switch (sPace) {
77  case NOSPACE:
78  case NOFIELD:
79  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Makes no sense");
80  case H1:
81  case L2:
82  break;
83  default:
84  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
85  "Not implemented for this space", FieldSpaceNames[sPace]);
86  }
87  break;
89  switch (sPace) {
90  case NOSPACE:
91  case NOFIELD:
92  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Makes no sense");
93  case H1:
94  case HCURL:
95  case HDIV:
96  case L2:
99  break;
100  default:
101  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
102  "Not implemented for this space",
104  }
105  break;
106  case USER_BASE:
107  break;
108  default:
109  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
110  "Not implemented for this base <%s>",
112  }
114 }
NOSPACE
@ NOSPACE
Definition: definitions.h:83
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::EntPolynomialBaseCtx::query_interface
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Definition: EntPolynomialBaseCtx.cpp:11
H1
@ H1
continuous field
Definition: definitions.h:85
MoFEM::EntPolynomialBaseCtx
Class used to pass element data to calculate base functions on tet,triangle,edge.
Definition: EntPolynomialBaseCtx.hpp:22
ApproximationBaseNames
const static char *const ApproximationBaseNames[]
Definition: definitions.h:72
L2
@ L2
field with C-1 continuity
Definition: definitions.h:88
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::EntPolynomialBaseCtx::basePolynomialsType1
PetscErrorCode(* basePolynomialsType1)(int p, double alpha, double x, double t, double *diff_x, double *diff_t, double *L, double *diffL, const int dim)
Definition: EntPolynomialBaseCtx.hpp:31
USER_BASE
@ USER_BASE
user implemented approximation base
Definition: definitions.h:68
FieldSpace
FieldSpace
approximation spaces
Definition: definitions.h:82
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
FieldContinuity
FieldContinuity
Field continuity.
Definition: definitions.h:99
MoFEM::EntPolynomialBaseCtx::sPace
const FieldSpace sPace
Definition: EntPolynomialBaseCtx.hpp:37
AINSWORTH_LOBATTO_BASE
@ AINSWORTH_LOBATTO_BASE
Definition: definitions.h:62
Legendre_polynomials
PetscErrorCode Legendre_polynomials(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
Calculate Legendre approximation basis.
Definition: base_functions.c:15
MoFEM::EntPolynomialBaseCtx::EntPolynomialBaseCtx
EntPolynomialBaseCtx(EntitiesFieldData &data, const FieldSpace space, const FieldContinuity continuity, const FieldApproximationBase base, const FieldApproximationBase copy_node_base=LASTBASE)
Definition: EntPolynomialBaseCtx.cpp:17
MoFEM::EntPolynomialBaseCtx::bAse
const FieldApproximationBase bAse
Definition: EntPolynomialBaseCtx.hpp:39
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
AINSWORTH_BERNSTEIN_BEZIER_BASE
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
Definition: definitions.h:64
MoFEM::UnknownInterface
base class for all interface classes
Definition: UnknownInterface.hpp:34
LobattoKernel_polynomials
PetscErrorCode LobattoKernel_polynomials(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
Calculate Kernel Lobatto base functions.
Definition: base_functions.c:328
FieldSpaceNames
const static char *const FieldSpaceNames[]
Definition: definitions.h:92
DEMKOWICZ_JACOBI_BASE
@ DEMKOWICZ_JACOBI_BASE
Definition: definitions.h:66
Jacobi_polynomials
PetscErrorCode Jacobi_polynomials(int p, double alpha, double x, double t, double *diff_x, double *diff_t, double *L, double *diffL, const int dim)
Calculate Jacobi approximation basis.
Definition: base_functions.c:67
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
HCURL
@ HCURL
field with continuous tangents
Definition: definitions.h:86
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::EntPolynomialBaseCtx::fieldName
const std::string fieldName
Definition: EntPolynomialBaseCtx.hpp:40
FieldApproximationBase
FieldApproximationBase
approximation base
Definition: definitions.h:58
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
MoFEM::EntitiesFieldData
data structure for finite element entity
Definition: EntitiesFieldData.hpp:40
HDIV
@ HDIV
field with continuous normal traction
Definition: definitions.h:87
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
MoFEM::EntPolynomialBaseCtx::basePolynomialsType0
PetscErrorCode(* basePolynomialsType0)(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
Definition: EntPolynomialBaseCtx.hpp:27
NOFIELD
@ NOFIELD
scalar or vector of scalars describe (no true field)
Definition: definitions.h:84
MoFEM::EntPolynomialBaseCtx::setBase
MoFEMErrorCode setBase()
Definition: EntPolynomialBaseCtx.cpp:38