v0.15.0
Loading...
Searching...
No Matches
DGProjection.hpp
Go to the documentation of this file.
1/*/**
2 * @file DGProjection.hpp
3 * @author your name (you@domain.com)
4 * @brief
5 * @version 0.1
6 * @date 2023-08-23
7 *
8 * @copyright Copyright (c) 2023
9 *
10 */
11
12#ifndef DGPROJECTION_HPP
13#define DGPROJECTION_HPP
14
15namespace MoFEM {
16
17template <int DIM>
21 boost::shared_ptr<Range> edges_ptr);
22
23template <>
27 boost::shared_ptr<Range> edges_ptr);
28
29/**
30 * @brief Execute "this" element in the operator
31 *
32 * \code An example of usage in post-processing
33
34using InteriorElem = VolumeElementForcesAndSourcesCore;
35using PostProcFe = PostProcBrokenMeshInMoab<InteriorElem>;
36auto fe_post_proc = boost::make_shared<PostProcFe>(mField);
37auto op_this = new OpLoopThis<InteriorElem>(m_field, "DomainFE", Sev::noisy);
38fe_post_proc->getOpPtrVector()->push_back(op_this);
39
40auto fe_physics = op_this->getThisFEPtr();
41fe_physics->getRuleHook = [](int, int, int o) {
42 return 2 * o; };
43
44int order = 1;
45
46// entity data shared between physical and post proc elements
47auto entity_data_l2 = boost::make_shared<EntitiesFieldData>(MBENTITYSET);
48// integrated mass matrix of post proc element
49auto mass_ptr = boost::make_shared<MatrixDouble>();
50// vector of coeff shared between physical and post proc elements
51auto coeffs_ptr = boost::make_shared<MatrixDouble>();
52// data stored at
53// integration points of the physical element and evaluated at integration
54// points of the post proc element
55auto data_ptr = boost::make_shared<MatrixDouble>();
56fe_physics->getOpPtrVector()->push_back(new
57 OpDGProjectionMassMatrix(order, mass_ptr, entity_data_l2,
58 AINSWORTH_LEGENDRE_BASE, L2));
59
60// You need to call operator which will evaluate data_ptr
61
62fe_physics->getOpPtrVector()->push_back(new
63 OpCalculateVectorFieldValues("V", data_ptr);
64fe_physics->getOpPtrVector()->push_back( new
65 OpDGProjectionCoefficients(data_ptr, coeffs_ptr, mass_ptr, entity_data_l2,
66 AINSWORTH_LEGENDRE_BASE, L2));
67
68fe_post_proc->getOpPtrVector()->push_back(new
69 OpDGProjectionEvaluation(data_ptr, coeffs_ptr,
70 entity_data_l2, AINSWORTH_LEGENDRE_BASE, L2));
71
72 * \endcode
73 *
74 * @tparam E template for "this" element type
75 *
76 *
77 *
78 */
79template <typename E>
81
83
84 /**
85 * @brief Construct a new OpThis object
86 *
87 * @param m_field
88 * @param fe_name name of "this" element (domain element)
89 */
90 OpLoopThis(MoFEM::Interface &m_field, const std::string fe_name,
91 const LogManager::SeverityLevel sev = Sev::noisy)
92 : UserDataOperator(NOSPACE, OPSPACE), thisFEPtr(new E(m_field)),
93 feName(fe_name), sevLevel(sev) {}
94
95 /**
96 * @brief Construct a new OpThis object
97 *
98 * Use this if you lite to execute element on particular bit ref level and mask.
99 *
100 */
101 OpLoopThis(MoFEM::Interface &m_field, const std::string fe_name,
102 BitRefLevel bit_ref_level, BitRefLevel bit_ref_level_mask,
103 const LogManager::SeverityLevel sev = Sev::noisy)
104 : UserDataOperator(NOSPACE, OPSPACE), thisFEPtr(new E(m_field)),
105 feName(fe_name), sevLevel(sev), bitLevel(bit_ref_level),
106 bitMask(bit_ref_level_mask) {}
107
108 MoFEMErrorCode doWork(int side, EntityType type,
111 auto bit = getNumeredEntFiniteElementPtr()->getBitRefLevel();
112 if (((bitMask & bit) == bit) && (bitLevel & bit).any()) {
114 }
116 };
117
118 /**
119 * Here user will push operator evaluating field, or data at "this" element
120 * integration points.
121 */
122 boost::ptr_deque<UserDataOperator> &getOpPtrVector() {
123 return thisFEPtr->getOpPtrVector();
124 }
125
126 boost::shared_ptr<E> &getThisFEPtr() { return thisFEPtr; }
127
128protected:
129 const std::string feName;
130 boost::shared_ptr<E> thisFEPtr;
134};
135
137 OpDGProjectionMassMatrix(int order, boost::shared_ptr<MatrixDouble> mass_ptr,
138 boost::shared_ptr<EntitiesFieldData> data_l2,
139 const FieldApproximationBase b, const FieldSpace s,
140 int verb = QUIET, Sev sev = Sev::verbose);
141
142 MoFEMErrorCode doWork(int side, EntityType type,
144
145private:
147};
148
150
151 OpDGProjectionCoefficients(boost::shared_ptr<MatrixDouble> data_ptr,
152 boost::shared_ptr<MatrixDouble> coeffs_ptr,
153 boost::shared_ptr<MatrixDouble> mass_ptr,
154 boost::shared_ptr<EntitiesFieldData> data_l2,
155 const FieldApproximationBase b, const FieldSpace s,
156 const LogManager::SeverityLevel sev = Sev::noisy);
157
158 MoFEMErrorCode doWork(int side, EntityType type,
160
161protected:
162 boost::shared_ptr<MatrixDouble> dataPtr;
163 boost::shared_ptr<MatrixDouble> coeffsPtr;
164};
165
167
168 OpDGProjectionEvaluation(boost::shared_ptr<MatrixDouble> data_ptr,
169 boost::shared_ptr<MatrixDouble> coeffs_ptr,
170 boost::shared_ptr<EntitiesFieldData> data_l2,
171 const FieldApproximationBase b, const FieldSpace s,
172 const LogManager::SeverityLevel sev = Sev::noisy);
173
174 MoFEMErrorCode doWork(int side, EntityType type,
176};
177}; // namespace MoFEM
178
179#endif // DGPROJECTION_HPP
@ QUIET
@ VERBOSE
FieldApproximationBase
approximation base
Definition definitions.h:58
FieldSpace
approximation spaces
Definition definitions.h:82
@ NOSPACE
Definition definitions.h:83
#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.
constexpr int order
Order displacement.
SeverityLevel
Severity levels.
auto bit
set bit
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
MoFEMErrorCode setDGSetIntegrationPoints(ForcesAndSourcesCore::GaussHookFun &set_hook, ForcesAndSourcesCore::RuleHookFun rule, boost::shared_ptr< Range > edges_ptr)
MoFEMErrorCode setDGSetIntegrationPoints< 2 >(ForcesAndSourcesCore::GaussHookFun &set_hook, ForcesAndSourcesCore::RuleHookFun rule, boost::shared_ptr< Range > edges_ptr)
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
@ OPSPACE
operator do Work is execute on space data
MoFEMErrorCode loopThis(const string &fe_name, ForcesAndSourcesCore *this_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
User calls this function to loop over the same element using a different set of integration points....
boost::function< MoFEMErrorCode(ForcesAndSourcesCore *fe_raw_ptr, int order_row, int order_col, int order_data)> GaussHookFun
boost::function< int(int order_row, int order_col, int order_data)> RuleHookFun
boost::shared_ptr< MatrixDouble > coeffsPtr
boost::shared_ptr< MatrixDouble > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Execute "this" element in the operator.
const std::string feName
boost::shared_ptr< E > thisFEPtr
OpLoopThis(MoFEM::Interface &m_field, const std::string fe_name, BitRefLevel bit_ref_level, BitRefLevel bit_ref_level_mask, const LogManager::SeverityLevel sev=Sev::noisy)
Construct a new OpThis object.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
boost::shared_ptr< E > & getThisFEPtr()
OpLoopThis(MoFEM::Interface &m_field, const std::string fe_name, const LogManager::SeverityLevel sev=Sev::noisy)
Construct a new OpThis object.
boost::ptr_deque< UserDataOperator > & getOpPtrVector()
const LogManager::SeverityLevel sevLevel