v0.14.0
Public Member Functions | Protected Member Functions | List of all members
MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator Struct Reference

default operator for EDGE element More...

#include <src/finite_elements/EdgeElementForcesAndSourcesCore.hpp>

Inheritance diagram for MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator:
[legend]
Collaboration diagram for MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator:
[legend]

Public Member Functions

const EntityHandlegetConn ()
 get element connectivity More...
 
double getLength ()
 get edge length More...
 
VectorDoublegetDirection ()
 get edge direction More...
 
auto getFTensor1Normal ()
 get edge normal NOTE: it should be used only in 2D analysis More...
 
auto getFTensor1Normal (const FTensor::Tensor1< double, 3 > &vec)
 get ftensor1 edge normal More...
 
auto getFTensor1NormalsAtGaussPts (const FTensor::Tensor1< double, 3 > &vec)
 
auto getFTensor1NormalsAtGaussPts ()
 get normal at integration points More...
 
VectorDoublegetCoords ()
 get edge node coordinates More...
 
MatrixDoublegetTangentAtGaussPts ()
 get tangent vector to edge curve at integration points More...
 
DEPRECATED MatrixDoublegetTangetAtGaussPts ()
 
const EdgeElementForcesAndSourcesCoregetEdgeFE ()
 get pointer to this finite element More...
 
FTensor::Tensor1< double, 3 > getFTensor1Direction ()
 
FTensor::Tensor1< FTensor::PackPtr< double *, 3 >, 3 > getFTensor1Coords ()
 get get coords at gauss points More...
 
DEPRECATED FTensor::Tensor1< FTensor::PackPtr< double *, 3 >, 3 > getTensor1Coords ()
 
template<int DIM = 3>
FTensor::Tensor1< FTensor::PackPtr< double *, 3 >, DIM > getFTensor1TangentAtGaussPts ()
 Get tangent vector at integration points. More...
 
MoFEMErrorCode loopSideFaces (const string fe_name, FaceElementForcesAndSourcesCoreOnSide &fe_side)
 
template<>
FTensor::Tensor1< FTensor::PackPtr< double *, 3 >, 3 > getFTensor1TangentAtGaussPts ()
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPSPACE, const bool symm=true)
 
 UserDataOperator (const std::string field_name, const char type, const bool symm=true)
 
 UserDataOperator (const std::string row_field_name, const std::string col_field_name, const char type, const bool symm=true)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
int getFEDim () const
 Get dimension of finite element. More...
 
EntityType getFEType () const
 Get dimension of finite element. More...
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer. More...
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity. More...
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object. More...
 
int getOpType () const
 Get operator types. More...
 
void setOpType (const OpType type)
 Set operator type. More...
 
void addOpType (const OpType type)
 Add operator type. More...
 
int getNinTheLoop () const
 get number of finite element in the loop More...
 
int getLoopSize () const
 get size of elements in the loop More...
 
std::string getFEName () const
 Get name of the element. More...
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
ForcesAndSourcesCoregetRefinePtrFE () const
 
const PetscData::SwitchesgetDataCtx () const
 
const KspMethod::KSPContext getKSPCtx () const
 
const SnesMethod::SNESContext getSNESCtx () const
 
const TSMethod::TSContext getTSCtx () const
 
Vec getKSPf () const
 
Mat getKSPA () const
 
Mat getKSPB () const
 
Vec getSNESf () const
 
Vec getSNESx () const
 
Mat getSNESA () const
 
Mat getSNESB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSu_tt () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTStimeStep () const
 
double getTSa () const
 
double getTSaa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
double getMeasure () const
 get measure of element More...
 
