v0.14.0
Public Member Functions | Public Attributes | List of all members
MoFEM::OpSetCovariantPiolaTransformOnEdge Struct Reference

transform Hcurl base fluxes from reference element to physical edge More...

#include <src/finite_elements/DataOperators.hpp>

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

Public Member Functions

 OpSetCovariantPiolaTransformOnEdge (const VectorDouble &tangent, const MatrixDouble &tangent_at_pts)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::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)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &data, const bool error_if_no_base=false)
 
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

const VectorDoubletAngent
 
const MatrixDoubletangentAtGaussPt
 
- Public Attributes inherited from MoFEM::DataOperator
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity. More...
 
booldoVertices
 \deprectaed If false skip vertices More...
 
booldoEdges
 \deprectaed If false skip edges More...
 
booldoQuads
 \deprectaed More...
 
booldoTris
 \deprectaed More...
 
booldoTets
 \deprectaed More...
 
booldoPrisms
 \deprectaed More...
 

Additional Inherited Members

- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)>
 
using DoWorkRhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int side, EntityType type, EntitiesFieldData::EntData &data)>
 

Detailed Description

transform Hcurl base fluxes from reference element to physical edge

Definition at line 496 of file DataOperators.hpp.

Constructor & Destructor Documentation

◆ OpSetCovariantPiolaTransformOnEdge()

MoFEM::OpSetCovariantPiolaTransformOnEdge::OpSetCovariantPiolaTransformOnEdge ( const VectorDouble tangent,
const MatrixDouble tangent_at_pts 
)
inline

Definition at line 501 of file DataOperators.hpp.

503  : tAngent(tangent), tangentAtGaussPt(tangent_at_pts) {}

Member Function Documentation

◆ doWork()

MoFEMErrorCode MoFEM::OpSetCovariantPiolaTransformOnEdge::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)
virtual

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

Reimplemented from MoFEM::DataOperator.

Definition at line 738 of file DataOperators.cpp.

739  {
741 
742  if (type != MBEDGE)
744 
747  &tAngent[0], &tAngent[1], &tAngent[2]);
748  const double l0 = t_m(i) * t_m(i);
749 
750  auto get_base_at_pts = [&](auto base) {
752  &data.getN(base)(0, HVEC0), &data.getN(base)(0, HVEC1),
753  &data.getN(base)(0, HVEC2));
754  return t_h_curl;
755  };
756 
757  auto get_tangent_at_pts = [&]() {
759  &tangentAtGaussPt(0, 0), &tangentAtGaussPt(0, 1),
760  &tangentAtGaussPt(0, 2));
761  return t_m_at_pts;
762  };
763 
764  auto calculate_squared_edge_length = [&]() {
765  std::vector<double> l1;
766  int nb_gauss_pts = tangentAtGaussPt.size1();
767  if (nb_gauss_pts) {
768  l1.resize(nb_gauss_pts);
769  auto t_m_at_pts = get_tangent_at_pts();
770  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
771  l1[gg] = t_m_at_pts(i) * t_m_at_pts(i);
772  ++t_m_at_pts;
773  }
774  }
775  return l1;
776  };
777 
778  auto l1 = calculate_squared_edge_length();
779 
780  for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
781 
782  FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
783  const size_t nb_gauss_pts = data.getN(base).size1();
784  const size_t nb_dofs = data.getN(base).size2() / 3;
785  if (nb_gauss_pts && nb_dofs) {
786  auto t_h_curl = get_base_at_pts(base);
787  int cc = 0;
788  if (tangentAtGaussPt.size1() == nb_gauss_pts) {
789  auto t_m_at_pts = get_tangent_at_pts();
790  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
791  const double l0 = l1[gg];
792  for (int ll = 0; ll != nb_dofs; ll++) {
793  const double val = t_h_curl(0);
794  const double a = val / l0;
795  t_h_curl(i) = t_m_at_pts(i) * a;
796  ++t_h_curl;
797  ++cc;
798  }
799  ++t_m_at_pts;
800  }
801  } else {
802  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
803  for (int ll = 0; ll != nb_dofs; ll++) {
804  const double val = t_h_curl(0);
805  const double a = val / l0;
806  t_h_curl(i) = t_m(i) * a;
807  ++t_h_curl;
808  ++cc;
809  }
810  }
811  }
812 
813  if (cc != nb_gauss_pts * nb_dofs)
814  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "Data inconsistency");
815  }
816  }
817 
819 }

Member Data Documentation

◆ tAngent

const VectorDouble& MoFEM::OpSetCovariantPiolaTransformOnEdge::tAngent

Definition at line 498 of file DataOperators.hpp.

◆ tangentAtGaussPt

const MatrixDouble& MoFEM::OpSetCovariantPiolaTransformOnEdge::tangentAtGaussPt

Definition at line 499 of file DataOperators.hpp.


The documentation for this struct was generated from the following files:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::OpSetCovariantPiolaTransformOnEdge::tangentAtGaussPt
const MatrixDouble & tangentAtGaussPt
Definition: DataOperators.hpp:499
MoFEM::OpSetCovariantPiolaTransformOnEdge::tAngent
const VectorDouble & tAngent
Definition: DataOperators.hpp:498
LASTBASE
@ LASTBASE
Definition: definitions.h:69
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
MOFEM_IMPOSSIBLE_CASE
@ MOFEM_IMPOSSIBLE_CASE
Definition: definitions.h:35
HVEC1
@ HVEC1
Definition: definitions.h:199
a
constexpr double a
Definition: approx_sphere.cpp:30
convert.type
type
Definition: convert.py:64
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index< 'i', 3 >
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
FieldApproximationBase
FieldApproximationBase
approximation base
Definition: definitions.h:58
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
HVEC2
@ HVEC2
Definition: definitions.h:199
HVEC0
@ HVEC0
Definition: definitions.h:199