v0.14.0
Public Member Functions | Private Attributes | List of all members
MoFEM::OpScaleBaseBySpaceInverseOfMeasure< OP > Struct Template Reference

Scale base functions by inverses of measure of element. More...

#include <src/finite_elements/HODataOperators.hpp>

Inheritance diagram for MoFEM::OpScaleBaseBySpaceInverseOfMeasure< OP >:
[legend]
Collaboration diagram for MoFEM::OpScaleBaseBySpaceInverseOfMeasure< OP >:
[legend]

Public Member Functions

 OpScaleBaseBySpaceInverseOfMeasure (boost::shared_ptr< VectorDouble > det_jac_ptr, const FieldSpace space=L2)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 

Private Attributes

FieldSpace fieldSpace
 
boost::shared_ptr< VectorDoubledetJacPtr
 

Detailed Description

template<typename OP>
struct MoFEM::OpScaleBaseBySpaceInverseOfMeasure< OP >

Scale base functions by inverses of measure of element.

Template Parameters
OP
Examples
seepage.cpp.

Definition at line 390 of file HODataOperators.hpp.

Constructor & Destructor Documentation

◆ OpScaleBaseBySpaceInverseOfMeasure()

template<typename OP >
MoFEM::OpScaleBaseBySpaceInverseOfMeasure< OP >::OpScaleBaseBySpaceInverseOfMeasure ( boost::shared_ptr< VectorDouble det_jac_ptr,
const FieldSpace  space = L2 
)
inline

Definition at line 392 of file HODataOperators.hpp.

394  : OP(space), fieldSpace(space), detJacPtr(det_jac_ptr) {}

Member Function Documentation

◆ doWork()

template<typename OP >
MoFEMErrorCode MoFEM::OpScaleBaseBySpaceInverseOfMeasure< OP >::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)
inline

Definition at line 396 of file HODataOperators.hpp.

397  {
399 
400  if (!detJacPtr) {
401  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "detJacPtr not set");
402  }
403 
404  auto scale = [&]() {
405  for (int b = AINSWORTH_LEGENDRE_BASE; b != USER_BASE; b++) {
406  FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
407  auto &base_fun = data.getN(base);
408  auto &diff_base_fun = data.getDiffN(base);
409  if (detJacPtr) {
410 
411  auto &det_vec = *detJacPtr;
412  const auto nb_int_pts = base_fun.size1();
413 
414  if (nb_int_pts != det_vec.size())
415  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
416  "Number of integration pts in detJacPtr does not mush "
417  "number of integration pts in base function");
418 
419  auto get_row = [](auto &m, auto gg) {
420  return ublas::matrix_row<decltype(m)>(m, gg);
421  };
422 
423  for (auto gg = 0; gg != nb_int_pts; ++gg)
424  get_row(base_fun) /= det_vec[gg];
425 
426  if (diff_base_fun.size1() == nb_int_pts) {
427  for (auto gg = 0; gg != nb_int_pts; ++gg)
428  get_row(diff_base_fun) /= det_vec[gg];
429  }
430  }
431  }
432  };
433 
434  if (this->getFEDim() == 3) {
435  switch (fieldSpace) {
436  case H1:
437  scale();
438  break;
439  case HCURL:
440  if (type >= MBEDGE)
441  scale();
442  break;
443  case HDIV:
444  if (type >= MBTRI)
445  scale();
446  break;
447  case L2:
448  if (type >= MBTET)
449  scale();
450  break;
451  default:
452  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "impossible case");
453  }
454  } else if (this->getFEDim() == 2) {
455  switch (fieldSpace) {
456  case H1:
457  scale();
458  break;
459  case HCURL:
460  if (type >= MBEDGE)
461  scale();
462  break;
463  case HDIV:
464  case L2:
465  if (type >= MBTRI)
466  scale();
467  break;
468  default:
469  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "impossible case");
470  }
471  } else if (this->getFEDim() == 1) {
472  switch (fieldSpace) {
473  case H1:
474  scale();
475  break;
476  case HCURL:
477  case L2:
478  if (type >= MBEDGE)
479  scale();
480  break;
481  default:
482  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "impossible case");
483  }
484  } else {
485  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "impossible case");
486  }
487 
489  }

Member Data Documentation

◆ detJacPtr

template<typename OP >
boost::shared_ptr<VectorDouble> MoFEM::OpScaleBaseBySpaceInverseOfMeasure< OP >::detJacPtr
private

Definition at line 493 of file HODataOperators.hpp.

◆ fieldSpace

template<typename OP >
FieldSpace MoFEM::OpScaleBaseBySpaceInverseOfMeasure< OP >::fieldSpace
private

Definition at line 492 of file HODataOperators.hpp.


The documentation for this struct was generated from the following file:
H1
@ H1
continuous field
Definition: definitions.h:85
L2
@ L2
field with C-1 continuity
Definition: definitions.h:88
MOFEM_IMPOSSIBLE_CASE
@ MOFEM_IMPOSSIBLE_CASE
Definition: definitions.h:35
USER_BASE
@ USER_BASE
user implemented approximation base
Definition: definitions.h:68
ContactOps::scale
double scale
Definition: EshelbianContact.hpp:22
convert.type
type
Definition: convert.py:64
MoFEM::OpScaleBaseBySpaceInverseOfMeasure::fieldSpace
FieldSpace fieldSpace
Definition: HODataOperators.hpp:492
MoFEM::OpScaleBaseBySpaceInverseOfMeasure::detJacPtr
boost::shared_ptr< VectorDouble > detJacPtr
Definition: HODataOperators.hpp:493
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
FieldApproximationBase
FieldApproximationBase
approximation base
Definition: definitions.h:58
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
OP
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
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346