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 733 of file DataOperators.cpp.

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

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:447
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:186
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:440
HVEC2
@ HVEC2
Definition: definitions.h:186
HVEC0
@ HVEC0
Definition: definitions.h:186