v0.16.0
Loading...
Searching...
No Matches
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
9namespace 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
32protected:
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 */
43template <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
60protected:
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 */
71template <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
89protected:
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/** \brief Get norm of input MatrixDouble for symmetric Tensor2
98 *
99 */
100template <int DIM>
102 : public OpCalcNormL2Tensor2<DIM, DIM> {
103
104 using OpCalcNormL2Tensor2<DIM, DIM>::OpCalcNormL2Tensor2;
105
106 /**
107 * \brief calculate norm of symmetric tensor values at integration points
108 * @param side side entity number
109 * @param type side entity type
110 * @param data entity data
111 * @return error code
112 */
113 MoFEMErrorCode doWork(int side, EntityType type,
115};
116
117/** \brief Get values from scalar function at integration points and save them
118 * to VectorDouble for Tensor0
119 *
120 */
121
123
124 OpGetTensor0fromFunc(boost::shared_ptr<VectorDouble> data_ptr,
125 ScalarFun scalar_function);
126
127 /**
128 * \brief calculate values of scalar function at integration points
129 * @param side side entity number
130 * @param type side entity type
131 * @param data entity data
132 * @return error code
133 */
134 MoFEMErrorCode doWork(int side, EntityType type,
136
137protected:
139 boost::shared_ptr<VectorDouble> dataPtr;
140};
141
142typedef boost::function<VectorDouble(const double, const double, const double)>
144
145/** \brief Get values from vector function at integration points and save them
146 * to MatrixDouble for Tensor1
147 *
148 * @tparam TENS_DIM Dimension of the stored output tensor in data_ptr.
149 * @tparam FUNC_DIM Dimension of the vector returned by vector_function.
150 *
151 * If FUNC_DIM is larger than TENS_DIM, only the leading TENS_DIM components
152 * are copied to the output tensor. If TENS_DIM is larger than FUNC_DIM,
153 * doWork returns a data inconsistency error.
154 */
155
156template <int TENS_DIM, int FUNC_DIM>
158
159 OpGetTensor1fromFunc(boost::shared_ptr<MatrixDouble> data_ptr,
160 VectorFunc vector_function);
161
162 /**
163 * \brief calculate values of vector function at integration points
164 * @param side side entity number
165 * @param type side entity type
166 * @param data entity data
167 * @return error code
168 */
169 MoFEMErrorCode doWork(int side, EntityType type,
171
172private:
174 boost::shared_ptr<MatrixDouble> dataPtr;
175};
176
177typedef boost::function<MatrixDouble(const double, const double, const double)>
179
180/** \brief Get values from matrix function at integration points and save them
181 * to MatrixDouble for Tensor2
182 *
183 * @tparam TENS_DIM Dimension of the stored output tensor in data_ptr.
184 * @tparam FUNC_DIM Dimension of the square matrix returned by matrix_function.
185 *
186 * If FUNC_DIM is larger than TENS_DIM, only the leading TENS_DIM by TENS_DIM
187 * block is copied to the output tensor. If TENS_DIM is larger than FUNC_DIM,
188 * doWork returns a data inconsistency error.
189 */
190
191template <int TENS_DIM, int FUNC_DIM>
193
194 OpGetTensor2fromFunc(boost::shared_ptr<MatrixDouble> data_ptr,
195 MatrixFunc matrix_function);
196
197 /**
198 * \brief calculate values of matrix function at integration points
199 * @param side side entity number
200 * @param type side entity type
201 * @param data entity data
202 * @return error code
203 */
204 MoFEMErrorCode doWork(int side, EntityType type,
206
207protected:
209 boost::shared_ptr<MatrixDouble> dataPtr;
210};
211
212/** \brief Get values from matrix function in symmetric tensor storage at
213 * integration points and save them to MatrixDouble for symmetric Tensor2
214 *
215 * @tparam TENS_DIM Dimension of the stored output symmetric tensor in data_ptr.
216 * @tparam FUNC_DIM Dimension of the symmetric matrix returned by matrix_function.
217 *
218 * If FUNC_DIM is larger than TENS_DIM, only the leading TENS_DIM by TENS_DIM
219 * symmetric block is copied to the output tensor. If TENS_DIM is larger than
220 * FUNC_DIM, doWork returns a data inconsistency error.
221 */
222
223template <int TENS_DIM, int FUNC_DIM>
225 : public OpGetTensor2fromFunc<TENS_DIM, FUNC_DIM> {
226
227 using OpGetTensor2fromFunc<TENS_DIM, FUNC_DIM>::OpGetTensor2fromFunc;
228
229 /**
230 * \brief calculate values of matrix function at integration points
231 * @param side side entity number
232 * @param type side entity type
233 * @param data entity data
234 * @return error code
235 */
236 MoFEMErrorCode doWork(int side, EntityType type,
238};
239
240} // namespace MoFEM
241
242#endif // __NORM_OPERATORS_HPP__
std::string type
boost::function< double(const double, const double, const double)> ScalarFun
Scalar function type.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
Definition Types.hpp:77
UBlasVector< double > VectorDouble
Definition Types.hpp:68
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
boost::function< MatrixDouble(const double, const double, const double)> MatrixFunc
boost::function< VectorDouble(const double, const double, const double)> VectorFunc
Data on single entity (This is passed as argument to DataOperator::doWork)
Get norm of input VectorDouble for Tensor0.
boost::shared_ptr< VectorDouble > dataPtr
boost::shared_ptr< VectorDouble > diffDataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate norm of scalar values at integration points
SmartPetscObj< Vec > dataVec
boost::shared_ptr< Range > entsPtr
Get norm of input MatrixDouble for Tensor1.
boost::shared_ptr< MatrixDouble > diffDataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate norm of vector values at integration points
boost::shared_ptr< Range > entsPtr
SmartPetscObj< Vec > dataVec
boost::shared_ptr< MatrixDouble > dataPtr
Get norm of input MatrixDouble for symmetric Tensor2.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate norm of symmetric tensor values at integration points
Get norm of input MatrixDouble for Tensor2.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate norm of tensor values at integration points
boost::shared_ptr< MatrixDouble > diffDataPtr
boost::shared_ptr< MatrixDouble > dataPtr
SmartPetscObj< Vec > dataVec
boost::shared_ptr< Range > entsPtr
Get values from scalar function at integration points and save them to VectorDouble for Tensor0.
boost::shared_ptr< VectorDouble > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of scalar function at integration points
Get values from vector function at integration points and save them to MatrixDouble for Tensor1.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of vector function at integration points
boost::shared_ptr< MatrixDouble > dataPtr
Get values from matrix function in symmetric tensor storage at integration points and save them to Ma...
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of matrix function at integration points
Get values from matrix function at integration points and save them to MatrixDouble for Tensor2.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of matrix function at integration points
boost::shared_ptr< MatrixDouble > dataPtr
intrusive_ptr for managing petsc objects