v0.9.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 /* This file is part of MoFEM.
7  * MoFEM is free software: you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
19 
20 using namespace MoFEM;
21 
23  const MOFEMuuid &uuid, BaseFunctionUnknownInterface **iface) const {
24 
26  *iface = NULL;
27  if (uuid == IDD_TET_BASE_FUNCTION || uuid == IDD_TRI_BASE_FUNCTION ||
29  *iface = const_cast<EntPolynomialBaseCtx *>(this);
31  } else {
32  SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "wrong interference");
33  }
35  CHKERRG(ierr);
37 }
38 
40  DataForcesAndSourcesCore &data, const FieldSpace space,
41  const FieldApproximationBase base,
42  const FieldApproximationBase copy_node_base)
43  : dAta(data), sPace(space), bAse(base), copyNodeBase(copy_node_base) {
44  ierr = setBase();
45  CHKERRABORT(PETSC_COMM_WORLD, ierr);
46 }
47 
49  DataForcesAndSourcesCore &data, const std::string field_name,
50  const FieldSpace space, const FieldApproximationBase base,
51  const FieldApproximationBase copy_node_base)
52  : dAta(data), sPace(space), bAse(base), fieldName(field_name),
53  copyNodeBase(copy_node_base) {
54  ierr = setBase();
55  CHKERRABORT(PETSC_COMM_WORLD, ierr);
56 }
57 
60  switch (bAse) {
62  switch (sPace) {
63  case NOSPACE:
64  case NOFIELD:
65  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Makes no sense");
66  case H1:
67  case HCURL:
68  case HDIV:
69  case L2:
71  break;
72  default:
73  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
74  "Not implemented for this space", FieldSpaceNames[sPace]);
75  }
76  break;
78  switch (sPace) {
79  case NOSPACE:
80  case NOFIELD:
81  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Makes no sense");
82  case H1:
83  case HCURL:
84  case HDIV:
85  case L2:
87  break;
88  default:
89  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
90  "Not implemented for this space", FieldSpaceNames[sPace]);
91  }
92  break;
94  if(fieldName.empty())
95  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Field name not set");
96  switch (sPace) {
97  case NOSPACE:
98  case NOFIELD:
99  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Makes no sense");
100  case H1:
101  break;
102  default:
103  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
104  "Not implemented for this space", FieldSpaceNames[sPace]);
105  }
106  break;
108  switch (sPace) {
109  case NOSPACE:
110  case NOFIELD:
111  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Makes no sense");
112  case H1:
113  case HCURL:
114  case HDIV:
115  case L2:
117  break;
118  default:
119  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
120  "Not implemented for this space",
122  }
123  break;
124  case USER_BASE:
125  break;
126  default:
127  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
128  "Not implemented for this base <%s>",
130  }
132 }
PetscErrorCode Legendre_polynomials(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
Calculate Legendre approximation basis.
MoFEM interface unique ID.
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, BaseFunctionUnknownInterface **iface) const
field with continuous normal traction
Definition: definitions.h:173
user implemented approximation base
Definition: definitions.h:154
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, BaseFunctionUnknownInterface **iface) const
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.
PetscErrorCode(* basePolynomialsType0)(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
data structure for finite element entityIt keeps that about indices of degrees of freedom,...
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
scalar or vector of scalars describe (no true field)
Definition: definitions.h:170
const FieldApproximationBase bAse
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:544
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
EntPolynomialBaseCtx(DataForcesAndSourcesCore &data, const FieldSpace space, const FieldApproximationBase base, const FieldApproximationBase copy_node_base=LASTBASE)
static const MOFEMuuid IDD_TET_BASE_FUNCTION
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
static const char *const ApproximationBaseNames[]
Definition: definitions.h:158
PetscErrorCode LobattoKernel_polynomials(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
Calculate Kernel Lobatto base functions.
FieldApproximationBase
approximation base
Definition: definitions.h:144
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:146
static const char *const FieldSpaceNames[]
Definition: definitions.h:178
field with continuous tangents
Definition: definitions.h:172
FieldSpace
approximation spaces
Definition: definitions.h:168
static const MOFEMuuid IDD_EDGE_BASE_FUNCTION
PetscErrorCode(* basePolynomialsType1)(int p, double alpha, double x, double t, double *diff_x, double *diff_t, double *L, double *diffL, const int dim)
static const MOFEMuuid IDD_TRI_BASE_FUNCTION
continuous field
Definition: definitions.h:171
static const MOFEMuuid IDD_QUAD_BASE_FUNCTION
field with C-1 continuity
Definition: definitions.h:174