v0.15.0
Loading...
Searching...
No Matches
OpError Struct Reference
Inheritance diagram for OpError:
[legend]
Collaboration diagram for OpError:
[legend]

Public Member Functions

 OpError (boost::shared_ptr< VectorDouble > u_at_pts_ptr, double &l2_error)
 
 OpError (const std::string field_name, boost::shared_ptr< MatrixDouble > x_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Static Public Attributes

static SmartPetscObj< Vec > errorVec
 

Private Attributes

boost::shared_ptr< VectorDoubleuAtPtsPtr
 
doublel2Error
 
boost::shared_ptr< MatrixDoublexPtr
 

Detailed Description

Constructor & Destructor Documentation

◆ OpError() [1/2]

OpError::OpError ( boost::shared_ptr< VectorDouble > u_at_pts_ptr,
double & l2_error )
inline
Examples
approx_sphere.cpp.

Definition at line 62 of file initial_diffusion.cpp.

63 : DomainEleOp("PHOTON_FLUENCE_RATE", OPROW), uAtPtsPtr(u_at_pts_ptr),
64 l2Error(l2_error) {
65 // Only will be executed once on vertices
66 std::fill(&doEntities[MBEDGE], &doEntities[MBMAXTYPE], false);
67 }
DomainEle::UserDataOperator DomainEleOp
Finire element operator type.
boost::shared_ptr< VectorDouble > uAtPtsPtr
double & l2Error

◆ OpError() [2/2]

OpError::OpError ( const std::string field_name,
boost::shared_ptr< MatrixDouble > x_ptr )
inline

Definition at line 221 of file approx_sphere.cpp.

222 : DomainEleOp(field_name, field_name, AssemblyDomainEleOp::OPROW),
223 xPtr(x_ptr) {
224
225 std::fill(&doEntities[MBEDGE], &doEntities[MBMAXTYPE], false);
226 }
constexpr auto field_name
boost::shared_ptr< MatrixDouble > xPtr

Member Function Documentation

◆ doWork()

MoFEMErrorCode OpError::doWork ( int side,
EntityType type,
EntData & data )
inline
Examples
approx_sphere.cpp.

Definition at line 228 of file approx_sphere.cpp.

228 {
229
231
232 auto t_w = getFTensor0IntegrationWeight();
233 auto t_x = getFTensor1FromMat<3>(*xPtr);
234 auto t_normal = getFTensor1NormalsAtGaussPts();
235 auto nb_integration_pts = getGaussPts().size2();
236
237 double error = 0;
238
239 for (int gg = 0; gg != nb_integration_pts; gg++) {
240
241 double l = std::sqrt(t_normal(i) * t_normal(i));
242 error += t_w * l * std::abs((t_x(i) * t_x(i) - A * A));
243
244 ++t_w;
245 ++t_x;
246 ++t_normal;
247 }
248
249 CHKERR VecSetValue(errorVec, 0, error, ADD_VALUES);
250
252 }
FTensor::Index< 'i', 3 > i
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'l', 3 > l
FTensor::Tensor1< FTensor::PackPtr< T *, S >, Tensor_Dim > getFTensor1FromMat(ublas::matrix< T, L, A > &data)
Get tensor rank 1 (vector) form data matrix.
static SmartPetscObj< Vec > errorVec

Member Data Documentation

◆ errorVec

SmartPetscObj< Vec > OpError::errorVec
static
Examples
approx_sphere.cpp.

Definition at line 254 of file approx_sphere.cpp.

◆ l2Error

double& OpError::l2Error
private

Definition at line 71 of file initial_diffusion.cpp.

◆ uAtPtsPtr

boost::shared_ptr<VectorDouble> OpError::uAtPtsPtr
private

Definition at line 70 of file initial_diffusion.cpp.

◆ xPtr

boost::shared_ptr<MatrixDouble> OpError::xPtr
private
Examples
approx_sphere.cpp.

Definition at line 257 of file approx_sphere.cpp.


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