v0.9.0
Public Member Functions | Public Attributes | List of all members
MoFEM::OpSetInvJacH1 Struct Reference

Transform local reference derivatives of shape function to global derivatives. More...

#include <src/finite_elements/DataOperators.hpp>

Inheritance diagram for MoFEM::OpSetInvJacH1:
[legend]
Collaboration diagram for MoFEM::OpSetInvJacH1:
[legend]

Public Member Functions

 OpSetInvJacH1 (MatrixDouble3by3 &inv_jac)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true, const bool do_vertices=true, const bool do_edges=true, const bool do_quads=true, const bool do_tris=true, const bool do_tets=true, const bool do_prisms=true)
 
virtual ~DataOperator ()
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data, bool symm=true)
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool do_vertices, const bool do_edges, const bool do_quads, const bool do_tris, const bool do_tets, const bool do_prisms, const bool error_if_no_base=true)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool error_if_no_base=true)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not. More...
 
void setSymm ()
 set if operator is executed taking in account symmetry More...
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem More...
 

Public Attributes

FTensor::Tensor2< double *, 3, 3 > tInvJac
 
FTensor::Index< 'i', 3 > i
 
FTensor::Index< 'j', 3 > j
 
MatrixDouble diffNinvJac
 
- Public Attributes inherited from MoFEM::DataOperator
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
bool doVertices
 If false skip vertices. More...
 
bool doEdges
 If false skip edges. More...
 
bool doQuads
 
bool doTris
 
bool doTets
 
bool doPrisms
 

Detailed Description

Transform local reference derivatives of shape function to global derivatives.

Definition at line 125 of file DataOperators.hpp.

Constructor & Destructor Documentation

◆ OpSetInvJacH1()

MoFEM::OpSetInvJacH1::OpSetInvJacH1 ( MatrixDouble3by3 inv_jac)

Definition at line 131 of file DataOperators.hpp.

132  : tInvJac(&inv_jac(0, 0), &inv_jac(0, 1), &inv_jac(0, 2), &inv_jac(1, 0),
133  &inv_jac(1, 1), &inv_jac(1, 2), &inv_jac(2, 0), &inv_jac(2, 1),
134  &inv_jac(2, 2)) {}
FTensor::Tensor2< double *, 3, 3 > tInvJac

Member Function Documentation

◆ doWork()

MoFEMErrorCode MoFEM::OpSetInvJacH1::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)
virtual

Operator for linear form, usually to calculate values on right hand side.

Reimplemented from MoFEM::DataOperator.

Definition at line 656 of file DataOperators.cpp.

657  {
659 
660  auto transform_base = [&](MatrixDouble &diff_n,
661  const bool diff_at_gauss_ptr) {
663 
664  if (!diff_n.size1())
666  if (!diff_n.size2())
668 
669  const int nb_base_functions =
670  (diff_at_gauss_ptr || type != MBVERTEX) ? diff_n.size2() / 3 : 4;
671  const int nb_gauss_pts =
672  (diff_at_gauss_ptr || type != MBVERTEX) ? diff_n.size1() : 1;
673  diffNinvJac.resize(diff_n.size1(), diff_n.size2(), false);
674 
675  double *t_diff_n_ptr = &*diff_n.data().begin();
677  t_diff_n_ptr, &t_diff_n_ptr[1], &t_diff_n_ptr[2]);
678  double *t_inv_n_ptr = &*diffNinvJac.data().begin();
680  t_inv_n_ptr, &t_inv_n_ptr[1], &t_inv_n_ptr[2]);
681 
682  switch (type) {
683 
684  case MBVERTEX:
685  case MBEDGE:
686  case MBTRI:
687  case MBTET: {
688  for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
689  for (unsigned int bb = 0; bb != nb_base_functions; ++bb) {
690  t_inv_diff_n(i) = t_diff_n(j) * tInvJac(j, i);
691  ++t_diff_n;
692  ++t_inv_diff_n;
693  }
694  }
695 
696  } break;
697  default:
698  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
699  }
700 
701  diff_n.data().swap(diffNinvJac.data());
702 
704  };
705 
706  for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
707  FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
708  CHKERR transform_base(data.getDiffN(base), false);
709  }
710 
711  switch (type) {
712  case MBVERTEX:
713  for (auto &m : data.getBBDiffNMap())
714  CHKERR transform_base(*(m.second), true);
715  break;
716  default:
717  for (auto &ptr : data.getBBDiffNByOrderArray())
718  if (ptr)
719  CHKERR transform_base(*ptr, true);
720  }
721 
723 }
MatrixDouble diffNinvJac
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:74
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
FTensor::Tensor2< double *, 3, 3 > tInvJac
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
FTensor::Index< 'i', 3 > i
FieldApproximationBase
approximation base
Definition: definitions.h:144
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:146
#define CHKERR
Inline error check.
Definition: definitions.h:596
FTensor::Index< 'j', 3 > j
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

Member Data Documentation

◆ diffNinvJac

MatrixDouble MoFEM::OpSetInvJacH1::diffNinvJac

Definition at line 136 of file DataOperators.hpp.

◆ i

FTensor::Index<'i', 3> MoFEM::OpSetInvJacH1::i

Definition at line 128 of file DataOperators.hpp.

◆ j

FTensor::Index<'j', 3> MoFEM::OpSetInvJacH1::j

Definition at line 129 of file DataOperators.hpp.

◆ tInvJac

FTensor::Tensor2<double *, 3, 3> MoFEM::OpSetInvJacH1::tInvJac

Definition at line 127 of file DataOperators.hpp.


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