v0.14.0
FatPrismElementForcesAndSourcesCore.hpp
Go to the documentation of this file.
1 /** \file ForcesAndSourcesCore.hpp
2 
3  \brief Implementation of elements on entities.
4 
5  Those element are inherited by user to implement specific implementation of
6  particular problem.
7 
8 */
9 
10 
11 
12 #ifndef __FATPRISMELEMENTFORCESANDSURCESCORE_HPP__
13 #define __FATPRISMELEMENTFORCESANDSURCESCORE_HPP__
14 
15 using namespace boost::numeric;
16 
17 namespace MoFEM {
18 
19 /** \brief FatPrism finite element
20  \ingroup mofem_forces_and_sources_prism_element
21 
22  User is implementing own operator at Gauss points level, by own object
23  derived from FatPrismElementForcesAndSourcesCoreL::UserDataOperator. Arbitrary
24  number of operator added pushing objects to rowOpPtrVector and
25  rowColOpPtrVector.
26 
27  \todo Need to implement operators that will make this element work as Volume
28  element
29 
30  */
33 
35 
36  virtual int getRuleTrianglesOnly(int order) { return 2 * order; };
37  virtual int getRuleThroughThickness(int order) { return 2 * order; };
38 
39  virtual MoFEMErrorCode setGaussPtsTrianglesOnly(int order_triangles_only) {
41  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
43  }
44 
45  virtual MoFEMErrorCode setGaussPtsThroughThickness(int order_thickness) {
47  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
49  }
50 
51  /** \brief default operator for Flat Prism element
52  * \ingroup mofem_forces_and_sources_prism_element
53  */
56 
58 
59  /** \brief get face aRea
60  \param dd if dd == 0 it is for face F3 if dd == 1 is for face F4
61  */
62  inline double getArea(const int dd);
63 
64  inline double getAreaF3();
65  inline double getAreaF4();
66 
67  /** \brief get triangle normal
68 
69  Normal has 6 elements, first 3 are for face F3 another three for face F4
70 
71  */
72  inline VectorDouble &getNormal();
73 
74  inline VectorAdaptor getNormalF3();
75 
76  inline VectorAdaptor getNormalF4();
77 
78  /** \brief get Gauss pts. in the prism
79  */
80  inline MatrixDouble &getGaussPts();
81 
82  /** \brief get Gauss pts. on triangles
83  */
84  inline MatrixDouble &getGaussPtsTrianglesOnly();
85 
86  /** \brief get Gauss pts. through thickness
87  */
88  inline MatrixDouble &getGaussPtsThroughThickness();
89 
90  /** \brief get coordinates at Gauss pts.
91 
92  Matrix has size (nb integration points)x(coordinates on F3 and F4 = 6),
93  i.e. coordinates on face F3 and F4
94 
95  */
96  inline MatrixDouble &getCoordsAtGaussPts();
97 
98  /** \brief get coordinates at Gauss pts.
99 
100  Matrix has size (nb integration points)x(coordinates on F3 and F4 = 6),
101  i.e. coordinates on face F3 and F4
102 
103  */
104  inline MatrixDouble &getCoordsAtGaussPtsTrianglesOnly();
105 
106  /** \brief coordinate at Gauss points on face 3 (if hierarchical
107  * approximation of element geometry)
108  */
109  inline MatrixDouble &getHOCoordsAtGaussPtsF3();
110 
111  /** \brief coordinate at Gauss points on face 4 (if hierarchical
112  * approximation of element geometry)
113  */
114  inline MatrixDouble &getHOCoordsAtGaussPtsF4();
115 
116  /** \brief if higher order geometry return normals at face F3 at Gauss pts.
117  *
118  * Face 3 is top face in canonical triangle numeration, see \cite
119  * tautges2010canonical
120  *
121  */
122  inline MatrixDouble &getNormalsAtGaussPtsF3();
123 
124  /** \brief if higher order geometry return normals at face F4 at Gauss pts.
125  *
126  * Face 4 is top face in canonical triangle numeration, see \cite
127  * tautges2010canonical
128  *
129  */
130  inline MatrixDouble &getNormalsAtGaussPtsF4();
131 
132  /** \brief if higher order geometry return normals at Gauss pts.
133  *
134  * Face 3 is top face in canonical triangle numeration, see \cite
135  * tautges2010canonical
136  *
137  * \param gg gauss point number
138  */
139  inline ublas::matrix_row<MatrixDouble> getNormalsAtGaussPtsF3(const int gg);
140 
141  /** \brief if higher order geometry return normals at Gauss pts.
142  *
143  * Face 3 is top face in canonical triangle numeration, see \cite
144  * tautges2010canonical
145  *
146  * \param gg gauss point number
147  */
148  inline ublas::matrix_row<MatrixDouble> getNormalsAtGaussPtsF4(const int gg);
149 
150  /** \brief if higher order geometry return tangent vector to triangle at
151  * Gauss pts.
152  */
153  inline MatrixDouble &getTangent1AtGaussPtF3();
154 
155  /** \brief if higher order geometry return tangent vector to triangle at
156  * Gauss pts.
157  */
158  inline MatrixDouble &getTangent2AtGaussPtF3();
159 
160  /** \brief if higher order geometry return tangent vector to triangle at
161  * Gauss pts.
162  */
163  inline MatrixDouble &getTangent1AtGaussPtF4();
164 
165  /** \brief if higher order geometry return tangent vector to triangle at
166  * Gauss pts.
167  */
168  inline MatrixDouble &getTangent2AtGaussPtF4();
169 
170  inline EntitiesFieldData &getTrianglesOnlyDataStructure();
171 
172  inline EntitiesFieldData &getTroughThicknessDataStructure();
173 
174  /** \brief return pointer to fat prism finite element
175  */
176  inline const FatPrismElementForcesAndSourcesCore *getPrismFE();
177 
178  protected:
179  MoFEMErrorCode setPtrFE(ForcesAndSourcesCore *ptr);
180 
181  };
182 
183  MoFEMErrorCode operator()();
184 
185 protected:
186  double aRea[2];
188 
192 
195 
205 
206  friend class UserDataOperator;
207 };
208 
209 inline double
210 FatPrismElementForcesAndSourcesCore::UserDataOperator::getArea(const int dd) {
211  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)->aRea[0];
212 }
213 
214 inline double
215 FatPrismElementForcesAndSourcesCore::UserDataOperator::getAreaF3() {
216  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)->aRea[0];
217 }
218 inline double
219 FatPrismElementForcesAndSourcesCore::UserDataOperator::getAreaF4() {
220  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)->aRea[1];
221 }
222 
223 inline VectorDouble &
224 FatPrismElementForcesAndSourcesCore::UserDataOperator::getNormal() {
225  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)->normal;
226 }
227 
228 inline VectorAdaptor
229 FatPrismElementForcesAndSourcesCore::UserDataOperator::getNormalF3() {
230  double *data =
231  &(static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)->normal[0]);
232  return VectorAdaptor(3, ublas::shallow_array_adaptor<double>(3, data));
233 }
234 
235 inline VectorAdaptor
236 FatPrismElementForcesAndSourcesCore::UserDataOperator::getNormalF4() {
237  double *data =
238  &(static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)->normal[3]);
239  return VectorAdaptor(3, ublas::shallow_array_adaptor<double>(3, data));
240 }
241 
242 inline MatrixDouble &
243 FatPrismElementForcesAndSourcesCore::UserDataOperator::getGaussPts() {
244  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)->gaussPts;
245 }
246 
247 inline MatrixDouble &FatPrismElementForcesAndSourcesCore::UserDataOperator::
248  getGaussPtsTrianglesOnly() {
249  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
250  ->gaussPtsTrianglesOnly;
251 }
252 
253 inline MatrixDouble &FatPrismElementForcesAndSourcesCore::UserDataOperator::
254  getGaussPtsThroughThickness() {
255  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
256  ->gaussPtsThroughThickness;
257 }
258 
259 inline MatrixDouble &
260 FatPrismElementForcesAndSourcesCore::UserDataOperator::getCoordsAtGaussPts() {
261  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
262  ->coordsAtGaussPts;
263 }
264 
265 inline MatrixDouble &FatPrismElementForcesAndSourcesCore::UserDataOperator::
266  getCoordsAtGaussPtsTrianglesOnly() {
267  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
268  ->coordsAtGaussPtsTrianglesOnly;
269 }
270 
271 inline MatrixDouble &FatPrismElementForcesAndSourcesCore::UserDataOperator::
272  getHOCoordsAtGaussPtsF3() {
273  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
274  ->hoCoordsAtGaussPtsF3;
275 }
276 
277 inline MatrixDouble &FatPrismElementForcesAndSourcesCore::UserDataOperator::
278  getHOCoordsAtGaussPtsF4() {
279  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
280  ->hoCoordsAtGaussPtsF4;
281 }
282 
283 inline MatrixDouble &
284 FatPrismElementForcesAndSourcesCore::UserDataOperator::getNormalsAtGaussPtsF3() {
285  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
286  ->nOrmals_at_GaussPtF3;
287 }
288 
289 inline MatrixDouble &
290 FatPrismElementForcesAndSourcesCore::UserDataOperator::getNormalsAtGaussPtsF4() {
291  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
292  ->nOrmals_at_GaussPtF4;
293 }
294 
295 inline ublas::matrix_row<MatrixDouble>
296 FatPrismElementForcesAndSourcesCore::UserDataOperator::getNormalsAtGaussPtsF3(
297  const int gg) {
298  return ublas::matrix_row<MatrixDouble>(
300  ->nOrmals_at_GaussPtF3,
301  gg);
302 }
303 
304 inline ublas::matrix_row<MatrixDouble>
305 FatPrismElementForcesAndSourcesCore::UserDataOperator::getNormalsAtGaussPtsF4(
306  const int gg) {
307  return ublas::matrix_row<MatrixDouble>(
309  ->nOrmals_at_GaussPtF4,
310  gg);
311 }
312 
313 inline MatrixDouble &FatPrismElementForcesAndSourcesCore::UserDataOperator::
314  getTangent1AtGaussPtF3() {
315  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
316  ->tAngent1_at_GaussPtF3;
317 }
318 
319 inline MatrixDouble &FatPrismElementForcesAndSourcesCore::UserDataOperator::
320  getTangent2AtGaussPtF3() {
321  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
322  ->tAngent2_at_GaussPtF3;
323 }
324 
325 inline MatrixDouble &FatPrismElementForcesAndSourcesCore::UserDataOperator::
326  getTangent1AtGaussPtF4() {
327  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
328  ->tAngent1_at_GaussPtF4;
329 }
330 
331 inline MatrixDouble &FatPrismElementForcesAndSourcesCore::UserDataOperator::
332  getTangent2AtGaussPtF4() {
333  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
334  ->tAngent2_at_GaussPtF4;
335 }
336 
337 inline EntitiesFieldData &FatPrismElementForcesAndSourcesCore::
338  UserDataOperator::getTrianglesOnlyDataStructure() {
339  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
340  ->dataH1TrianglesOnly;
341 }
342 
343 inline EntitiesFieldData &FatPrismElementForcesAndSourcesCore::
344  UserDataOperator::getTroughThicknessDataStructure() {
345  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE)
346  ->dataH1TroughThickness;
347 }
348 
350 FatPrismElementForcesAndSourcesCore::UserDataOperator::getPrismFE() {
351  return static_cast<FatPrismElementForcesAndSourcesCore *>(ptrFE);
352 }
353 
354 } // namespace MoFEM
355 
356 #endif //__FATPRISMELEMENTFORCESANDSURCESCORE_HPP__
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
MoFEM::FatPrismElementForcesAndSourcesCore::dataH1TrianglesOnly
EntitiesFieldData dataH1TrianglesOnly
Definition: FatPrismElementForcesAndSourcesCore.hpp:193
MoFEM::FatPrismElementForcesAndSourcesCore::hoCoordsAtGaussPtsF3
MatrixDouble hoCoordsAtGaussPtsF3
Definition: FatPrismElementForcesAndSourcesCore.hpp:196
MoFEM::FatPrismElementForcesAndSourcesCore::UserDataOperator
default operator for Flat Prism element
Definition: FatPrismElementForcesAndSourcesCore.hpp:54
MoFEM::FatPrismElementForcesAndSourcesCore::hoCoordsAtGaussPtsF4
MatrixDouble hoCoordsAtGaussPtsF4
Definition: FatPrismElementForcesAndSourcesCore.hpp:200
MoFEM::FatPrismElementForcesAndSourcesCore::tAngent1_at_GaussPtF4
MatrixDouble tAngent1_at_GaussPtF4
Definition: FatPrismElementForcesAndSourcesCore.hpp:202
MoFEM::FatPrismElementForcesAndSourcesCore::tAngent1_at_GaussPtF3
MatrixDouble tAngent1_at_GaussPtF3
Definition: FatPrismElementForcesAndSourcesCore.hpp:198
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
MoFEM::FatPrismElementForcesAndSourcesCore::tAngent2_at_GaussPtF4
MatrixDouble tAngent2_at_GaussPtF4
Definition: FatPrismElementForcesAndSourcesCore.hpp:203
MoFEM::FatPrismElementForcesAndSourcesCore::gaussPtsTrianglesOnly
MatrixDouble gaussPtsTrianglesOnly
Definition: FatPrismElementForcesAndSourcesCore.hpp:189
MoFEM::FatPrismElementForcesAndSourcesCore::coordsAtGaussPtsTrianglesOnly
MatrixDouble coordsAtGaussPtsTrianglesOnly
Definition: FatPrismElementForcesAndSourcesCore.hpp:190
order
constexpr int order
Definition: dg_projection.cpp:18
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::FatPrismElementForcesAndSourcesCore::setGaussPtsThroughThickness
virtual MoFEMErrorCode setGaussPtsThroughThickness(int order_thickness)
Definition: FatPrismElementForcesAndSourcesCore.hpp:45
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::FatPrismElementForcesAndSourcesCore::dataH1TroughThickness
EntitiesFieldData dataH1TroughThickness
Definition: FatPrismElementForcesAndSourcesCore.hpp:194
MoFEM::FatPrismElementForcesAndSourcesCore::getRuleTrianglesOnly
virtual int getRuleTrianglesOnly(int order)
Definition: FatPrismElementForcesAndSourcesCore.hpp:36
MoFEM::FatPrismElementForcesAndSourcesCore::setGaussPtsTrianglesOnly
virtual MoFEMErrorCode setGaussPtsTrianglesOnly(int order_triangles_only)
Definition: FatPrismElementForcesAndSourcesCore.hpp:39
MoFEM::OpGetCoordsAndNormalsOnPrism
calculate normals at Gauss points of triangle element
Definition: DataOperators.hpp:378
MoFEM::FatPrismElementForcesAndSourcesCore
FatPrism finite element.
Definition: FatPrismElementForcesAndSourcesCore.hpp:31
MoFEM::Types::VectorAdaptor
VectorShallowArrayAdaptor< double > VectorAdaptor
Definition: Types.hpp:115
MoFEM::VolumeElementForcesAndSourcesCore
Volume finite element base.
Definition: VolumeElementForcesAndSourcesCore.hpp:26
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
Definition: VolumeElementForcesAndSourcesCore.hpp:108
MoFEM::FatPrismElementForcesAndSourcesCore::gaussPtsThroughThickness
MatrixDouble gaussPtsThroughThickness
Definition: FatPrismElementForcesAndSourcesCore.hpp:191
MoFEM::ForcesAndSourcesCore
structure to get information form mofem into EntitiesFieldData
Definition: ForcesAndSourcesCore.hpp:22
FTensor::dd
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
MoFEM::FatPrismElementForcesAndSourcesCore::getRuleThroughThickness
virtual int getRuleThroughThickness(int order)
Definition: FatPrismElementForcesAndSourcesCore.hpp:37
UBlasVector< double >
MoFEM::FatPrismElementForcesAndSourcesCore::nOrmals_at_GaussPtF4
MatrixDouble nOrmals_at_GaussPtF4
Definition: FatPrismElementForcesAndSourcesCore.hpp:201
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
MoFEM::EntitiesFieldData
data structure for finite element entity
Definition: EntitiesFieldData.hpp:40
MoFEM::FatPrismElementForcesAndSourcesCore::tAngent2_at_GaussPtF3
MatrixDouble tAngent2_at_GaussPtF3
Definition: FatPrismElementForcesAndSourcesCore.hpp:199
MoFEM::FatPrismElementForcesAndSourcesCore::nOrmals_at_GaussPtF3
MatrixDouble nOrmals_at_GaussPtF3
Definition: FatPrismElementForcesAndSourcesCore.hpp:197
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
MoFEM::FatPrismElementForcesAndSourcesCore::normal
VectorDouble normal
Definition: FatPrismElementForcesAndSourcesCore.hpp:187
MoFEM::FatPrismElementForcesAndSourcesCore::opHOCoordsAndNormals
OpGetCoordsAndNormalsOnPrism opHOCoordsAndNormals
Definition: FatPrismElementForcesAndSourcesCore.hpp:204
MoFEM::ForcesAndSourcesCore::UserDataOperator::ptrFE
ForcesAndSourcesCore * ptrFE
Definition: ForcesAndSourcesCore.hpp:984