v0.8.4
Public Member Functions | Public Attributes | List of all members
MoFEM::OpSetCovariantPiolaTransformOnTriangle Struct Reference

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

#include <src/finite_elements/DataOperators.hpp>

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

Public Member Functions

 OpSetCovariantPiolaTransformOnTriangle (const VectorDouble &normal, const MatrixDouble &normals_at_pts, const VectorDouble &tangent0, const MatrixDouble &tangent0_at_pts, const VectorDouble &tangent1, const MatrixDouble &tangent1_at_pts)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 Operator for linear form, usually to calculate values on left 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 right 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 VectorDoublenOrmal
 
const MatrixDoublenormalsAtGaussPt
 
const VectorDoubletAngent0
 
const MatrixDoubletangent0AtGaussPt
 
const VectorDoubletAngent1
 
const MatrixDoubletangent1AtGaussPt
 
- 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 triangle

Definition at line 717 of file DataOperators.hpp.

Constructor & Destructor Documentation

◆ OpSetCovariantPiolaTransformOnTriangle()

MoFEM::OpSetCovariantPiolaTransformOnTriangle::OpSetCovariantPiolaTransformOnTriangle ( const VectorDouble normal,
const MatrixDouble normals_at_pts,
const VectorDouble tangent0,
const MatrixDouble tangent0_at_pts,
const VectorDouble tangent1,
const MatrixDouble tangent1_at_pts 
)

Definition at line 726 of file DataOperators.hpp.

733  :
734  nOrmal(normal),
735  normalsAtGaussPt(normals_at_pts),
736  tAngent0(tangent0),
737  tangent0AtGaussPt(tangent0_at_pts),
738  tAngent1(tangent1),
739  tangent1AtGaussPt(tangent1_at_pts)
740  {}

Member Function Documentation

◆ doWork()

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

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

Reimplemented from MoFEM::DataOperator.

Definition at line 1428 of file DataOperators.cpp.

