v0.13.1
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.

Definition at line 364 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 366 of file HODataOperators.hpp.

368 : 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 370 of file HODataOperators.hpp.

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

Member Data Documentation

◆ detJacPtr

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

Definition at line 468 of file HODataOperators.hpp.

◆ fieldSpace

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

Definition at line 467 of file HODataOperators.hpp.


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