doublegetMeasure ()
 get measure of element More...
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy, AdjCache *adj_cache=nullptr)
 User calls this function to loop over elements on the side of face. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopThis (const string &fe_name, ForcesAndSourcesCore *this_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over the same element using a different set of integration points. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopParent (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopChildren (const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations. 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 doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
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...
 

Protected Member Functions

MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType {
  OPROW = 1 << 0, OPCOL = 1 << 1, OPROWCOL = 1 << 2, OPSPACE = 1 << 3,
  OPLAST = 1 << 3
}
 Controls loop over entities on element. More...
 
using AdjCache = std::map< EntityHandle, std::vector< boost::weak_ptr< NumeredEntFiniteElement > >>
 
- 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)>
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- 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...
 
- Static Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
static const char *const OpTypeNames []
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

default operator for EDGE element

Examples
continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, forces_and_sources_testing_edge_element.cpp, hcurl_divergence_operator_2d.cpp, helmholtz.cpp, and phase.cpp.

Definition at line 68 of file EdgeElementForcesAndSourcesCore.hpp.

Member Function Documentation

◆ getConn()

const EntityHandle * UserDataOperator::getConn ( )
inline

get element connectivity

Definition at line 185 of file EdgeElementForcesAndSourcesCore.hpp.

185  {
186  return static_cast<EdgeElementForcesAndSourcesCore *>(ptrFE)->cOnn;
187 }

◆ getCoords()

VectorDouble & UserDataOperator::getCoords ( )
inline

get edge node coordinates

Definition at line 199 of file EdgeElementForcesAndSourcesCore.hpp.

199  {
200  return static_cast<EdgeElementForcesAndSourcesCore *>(ptrFE)->cOords;
201 }

◆ getDirection()

VectorDouble & UserDataOperator::getDirection ( )
inline

get edge direction

Definition at line 194 of file EdgeElementForcesAndSourcesCore.hpp.

194  {
195  return static_cast<EdgeElementForcesAndSourcesCore *>(ptrFE)->dIrection;
196 }

◆ getEdgeFE()

const EdgeElementForcesAndSourcesCore * UserDataOperator::getEdgeFE ( )
inline

get pointer to this finite element

Definition at line 210 of file EdgeElementForcesAndSourcesCore.hpp.

210  {
211  return static_cast<EdgeElementForcesAndSourcesCore *>(ptrFE);
212 }

◆ getFTensor1Coords()

FTensor::Tensor1< FTensor::PackPtr< double *, 3 >, 3 > UserDataOperator::getFTensor1Coords ( )
inline

get get coords at gauss points

auto t_center;
auto t_coords = getFTensor1Coords();
t_center(i) = 0;
for(int nn = 0;nn!=2;nn++) {
t_center(i) += t_coords(i);
++t_coords;
}
t_center(i) /= 2;

Definition at line 221 of file EdgeElementForcesAndSourcesCore.hpp.

221  {
222  double *ptr = &*getCoords().data().begin();
223  return FTensor::Tensor1<FTensor::PackPtr<double *, 3>, 3>(ptr, &ptr[1],
224  &ptr[2]);
225 }

◆ getFTensor1Direction()

FTensor::Tensor1< double, 3 > UserDataOperator::getFTensor1Direction ( )
inline

Definition at line 215 of file EdgeElementForcesAndSourcesCore.hpp.

215  {
217  getDirection()[2]);
218 }

◆ getFTensor1Normal() [1/2]

auto UserDataOperator::getFTensor1Normal ( )
inline

get edge normal NOTE: it should be used only in 2D analysis

Definition at line 256 of file EdgeElementForcesAndSourcesCore.hpp.

256  {
258 }

◆ getFTensor1Normal() [2/2]

auto UserDataOperator::getFTensor1Normal ( const FTensor::Tensor1< double, 3 > &  vec)
inline

get ftensor1 edge normal

Parameters
vecvector in third direction
Returns
auto

Definition at line 244 of file EdgeElementForcesAndSourcesCore.hpp.

245  {
250  auto t_dir = getFTensor1Direction();
251  t_normal(i) = FTensor::levi_civita(i, j, k) * t_dir(j) * vec(k);
252  return t_normal;
253 }

◆ getFTensor1NormalsAtGaussPts() [1/2]

auto UserDataOperator::getFTensor1NormalsAtGaussPts ( )
inline

get normal at integration points

Example:

double nrm2;
auto t_normal = getFTensor1NormalsAtGaussPts();
for(int gg = gg!=data.getN().size1();gg++) {
nrm2 = sqrt(t_normal(i)*t_normal(i));
++t_normal;
}

Definition at line 281 of file EdgeElementForcesAndSourcesCore.hpp.

281  {
283 }

◆ getFTensor1NormalsAtGaussPts() [2/2]

auto UserDataOperator::getFTensor1NormalsAtGaussPts ( const FTensor::Tensor1< double, 3 > &  vec)
inline

Definition at line 261 of file EdgeElementForcesAndSourcesCore.hpp.

261  {
265 
266  auto &normals_at_gauss_pts =
268  normals_at_gauss_pts.resize(3, getGaussPts().size2(), false);
269  auto t_normal = getFTensor1FromMat<3>(normals_at_gauss_pts);
270  auto t_dir = getFTensor1TangentAtGaussPts<3>();
271  for(auto gg = 0; gg!=getGaussPts().size2(); ++gg) {
272  t_normal(i) = FTensor::levi_civita(i, j, k) * t_dir(j) * vec(k);
273  ++t_normal;
274  ++t_dir;
275  }
276 
277  return getFTensor1FromMat<3>(normals_at_gauss_pts);
278 }

◆ getFTensor1TangentAtGaussPts() [1/2]

template<int DIM = 3>
FTensor::Tensor1<FTensor::PackPtr<double *, 3>, DIM> MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator::getFTensor1TangentAtGaussPts ( )
inline

Get tangent vector at integration points.

Returns
FTensor::Tensor1<FTensor::PackPtr<double *, 3>, DIM>

◆ getFTensor1TangentAtGaussPts() [2/2]

FTensor::Tensor1< FTensor::PackPtr< double *, 3 >, 2 > UserDataOperator::getFTensor1TangentAtGaussPts< 2 >
inline

Definition at line 230 of file EdgeElementForcesAndSourcesCore.hpp.

230  {
231  double *ptr = &*getTangentAtGaussPts().data().begin();
232  return FTensor::Tensor1<FTensor::PackPtr<double *, 3>, 3>(ptr, &ptr[1],
233  &ptr[2]);
234 }

◆ getLength()

double UserDataOperator::getLength ( )
inline

get edge length

Definition at line 189 of file EdgeElementForcesAndSourcesCore.hpp.

189  {
190  return static_cast<EdgeElementForcesAndSourcesCore *>(ptrFE)->lEngth;
191 }

◆ getTangentAtGaussPts()

MatrixDouble & UserDataOperator::getTangentAtGaussPts ( )
inline

get tangent vector to edge curve at integration points

Definition at line 204 of file EdgeElementForcesAndSourcesCore.hpp.

204  {
205  return static_cast<EdgeElementForcesAndSourcesCore *>(ptrFE)
207 }

◆ getTangetAtGaussPts()

DEPRECATED MatrixDouble& MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator::getTangetAtGaussPts ( )
inline

Definition at line 130 of file EdgeElementForcesAndSourcesCore.hpp.

130  {
131  return getTangentAtGaussPts();
132  }

◆ getTensor1Coords()

DEPRECATED FTensor::Tensor1<FTensor::PackPtr<double *, 3>, 3> MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator::getTensor1Coords ( )
inline
Deprecated:
use getFTensor1Coords

Definition at line 163 of file EdgeElementForcesAndSourcesCore.hpp.

163  {
164  return getFTensor1Coords();
165  }

◆ loopSideFaces()

MoFEMErrorCode UserDataOperator::loopSideFaces ( const string  fe_name,
FaceElementForcesAndSourcesCoreOnSide fe_side 
)

Definition at line 145 of file EdgeElementForcesAndSourcesCore.cpp.

146  {
147  return loopSide(fe_name, &fe_side, 2);
148 }

◆ setPtrFE()

MoFEMErrorCode UserDataOperator::setPtrFE ( ForcesAndSourcesCore ptr)
protectedvirtual

Reimplemented from MoFEM::ForcesAndSourcesCore::UserDataOperator.

Definition at line 135 of file EdgeElementForcesAndSourcesCore.cpp.

136  {
138  if (!(ptrFE = dynamic_cast<EdgeElementForcesAndSourcesCore *>(ptr)))
139  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
140  "User operator and finite element do not work together");
142 }

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::EdgeElementForcesAndSourcesCore::UserDataOperator::getFTensor1Coords
FTensor::Tensor1< FTensor::PackPtr< double *, 3 >, 3 > getFTensor1Coords()
get get coords at gauss points
Definition: EdgeElementForcesAndSourcesCore.hpp:221
EdgeElementForcesAndSourcesCore
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator::getFTensor1NormalsAtGaussPts
auto getFTensor1NormalsAtGaussPts()
get normal at integration points
Definition: EdgeElementForcesAndSourcesCore.hpp:281
MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator::getDirection
VectorDouble & getDirection()
get edge direction
Definition: EdgeElementForcesAndSourcesCore.hpp:194
MoFEM::EdgeElementForcesAndSourcesCore::tangentAtGaussPts
MatrixDouble tangentAtGaussPts
Definition: EdgeElementForcesAndSourcesCore.hpp:48
MoFEM::EdgeElementForcesAndSourcesCore::cOnn
const EntityHandle * cOnn
Definition: EdgeElementForcesAndSourcesCore.hpp:54
FTensor::levi_civita
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
Definition: Levi_Civita.hpp:617
MoFEM::EdgeElementForcesAndSourcesCore::lEngth
double & lEngth
Definition: EdgeElementForcesAndSourcesCore.hpp:51
MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator::getTangentAtGaussPts
MatrixDouble & getTangentAtGaussPts()
get tangent vector to edge curve at integration points
Definition: EdgeElementForcesAndSourcesCore.hpp:204
MoFEM::ForcesAndSourcesCore::UserDataOperator::getGaussPts
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
Definition: ForcesAndSourcesCore.hpp:1235
MoFEM::EdgeElementForcesAndSourcesCore::cOords
VectorDouble cOords
Definition: EdgeElementForcesAndSourcesCore.hpp:56
MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator::getFTensor1Normal
auto getFTensor1Normal()
get edge normal NOTE: it should be used only in 2D analysis
Definition: EdgeElementForcesAndSourcesCore.hpp:256
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
MoFEM::EdgeElementForcesAndSourcesCore::normalsAtGaussPts
MatrixDouble normalsAtGaussPts
Definition: EdgeElementForcesAndSourcesCore.hpp:49
FTensor::Index< 'i', 3 >
MoFEM::EdgeElementForcesAndSourcesCore::tFaceOrientation
static FTensor::Tensor1< double, 3 > tFaceOrientation
Definition: EdgeElementForcesAndSourcesCore.hpp:44
MoFEM::ForcesAndSourcesCore::UserDataOperator::loopSide
MoFEMErrorCode loopSide(const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy, AdjCache *adj_cache=nullptr)
User calls this function to loop over elements on the side of face. This function calls finite elemen...
Definition: ForcesAndSourcesCore.cpp:1668
MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator::getFTensor1Direction
FTensor::Tensor1< double, 3 > getFTensor1Direction()
Definition: EdgeElementForcesAndSourcesCore.hpp:215
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator::getCoords
VectorDouble & getCoords()
get edge node coordinates
Definition: EdgeElementForcesAndSourcesCore.hpp:199
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
MoFEM::EdgeElementForcesAndSourcesCore::dIrection
VectorDouble dIrection
Definition: EdgeElementForcesAndSourcesCore.hpp:55
MoFEM::ForcesAndSourcesCore::UserDataOperator::ptrFE
ForcesAndSourcesCore * ptrFE
Definition: ForcesAndSourcesCore.hpp:984