v0.9.1
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  case L2:
102  break;
103  default:
104  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
105  "Not implemented for this space", FieldSpaceNames[sPace]);
106  }
107  break;
109  switch (sPace) {
110  case NOSPACE:
111  case NOFIELD:
112  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Makes no sense");
113  case H1:
114  case HCURL:
115  case HDIV:
116  case L2:
118  break;
119  default:
120  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
121  "Not implemented for this space",
123  }
124  break;
125  case USER_BASE:
126  break;
127  default:
128  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
129  "Not implemented for this base <%s>",
131  }
133 }
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:179
user implemented approximation base
Definition: definitions.h:160
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:507
scalar or vector of scalars describe (no true field)
Definition: definitions.h:176
const FieldApproximationBase bAse
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:550
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
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:164
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:150
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:152
static const char *const FieldSpaceNames[]
Definition: definitions.h:184
field with continuous tangents
Definition: definitions.h:178
FieldSpace
approximation spaces
Definition: definitions.h:174
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:177
static const MOFEMuuid IDD_QUAD_BASE_FUNCTION
field with C-1 continuity
Definition: definitions.h:180