v0.14.0
Public Member Functions | Public Attributes | List of all members
StandardPoisson::OpError Struct Reference
Inheritance diagram for StandardPoisson::OpError:
[legend]
Collaboration diagram for StandardPoisson::OpError:
[legend]

Public Member Functions

 OpError (std::string domain_field, boost::shared_ptr< CommonData > &common_data_ptr, MoFEM::Interface &m_field)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 [OpError] More...
 

Public Attributes

std::string domainField
 
boost::shared_ptr< CommonDatacommonDataPtr
 
MoFEM::InterfacemField
 

Detailed Description

Definition at line 84 of file standard_poisson.cpp.

Constructor & Destructor Documentation

◆ OpError()

StandardPoisson::OpError::OpError ( std::string  domain_field,
boost::shared_ptr< CommonData > &  common_data_ptr,
MoFEM::Interface m_field 
)
inline

Definition at line 88 of file standard_poisson.cpp.

91  : DomainEleOp(domain_field, OPROW), domainField(domain_field),
92  commonDataPtr(common_data_ptr), mField(m_field) {
93  std::fill(&doEntities[MBVERTEX], &doEntities[MBMAXTYPE], false);
94  doEntities[MBTRI] = doEntities[MBQUAD] = true;
95  }

Member Function Documentation

◆ doWork()

MoFEMErrorCode StandardPoisson::OpError::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)

[OpError]

Definition at line 366 of file standard_poisson.cpp.

367  {
369  const int nb_integration_pts = getGaussPts().size2();
370  const double area = getMeasure();
371  auto t_w = getFTensor0IntegrationWeight();
372  auto t_val = getFTensor0FromVec(*(commonDataPtr->approxVals));
373  auto t_val_grad = getFTensor1FromMat<2>(*(commonDataPtr->approxValsGrad));
374  auto t_coords = getFTensor1CoordsAtGaussPts();
377 
378  double error_l2 = 0;
379  double error_h1 = 0;
380 
381  for (int gg = 0; gg != nb_integration_pts; ++gg) {
382  const double alpha = t_w * area;
383 
384  double diff = t_val - StandardPoisson::analyticalFunction(
385  t_coords(0), t_coords(1), t_coords(2));
386  error_l2 += alpha * sqr(diff);
387 
389  t_coords(0), t_coords(1), t_coords(2));
390  auto t_fun_grad = getFTensor1FromArray<2, 2>(vec);
391  t_diff(i) = t_val_grad(i) - t_fun_grad(i);
392 
393  error_h1 += alpha * t_diff(i) * t_diff(i);
394 
395  ++t_w;
396  ++t_val;
397  ++t_val_grad;
398  ++t_coords;
399  }
400 
401  int index = CommonData::ERROR_L2_NORM;
402  constexpr std::array<int, 2> indices = {CommonData::ERROR_L2_NORM,
404  std::array<double, 2> values;
405  values[0] = error_l2;
406  values[1] = error_h1;
407  CHKERR VecSetValues(commonDataPtr->petscVec, 2, indices.data(), values.data(),
408  ADD_VALUES);
410 }

Member Data Documentation

◆ commonDataPtr

boost::shared_ptr<CommonData> StandardPoisson::OpError::commonDataPtr

Definition at line 86 of file standard_poisson.cpp.

◆ domainField

std::string StandardPoisson::OpError::domainField

Definition at line 85 of file standard_poisson.cpp.

◆ mField

MoFEM::Interface& StandardPoisson::OpError::mField

Definition at line 87 of file standard_poisson.cpp.


The documentation for this struct was generated from the following file:
DomainEleOp
DomainEle::UserDataOperator DomainEleOp
Definition: standard_poisson.cpp:14
StandardPoisson::OpError::commonDataPtr
boost::shared_ptr< CommonData > commonDataPtr
Definition: standard_poisson.cpp:86
StandardPoisson::OpError::domainField
std::string domainField
Definition: standard_poisson.cpp:85
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
StandardPoisson::analyticalFunctionGrad
static VectorDouble analyticalFunctionGrad(const double x, const double y, const double z)
[Analytical function]
Definition: standard_poisson.cpp:51
MoFEM::VecSetValues
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
Definition: EntitiesFieldData.hpp:1589
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
StandardPoisson::CommonData::ERROR_L2_NORM
@ ERROR_L2_NORM
Definition: standard_poisson.cpp:79
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index< 'i', 2 >
sqr
double sqr(double x)
Definition: standard_poisson.cpp:7
MoFEM::Types::VectorDouble
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
StandardPoisson::OpError::mField
MoFEM::Interface & mField
Definition: standard_poisson.cpp:87
StandardPoisson::CommonData::ERROR_H1_SEMINORM
@ ERROR_H1_SEMINORM
Definition: standard_poisson.cpp:79
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
StandardPoisson::analyticalFunction
static double analyticalFunction(const double x, const double y, const double z)
[Analytical function]
Definition: standard_poisson.cpp:44