v0.15.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
EshelbianPlasticity::CGGUserPolynomialBase Struct Reference

#include "users_modules/eshelbian_plasticity/src/EshelbianPlasticity.hpp"

Inheritance diagram for EshelbianPlasticity::CGGUserPolynomialBase:
[legend]
Collaboration diagram for EshelbianPlasticity::CGGUserPolynomialBase:
[legend]

Public Types

using CachePhi = boost::tuple< int, int, MatrixDouble >
 

Public Member Functions

 CGGUserPolynomialBase (boost::shared_ptr< CachePhi > cache_phi=nullptr)
 
 ~CGGUserPolynomialBase ()=default
 
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, BaseFunctionUnknownInterface **iface) const
 
MoFEMErrorCode getValue (MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
 

Private Member Functions

MoFEMErrorCode getValueHdivForCGGBubble (MatrixDouble &pts)
 

Private Attributes

MatrixDouble shapeFun
 
boost::shared_ptr< CachePhicachePhiPtr
 

Detailed Description

Definition at line 37 of file EshelbianPlasticity.hpp.

Member Typedef Documentation

◆ CachePhi

using EshelbianPlasticity::CGGUserPolynomialBase::CachePhi = boost::tuple<int, int, MatrixDouble>

Definition at line 39 of file EshelbianPlasticity.hpp.

Constructor & Destructor Documentation

◆ CGGUserPolynomialBase()

EshelbianPlasticity::CGGUserPolynomialBase::CGGUserPolynomialBase ( boost::shared_ptr< CachePhi cache_phi = nullptr)

Definition at line 2187 of file EshelbianPlasticity.cpp.

2189 : TetPolynomialBase(), cachePhiPtr(cache_phi_otr) {}
Calculate base functions on tetrahedral.

◆ ~CGGUserPolynomialBase()

EshelbianPlasticity::CGGUserPolynomialBase::~CGGUserPolynomialBase ( )
default

Member Function Documentation

◆ getValue()

MoFEMErrorCode EshelbianPlasticity::CGGUserPolynomialBase::getValue ( MatrixDouble &  pts,
boost::shared_ptr< BaseFunctionCtx ctx_ptr 
)

Definition at line 2199 of file EshelbianPlasticity.cpp.

2200 {
2202
2203 this->cTx = ctx_ptr->getInterface<EntPolynomialBaseCtx>();
2204
2205 int nb_gauss_pts = pts.size2();
2206 if (!nb_gauss_pts) {
2208 }
2209
2210 if (pts.size1() < 3) {
2211 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2212 "Wrong dimension of pts, should be at least 3 rows with "
2213 "coordinates");
2214 }
2215
2216 const auto base = this->cTx->bAse;
2217 EntitiesFieldData &data = this->cTx->dAta;
2218
2219 switch (this->cTx->sPace) {
2220 case HDIV:
2222 break;
2223 case L2:
2224 data.dataOnEntities[MBVERTEX][0].getN(base).resize(nb_gauss_pts, 4, false);
2226 &*data.dataOnEntities[MBVERTEX][0].getN(base).data().begin(),
2227 &pts(0, 0), &pts(1, 0), &pts(2, 0), nb_gauss_pts);
2228 data.dataOnEntities[MBVERTEX][0].getDiffN(base).resize(4, 3, false);
2229 std::copy(Tools::diffShapeFunMBTET.begin(), Tools::diffShapeFunMBTET.end(),
2230 data.dataOnEntities[MBVERTEX][0].getDiffN(base).data().begin());
2231 this->cTx->basePolynomialsType0 = Legendre_polynomials;
2232 CHKERR getValueL2AinsworthBase(pts);
2233 break;
2234 default:
2235 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
2236 }
2237
2239}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ L2
field with C-1 continuity
Definition definitions.h:88
@ HDIV
field with continuous normal traction
Definition definitions.h:87
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
PetscErrorCode Legendre_polynomials(int p, double s, double *diff_s, double *L, double *diffL, const int dim)
Calculate Legendre approximation basis.
MoFEMErrorCode getValueHdivForCGGBubble(MatrixDouble &pts)
Class used to pass element data to calculate base functions on tet,triangle,edge.
data structure for finite element entity
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
static MoFEMErrorCode shapeFunMBTET(double *shape, const double *ksi, const double *eta, const double *zeta, const double nb)
Calculate shape functions on tetrahedron.
Definition Tools.hpp:747
static constexpr std::array< double, 12 > diffShapeFunMBTET
Definition Tools.hpp:271

◆ getValueHdivForCGGBubble()

