v0.8.23
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, 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

const VectorDoubletAngent
 
const MatrixDoubletangentAtGaussPt
 
- 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 Hcurl base fluxes from reference element to physical edge

Definition at line 566 of file DataOperators.hpp.

Constructor & Destructor Documentation

◆ OpSetCovariantPiolaTransformOnEdge()

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

Definition at line 571 of file DataOperators.hpp.

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

Member Function Documentation

◆ doWork()

MoFEMErrorCode MoFEM::OpSetCovariantPiolaTransformOnEdge::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 1557 of file DataOperators.cpp.

1558  {
1560 
1561  if (type != MBEDGE)
1563 
1566  &tAngent[0], &tAngent[1], &tAngent[2]);
1567  const double l0 = t_m(i) * t_m(i);
1568 
1569  auto get_base_at_pts = [&](auto base) {
1571  &data.getN(base)(0, HVEC0), &data.getN(base)(0, HVEC1),
1572  &data.getN(base)(0, HVEC2));
1573  return t_h_curl;
1574  };
1575 
1576  auto get_tangent_at_pts = [&]() {
1578  &tangentAtGaussPt(0, 0), &tangentAtGaussPt(0, 1),
1579  &tangentAtGaussPt(0, 2));
1580  return t_m_at_pts;
1581  };
1582 
1583  auto calculate_squared_edge_length = [&]() {
1584  std::vector<double> l1;
1585  int nb_gauss_pts = tangentAtGaussPt.size1();
1586  if (nb_gauss_pts) {
1587  l1.resize(nb_gauss_pts);
1588  auto t_m_at_pts = get_tangent_at_pts();
1589  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1590  l1[gg] = t_m_at_pts(i) * t_m_at_pts(i);
1591  ++t_m_at_pts;
1592  }
1593  }
1594  return l1;
1595  };
1596 
1597  auto l1 = calculate_squared_edge_length();
1598 
1599  for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
1600 
1601  FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
1602  const size_t nb_gauss_pts = data.getN(base).size1();
1603  const size_t nb_dofs = data.getN(base).size2() / 3;
1604  if (nb_gauss_pts && nb_dofs) {
1605  auto t_h_curl = get_base_at_pts(base);
1606  int cc = 0;
1607  if (tangentAtGaussPt.size1() == nb_gauss_pts) {
1608  auto t_m_at_pts = get_tangent_at_pts();
1609  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
1610  const double l0 = l1[gg];
1611  for (int ll = 0; ll != nb_dofs; ll++) {
1612  const double val = t_h_curl(0);
1613  const double a = val / l0;
1614  t_h_curl(i) = t_m_at_pts(i) * a;
1615  ++t_h_curl;
1616  ++cc;
1617  }
1618  ++t_m_at_pts;
1619  }
1620  } else {
1621  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
1622  for (int ll = 0; ll != nb_dofs; ll++) {
1623  const double val = t_h_curl(0);
1624  const double a = val / l0;
1625  t_h_curl(i) = t_m(i) * a;
1626  ++t_h_curl;
1627  ++cc;
1628  }
1629  }
1630  }
1631 
1632  if (cc != nb_gauss_pts * nb_dofs)
1633  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE, "Data inconsistency");
1634 
1635  }
1636  }
1637 
1639 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
FieldApproximationBase
approximation base
Definition: definitions.h:143
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:145

Member Data Documentation

◆ tAngent

const VectorDouble& MoFEM::OpSetCovariantPiolaTransformOnEdge::tAngent

Definition at line 568 of file DataOperators.hpp.

◆ tangentAtGaussPt

const MatrixDouble& MoFEM::OpSetCovariantPiolaTransformOnEdge::tangentAtGaussPt

Definition at line 569 of file DataOperators.hpp.


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