v0.14.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SomeUserPolynomialBase Struct Reference

Class used to calculate base functions at integration points. More...

Inheritance diagram for SomeUserPolynomialBase:
[legend]
Collaboration diagram for SomeUserPolynomialBase:
[legend]

Public Member Functions

 SomeUserPolynomialBase ()=default
 
 ~SomeUserPolynomialBase ()=default
 
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Return interface to this class when one ask for for tetrahedron, otherisw return interface class for generic class. More...
 
MoFEMErrorCode getValue (MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
 Calculate base functions at intergeneration points. More...
 
- Public Member Functions inherited from MoFEM::BaseFunction
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, MoFEM::UnknownInterface **iface) const
 
virtual MoFEMErrorCode getValue (MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
 
virtual MoFEMErrorCode getValue (MatrixDouble &pts_x, MatrixDouble &pts_t, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
 
- Public Member Functions inherited from MoFEM::BaseFunctionUnknownInterface
virtual ~BaseFunctionUnknownInterface ()=default
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 

Private Member Functions

MoFEMErrorCode getValueHdivForCGGBubble (MatrixDouble &pts)
 

Private Attributes

EntPolynomialBaseCtxcTx
 
MatrixDouble shapeFun
 

Additional Inherited Members

- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version. More...
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version. More...
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version. More...
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version. More...
 

Detailed Description

Class used to calculate base functions at integration points.

Examples
forces_and_sources_testing_users_base.cpp.

Definition at line 33 of file forces_and_sources_testing_users_base.cpp.

Constructor & Destructor Documentation

◆ SomeUserPolynomialBase()

SomeUserPolynomialBase::SomeUserPolynomialBase ( )
default

◆ ~SomeUserPolynomialBase()

SomeUserPolynomialBase::~SomeUserPolynomialBase ( )
default

Member Function Documentation

◆ getValue()

MoFEMErrorCode SomeUserPolynomialBase::getValue ( MatrixDouble &  pts,
boost::shared_ptr< BaseFunctionCtx ctx_ptr 
)
inline

Calculate base functions at intergeneration points.

Parameters
pts
ctx_ptr
Returns
MoFEMErrorCode

Definition at line 59 of file forces_and_sources_testing_users_base.cpp.

60  {
62 
64 
65  int nb_gauss_pts = pts.size2();
66  if (!nb_gauss_pts) {
68  }
69 
70  if (pts.size1() < 3) {
71  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
72  "Wrong dimension of pts, should be at least 3 rows with "
73  "coordinates");
74  }
75 
76  switch (cTx->sPace) {
77  case HDIV:
79  break;
80  default:
81  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
82  }
83 
85  }

◆ getValueHdivForCGGBubble()

MoFEMErrorCode SomeUserPolynomialBase::getValueHdivForCGGBubble ( MatrixDouble &  pts)
inlineprivate

Definition at line 92 of file forces_and_sources_testing_users_base.cpp.

92  {
94 
95  const FieldApproximationBase base = cTx->bAse;
96  // This should be used only in case USER_BASE is selected
97  if (cTx->bAse != USER_BASE) {
98  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
99  "Wrong base, should be USER_BASE");
100  }
101 
102  // This is example, simply use Demkowicz HDiv base to generate base
103  // functions
104 
105  EntitiesFieldData &data = cTx->dAta;
106  int nb_gauss_pts = pts.size2();
107 
108  // calculate shape functions, i.e. barycentric coordinates
109  shapeFun.resize(nb_gauss_pts, 4, false);
110  CHKERR ShapeMBTET(&*shapeFun.data().begin(), &pts(0, 0), &pts(1, 0),
111  &pts(2, 0), nb_gauss_pts);
112  // derivatives of shape functions
113  double diff_shape_fun[12];
114  CHKERR ShapeDiffMBTET(diff_shape_fun);
115 
116  int volume_order = data.dataOnEntities[MBTET][0].getOrder();
117 
118  int p_f[4];
119  double *phi_f[4];
120  double *diff_phi_f[4];
121 
122  // Calculate base function on tet faces
123  for (int ff = 0; ff != 4; ff++) {
124  int face_order = data.dataOnEntities[MBTRI][ff].getOrder();
125  int order = volume_order > face_order ? volume_order : face_order;
126  data.dataOnEntities[MBTRI][ff].getN(base).resize(
127  nb_gauss_pts, 3 * NBFACETRI_DEMKOWICZ_HDIV(order), false);
128  data.dataOnEntities[MBTRI][ff].getDiffN(base).resize(
129  nb_gauss_pts, 9 * NBFACETRI_DEMKOWICZ_HDIV(order), false);
130  p_f[ff] = order;
131  phi_f[ff] = &*data.dataOnEntities[MBTRI][ff].getN(base).data().begin();
132  diff_phi_f[ff] =
133  &*data.dataOnEntities[MBTRI][ff].getDiffN(base).data().begin();
135  continue;
137  &data.facesNodes(ff, 0), order, &*shapeFun.data().begin(),
138  diff_shape_fun, phi_f[ff], diff_phi_f[ff], nb_gauss_pts, 4);
139  }
140 
141  // Calculate base functions in tet interior
142  if (NBVOLUMETET_DEMKOWICZ_HDIV(volume_order) > 0) {
143  data.dataOnEntities[MBTET][0].getN(base).resize(
144  nb_gauss_pts, 3 * NBVOLUMETET_DEMKOWICZ_HDIV(volume_order), false);
145  data.dataOnEntities[MBTET][0].getDiffN(base).resize(
146  nb_gauss_pts, 9 * NBVOLUMETET_DEMKOWICZ_HDIV(volume_order), false);
147  double *phi_v = &*data.dataOnEntities[MBTET][0].getN(base).data().begin();
148  double *diff_phi_v =
149  &*data.dataOnEntities[MBTET][0].getDiffN(base).data().begin();
151  volume_order, &*shapeFun.data().begin(), diff_shape_fun, p_f, phi_f,
152  diff_phi_f, phi_v, diff_phi_v, nb_gauss_pts);
153  }
154 
155  // Set size of face base correctly
156  for (int ff = 0; ff != 4; ff++) {
157  int face_order = data.dataOnEntities[MBTRI][ff].getOrder();
158  data.dataOnEntities[MBTRI][ff].getN(base).resize(
159  nb_gauss_pts, 3 * NBFACETRI_DEMKOWICZ_HDIV(face_order), true);
160  data.dataOnEntities[MBTRI][ff].getDiffN(base).resize(
161  nb_gauss_pts, 9 * NBFACETRI_DEMKOWICZ_HDIV(face_order), true);
162  }
163 
165  }