MoFEMErrorCode EshelbianPlasticity::CGGUserPolynomialBase::getValueHdivForCGGBubble ( MatrixDouble &  pts)
private

number of integration points

Definition at line 2242 of file EshelbianPlasticity.cpp.

2242 {
2244
2245 // This should be used only in case USER_BASE is selected
2246 if (this->cTx->bAse != USER_BASE) {
2247 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2248 "Wrong base, should be USER_BASE");
2249 }
2250 // get access to data structures on element
2251 EntitiesFieldData &data = this->cTx->dAta;
2252 // Get approximation order on element. Note that bubble functions are only
2253 // on tetrahedron.
2254 const int order = data.dataOnEntities[MBTET][0].getOrder();
2255 /// number of integration points
2256 const int nb_gauss_pts = pts.size2();
2257
2258 auto check_cache = [this](int order, int nb_gauss_pts) -> bool {
2259 if (cachePhiPtr) {
2260 return cachePhiPtr->get<0>() == order &&
2261 cachePhiPtr->get<1>() == nb_gauss_pts;
2262 } else {
2263 return false;
2264 }
2265 };
2266
2267 if (check_cache(order, nb_gauss_pts)) {
2268 auto &mat = cachePhiPtr->get<2>();
2269 auto &phi = data.dataOnEntities[MBTET][0].getN(USER_BASE);
2270 phi.resize(mat.size1(), mat.size2(), false);
2271 noalias(phi) = mat;
2272
2273 } else {
2274 // calculate shape functions, i.e. barycentric coordinates
2275 shapeFun.resize(nb_gauss_pts, 4, false);
2276 CHKERR ShapeMBTET(&*shapeFun.data().begin(), &pts(0, 0), &pts(1, 0),
2277 &pts(2, 0), nb_gauss_pts);
2278 // derivatives of shape functions
2279 double diff_shape_fun[12];
2280 CHKERR ShapeDiffMBTET(diff_shape_fun);
2281
2282 const int nb_base_functions = NBVOLUMETET_CCG_BUBBLE(order);
2283 // get base functions and set size
2284 MatrixDouble &phi = data.dataOnEntities[MBTET][0].getN(USER_BASE);
2285 phi.resize(nb_gauss_pts, 9 * nb_base_functions, false);
2286 // finally calculate base functions
2288 &phi(0, 0), &phi(0, 1), &phi(0, 2),
2289
2290 &phi(0, 3), &phi(0, 4), &phi(0, 5),
2291
2292 &phi(0, 6), &phi(0, 7), &phi(0, 8));
2293 CHKERR CGG_BubbleBase_MBTET(order, &shapeFun(0, 0), diff_shape_fun, t_phi,
2294 nb_gauss_pts);
2295
2296 if (cachePhiPtr) {
2297 cachePhiPtr->get<0>() = order;
2298 cachePhiPtr->get<1>() = nb_gauss_pts;
2299 cachePhiPtr->get<2>().resize(phi.size1(), phi.size2(), false);
2300 noalias(cachePhiPtr->get<2>()) = phi;
2301 }
2302 }
2303
2305}
#define NBVOLUMETET_CCG_BUBBLE(P)
Bubble function for CGG H div space.
@ USER_BASE
user implemented approximation base
Definition definitions.h:68
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
constexpr int order
PetscErrorCode ShapeDiffMBTET(double *diffN)
calculate derivatives of shape functions
Definition fem_tools.c:319
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
MoFEMErrorCode CGG_BubbleBase_MBTET(const int p, const double *N, const double *diffN, FTensor::Tensor2< FTensor::PackPtr< double *, 9 >, 3, 3 > &phi, const int gdim)
Calculate CGGT tonsorial bubble base.
static double phi

◆ query_interface()

MoFEMErrorCode EshelbianPlasticity::CGGUserPolynomialBase::query_interface ( boost::typeindex::type_index  type_index,
BaseFunctionUnknownInterface **  iface 
) const

Definition at line 2191 of file EshelbianPlasticity.cpp.

2193 {
2194 *iface = const_cast<CGGUserPolynomialBase *>(this);
2195 return 0;
2196}
CGGUserPolynomialBase(boost::shared_ptr< CachePhi > cache_phi=nullptr)

Member Data Documentation

◆ cachePhiPtr

boost::shared_ptr<CachePhi> EshelbianPlasticity::CGGUserPolynomialBase::cachePhiPtr
private

Definition at line 51 of file EshelbianPlasticity.hpp.

◆ shapeFun

MatrixDouble EshelbianPlasticity::CGGUserPolynomialBase::shapeFun
private

Definition at line 50 of file EshelbianPlasticity.hpp.


The documentation for this struct was generated from the following files: