v0.13.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
plastic.cpp, and thermo_plastic.cpp.

Definition at line 354 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 
)

Definition at line 356 of file HODataOperators.hpp.

358  : OP(space), fieldSpace(space), detJacPtr(det_jac_ptr) {}
boost::shared_ptr< VectorDouble > detJacPtr

Member Function Documentation

◆ doWork()

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

Definition at line 360 of file HODataOperators.hpp.

361  {
363 
364  if (!detJacPtr) {
365  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "detJacPtr not set");
366  }
367 
368  auto scale = [&]() {
369  for (int b = AINSWORTH_LEGENDRE_BASE; b != USER_BASE; b++) {
370  FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
371  auto &base_fun = data.getN(base);
372  auto &diff_base_fun = data.getDiffN(base);
373  if (detJacPtr) {
374 
375  auto &det_vec = *detJacPtr;
376  const auto nb_base_fun = base_fun.size2();
377  const auto nb_int_pts = base_fun.size1();
378 
379  if (nb_int_pts != det_vec.size())
380  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
381  "Number of integration pts in detJacPtr does not mush "
382  "number of integration pts in base function");
383 
384  auto get_row = [](auto &m, auto gg) {
385  return ublas::matrix_row<decltype(m)>(m, gg);
386  };
387 
388  for (auto gg = 0; gg != nb_int_pts; ++gg)
389  get_row(base_fun) /= det_vec[gg];
390 
391  if (diff_base_fun.size1() == nb_int_pts) {
392  for (auto gg = 0; gg != nb_int_pts; ++gg)
393  get_row(diff_base_fun) /= det_vec[gg];
394  }
395  }
396  }
397  };
398 
399  if (this->getFEDim() == 3) {
400  switch (fieldSpace) {
401  case H1:
402  scale();
403  break;
404  case HCURL:
405  if (type >= MBEDGE)
406  scale();
407  break;
408  case HDIV:
409  if (type >= MBTRI)
410  scale();
411  break;
412  case L2:
413  if (type >= MBTET)
414  scale();
415  break;
416  default:
417  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE, "impossible case");
418  }
419  } else if (this->getFEDim() == 2) {
420  switch (fieldSpace) {
421  case H1:
422  scale();
423  break;
424  case HCURL:
425  if (type >= MBEDGE)
426  scale();
427  break;
428  case HDIV:
429  case L2:
430  if (type >= MBTRI)
431  scale();
432  break;
433  default:
434  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE, "impossible case");
435  }
436  } else if (this->getFEDim() == 1) {
437  switch (fieldSpace) {
438  case H1:
439  scale();
440  break;
441  case HCURL:
442  case L2:
443  if (type >= MBEDGE)
444  scale();
445  break;
446  default:
447  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE, "impossible case");
448  }
449  } else {
450  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE, "impossible case");
451  }
452 
454  }
FieldApproximationBase
approximation base
Definition: definitions.h:71
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:73
@ USER_BASE
user implemented approximation base
Definition: definitions.h:81
@ L2
field with C-1 continuity
Definition: definitions.h:101
@ H1
continuous field
Definition: definitions.h:98
@ HCURL
field with continuous tangents
Definition: definitions.h:99
@ HDIV
field with continuous normal traction
Definition: definitions.h:100
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
@ MOFEM_IMPOSIBLE_CASE
Definition: definitions.h:48
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:44
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
double scale
Definition: plastic.cpp:103
FTensor::Index< 'm', 3 > m

Member Data Documentation

◆ detJacPtr

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

Definition at line 458 of file HODataOperators.hpp.

◆ fieldSpace

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

Definition at line 457 of file HODataOperators.hpp.


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