◆ query_interface()

MoFEMErrorCode SomeUserPolynomialBase::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const
inlinevirtual

Return interface to this class when one ask for for tetrahedron, otherisw return interface class for generic class.

Parameters
ifaceinterface class
Returns
MoFEMErrorCode

Implements MoFEM::BaseFunctionUnknownInterface.

Definition at line 45 of file forces_and_sources_testing_users_base.cpp.

46  {
48  *iface = const_cast<SomeUserPolynomialBase *>(this);
50  }

Member Data Documentation

◆ cTx

EntPolynomialBaseCtx* SomeUserPolynomialBase::cTx
private

Definition at line 88 of file forces_and_sources_testing_users_base.cpp.

◆ shapeFun

MatrixDouble SomeUserPolynomialBase::shapeFun
private

Definition at line 90 of file forces_and_sources_testing_users_base.cpp.


The documentation for this struct was generated from the following file:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Definition: UnknownInterface.hpp:93
MoFEM::Hdiv_Demkowicz_Face_MBTET_ON_FACE
MoFEMErrorCode Hdiv_Demkowicz_Face_MBTET_ON_FACE(int *faces_nodes, int p, double *N, double *diffN, double *phi_f, double *diff_phi_f, int gdim, int nb)
Definition: Hdiv.cpp:617
MoFEM::EntPolynomialBaseCtx
Class used to pass element data to calculate base functions on tet,triangle,edge.
Definition: EntPolynomialBaseCtx.hpp:22
MoFEM::EntPolynomialBaseCtx::dAta
EntitiesFieldData & dAta
Definition: EntPolynomialBaseCtx.hpp:36
MoFEM::Hdiv_Demkowicz_Interior_MBTET
MoFEMErrorCode Hdiv_Demkowicz_Interior_MBTET(int p, double *N, double *diffN, int p_face[], double *phi_f[4], double *diff_phi_f[4], double *phi_v, double *diff_phi_v, int gdim)
Definition: Hdiv.cpp:762
MoFEM::EntitiesFieldData::facesNodes
MatrixInt facesNodes
nodes on finite element faces
Definition: EntitiesFieldData.hpp:46
USER_BASE
@ USER_BASE
user implemented approximation base
Definition: definitions.h:68
order
constexpr int order
Definition: dg_projection.cpp:18
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
NBFACETRI_DEMKOWICZ_HDIV
#define NBFACETRI_DEMKOWICZ_HDIV(P)
Definition: h1_hdiv_hcurl_l2.h:139
MoFEM::EntPolynomialBaseCtx::sPace
const FieldSpace sPace
Definition: EntPolynomialBaseCtx.hpp:37
SomeUserPolynomialBase::shapeFun
MatrixDouble shapeFun
Definition: forces_and_sources_testing_users_base.cpp:90
NBVOLUMETET_DEMKOWICZ_HDIV
#define NBVOLUMETET_DEMKOWICZ_HDIV(P)
Definition: h1_hdiv_hcurl_l2.h:140
MoFEM::EntPolynomialBaseCtx::bAse
const FieldApproximationBase bAse
Definition: EntPolynomialBaseCtx.hpp:38
ShapeDiffMBTET
PetscErrorCode ShapeDiffMBTET(double *diffN)
calculate derivatives of shape functions
Definition: fem_tools.c:319
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
FieldApproximationBase
FieldApproximationBase
approximation base
Definition: definitions.h:58
MoFEM::EntitiesFieldData::dataOnEntities
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
Definition: EntitiesFieldData.hpp:56
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
SomeUserPolynomialBase::getValueHdivForCGGBubble
MoFEMErrorCode getValueHdivForCGGBubble(MatrixDouble &pts)
Definition: forces_and_sources_testing_users_base.cpp:92
MoFEM::EntitiesFieldData
data structure for finite element entity
Definition: EntitiesFieldData.hpp:40
SomeUserPolynomialBase
Class used to calculate base functions at integration points.
Definition: forces_and_sources_testing_users_base.cpp:33
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
HDIV
@ HDIV
field with continuous normal traction
Definition: definitions.h:87
SomeUserPolynomialBase::cTx
EntPolynomialBaseCtx * cTx
Definition: forces_and_sources_testing_users_base.cpp:88
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
ShapeMBTET
PetscErrorCode ShapeMBTET(double *N, const double *G_X, const double *G_Y, const double *G_Z, int DIM)
calculate shape functions
Definition: fem_tools.c:306