v0.9.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 29 of file FieldApproximation.hpp.

Constructor & Destructor Documentation

◆ FieldApproximationH1()

FieldApproximationH1::FieldApproximationH1 ( MoFEM::Interface m_field)

Definition at line 36 of file FieldApproximation.hpp.

37  : mField(m_field), feVolume(m_field), feFace(m_field) {}
MoFEM::Interface & mField
MoFEM::FaceElementForcesAndSourcesCore feFace
VolumeElementForcesAndSourcesCore feVolume

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 
)

assemble matrix and vector

Definition at line 520 of file FieldApproximation.hpp.

524  {
526 
527  CHKERR setOperatorsVolume(field_name, A, vec_F, function_evaluator);
528  if (A) {
529  CHKERR MatZeroEntries(A);
530  }
531  // calculate and assemble
532  CHKERR mField.loop_finite_elements(problem_name, fe_name, feVolume);
533  if (A) {
534  CHKERR MatAssemblyBegin(A, MAT_FLUSH_ASSEMBLY);
535  CHKERR MatAssemblyEnd(A, MAT_FLUSH_ASSEMBLY);
536  }
537  for (unsigned int lhs = 0; lhs < vec_F.size(); lhs++) {
538  CHKERR VecAssemblyBegin(vec_F[lhs]);
539  CHKERR VecAssemblyEnd(vec_F[lhs]);
540  }
542  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEMErrorCode setOperatorsVolume(const std::string &field_name, Mat A, std::vector< Vec > &vec_F, FUNEVAL &function_evaluator)
Set operators.
MoFEM::Interface & mField
#define CHKERR
Inline error check.
Definition: definitions.h:596
VolumeElementForcesAndSourcesCore feVolume
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
DEPRECATED MoFEMErrorCode loop_finite_elements(const Problem *problem_ptr, const std::string &fe_name, FEMethod &method, int lower_rank, int upper_rank, MoFEMTypes bh, int verb=DEFAULT_VERBOSITY)

◆ setOperatorsFace()

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

Set operators.

Definition at line 502 of file FieldApproximation.hpp.

504  {
506  // add operator to calculate F vector
507  feFace.getOpPtrVector().push_back(
508  new OpApproxFace<FUNEVAL>(field_name, A, vec_F, function_evaluator));
509  // add operator to calculate A matrix
510  // if(A) {
511  // feFace.getOpPtrVector().push_back(new
512  // OpApproxFace<FUNEVAL>(field_name,A,vec_F,function_evaluator));
513  // }
515  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEM::FaceElementForcesAndSourcesCore feFace
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ setOperatorsVolume()

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

Set operators.

Definition at line 484 of file FieldApproximation.hpp.

486  {
488  // add operator to calculate F vector
489  feVolume.getOpPtrVector().push_back(
490  new OpApproxVolume<FUNEVAL>(field_name, A, vec_F, function_evaluator));
491  // add operator to calculate A matrix
492  // if(A) {
493  // feVolume.getOpPtrVector().push_back(new
494  // OpApproxVolume<FUNEVAL>(field_name,A,vec_F,function_evaluator));
495  // }
497  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
VolumeElementForcesAndSourcesCore feVolume
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

Member Data Documentation

◆ feFace

MoFEM::FaceElementForcesAndSourcesCore FieldApproximationH1::feFace

Definition at line 34 of file FieldApproximation.hpp.

◆ feVolume

VolumeElementForcesAndSourcesCore FieldApproximationH1::feVolume

Definition at line 33 of file FieldApproximation.hpp.

◆ mField

MoFEM::Interface& FieldApproximationH1::mField

Definition at line 31 of file FieldApproximation.hpp.

◆ problemName

const std::string FieldApproximationH1::problemName

Definition at line 32 of file FieldApproximation.hpp.


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