v0.13.1
FaceElementForcesAndSourcesCore.hpp
Go to the documentation of this file.
1/** \file FaceElementForcesAndSourcesCore.hpp
2 \brief Implementation of face element.
3
4*/
5
6/* This file is part of MoFEM.
7 * MoFEM is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU Lesser General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * MoFEM is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef __FACEELEMENTFORCESANDSOURCESCORE_HPP__
21#define __FACEELEMENTFORCESANDSOURCESCORE_HPP__
22
23using namespace boost::numeric;
24
25namespace MoFEM {
26
27struct VolumeElementForcesAndSourcesCoreOnSide;
28
29/** \brief Face finite element
30 \ingroup mofem_forces_and_sources_tri_element
31
32 User is implementing own operator at Gauss point level, by own object
33 derived from FaceElementForcesAndSourcesCoreL::UserDataOperator. Arbitrary
34 number of operator added pushing objects to OpPtrVector
35
36 */
38
39 /**
40 * @deprecated not used anumore, will be removed in next versions
41 *
42 */
44
45 /** \brief default operator for TRI element
46 * \ingroup mofem_forces_and_sources_tri_element
47 */
48 struct UserDataOperator;
49
51
53
54protected:
55 /**
56 * \brief Calculate element area and normal of the face at integration points
57 *
58 * @return Error code
59 */
61
62 /**
63 * \brief Calculate element area and normal of the face
64 *
65 * Note that at that point is assumed that geometry is exclusively defined
66 * by corner nodes.
67 *
68 * @return Error code
69 */
71
72 /**
73 * \brief Set integration points
74 * @return Error code
75 */
77
78 /**
79 * \brief Determine approximation space and order of base functions
80 * @return Error code
81 */
83
84 /**
85 * \brief Calculate coordinate at integration points
86 * @return Error code
87 */
89
90 double aRea;
92 const EntityHandle *conn;
95
99
100 friend class UserDataOperator;
102};
103
104/** \brief default operator for TRI element
105 * \ingroup mofem_forces_and_sources_tri_element
106 */
109
111
112 /**
113 * \brief get area of face
114 * @return area of face
115 */
116 inline double getArea();
117
118 /**
119 * \brief get measure of element
120 * @return area of face
121 */
122 inline double getMeasure();
123
124 /** \brief get triangle normal
125 */
126 inline VectorDouble &getNormal();
127
128 /** \brief get triangle tangent 1
129 */
130 inline VectorDouble &getTangent1();
131
132 /** \brief get triangle tangent 2
133 */
134 inline VectorDouble &getTangent2();
135
136 /** \brief get normal as tensor
137 */
138 inline auto getFTensor1Normal();
139
140 /** \brief get tangentOne as tensor
141 */
142 inline auto getFTensor1Tangent1();
143
144 /** \brief get tangentTwo as tensor
145 */
146 inline auto getFTensor1Tangent2();
147
148 /** \brief get element number of nodes
149 */
150 inline int getNumNodes();
151
152 /** \brief get element connectivity
153 */
154 inline const EntityHandle *getConn();
155
156 /** \brief get triangle coordinates
157 */
158 inline VectorDouble &getCoords();
159
160 /**
161 * \brief get get coords at gauss points
162
163 \code
164 FTensor::Index<'i',3> i;
165 FTensor::Tensor1<double,3> t_center;
166 auto t_coords = getFTensor1Coords();
167 t_center(i) = 0;
168 for(int nn = 0;nn!=3;nn++) {
169 t_center(i) += t_coords(i);
170 ++t_coords;
171 }
172 t_center(i) /= 3;
173 \endcode
174
175 */
176 inline auto getFTensor1Coords();
177
178 /** \brief if higher order geometry return normals at Gauss pts.
179
180 Note: returned matrix has size 0 in rows and columns if no HO approximation
181 of geometry is available.
182
183 */
185
186 /** \brief if higher order geometry return normals at Gauss pts.
187 *
188 * \param gg gauss point number
189 */
190 inline ublas::matrix_row<MatrixDouble> getNormalsAtGaussPts(const int gg);
191
192 /** \brief if higher order geometry return tangent vector to triangle at
193 Gauss pts.
194
195 Note: returned matrix has size 0 in rows and columns if no HO approximation
196 of geometry is avaliable.
197
198 */
200
201 /** \brief if higher order geometry return tangent vector to triangle at
202 Gauss pts.
203
204 Note: returned matrix has size 0 in rows and columns if no HO approximation
205 of geometry is avaliable.
206
207 */
209
210 /** \brief get normal at integration points
211
212 Example:
213 \code
214 double nrm2;
215 FTensor::Index<'i',3> i;
216 auto t_normal = getFTensor1NormalsAtGaussPts();
217 for(int gg = gg!=data.getN().size1();gg++) {
218 nrm2 = sqrt(t_normal(i)*t_normal(i));
219 ++t_normal;
220 }
221 \endcode
222
223 */
224 inline auto getFTensor1NormalsAtGaussPts();
225
226 /** \brief get tangent 1 at integration points
227
228 */
229 inline auto getFTensor1Tangent1AtGaussPts();
230
231 /** \brief get tangent 2 at integration points
232
233 */
234 inline auto getFTensor1Tangent2AtGaussPts();
235
236 /** \brief return pointer to Generic Triangle Finite Element object
237 */
239
240 /**
241 *
242 * User call this function to loop over elements on the side of face. This
243 * function calls MoFEM::VolumeElementForcesAndSourcesCoreOnSide with is
244 * operator to do calculations.
245 *
246 * @param fe_name Name of the element
247 * @param method Finite element object
248 * @return error code
249 */
251 loopSideVolumes(const string fe_name,
253
254private:
256};
257
259 return static_cast<FaceElementForcesAndSourcesCore *>(ptrFE)->aRea;
260}
261
263 return getArea();
264}
265
267 return static_cast<FaceElementForcesAndSourcesCore *>(ptrFE)->nOrmal;
268}
269
271 return static_cast<FaceElementForcesAndSourcesCore *>(ptrFE)->tangentOne;
272}
273
275 return static_cast<FaceElementForcesAndSourcesCore *>(ptrFE)->tangentTwo;
276}
277
279 double *ptr = &*getNormal().data().begin();
280 return FTensor::Tensor1<double *, 3>(ptr, &ptr[1], &ptr[2]);
281}
282
284 double *ptr = &*getTangent1().data().begin();
285 return FTensor::Tensor1<double *, 3>(ptr, &ptr[1], &ptr[2]);
286}
287
289 double *ptr = &*getTangent2().data().begin();
290 return FTensor::Tensor1<double *, 3>(ptr, &ptr[1], &ptr[2]);
291}
292
294 return static_cast<FaceElementForcesAndSourcesCore *>(ptrFE)->num_nodes;
295}
296
297const EntityHandle *
299 return static_cast<FaceElementForcesAndSourcesCore *>(ptrFE)->conn;
300}
301
303 return static_cast<FaceElementForcesAndSourcesCore *>(ptrFE)->coords;
304}
305
307 double *ptr = &*getCoords().data().begin();
309 &ptr[2]);
310}
311
314 return static_cast<FaceElementForcesAndSourcesCore *>(ptrFE)
316}
317
318ublas::matrix_row<MatrixDouble>
320 const int gg) {
321 return ublas::matrix_row<MatrixDouble>(
323 gg);
324}
325
328 return static_cast<FaceElementForcesAndSourcesCore *>(ptrFE)
330}
331
334 return static_cast<FaceElementForcesAndSourcesCore *>(ptrFE)
336}
337
340 double *ptr = &*getNormalsAtGaussPts().data().begin();
342 &ptr[2]);
343}
344
347 double *ptr = &*getTangent1AtGaussPts().data().begin();
349 &ptr[2]);
350}
351
354 double *ptr = &*getTangent2AtGaussPts().data().begin();
356 &ptr[2]);
357}
358
361 return static_cast<FaceElementForcesAndSourcesCore *>(ptrFE);
362}
363
364/** \deprecated use FaceElementForcesAndSourcesCore
365 */
368
369} // namespace MoFEM
370
371#endif //__FACEELEMENTFORCESANDSOURCESCORE_HPP__
372
373/**
374 * \defgroup mofem_forces_and_sources_tri_element Face Element
375 * \brief Implementation of face element
376 *
377 * \ingroup mofem_forces_and_sources
378 **/
#define DEPRECATED
Definition: definitions.h:30
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
DEPRECATED typedef FaceElementForcesAndSourcesCore FaceElementForcesAndSourcesCoreBase
Deprecated interface functions.
MatrixDouble & getNormalsAtGaussPts()
if higher order geometry return normals at Gauss pts.
MoFEMErrorCode loopSideVolumes(const string fe_name, VolumeElementForcesAndSourcesCoreOnSide &fe_method)
FaceElementForcesAndSourcesCore * getFaceFE()
return pointer to Generic Triangle Finite Element object
MatrixDouble & getTangent2AtGaussPts()
if higher order geometry return tangent vector to triangle at Gauss pts.
MatrixDouble & getTangent1AtGaussPts()
if higher order geometry return tangent vector to triangle at Gauss pts.
virtual MoFEMErrorCode calculateAreaAndNormal()
Calculate element area and normal of the face.
MoFEMErrorCode operator()()
function is run for every finite element
virtual MoFEMErrorCode getSpaceBaseAndOrderOnElement()
Determine approximation space and order of base functions.
virtual MoFEMErrorCode calculateAreaAndNormalAtIntegrationPts()
Calculate element area and normal of the face at integration points.
virtual MoFEMErrorCode setIntegrationPts()
Set integration points.
virtual MoFEMErrorCode calculateCoordinatesAtGaussPts()
Calculate coordinate at integration points.
UserDataOperator(const FieldSpace space, const char type=OPSPACE, const bool symm=true)
structure to get information form mofem into EntitiesFieldData
Base volume element used to integrate on skeleton.