v0.14.0
Classes | Public Member Functions | Public Attributes | List of all members
FieldApproximationH1 Struct Reference

Finite element for approximating analytical filed on the mesh. More...

#include <users_modules/basic_finite_elements/src/FieldApproximation.hpp>

Collaboration diagram for FieldApproximationH1:
[legend]

Classes

struct  OpApproxFace
 Gauss point operators to calculate matrices and vectors. More...
 
struct  OpApproxVolume
 Gauss point operators to calculate matrices and vectors. More...
 

Public Member Functions

 FieldApproximationH1 (MoFEM::Interface &m_field)
 
template<typename FUNEVAL >
MoFEMErrorCode setOperatorsVolume (const std::string &field_name, Mat A, std::vector< Vec > &vec_F, FUNEVAL &function_evaluator)
 Set operators. More...
 
template<typename FUNEVAL >
MoFEMErrorCode setOperatorsFace (const std::string &field_name, Mat A, std::vector< Vec > &vec_F, FUNEVAL &function_evaluator)
 Set operators. More...
 
template<typename FUNEVAL >
MoFEMErrorCode loopMatrixAndVectorVolume (const std::string &problem_name, const std::string &fe_name, const std::string &field_name, Mat A, std::vector< Vec > &vec_F, FUNEVAL &function_evaluator)
 assemble matrix and vector More...
 

Public Attributes

MoFEM::InterfacemField
 
const std::string problemName
 
VolumeElementForcesAndSourcesCore feVolume
 
MoFEM::FaceElementForcesAndSourcesCore feFace
 

Detailed Description

Finite element for approximating analytical filed on the mesh.

Definition at line 17 of file FieldApproximation.hpp.

Constructor & Destructor Documentation

◆ FieldApproximationH1()

FieldApproximationH1::FieldApproximationH1 ( MoFEM::Interface m_field)
inline

Definition at line 24 of file FieldApproximation.hpp.

25  : mField(m_field), feVolume(m_field), feFace(m_field) {}

Member Function Documentation

◆ loopMatrixAndVectorVolume()

template<typename FUNEVAL >
MoFEMErrorCode FieldApproximationH1::loopMatrixAndVectorVolume ( const std::string &  problem_name,
const std::string &  fe_name,
const std::string &  field_name,
Mat  A,
std::vector< Vec > &  vec_F,
FUNEVAL &  function_evaluator 
)
inline

assemble matrix and vector

Definition at line 481 of file FieldApproximation.hpp.

485  {
487 
488  CHKERR setOperatorsVolume(field_name, A, vec_F, function_evaluator);
489  if (A) {
490  CHKERR MatZeroEntries(A);
491  }
492  // calculate and assemble
493  CHKERR mField.loop_finite_elements(problem_name, fe_name, feVolume);
494  if (A) {
495  CHKERR MatAssemblyBegin(A, MAT_FLUSH_ASSEMBLY);
496  CHKERR MatAssemblyEnd(A, MAT_FLUSH_ASSEMBLY);
497  }
498  for (unsigned int lhs = 0; lhs < vec_F.size(); lhs++) {
499  CHKERR VecAssemblyBegin(vec_F[lhs]);
500  CHKERR VecAssemblyEnd(vec_F[lhs]);
501  }
503  }

◆ setOperatorsFace()

template<typename FUNEVAL >
MoFEMErrorCode FieldApproximationH1::setOperatorsFace ( const std::string &  field_name,
Mat  A,
std::vector< Vec > &  vec_F,
FUNEVAL &  function_evaluator 
)
inline

Set operators.

Definition at line 463 of file FieldApproximation.hpp.

465  {
467  // add operator to calculate F vector
468  feFace.getOpPtrVector().push_back(
469  new OpApproxFace<FUNEVAL>(field_name, A, vec_F, function_evaluator));
470  // add operator to calculate A matrix
471  // if(A) {
472  // feFace.getOpPtrVector().push_back(new
473  // OpApproxFace<FUNEVAL>(field_name,A,vec_F,function_evaluator));
474  // }
476  }

◆ setOperatorsVolume()

template<typename FUNEVAL >
MoFEMErrorCode FieldApproximationH1::setOperatorsVolume ( const std::string &  field_name,
Mat  A,
std::vector< Vec > &  vec_F,
FUNEVAL &  function_evaluator 
)
inline

Set operators.

Definition at line 445 of file FieldApproximation.hpp.

447  {
449  // add operator to calculate F vector
450  feVolume.getOpPtrVector().push_back(
451  new OpApproxVolume<FUNEVAL>(field_name, A, vec_F, function_evaluator));
452  // add operator to calculate A matrix
453  // if(A) {
454  // feVolume.getOpPtrVector().push_back(new
455  // OpApproxVolume<FUNEVAL>(field_name,A,vec_F,function_evaluator));
456  // }
458  }

Member Data Documentation

◆ feFace

MoFEM::FaceElementForcesAndSourcesCore FieldApproximationH1::feFace

Definition at line 22 of file FieldApproximation.hpp.

◆ feVolume

VolumeElementForcesAndSourcesCore FieldApproximationH1::feVolume

Definition at line 21 of file FieldApproximation.hpp.

◆ mField

MoFEM::Interface& FieldApproximationH1::mField

Definition at line 19 of file FieldApproximation.hpp.

◆ problemName

const std::string FieldApproximationH1::problemName

Definition at line 20 of file FieldApproximation.hpp.


The documentation for this struct was generated from the following file:
MoFEM::CoreInterface::loop_finite_elements
virtual MoFEMErrorCode loop_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
FieldApproximationH1::setOperatorsVolume
MoFEMErrorCode setOperatorsVolume(const std::string &field_name, Mat A, std::vector< Vec > &vec_F, FUNEVAL &function_evaluator)
Set operators.
Definition: FieldApproximation.hpp:445
FieldApproximationH1::feVolume
VolumeElementForcesAndSourcesCore feVolume
Definition: FieldApproximation.hpp:21
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
FieldApproximationH1::feFace
MoFEM::FaceElementForcesAndSourcesCore feFace
Definition: FieldApproximation.hpp:22
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
MoFEM::ForcesAndSourcesCore::getOpPtrVector
boost::ptr_deque< UserDataOperator > & getOpPtrVector()
Use to push back operator for row operator.
Definition: ForcesAndSourcesCore.hpp:83
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
FieldApproximationH1::mField
MoFEM::Interface & mField
Definition: FieldApproximation.hpp:19