v0.14.0
NormsOperators.hpp
Go to the documentation of this file.
1 /** \file NormsOperators.hpp
2  * \brief User data Operators for calculating norms
3 
4 */
5 
6 #ifndef __NORM_OPERATORS_HPP__
7 #define __NORM_OPERATORS_HPP__
8 
9 namespace MoFEM {
10 
11 /** \brief Get norm of input VectorDouble for Tensor0
12  *
13  */
14 
16 
17  OpCalcNormL2Tensor0(boost::shared_ptr<VectorDouble> data_ptr,
18  SmartPetscObj<Vec> data_vec, const int index,
19  boost::shared_ptr<VectorDouble> diff_data_ptr = nullptr,
20  boost::shared_ptr<Range> ent_ptr = nullptr);
21 
22  /**
23  * \brief calculate norm of scalar values at integration points
24  * @param side side entity number
25  * @param type side entity type
26  * @param data entity data
27  * @return error code
28  */
29  MoFEMErrorCode doWork(int side, EntityType type,
31 
32 protected:
33  boost::shared_ptr<VectorDouble> dataPtr;
34  boost::shared_ptr<VectorDouble> diffDataPtr;
35  boost::shared_ptr<Range> entsPtr;
37  const int iNdex;
38 };
39 
40 /** \brief Get norm of input MatrixDouble for Tensor1
41  *
42  */
43 template <int DIM>
45 
46  OpCalcNormL2Tensor1(boost::shared_ptr<MatrixDouble> data_ptr,
47  SmartPetscObj<Vec> data_vec, const int index,
48  boost::shared_ptr<MatrixDouble> diff_data_ptr = nullptr,
49  boost::shared_ptr<Range> ent_ptr = nullptr);
50  /**
51  * \brief calculate norm of vector values at integration points
52  * @param side side entity number
53  * @param type side entity type
54  * @param data entity data
55  * @return error code
56  */
57  MoFEMErrorCode doWork(int side, EntityType type,
59 
60 protected:
61  boost::shared_ptr<MatrixDouble> dataPtr;
62  boost::shared_ptr<MatrixDouble> diffDataPtr;
63  boost::shared_ptr<Range> entsPtr;
65  const int iNdex;
66 };
67 
68 /** \brief Get norm of input MatrixDouble for Tensor2
69  *
70  */
71 template <int DIM_1, int DIM_2>
73 
74  OpCalcNormL2Tensor2(boost::shared_ptr<MatrixDouble> data_ptr,
75  SmartPetscObj<Vec> data_vec, const int index,
76  boost::shared_ptr<MatrixDouble> diff_data_ptr = nullptr,
77  boost::shared_ptr<Range> ent_ptr = nullptr);
78 
79  /**
80  * \brief calculate norm of tensor values at integration points
81  * @param side side entity number
82  * @param type side entity type
83  * @param data entity data
84  * @return error code
85  */
86  MoFEMErrorCode doWork(int side, EntityType type,
88 
89 protected:
90  boost::shared_ptr<MatrixDouble> dataPtr;
91  boost::shared_ptr<MatrixDouble> diffDataPtr;
93  boost::shared_ptr<Range> entsPtr;
94  const int iNdex;
95 };
96 
97 typedef boost::function<VectorDouble(const double, const double, const double)>
99 
100 /** \brief Get values from scalar function at integration points and save them
101  * to VectorDouble for Tensor0
102  *
103  */
104 
106 
107  OpGetTensor0fromFunc(boost::shared_ptr<VectorDouble> data_ptr,
108  ScalarFun scalar_function);
109 
110  /**
111  * \brief calculate values of scalar function at integration points
112  * @param side side entity number
113  * @param type side entity type
114  * @param data entity data
115  * @return error code
116  */
117  MoFEMErrorCode doWork(int side, EntityType type,
119 
120 protected:
122  boost::shared_ptr<VectorDouble> dataPtr;
123 };
124 
125 template <int SPACE_DIM, int BASE_DIM>
127 
128  OpGetTensor1fromFunc(boost::shared_ptr<MatrixDouble> data_ptr,
129  VectorFunc vector_function);
130 
131  /**
132  * \brief calculate values of vector function at integration points
133  * @param side side entity number
134  * @param type side entity type
135  * @param data entity data
136  * @return error code
137  */
138  MoFEMErrorCode doWork(int side, EntityType type,
140 
141 private:
143  boost::shared_ptr<MatrixDouble> dataPtr;
144 };
145 
146 } // namespace MoFEM
147 
148 #endif // __NORM_OPERATORS_HPP__
MoFEM::OpGetTensor1fromFunc::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of vector function at integration points
Definition: NormsOperators.cpp:227
MoFEM::EntitiesFieldData::EntData
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:128
MoFEM::OpGetTensor0fromFunc::dataPtr
boost::shared_ptr< VectorDouble > dataPtr
Definition: NormsOperators.hpp:122
MoFEM::OpCalcNormL2Tensor2::dataVec
SmartPetscObj< Vec > dataVec
Definition: NormsOperators.hpp:92
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::OpCalcNormL2Tensor0::OpCalcNormL2Tensor0
OpCalcNormL2Tensor0(boost::shared_ptr< VectorDouble > data_ptr, SmartPetscObj< Vec > data_vec, const int index, boost::shared_ptr< VectorDouble > diff_data_ptr=nullptr, boost::shared_ptr< Range > ent_ptr=nullptr)
Definition: NormsOperators.cpp:10
MoFEM::OpGetTensor1fromFunc::OpGetTensor1fromFunc
OpGetTensor1fromFunc(boost::shared_ptr< MatrixDouble > data_ptr, VectorFunc vector_function)
Definition: NormsOperators.cpp:220
MoFEM::OpCalcNormL2Tensor1::dataVec
SmartPetscObj< Vec > dataVec
Definition: NormsOperators.hpp:64
MoFEM::OpCalcNormL2Tensor2::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: NormsOperators.hpp:90
MoFEM::OpCalcNormL2Tensor2::iNdex
const int iNdex
Definition: NormsOperators.hpp:94
MoFEM::VectorFunc
boost::function< VectorDouble(const double, const double, const double)> VectorFunc
Definition: NormsOperators.hpp:98
MoFEM::OpCalcNormL2Tensor1::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: NormsOperators.hpp:61
MoFEM::OpCalcNormL2Tensor2
Get norm of input MatrixDouble for Tensor2.
Definition: NormsOperators.hpp:72
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::ForcesAndSourcesCore::UserDataOperator
Definition: ForcesAndSourcesCore.hpp:549
convert.type
type
Definition: convert.py:64
MoFEM::OpCalcNormL2Tensor2::entsPtr
boost::shared_ptr< Range > entsPtr
Definition: NormsOperators.hpp:93
MoFEM::OpCalcNormL2Tensor1::OpCalcNormL2Tensor1
OpCalcNormL2Tensor1(boost::shared_ptr< MatrixDouble > data_ptr, SmartPetscObj< Vec > data_vec, const int index, boost::shared_ptr< MatrixDouble > diff_data_ptr=nullptr, boost::shared_ptr< Range > ent_ptr=nullptr)
Definition: NormsOperators.cpp:66
MoFEM::OpCalcNormL2Tensor2::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate norm of tensor values at integration points
Definition: NormsOperators.cpp:142
MoFEM::ScalarFun
boost::function< double(const double, const double, const double)> ScalarFun
Scalar function type.
Definition: FormsIntegrators.hpp:144
MoFEM::OpCalcNormL2Tensor0::dataPtr
boost::shared_ptr< VectorDouble > dataPtr
Definition: NormsOperators.hpp:33
MoFEM::OpCalcNormL2Tensor1
Get norm of input MatrixDouble for Tensor1.
Definition: NormsOperators.hpp:44
MoFEM::OpCalcNormL2Tensor2::diffDataPtr
boost::shared_ptr< MatrixDouble > diffDataPtr
Definition: NormsOperators.hpp:91
MoFEM::OpCalcNormL2Tensor0::iNdex
const int iNdex
Definition: NormsOperators.hpp:37
MoFEM::OpGetTensor1fromFunc::vFunc
VectorFunc vFunc
Definition: NormsOperators.hpp:142
MoFEM::OpGetTensor1fromFunc
Definition: NormsOperators.hpp:126
MoFEM::OpGetTensor0fromFunc
Get values from scalar function at integration points and save them to VectorDouble for Tensor0.
Definition: NormsOperators.hpp:105
MoFEM::OpGetTensor1fromFunc::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: NormsOperators.hpp:143
MoFEM::OpGetTensor0fromFunc::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of scalar function at integration points
Definition: NormsOperators.cpp:192
MoFEM::OpCalcNormL2Tensor0::dataVec
SmartPetscObj< Vec > dataVec
Definition: NormsOperators.hpp:36
MoFEM::OpCalcNormL2Tensor1::iNdex
const int iNdex
Definition: NormsOperators.hpp:65
MoFEM::OpCalcNormL2Tensor0::entsPtr
boost::shared_ptr< Range > entsPtr
Definition: NormsOperators.hpp:35
MoFEM::OpCalcNormL2Tensor1::entsPtr
boost::shared_ptr< Range > entsPtr
Definition: NormsOperators.hpp:63
MoFEM::OpCalcNormL2Tensor0
Get norm of input VectorDouble for Tensor0.
Definition: NormsOperators.hpp:15
MoFEM::OpCalcNormL2Tensor2::OpCalcNormL2Tensor2
OpCalcNormL2Tensor2(boost::shared_ptr< MatrixDouble > data_ptr, SmartPetscObj< Vec > data_vec, const int index, boost::shared_ptr< MatrixDouble > diff_data_ptr=nullptr, boost::shared_ptr< Range > ent_ptr=nullptr)
Definition: NormsOperators.cpp:126
MoFEM::OpGetTensor0fromFunc::OpGetTensor0fromFunc
OpGetTensor0fromFunc(boost::shared_ptr< VectorDouble > data_ptr, ScalarFun scalar_function)
Definition: NormsOperators.cpp:186
MoFEM::Types::VectorDouble
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
MoFEM::OpCalcNormL2Tensor1::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate norm of vector values at integration points
Definition: NormsOperators.cpp:82
MoFEM::SmartPetscObj< Vec >
MoFEM::OpGetTensor0fromFunc::sFunc
ScalarFun sFunc
Definition: NormsOperators.hpp:121
MoFEM::OpCalcNormL2Tensor0::diffDataPtr
boost::shared_ptr< VectorDouble > diffDataPtr
Definition: NormsOperators.hpp:34
MoFEM::OpCalcNormL2Tensor1::diffDataPtr
boost::shared_ptr< MatrixDouble > diffDataPtr
Definition: NormsOperators.hpp:62
MoFEM::OpCalcNormL2Tensor0::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate norm of scalar values at integration points
Definition: NormsOperators.cpp:24