v0.15.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Attributes | List of all members
Example::OpError< FIELD_DIM > Struct Template Reference
Inheritance diagram for Example::OpError< FIELD_DIM >:
[legend]
Collaboration diagram for Example::OpError< FIELD_DIM >:
[legend]

Public Member Functions

 OpError (boost::shared_ptr< MatrixDouble > data_ptr, BitRefLevel bits=BitRefLevel(), BitRefLevel mask=BitRefLevel())
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Public Attributes

boost::shared_ptr< CommonDatacommonDataPtr
 

Private Attributes

boost::shared_ptr< MatrixDoubledataPtr
 
BitRefLevel bitsEle
 
BitRefLevel maskEle
 

Detailed Description

template<int FIELD_DIM>
struct Example::OpError< FIELD_DIM >
Examples
mofem/tutorials/adv-6/between_meshes_dg_projection.cpp, and mofem/tutorials/scl-0/approximaton.cpp.

Definition at line 87 of file between_meshes_dg_projection.cpp.

Constructor & Destructor Documentation

◆ OpError()

template<int FIELD_DIM>
Example::OpError< FIELD_DIM >::OpError ( boost::shared_ptr< MatrixDouble data_ptr,
BitRefLevel  bits = BitRefLevel(),
BitRefLevel  mask = BitRefLevel() 
)
inline

Definition at line 90 of file between_meshes_dg_projection.cpp.

92 : DomainEleOp(NOSPACE, OPSPACE), dataPtr(data_ptr), bitsEle(bits),
93 maskEle(mask) {}
@ NOSPACE
Definition definitions.h:83
boost::shared_ptr< MatrixDouble > dataPtr
DomainEle::UserDataOperator DomainEleOp

Member Function Documentation

◆ doWork()

template<int FIELD_DIM>
MoFEMErrorCode Example::OpError< FIELD_DIM >::doWork ( int  side,
EntityType  type,
EntData data 
)
inline
Examples
mofem/tutorials/adv-6/between_meshes_dg_projection.cpp, and mofem/tutorials/scl-0/approximaton.cpp.

Definition at line 95 of file between_meshes_dg_projection.cpp.

95 {
97
98 auto fe_ptr = getNumeredEntFiniteElementPtr();
99 auto fe_bit = fe_ptr->getBitRefLevel();
100 if ((fe_bit & bitsEle).any() && ((fe_bit & maskEle) == fe_bit)) {
101 const int nb_integration_pts = getGaussPts().size2();
102
103 auto t_val = getFTensor1FromMat<1>(*(dataPtr));
104 auto t_coords = getFTensor1CoordsAtGaussPts();
105
106 for (int gg = 0; gg != nb_integration_pts; ++gg) {
107
108 double projected_value = t_val(0);
109 double analytical_value = fun(t_coords(0), t_coords(1), t_coords(2));
110 double error = projected_value - analytical_value;
111
112 constexpr double eps = 1e-8;
113 if (std::abs(error) > eps) {
114 MOFEM_LOG("SELF", Sev::error)
115 << "Projection error too large: " << error << " at point ("
116 << t_coords(0) << ", " << t_coords(1) << ")"
117 << " projected=" << projected_value
118 << " analytical=" << analytical_value;
119 SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
120 "DG projection failed accuracy test");
121 }
122
123 ++t_val;
124 ++t_coords;
125 }
126
127 MOFEM_LOG("SELF", Sev::noisy)
128 << "DG projection accuracy validation passed";
129 }
130
132 }
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_ATOM_TEST_INVALID
Definition definitions.h:40
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
auto fun
#define MOFEM_LOG(channel, severity)
Log.
constexpr double eps
Definition HenckyOps.hpp:13

Member Data Documentation

◆ bitsEle

template<int FIELD_DIM>
BitRefLevel Example::OpError< FIELD_DIM >::bitsEle
private

◆ commonDataPtr

template<int FIELD_DIM>
boost::shared_ptr<CommonData> Example::OpError< FIELD_DIM >::commonDataPtr

◆ dataPtr

template<int FIELD_DIM>
boost::shared_ptr<MatrixDouble> Example::OpError< FIELD_DIM >::dataPtr
private

◆ maskEle

template<int FIELD_DIM>
BitRefLevel Example::OpError< FIELD_DIM >::maskEle
private

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