v0.15.0
Loading...
Searching...
No Matches
VolumeElementForcesAndSourcesCoreOnSide.hpp
Go to the documentation of this file.
1/** \file VolumeElementForcesAndSourcesCoreOnSide.hpp
2 \brief Volume element.
3
4 Those element are inherited by user to implement specific implementation of
5 particular problem.
6
7*/
8
9
10
11#ifndef __VOLUMEELEMENTFORCESANDSOURCESCORE_ONSIDE_HPP__
12#define __VOLUMEELEMENTFORCESANDSOURCESCORE_ONSIDE_HPP__
13
14using namespace boost::numeric;
15
16namespace MoFEM {
17
18/**
19 * \brief Base volume element used to integrate on skeleton
20 * \ingroup mofem_forces_and_sources_volume_element
21 */
24
26
27 /**
28 * @brief Get the face nodes mapped on volume element
29 *
30 * \todo That this is not general, e.g., for quad number of nodes is 4.
31 *
32 * @return const std::array<int, 4>&
33 */
34 inline const std::array<int, 4> &getFaceConnMap() const;
35
36 /**
37 * @brief Get face nodes maped on volume
38 *
39 * \todo That this is not general, e.g., for prism or hex, size of fixed array
40 * is wrong.
41 *
42 * @return const sdt::array<int, 4>&
43 */
44 inline const std::array<int, 8> &getTetConnMap() const;
45
46 /**
47 * @brief Get node on volume opposite to volume element
48 *
49 * \todo That this is not general, e.g., for prism or hex, opoosite node is
50 * not unique.
51 *
52 * @return int
53 */
54 inline int getOppositeNode() const;
55
56 /**
57 * @brief Sense face on volume
58 * @deprecated use getSkeletonSense()
59 *
60 * @return int
61 */
62 DEPRECATED inline int getFaceSense() const;
63
64 /**
65 * @brief Sense face on volume
66 *
67 * @return int
68 */
69 inline int getSkeletonSense() const;
70
71 /**
72 * @brief Face number on the volume
73 *
74 * @return int
75 */
76 inline int getFaceSideNumber() const;
77
78 /** \brief default operator for TET element
79 * \ingroup mofem_forces_and_sources_volume_element
80 */
81 struct UserDataOperator;
82
83 int getRule(int order);
85
86 /**
87 * \brief Get side and sense and call operator from derived class
88 */
90
91private:
92
94
95 int faceSense; ///< Sense of face, could be 1 or -1
96 int faceSideNumber; ///< Face side number
97 int nbNodesOnFace; ///< Number of nodes on face
98 std::array<int, 4> faceConnMap;
99 std::array<int, 8> tetConnMap;
101 bool operatorImplCalled = false; ///< flag to check if operatorImpl was called
102};
103
104/** \brief default operator for TET element
105 * \ingroup mofem_forces_and_sources_volume_element
106 */
109
110 using VolumeElementForcesAndSourcesCore::UserDataOperator::UserDataOperator;
111
113
115
116 /**
117 * \brief get face sense in respect to volume
118 * \deprecated use getSkeletonSense
119 * @return error code
120 */
121 DEPRECATED inline int getFaceSense() const;
122
123 /**
124 * @brief Get the skeleton sense
125 *
126 * calls getFaceSense()
127 *
128 * @return int
129 */
130 inline int getSkeletonSense() const;
131
132 /**
133 * \brief get face side number in respect to volume
134 * @return error code
135 */
136 inline int getFaceSideNumber() const;
137
138 inline bool getEdgeFace(const int ee) const;
139
140 /**
141 * get face normal on side which is this element
142 * @return face normal
143 */
144 inline VectorDouble &getNormal();
145
146 /** \brief get triangle tangent 1
147 */
148 inline VectorDouble &getTangent1();
149
150 /** \brief get triangle tangent 2
151 */
152 inline VectorDouble &getTangent2();
153
154 /** \brief get normal as tensor
155 */
156 inline auto getFTensor1Normal();
157
158 /** \brief get tangentOne as tensor
159 */
160 inline auto getFTensor1Tangent1();
161
162 /** \brief get tangentTwo as tensor
163 */
164 inline auto getFTensor1Tangent2();
165
166 /** \brief if higher order geometry return normals at Gauss pts.
167
168 Note: returned matrix has size 0 in rows and columns if no HO approximation
169 of geometry is available.
170
171 */
173
174 /** \brief if higher order geometry return normals at Gauss pts.
175 *
176 * \param gg gauss point number
177 */
178 inline ublas::matrix_row<MatrixDouble> getNormalsAtGaussPts(const int gg);
179
180 /** \brief get normal at integration points
181
182 Example:
183 \code
184 double nrm2;
185 FTensor::Index<'i',3> i;
186 auto t_normal = getFTensor1NormalsAtGaussPts();
187 for(int gg = gg!=data.getN().size1();gg++) {
188 nrm2 = sqrt(t_normal(i)*t_normal(i));
189 ++t_normal;
190 }
191 \endcode
192
193 */
194 inline auto getFTensor1NormalsAtGaussPts();
195
196 /** \brief get face coordinates at Gauss pts.
197
198 \note Coordinates should be the same what function getCoordsAtGaussPts
199 on tets is returning. If both coordinates are different it is error, or you
200 do something very unusual.
201
202 */
204
205protected:
207};
208
209const std::array<int, 4> &
213
214const std::array<int, 8> &
218
222
226
230
234
236VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::getFaceFE()
237 const {
238 return static_cast<FaceElementForcesAndSourcesCore *>(
240}
241
243VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::getNormal() {
244 return getFaceFE()->nOrmal;
245}
246
248VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::getTangent1() {
249 return getFaceFE()->tangentOne;
250}
251
253VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::getTangent2() {
254 return getFaceFE()->tangentTwo;
255}
256
258VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::getVolumeFE()
259 const {
260 return static_cast<VolumeElementForcesAndSourcesCoreOnSide *>(ptrFE);
261}
262
263int VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::
264 getFaceSense() const {
265 return getSkeletonSense();
266}
267
268int VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::
269 getSkeletonSense() const {
270 return getVolumeFE()->faceSense;
271}
272
273auto VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::
274 getFTensor1Normal() {
275 double *ptr = &*getNormal().data().begin();
276 return FTensor::Tensor1<double *, 3>(ptr, &ptr[1], &ptr[2]);
277}
278
279auto VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::
280 getFTensor1Tangent1() {
281 double *ptr = &*getTangent1().data().begin();
282 return FTensor::Tensor1<double *, 3>(ptr, &ptr[1], &ptr[2]);
283}
284
285auto VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::
286 getFTensor1Tangent2() {
287 double *ptr = &*getTangent2().data().begin();
288 return FTensor::Tensor1<double *, 3>(ptr, &ptr[1], &ptr[2]);
289}
290
291inline auto VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::
292 getFTensor1NormalsAtGaussPts() {
293 double *ptr = &*getNormalsAtGaussPts().data().begin();
295 &ptr[2]);
296}
297
298int VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::
299 getFaceSideNumber() const {
300 return getVolumeFE()->faceSideNumber;
301}
302
303MatrixDouble &VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::
304 getNormalsAtGaussPts() {
305 return getFaceFE()->normalsAtGaussPts;
306}
307
308MatrixDouble &VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::
309 getFaceCoordsAtGaussPts() {
310 return getFaceFE()->coordsAtGaussPts;
311}
312
313bool VolumeElementForcesAndSourcesCoreOnSide::UserDataOperator::getEdgeFace(
314 const int ee) const {
315 constexpr bool edges_on_faces[6][4] = {{true, false, false, true}, // e0
316 {false, true, false, true}, // e1
317 {false, false, true, true}, // e2
318 {true, false, true, false}, // e3
319 {true, true, false, false}, // e4
320 {false, true, true, false}};
321 return edges_on_faces[ee][getFaceSideNumber()];
322}
323
324ublas::matrix_row<MatrixDouble> VolumeElementForcesAndSourcesCoreOnSide::
325 UserDataOperator::getNormalsAtGaussPts(const int gg) {
326 return ublas::matrix_row<MatrixDouble>(getNormalsAtGaussPts(), gg);
327}
328
329/**
330 * @deprecated use VolumeElementForcesAndSourcesCore
331 *
332 */
335
336/**
337 * @deprecated do not use this template, it is obsolete
338 */
339template <int SWITCH>
347
348
349
350} // namespace MoFEM
351
352#endif //__VOLUMEELEMENTFORCESANDSOURCESCORE_ONSIDE_HPP__
#define DEPRECATED
Definition definitions.h:17
constexpr int order
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
DEPRECATED typedef VolumeElementForcesAndSourcesCoreOnSide VolumeElementForcesAndSourcesCoreOnSideBase
structure to get information form mofem into EntitiesFieldData
ForcesAndSourcesCore * sidePtrFE
Element to integrate on the sides.
MatrixDouble & getNormalsAtGaussPts()
if higher order geometry return normals at Gauss pts.
const std::array< int, 8 > & getTetConnMap() const
Get face nodes maped on volume.
const std::array< int, 4 > & getFaceConnMap() const
Get the face nodes mapped on volume element.
MoFEMErrorCode operator()()
Get side and sense and call operator from derived class.
int getOppositeNode() const
Get node on volume opposite to volume element.