v0.9.1
Public Member Functions | Public Attributes | List of all members
MoFEM::OpGetCoordsAndNormalsOnFace Struct Reference

Calculate normals at Gauss points of triangle element. More...

#include <src/finite_elements/DataOperators.hpp>

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

Public Member Functions

 OpGetCoordsAndNormalsOnFace (MatrixDouble &coords_at_gausspt, MatrixDouble &normals_at_gausspt, MatrixDouble &tangent1_at_gausspt, MatrixDouble &tangent2_at_gausspt)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
MoFEMErrorCode calculateNormals ()
 
- 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, 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)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &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

MatrixDoublecOords_at_GaussPt
 
MatrixDoublenOrmals_at_GaussPt
 
MatrixDoubletAngent1_at_GaussPt
 
MatrixDoubletAngent2_at_GaussPt
 
MatrixDouble sPin
 
- Public Attributes inherited from MoFEM::DataOperator
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...
 

Detailed Description

Calculate normals at Gauss points of triangle element.

Definition at line 445 of file DataOperators.hpp.

Constructor & Destructor Documentation

◆ OpGetCoordsAndNormalsOnFace()

MoFEM::OpGetCoordsAndNormalsOnFace::OpGetCoordsAndNormalsOnFace ( MatrixDouble coords_at_gausspt,
MatrixDouble normals_at_gausspt,
MatrixDouble tangent1_at_gausspt,
MatrixDouble tangent2_at_gausspt 
)

Definition at line 452 of file DataOperators.hpp.

456  : cOords_at_GaussPt(coords_at_gausspt),
457  nOrmals_at_GaussPt(normals_at_gausspt),
458  tAngent1_at_GaussPt(tangent1_at_gausspt),
459  tAngent2_at_GaussPt(tangent2_at_gausspt) {}

Member Function Documentation

◆ calculateNormals()

MoFEMErrorCode MoFEM::OpGetCoordsAndNormalsOnFace::calculateNormals ( )

Definition at line 759 of file DataOperators.cpp.

759  {
761 
762  nOrmals_at_GaussPt.resize(tAngent1_at_GaussPt.size1(), 3, false);
763 
764  auto get_ftensor1 = [](MatrixDouble &m) {
766  &m(0, 0), &m(0, 1), &m(0, 2));
767  };
768  auto t_normal = get_ftensor1(nOrmals_at_GaussPt);
769  auto t_t1 = get_ftensor1(tAngent1_at_GaussPt);
770  auto t_t2 = get_ftensor1(tAngent2_at_GaussPt);
771 
775 
776  for (unsigned int gg = 0; gg != tAngent1_at_GaussPt.size1(); ++gg) {
777  t_normal(j) = FTensor::levi_civita(i, j, k) * t_t1(k) * t_t2(i);
778  ++t_normal;
779  ++t_t1;
780  ++t_t2;
781  }
782 
784 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:507
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:75
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
FTensor::Index< 'm', 2 > m
Definition: PlasticOps.hpp:67
FTensor::Index< 'k', 2 > k
Definition: ContactOps.hpp:28
FTensor::Index< 'j', 2 > j
Definition: ContactOps.hpp:27
FTensor::Index< 'i', 2 > i
[Common data]
Definition: ContactOps.hpp:26
constexpr std::enable_if<(Dim0<=2 &&Dim1<=2), Tensor2_Expr< Levi_Civita< T >, T, Dim0, Dim1, i, j > >::type levi_civita(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
levi_civita functions to make for easy adhoc use

◆ doWork()

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

675  {
677 
678  unsigned int nb_dofs = data.getFieldData().size();
679  if (nb_dofs == 0)
681 
682  int nb_gauss_pts = data.getN().size1();
683  cOords_at_GaussPt.resize(nb_gauss_pts, 3, false);
684  tAngent1_at_GaussPt.resize(nb_gauss_pts, 3, false);
685  tAngent2_at_GaussPt.resize(nb_gauss_pts, 3, false);
686 
687  auto get_ftensor1 = [](MatrixDouble &m) {
689  &m(0, 0), &m(0, 1), &m(0, 2));
690  };
691  auto t_coords = get_ftensor1(cOords_at_GaussPt);
692  auto t_t1 = get_ftensor1(tAngent1_at_GaussPt);
693  auto t_t2 = get_ftensor1(tAngent2_at_GaussPt);
697 
698  switch (type) {
699  case MBVERTEX: {
700  cOords_at_GaussPt.clear();
701  tAngent1_at_GaussPt.clear();
702  tAngent2_at_GaussPt.clear();
703  }
704  case MBEDGE:
705  case MBTRI:
706  case MBQUAD: {
707  if (2 * data.getN().size2() != data.getDiffN().size2()) {
708  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
709  }
710  if (nb_dofs % 3 != 0) {
711  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
712  }
713  if (nb_dofs > 3 * data.getN().size2()) {
714  unsigned int nn = 0;
715  for (; nn != nb_dofs; nn++) {
716  if (!data.getFieldDofs()[nn]->getActive())
717  break;
718  }
719  if (nn > 3 * data.getN().size2()) {
720  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
721  "data inconsistency for base %s",
722  ApproximationBaseNames[data.getBase()]);
723  } else {
724  nb_dofs = nn;
725  if (!nb_dofs)
727  }
728  }
729  const int nb_base_functions = data.getN().size2();
730  auto t_base = data.getFTensor0N();
731  auto t_diff_base = data.getFTensor1DiffN<2>();
732  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
733  auto t_data = data.getFTensor1FieldData<3>();
734  int bb = 0;
735  for (; bb != nb_dofs / 3; ++bb) {
736  t_coords(i) += t_base * t_data(i);
737  t_t1(i) += t_data(i) * t_diff_base(N0);
738  t_t2(i) += t_data(i) * t_diff_base(N1);
739  ++t_data;
740  ++t_base;
741  ++t_diff_base;
742  }
743  for (; bb != nb_base_functions; ++bb) {
744  ++t_base;
745  ++t_diff_base;
746  }
747  ++t_coords;
748  ++t_t1;
749  ++t_t2;
750  }
751  } break;
752  default:
753  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
754  }
755 
757 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:507
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:75
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
static const char *const ApproximationBaseNames[]
Definition: definitions.h:164
FTensor::Index< 'm', 2 > m
Definition: PlasticOps.hpp:67
FTensor::Index< 'i', 2 > i
[Common data]
Definition: ContactOps.hpp:26

Member Data Documentation

◆ cOords_at_GaussPt

MatrixDouble& MoFEM::OpGetCoordsAndNormalsOnFace::cOords_at_GaussPt

Definition at line 447 of file DataOperators.hpp.

◆ nOrmals_at_GaussPt

MatrixDouble& MoFEM::OpGetCoordsAndNormalsOnFace::nOrmals_at_GaussPt

Definition at line 448 of file DataOperators.hpp.

◆ sPin

MatrixDouble MoFEM::OpGetCoordsAndNormalsOnFace::sPin

Definition at line 461 of file DataOperators.hpp.

◆ tAngent1_at_GaussPt

MatrixDouble& MoFEM::OpGetCoordsAndNormalsOnFace::tAngent1_at_GaussPt

Definition at line 449 of file DataOperators.hpp.

◆ tAngent2_at_GaussPt

MatrixDouble& MoFEM::OpGetCoordsAndNormalsOnFace::tAngent2_at_GaussPt

Definition at line 450 of file DataOperators.hpp.


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