1429  {
1430 
1432 
1433  if (type != MBEDGE && type != MBTRI)
1435 
1439 
1440  // double zero = 0;
1442  &tAngent0[0], &tAngent1[0], &nOrmal[0], &tAngent0[1], &tAngent1[1],
1443  &nOrmal[1], &tAngent0[2], &tAngent1[2], &nOrmal[2], 3);
1444  double det;
1446  ierr = determinantTensor3by3(t_m, det);
1447  CHKERRG(ierr);
1448  ierr = invertTensor3by3(t_m, det, t_inv_m);
1449  CHKERRG(ierr);
1450 
1451  for (int b = AINSWORTH_LEGENDRE_BASE; b != USER_BASE; b++) {
1452 
1453  FieldApproximationBase base = ApproximationBaseArray[b];
1454 
1455  int nb_dofs = data.getHcurlN(base).size2() / 3;
1456  int nb_gauss_pts = data.getHcurlN(base).size1();
1457 
1458  MatrixDouble piola_n(data.getHcurlN(base).size1(),
1459  data.getHcurlN(base).size2());
1460  MatrixDouble diff_piola_n(data.getDiffHcurlN(base).size1(),
1461  data.getDiffHcurlN(base).size2());
1462 
1463  if (nb_dofs > 0 && nb_gauss_pts > 0) {
1464 
1465  FieldApproximationBase base = ApproximationBaseArray[b];
1467  &data.getHcurlN(base)(0, HCURL0), &data.getHcurlN(base)(0, HCURL1),
1468  &data.getHcurlN(base)(0, HCURL2));
1470  &data.getDiffHcurlN(base)(0, HCURL0_0),
1471  &data.getDiffHcurlN(base)(0, HCURL0_1),
1472  &data.getDiffHcurlN(base)(0, HCURL1_0),
1473  &data.getDiffHcurlN(base)(0, HCURL1_1),
1474  &data.getDiffHcurlN(base)(0, HCURL2_0),
1475  &data.getDiffHcurlN(base)(0, HCURL2_1));
1476  FTensor::Tensor1<FTensor::PackPtr<double *, 3>, 3> t_transformed_h_curl(
1477  &piola_n(0, HCURL0), &piola_n(0, HCURL1), &piola_n(0, HCURL2));
1479  t_transformed_diff_h_curl(
1480  &diff_piola_n(0, HCURL0_0), &diff_piola_n(0, HCURL0_1),
1481  &diff_piola_n(0, HCURL1_0), &diff_piola_n(0, HCURL1_1),
1482  &diff_piola_n(0, HCURL2_0), &diff_piola_n(0, HCURL2_1));
1483 
1484  int cc = 0;
1485  if (normalsAtGaussPt.size1() == (unsigned int)nb_gauss_pts) {
1486  // HO geometry is set, so jacobian is different at each gauss point
1488  &tangent0AtGaussPt(0, 0), &tangent1AtGaussPt(0, 0),
1489  &normalsAtGaussPt(0, 0), &tangent0AtGaussPt(0, 1),
1490  &tangent1AtGaussPt(0, 1), &normalsAtGaussPt(0, 1),
1491  &tangent0AtGaussPt(0, 2), &tangent1AtGaussPt(0, 2),
1492  &normalsAtGaussPt(0, 2), 3);
1493  for (int gg = 0; gg < nb_gauss_pts; ++gg) {
1494  ierr = determinantTensor3by3(t_m_at_pts, det);
1495  CHKERRG(ierr);
1496  ierr = invertTensor3by3(t_m_at_pts, det, t_inv_m);
1497  CHKERRG(ierr);
1498  for (int ll = 0; ll != nb_dofs; ll++) {
1499  t_transformed_h_curl(i) = t_inv_m(j, i) * t_h_curl(j);
1500  t_transformed_diff_h_curl(i, k) =
1501  t_inv_m(j, i) * t_diff_h_curl(j, k);
1502  ++t_h_curl;
1503  ++t_transformed_h_curl;
1504  ++t_diff_h_curl;
1505  ++t_transformed_diff_h_curl;
1506  ++cc;
1507  }
1508  ++t_m_at_pts;
1509  }
1510  } else {
1511  for (int gg = 0; gg < nb_gauss_pts; ++gg) {
1512  for (int ll = 0; ll != nb_dofs; ll++) {
1513  t_transformed_h_curl(i) = t_inv_m(j, i) * t_h_curl(j);
1514  t_transformed_diff_h_curl(i, k) =
1515  t_inv_m(j, i) * t_diff_h_curl(j, k);
1516  ++t_h_curl;
1517  ++t_transformed_h_curl;
1518  ++t_diff_h_curl;
1519  ++t_transformed_diff_h_curl;
1520  ++cc;
1521  }
1522  }
1523  }
1524  if (cc != nb_gauss_pts * nb_dofs) {
1525  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSIBLE_CASE, "Data inconsistency");
1526  }
1527  data.getHcurlN(base).data().swap(piola_n.data());
1528  data.getDiffHcurlN(base).data().swap(diff_piola_n.data());
1529  }
1530  }
1531 
1533 }
MoFEMErrorCode invertTensor3by3(ublas::matrix< T, L, A > &jac_data, ublas::vector< T, A > &det_data, ublas::matrix< T, L, A > &inv_jac_data)
Calculate inverse of tensor rank 2 at integration points.
user implemented approximation base
Definition: definitions.h:146
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
MoFEMErrorCode determinantTensor3by3(T1 &t, T2 &det)
Calculate determinant.
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:565
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
FieldApproximationBase
approximation base
Definition: definitions.h:140
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Common.hpp:212
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:142

Member Data Documentation

◆ nOrmal

const VectorDouble& MoFEM::OpSetCovariantPiolaTransformOnTriangle::nOrmal

Definition at line 719 of file DataOperators.hpp.

◆ normalsAtGaussPt

const MatrixDouble& MoFEM::OpSetCovariantPiolaTransformOnTriangle::normalsAtGaussPt

Definition at line 720 of file DataOperators.hpp.

◆ tAngent0

const VectorDouble& MoFEM::OpSetCovariantPiolaTransformOnTriangle::tAngent0

Definition at line 721 of file DataOperators.hpp.

◆ tangent0AtGaussPt

const MatrixDouble& MoFEM::OpSetCovariantPiolaTransformOnTriangle::tangent0AtGaussPt

Definition at line 722 of file DataOperators.hpp.

◆ tAngent1

const VectorDouble& MoFEM::OpSetCovariantPiolaTransformOnTriangle::tAngent1

Definition at line 723 of file DataOperators.hpp.

◆ tangent1AtGaussPt

const MatrixDouble& MoFEM::OpSetCovariantPiolaTransformOnTriangle::tangent1AtGaussPt

Definition at line 724 of file DataOperators.hpp.


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