v0.14.0
Loading...
Searching...
No Matches
Tools.hpp
Go to the documentation of this file.
1/** \file Tools.hpp
2 * \brief Tools interface
3 *
4 * Implementation of some useful and very often used methods * in MoFEM.
5 *
6 * \ingroup mofem_tools
7 */
8
9#ifndef __TOOLS_HPP__
10#define __TOOLS_HPP__
11
12namespace MoFEM {
13
14/**
15 * \brief Auxiliary tools
16 * \nosubgrouping
17 * \ingroup mofem_tools
18 */
19struct Tools : public UnknownInterface {
20
21 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
22 UnknownInterface **iface) const;
23
25 Tools(const MoFEM::Core &core) : cOre(const_cast<MoFEM::Core &>(core)) {}
26
27 /** \name Computational */
28
29 /**
30 * \brief Calculate tetrahedron volume length quality
31 * @param coords tet coordinates
32 * @return Volume-length quality
33 */
34 static double volumeLengthQuality(const double *coords);
35
36 /**
37 * @brief Calculate volume of tetrahedron
38 *
39 * @param coords
40 * @return double volume
41 */
42 static double tetVolume(const double *coords);
43
44 /**
45 * \brief calculate minimal quality of tetrahedra in range
46 * @param tets range
47 * @param min_quality mimimal quality
48 * @return error code
49 */
51 const Range &tets, double &min_quality, Tag th = nullptr,
52 boost::function<double(double, double)> f =
53 [](double a, double b) -> double { return std::min(a, b); });
54
55 static constexpr double shapeFunMBEDGE0At00 = N_MBEDGE0(0);
56 static constexpr double shapeFunMBEDGE1At00 = N_MBEDGE1(0);
57
58 /**
59 * @brief Array of shape function at zero local point on reference element
60 *
61 */
62 static constexpr std::array<double, 2> shapeFunMBEDGEAt00 = {
64
65 static constexpr double diffN_MBEDGE0x = diffN_MBEDGE0;
66 static constexpr double diffN_MBEDGE1x = diffN_MBEDGE1;
67
68 static constexpr std::array<double, 2> diffShapeFunMBEDGE = {diffN_MBEDGE0x,
70
71 static inline double shapeFunMBEDGE0(const double x);
72
73 static inline double shapeFunMBEDGE1(const double x);
74
75 /**
76 * @brief Calculate shape functions on edge
77 *
78 * \note Template parameter is leading dimension of point coordinate arrays,
79 * such that \f$ksi_{n+1} = ksi[n + LDB]\f$
80 *
81 * @tparam 1
82 * @param shape shape functions
83 * @param ksi pointer to first local coordinates
84 * @param nb number of points
85 * @return MoFEMErrorCode
86 */
87 template <int LDB = 1>
88 static MoFEMErrorCode shapeFunMBEDGE(double *shape, const double *ksi,
89 const int nb);
90
91 static constexpr double diffShapeFunMBTRI0x =
92 diffN_MBTRI0x; ///< derivative of triangle shape function
93 static constexpr double diffShapeFunMBTRI0y =
94 diffN_MBTRI0y; ///< derivative of triangle shape function
95 static constexpr double diffShapeFunMBTRI1x =
96 diffN_MBTRI1x; ///< derivative of triangle shape function
97 static constexpr double diffShapeFunMBTRI1y =
98 diffN_MBTRI1y; ///< derivative of triangle shape function
99 static constexpr double diffShapeFunMBTRI2x =
100 diffN_MBTRI2x; ///< derivative of triangle shape function
101 static constexpr double diffShapeFunMBTRI2y =
102 diffN_MBTRI2y; ///< derivative of triangle shape function
103
104 static constexpr std::array<double, 6> diffShapeFunMBTRI = {
105
107
109
111
112 static constexpr double shapeFunMBTRI0At00 = N_MBTRI0(0, 0);
113 static constexpr double shapeFunMBTRI1At00 = N_MBTRI1(0, 0);
114 static constexpr double shapeFunMBTRI2At00 = N_MBTRI2(0, 0);
115
116 /**
117 * @brief Array of shape function at zero local point on reference element
118 *
119 */
120 static constexpr std::array<double, 3> shapeFunMBTRIAt00 = {
122
123 static inline double shapeFunMBTRI0(const double x, const double y);
124
125 static inline double shapeFunMBTRI1(const double x, const double y);
126
127 static inline double shapeFunMBTRI2(const double x, const double y);
128
129 /**
130 * @brief Calculate shape functions on triangle
131 *
132 * \note Template parameter is leading dimension of point coordinate arrays,
133 * such that \f$ksi_{n+1} = ksi[n + LDB]\f$
134 *
135 * @tparam 1
136 * @param shape shape functions
137 * @param ksi pointer to first local coordinates
138 * @param eta pointer to second local coordinates
139 * @param nb number of points
140 * @return MoFEMErrorCode
141 */
142 template <int LDB = 1>
143 static MoFEMErrorCode shapeFunMBTRI(double *shape, const double *ksi,
144 const double *eta, const int nb);
145
146 static constexpr double diffShapeFunMBQUADAtCenter0x =
147 diffN_MBQUAD0x(0.5); ///< derivative of quad shape function
148 static constexpr double diffShapeFunMBQUADAtCenter0y =
149 diffN_MBQUAD0y(0.5); ///< derivative of quad shape function
150 static constexpr double diffShapeFunMBQUADAtCenter1x =
151 diffN_MBQUAD1x(0.5); ///< derivative of quad shape function
152 static constexpr double diffShapeFunMBQUADAtCenter1y =
153 diffN_MBQUAD1y(0.5); ///< derivative of quad shape function
154 static constexpr double diffShapeFunMBQUADAtCenter2x =
155 diffN_MBQUAD2x(0.5); ///< derivative of quad shape function
156 static constexpr double diffShapeFunMBQUADAtCenter2y =
157 diffN_MBQUAD2y(0.5); ///< derivative of quad shape function
158 static constexpr double diffShapeFunMBQUADAtCenter3x =
159 diffN_MBQUAD3x(0.5); ///< derivative of quad shape function
160 static constexpr double diffShapeFunMBQUADAtCenter3y =
161 diffN_MBQUAD3y(0.5); ///< derivative of quad shape function
162
163 static constexpr double diffShapeFunMBHEXAtCenter0x =
164 diffN_MBHEX0x(0.5, 0.5); ///< derivative of HEX shape function
165 static constexpr double diffShapeFunMBHEXAtCenter0y =
166 diffN_MBHEX0y(0.5, 0.5); ///< derivative of HEX shape function
167 static constexpr double diffShapeFunMBHEXAtCenter0z =
168 diffN_MBHEX0z(0.5, 0.5); ///< derivative of HEX shape function
169 static constexpr double diffShapeFunMBHEXAtCenter1x =
170 diffN_MBHEX1x(0.5, 0.5); ///< derivative of HEX shape function
171 static constexpr double diffShapeFunMBHEXAtCenter1y =
172 diffN_MBHEX1y(0.5, 0.5); ///< derivative of HEX shape function
173 static constexpr double diffShapeFunMBHEXAtCenter1z =
174 diffN_MBHEX1z(0.5, 0.5); ///< derivative of HEX shape function
175 static constexpr double diffShapeFunMBHEXAtCenter2x =
176 diffN_MBHEX2x(0.5, 0.5); ///< derivative of HEX shape function
177 static constexpr double diffShapeFunMBHEXAtCenter2y =
178 diffN_MBHEX2y(0.5, 0.5); ///< derivative of HEX shape function
179 static constexpr double diffShapeFunMBHEXAtCenter2z =
180 diffN_MBHEX2z(0.5, 0.5); ///< derivative of HEX shape function
181 static constexpr double diffShapeFunMBHEXAtCenter3x =
182 diffN_MBHEX3x(0.5, 0.5); ///< derivative of HEX shape function
183 static constexpr double diffShapeFunMBHEXAtCenter3y =
184 diffN_MBHEX3y(0.5, 0.5); ///< derivative of quad shape function
185 static constexpr double diffShapeFunMBHEXAtCenter3z =
186 diffN_MBHEX3z(0.5, 0.5); ///< derivative of quad shape function
187 static constexpr double diffShapeFunMBHEXAtCenter4x =
188 diffN_MBHEX4x(0.5, 0.5); ///< derivative of HEX shape function
189 static constexpr double diffShapeFunMBHEXAtCenter4y =
190 diffN_MBHEX4y(0.5, 0.5); ///< derivative of quad shape function
191 static constexpr double diffShapeFunMBHEXAtCenter4z =
192 diffN_MBHEX4z(0.5, 0.5); ///< derivative of quad shape function
193 static constexpr double diffShapeFunMBHEXAtCenter5x =
194 diffN_MBHEX5x(0.5, 0.5); ///< derivative of HEX shape function
195 static constexpr double diffShapeFunMBHEXAtCenter5y =
196 diffN_MBHEX5y(0.5, 0.5); ///< derivative of quad shape function
197 static constexpr double diffShapeFunMBHEXAtCenter5z =
198 diffN_MBHEX5z(0.5, 0.5); ///< derivative of quad shape function
199 static constexpr double diffShapeFunMBHEXAtCenter6x =
200 diffN_MBHEX6x(0.5, 0.5); ///< derivative of HEX shape function
201 static constexpr double diffShapeFunMBHEXAtCenter6y =
202 diffN_MBHEX6y(0.5, 0.5); ///< derivative of quad shape function
203 static constexpr double diffShapeFunMBHEXAtCenter6z =
204 diffN_MBHEX6z(0.5, 0.5); ///< derivative of quad shape function
205 static constexpr double diffShapeFunMBHEXAtCenter7x =
206 diffN_MBHEX7x(0.5, 0.5); ///< derivative of HEX shape function
207 static constexpr double diffShapeFunMBHEXAtCenter7y =
208 diffN_MBHEX7y(0.5, 0.5); ///< derivative of quad shape function
209 static constexpr double diffShapeFunMBHEXAtCenter7z =
210 diffN_MBHEX7z(0.5, 0.5); ///< derivative of quad shape function
211
212 static constexpr std::array<double, 8> diffShapeFunMBQUADAtCenter = {
217
218 static constexpr std::array<double, 24> diffShapeFunMBHEXAtCenter = {
219
222
225
228
231
234
237
240
243
244 };
245
246 static constexpr double diffShapeFunMBTET0x =
247 diffN_MBTET0x; ///< derivative of tetrahedral shape function
248 static constexpr double diffShapeFunMBTET0y =
249 diffN_MBTET0y; ///< derivative of tetrahedral shape function
250 static constexpr double diffShapeFunMBTET0z =
251 diffN_MBTET0z; ///< derivative of tetrahedral shape function
252 static constexpr double diffShapeFunMBTET1x =
253 diffN_MBTET1x; ///< derivative of tetrahedral shape function
254 static constexpr double diffShapeFunMBTET1y =
255 diffN_MBTET1y; ///< derivative of tetrahedral shape function
256 static constexpr double diffShapeFunMBTET1z =
257 diffN_MBTET1z; ///< derivative of tetrahedral shape function
258 static constexpr double diffShapeFunMBTET2x =
259 diffN_MBTET2x; ///< derivative of tetrahedral shape function
260 static constexpr double diffShapeFunMBTET2y =
261 diffN_MBTET2y; ///< derivative of tetrahedral shape function
262 static constexpr double diffShapeFunMBTET2z =
263 diffN_MBTET2z; ///< derivative of tetrahedral shape function
264 static constexpr double diffShapeFunMBTET3x =
265 diffN_MBTET3x; ///< derivative of tetrahedral shape function
266 static constexpr double diffShapeFunMBTET3y =
267 diffN_MBTET3y; ///< derivative of tetrahedral shape function
268 static constexpr double diffShapeFunMBTET3z =
269 diffN_MBTET3z; ///< derivative of tetrahedral shape function
270
271 static constexpr std::array<double, 12> diffShapeFunMBTET = {
272
274
276
278
280
281 static inline double shapeFunMBTET0(const double x, const double y,
282 const double z);
283
284 static inline double shapeFunMBTET1(const double x, const double y,
285 const double z);
286
287 static inline double shapeFunMBTET2(const double x, const double y,
288 const double z);
289
290 static inline double shapeFunMBTET3(const double x, const double y,
291 const double z);
292
293 static constexpr double shapeFunMBTET0At000 = N_MBTET0(0, 0, 0);
294 static constexpr double shapeFunMBTET1At000 = N_MBTET1(0, 0, 0);
295 static constexpr double shapeFunMBTET2At000 = N_MBTET2(0, 0, 0);
296 static constexpr double shapeFunMBTET3At000 = N_MBTET3(0, 0, 0);
297
298 static constexpr double shapeFunMBTET0AtOneThird =
299 N_MBTET0(1. / 3., 1. / 3., 1. / 3.);
300 static constexpr double shapeFunMBTET1AtOneThird =
301 N_MBTET1(1. / 3., 1. / 3., 1. / 3.);
302 static constexpr double shapeFunMBTET2AtOneThird =
303 N_MBTET2(1. / 3., 1. / 3., 1. / 3.);
304 static constexpr double shapeFunMBTET3AtOneThird =
305 N_MBTET3(1. / 3., 1. / 3., 1. / 3.);
306
307 /**
308 * @brief Calculate shape functions on tetrahedron
309 *
310 * \note Template parameter is leading dimension of point coordinate arrays,
311 * such that \f$ksi_{n+1} = ksi[n + LDB]\f$
312 *
313 * @tparam 1
314 * @param shape shape functions
315 * @param ksi pointer to first local coordinates
316 * @param eta pointer to second local coordinates
317 * @param zeta pointer to first third coordinates
318 * @param nb number of points
319 * @return MoFEMErrorCode
320 */
321 template <int LDB = 1>
322 static MoFEMErrorCode shapeFunMBTET(double *shape, const double *ksi,
323 const double *eta, const double *zeta,
324 const double nb);
325
326 /**
327 * @brief Array of shape function at zero local point on reference element
328 *
329 */
330 static constexpr std::array<double, 4> shapeFunMBTETAt000 = {
333
334 /**
335 * @brief Array of shape function at center on reference element
336 *
337 */
338 static constexpr std::array<double, 4> shapeFunMBTETAtOneThird = {
341
342 /**
343 * @brief Get the Local Coordinates On Reference Four Node Tet object
344 *
345 * \code
346 * MatrixDouble elem_coords(4, 3);
347 * // Set nodal coordinates
348 * MatrixDouble global_coords(5, 3);
349 * // Set global coordinates
350 * MatrixDouble local_coords(global_coords.size1(), 3);
351 * CHKERR Tools::getLocalCoordinatesOnReferenceFourNodeTet(
352 * &elem_coords(0, 0), &global_coords(0, 0), global_coords.size1(),
353 * &local_coords(0, 0))
354 * \endcode
355 *
356 * @param elem_coords Global element node coordinates
357 * @param glob_coords Globale coordinates
358 * @param nb_nodes Number of points
359 * @param local_coords Result
360 * @return MoFEMErrorCode
361 */
363 const double *elem_coords, const double *glob_coords, const int nb_nodes,
364 double *local_coords);
365
366 /**
367 * @brief Get the Local Coordinates On Reference Four Node Tet object
368 *
369 * \code
370 * MatrixDouble elem_coords(4, 3);
371 * // Set nodal coordinates
372 * MatrixDouble global_coords(5, 3);
373 * // Set global coordinates
374 * MatrixDouble local_coords(global_coords.size1(), 3);
375 * CHKERR Tools::getLocalCoordinatesOnReferenceFourNodeTet(
376 * &elem_coords(0, 0), &global_coords(0, 0), global_coords.size1(),
377 * &local_coords(0, 0))
378 * \endcode
379 *
380 * @param elem_coords Global element node coordinates
381 * @param glob_coords Globale coordinates
382 * @param nb_nodes Number of points
383 * @param local_coords Result
384 * @return MoFEMErrorCode
385 */
387 const double *elem_coords, const double *glob_coords, const int nb_nodes,
388 double *local_coords);
389
390 /**
391 * @brief Get the Local Coordinates On Reference Four Node Tet object
392 *
393 * \code
394 * MatrixDouble elem_coords(4, 3);
395 * // Set nodal coordinates
396 * MatrixDouble global_coords(5, 3);
397 * // Set global coordinates
398 * MatrixDouble local_coords(global_coords.size1(), 3);
399 * CHKERR Tools::getLocalCoordinatesOnReferenceFourNodeTet(
400 * &elem_coords(0, 0), &global_coords(0, 0), global_coords.size1(),
401 * &local_coords(0, 0))
402 * \endcode
403 *
404 * @param elem_coords Global element node coordinates
405 * @param glob_coords Globale coordinates
406 * @param nb_nodes Number of points
407 * @param local_coords Result
408 * @return MoFEMErrorCode
409 */
411 const double *elem_coords, const double *glob_coords, const int nb_nodes,
412 double *local_coords);
413
414 /**
415 * @brief Get the Tets With Quality
416 *
417 * @param out_tets
418 * @param tets
419 * @param th
420 * @param f
421 * @return MoFEMErrorCode
422 */
424 Range &out_tets, const Range &tets, Tag th = nullptr,
425 boost::function<bool(double)> f = [](double q) -> bool {
426 if (q <= 0)
427 return true;
428 else
429 return false;
430 });
431 /**
432 * @brief Write file with tetrahedral of given quality
433 *
434 * @param file_name
435 * @param file_type
436 * @param options
437 * @param tets
438 * @param th
439 * @param f
440 * @return MoFEMErrorCode
441 */
443 const char *file_name, const char *file_type, const char *options,
444 const Range &tets, Tag th = nullptr,
445 boost::function<bool(double)> f = [](double q) -> bool {
446 if (q <= 0)
447 return true;
448 else
449 return false;
450 });
451
452 /**
453 * @brief Check of point is in tetrahedral
454 *
455 * @param tet_coords
456 * @param global_coord
457 * @param tol
458 * @param result
459 * @return MoFEMErrorCode
460 */
461 static MoFEMErrorCode checkIfPointIsInTet(const double tet_coords[],
462 const double global_coord[],
463 const double tol, bool &result);
464
465 /**
466 * @brief Get the Tri Normal objectGet triangle normal
467 *
468 * @param coords
469 * @param normal
470 * @return MoFEMErrorCode
471 */
472 static MoFEMErrorCode getTriNormal(const double *coords, double *normal);
473
474 /**
475 * @brief Get triangle normal
476 *
477 * @param tri
478 * @param normal
479 * @return MoFEMErrorCode
480 */
481 MoFEMErrorCode getTriNormal(const EntityHandle tri, double *normal) const;
482
483 /**
484 * @brief Get triangle area
485 *
486 * @param tri
487 * @return double
488 */
489 double getTriArea(const EntityHandle tri) const;
490
491 /**
492 * @brief Get edge length
493 *
494 * @param edge_coords
495 * @return double
496 */
497 static double getEdgeLength(const double *edge_coords);
498
499 /**
500 * @brief Get edge length
501 *
502 * @param edge
503 * @return double
504 */
505 double getEdgeLength(const EntityHandle edge);
506
513 };
514
515 /**
516 * @brief Find closet point on the segment from the point
517 *
518 * @param w_ptr segment first vertex coordinate
519 * @param v_ptr segment second vertex coordinate
520 * @param p_ptr coordinate of point
521 * @param t_ptr distance on the segment
522 *
523 * \note If t is outside bounds [ 0,-1 ] point is on the line point
524 * beyond segment.
525 *
526 * \code
527 *
528 * double w[] = {-1, 0, 0};
529 * double v[] = {1, 0, 0};
530 * double p[] = {0, 1, 0};
531 * double t;
532 * CHKERR Toolas::minDistancePointFromOnSegment(w, v, p, &t);
533 * double point_on_segment[3];
534 * for (int i = 0; i != 3; ++i)
535 * point_on_segment[i] = w[i] + t * (v[i] - w[i]);
536 *
537 * \endcode
538 *
539 * @return SEGMENT_MIN_DISTANCE
540 */
542 minDistancePointFromOnSegment(const double *w_ptr, const double *v_ptr,
543 const double *p_ptr,
544 double *const t_ptr = nullptr);
545 /**
546 * @brief Find points on two segments in closest distance
547 *
548 * @param w_ptr
549 * @param v_ptr
550 * @param k_ptr
551 * @param l_ptr
552 * @param tvw_ptr
553 * @param tlk_ptr
554 * @return SEGMENT_MIN_DISTANCE
555 *
556 * \note If tvwk or tlk are outside bound [0,-1], it means that points
557 * are on the lines beyond segments, respectively for segment vw and
558 * lk.
559 *
560 */
562 minDistanceFromSegments(const double *w_ptr, const double *v_ptr,
563 const double *k_ptr, const double *l_ptr,
564 double *const tvw_ptr = nullptr,
565 double *const tlk_ptr = nullptr);
566
567 /**
568 * @brief Find minimal distance to edges
569 *
570 * \note Finding only edges with have smaller distance than distance
571 * set on the input by min_dist_ptr
572 *
573 * @param v_ptr point coordinates
574 * @param nb nb points
575 * @param edges range of edges
576 * @param min_dist_ptr on return minimal distance, on input starting
577 * distance
578 * @param o_ptr coordinates of the point on edge
579 * @param o_segments closest segments
580 * @return MoFEMErrorCode
581 */
583 findMinDistanceFromTheEdges(const double *v_ptr, const int nb, Range edges,
584 double *min_dist_ptr, double *o_ptr = nullptr,
585 EntityHandle *o_segments = nullptr) const;
586
587 /** \name Debugging */
588
589 /**@{*/
590
591 /** \brief Print all DOFs for which element of vector is not a number
592 *
593 */
595 const RowColData row_or_col, Vec v);
596
597 /**@}*/
598
599 static MoFEMErrorCode
601 const int edge1);
602
603 static MoFEMErrorCode
605 const int edge1, const int edge2);
606};
607
608double Tools::shapeFunMBEDGE0(const double x) {
609 return N_MBEDGE0(x);
610}
611
612double Tools::shapeFunMBEDGE1(const double x) {
613 return N_MBEDGE1(x);
614}
615
616template <int LDB>
617MoFEMErrorCode Tools::shapeFunMBEDGE(double *shape, const double *ksi,
618 const int nb) {
620 for (int n = 0; n != nb; ++n) {
621 shape[0] = shapeFunMBEDGE0(*ksi);
622 shape[1] = shapeFunMBEDGE1(*ksi);
623 shape += 2;
624 ksi += LDB;
625 }
627}
628
629double Tools::shapeFunMBTRI0(const double x, const double y) {
630 return N_MBTRI0(x, y);
631}
632
633double Tools::shapeFunMBTRI1(const double x, const double y) {
634 return N_MBTRI1(x, y);
635}
636
637double Tools::shapeFunMBTRI2(const double x, const double y) {
638 return N_MBTRI2(x, y);
639}
640
641template <int LDB>
642MoFEMErrorCode Tools::shapeFunMBTRI(double *shape, const double *ksi,
643 const double *eta, const int nb) {
645 for (int n = 0; n != nb; ++n) {
646 shape[0] = shapeFunMBTRI0(*ksi, *eta);
647 shape[1] = shapeFunMBTRI1(*ksi, *eta);
648 shape[2] = shapeFunMBTRI2(*ksi, *eta);
649 shape += 3;
650 ksi += LDB;
651 eta += LDB;
652 }
654}
655
656double Tools::shapeFunMBTET0(const double x, const double y, const double z) {
657 return N_MBTET0(x, y, z);
658}
659
660double Tools::shapeFunMBTET1(const double x, const double y, const double z) {
661 return N_MBTET1(x, y, z);
662}
663
664double Tools::shapeFunMBTET2(const double x, const double y, const double z) {
665 return N_MBTET2(x, y, z);
666}
667
668double Tools::shapeFunMBTET3(const double x, const double y, const double z) {
669 return N_MBTET3(x, y, z);
670};
671
672template <int LDB>
673MoFEMErrorCode Tools::shapeFunMBTET(double *shape, const double *ksi,
674 const double *eta, const double *zeta,
675 const double nb) {
677 for (int n = 0; n != nb; ++n) {
678 shape[0] = shapeFunMBTET0(*ksi, *eta, *zeta);
679 shape[1] = shapeFunMBTET1(*ksi, *eta, *zeta);
680 shape[2] = shapeFunMBTET2(*ksi, *eta, *zeta);
681 shape[3] = shapeFunMBTET3(*ksi, *eta, *zeta);
682 shape += 4;
683 ksi += LDB;
684 eta += LDB;
685 zeta += LDB;
686 }
688}
689
690} // namespace MoFEM
691
692#endif // __TOOLS_HPP__a
693
694/**
695 * \defgroup mofem_tools Tools interface
696 * \brief Interface for tools
697 *
698 * \ingroup mofem
699 */
RowColData
RowColData.
Definition: definitions.h:123
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
#define diffN_MBTET0z
derivative of tetrahedral shape function
Definition: fem_tools.h:34
#define N_MBTET0(x, y, z)
tetrahedral shape function
Definition: fem_tools.h:28
#define diffN_MBTRI2x
derivative of triangle shape function
Definition: fem_tools.h:53
#define diffN_MBHEX3z(x, y)
Definition: fem_tools.h:98
#define diffN_MBHEX7z(x, y)
Definition: fem_tools.h:102
#define N_MBTET1(x, y, z)
tetrahedral shape function
Definition: fem_tools.h:29
#define diffN_MBQUAD2y(x)
Definition: fem_tools.h:66
#define diffN_MBTRI0y
derivative of triangle shape function
Definition: fem_tools.h:50
#define diffN_MBTRI1y
derivative of triangle shape function
Definition: fem_tools.h:52
#define diffN_MBQUAD1x(y)
Definition: fem_tools.h:63
#define diffN_MBHEX7y(x, z)
Definition: fem_tools.h:94
#define N_MBTRI1(x, y)
triangle shape function
Definition: fem_tools.h:47
#define diffN_MBHEX6x(y, z)
Definition: fem_tools.h:85
#define diffN_MBEDGE0
derivative of edge shape function
Definition: fem_tools.h:107
#define diffN_MBQUAD0x(y)
Definition: fem_tools.h:61
#define diffN_MBTET2z
derivative of tetrahedral shape function
Definition: fem_tools.h:40
#define diffN_MBEDGE1
derivative of edge shape function
Definition: fem_tools.h:108
#define diffN_MBQUAD1y(x)
Definition: fem_tools.h:64
#define diffN_MBQUAD3y(x)
Definition: fem_tools.h:68
#define diffN_MBHEX1y(x, z)
Definition: fem_tools.h:88
#define diffN_MBHEX3y(x, z)
Definition: fem_tools.h:90
#define N_MBEDGE0(x)
edge shape function
Definition: fem_tools.h:105
#define diffN_MBTET3y
derivative of tetrahedral shape function
Definition: fem_tools.h:42
#define diffN_MBTET0y
derivative of tetrahedral shape function
Definition: fem_tools.h:33
#define diffN_MBHEX4y(x, z)
Definition: fem_tools.h:91
#define diffN_MBHEX5x(y, z)
Definition: fem_tools.h:84
#define diffN_MBTET1z
derivative of tetrahedral shape function
Definition: fem_tools.h:37
#define diffN_MBHEX1z(x, y)
Definition: fem_tools.h:96
#define diffN_MBTET3z
derivative of tetrahedral shape function
Definition: fem_tools.h:43
#define diffN_MBHEX4z(x, y)
Definition: fem_tools.h:99
#define diffN_MBHEX6y(x, z)
Definition: fem_tools.h:93
#define diffN_MBHEX6z(x, y)
Definition: fem_tools.h:101
#define diffN_MBHEX5z(x, y)
Definition: fem_tools.h:100
#define diffN_MBQUAD0y(x)
Definition: fem_tools.h:62
#define diffN_MBTET1y
derivative of tetrahedral shape function
Definition: fem_tools.h:36
#define diffN_MBHEX0x(y, z)
Definition: fem_tools.h:79
#define diffN_MBHEX1x(y, z)
Definition: fem_tools.h:80
#define diffN_MBTRI0x
derivative of triangle shape function
Definition: fem_tools.h:49
#define diffN_MBHEX2z(x, y)
Definition: fem_tools.h:97
#define diffN_MBHEX5y(x, z)
Definition: fem_tools.h:92
#define diffN_MBHEX4x(y, z)
Definition: fem_tools.h:83
#define diffN_MBTET2y
derivative of tetrahedral shape function
Definition: fem_tools.h:39
#define diffN_MBTET2x
derivative of tetrahedral shape function
Definition: fem_tools.h:38
#define N_MBTRI0(x, y)
triangle shape function
Definition: fem_tools.h:46
#define diffN_MBTRI2y
derivative of triangle shape function
Definition: fem_tools.h:54
#define diffN_MBHEX3x(y, z)
Definition: fem_tools.h:82
#define diffN_MBQUAD3x(y)
Definition: fem_tools.h:67
#define diffN_MBQUAD2x(y)
Definition: fem_tools.h:65
#define diffN_MBHEX2y(x, z)
Definition: fem_tools.h:89
#define N_MBTRI2(x, y)
triangle shape function
Definition: fem_tools.h:48
#define diffN_MBHEX0y(x, z)
Definition: fem_tools.h:87
#define diffN_MBHEX0z(x, y)
Definition: fem_tools.h:95
#define N_MBTET2(x, y, z)
tetrahedral shape function
Definition: fem_tools.h:30
#define N_MBEDGE1(x)
edge shape function
Definition: fem_tools.h:106
#define diffN_MBTRI1x
derivative of triangle shape function
Definition: fem_tools.h:51
#define diffN_MBTET3x
derivative of tetrahedral shape function
Definition: fem_tools.h:41
#define diffN_MBHEX2x(y, z)
Definition: fem_tools.h:81
#define diffN_MBTET1x
derivative of tetrahedral shape function
Definition: fem_tools.h:35
#define diffN_MBTET0x
derivative of tetrahedral shape function
Definition: fem_tools.h:32
#define diffN_MBHEX7x(y, z)
Definition: fem_tools.h:86
#define N_MBTET3(x, y, z)
tetrahedral shape function
Definition: fem_tools.h:31
FTensor::Index< 'n', SPACE_DIM > n
static const double edge_coords[6][6]
double eta
const double v
phase velocity of light in medium (cm/ns)
double tol
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
double zeta
Viscous hardening.
Definition: plastic.cpp:170
Core (interface) class.
Definition: Core.hpp:82
keeps basic data about problem
Auxiliary tools.
Definition: Tools.hpp:19
static constexpr double shapeFunMBEDGE1At00
Definition: Tools.hpp:56
static constexpr double diffShapeFunMBTET0y
derivative of tetrahedral shape function
Definition: Tools.hpp:248
static SEGMENT_MIN_DISTANCE minDistanceFromSegments(const double *w_ptr, const double *v_ptr, const double *k_ptr, const double *l_ptr, double *const tvw_ptr=nullptr, double *const tlk_ptr=nullptr)
Find points on two segments in closest distance.
Definition: Tools.cpp:436
static constexpr double diffShapeFunMBHEXAtCenter6y
derivative of quad shape function
Definition: Tools.hpp:201
static constexpr double shapeFunMBTET1At000
Definition: Tools.hpp:294
static MoFEMErrorCode getLocalCoordinatesOnReferenceFourNodeTet(const double *elem_coords, const double *glob_coords, const int nb_nodes, double *local_coords)
Get the Local Coordinates On Reference Four Node Tet object.
Definition: Tools.cpp:90
static constexpr double shapeFunMBTET0At000
Definition: Tools.hpp:293
static constexpr double diffShapeFunMBHEXAtCenter0y
derivative of HEX shape function
Definition: Tools.hpp:165
static double shapeFunMBTET0(const double x, const double y, const double z)
Definition: Tools.hpp:656
static MoFEMErrorCode outerProductOfEdgeIntegrationPtsForQuad(MatrixDouble &pts, const int edge0, const int edge1)
Definition: Tools.cpp:577
static constexpr double diffShapeFunMBTRI1x
derivative of triangle shape function
Definition: Tools.hpp:95
static constexpr double diffShapeFunMBQUADAtCenter0x
derivative of quad shape function
Definition: Tools.hpp:146
static constexpr double diffShapeFunMBQUADAtCenter2y
derivative of quad shape function
Definition: Tools.hpp:156
static SEGMENT_MIN_DISTANCE minDistancePointFromOnSegment(const double *w_ptr, const double *v_ptr, const double *p_ptr, double *const t_ptr=nullptr)
Find closet point on the segment from the point.
Definition: Tools.cpp:413
static constexpr double shapeFunMBTRI1At00
Definition: Tools.hpp:113
static double shapeFunMBTET3(const double x, const double y, const double z)
Definition: Tools.hpp:668
static constexpr double diffShapeFunMBTET0z
derivative of tetrahedral shape function
Definition: Tools.hpp:250
static constexpr double diffShapeFunMBHEXAtCenter1x
derivative of HEX shape function
Definition: Tools.hpp:169
static constexpr double shapeFunMBTRI0At00
Definition: Tools.hpp:112
static constexpr double diffShapeFunMBTET3y
derivative of tetrahedral shape function
Definition: Tools.hpp:266
static constexpr std::array< double, 8 > diffShapeFunMBQUADAtCenter
Definition: Tools.hpp:212
MoFEMErrorCode findMinDistanceFromTheEdges(const double *v_ptr, const int nb, Range edges, double *min_dist_ptr, double *o_ptr=nullptr, EntityHandle *o_segments=nullptr) const
Find minimal distance to edges.
Definition: Tools.cpp:502
static constexpr double diffShapeFunMBTET1z
derivative of tetrahedral shape function
Definition: Tools.hpp:256
static double shapeFunMBTRI1(const double x, const double y)
Definition: Tools.hpp:633
static constexpr double diffShapeFunMBQUADAtCenter2x
derivative of quad shape function
Definition: Tools.hpp:154
static constexpr std::array< double, 6 > diffShapeFunMBTRI
Definition: Tools.hpp:104
static constexpr double diffShapeFunMBHEXAtCenter3z
derivative of quad shape function
Definition: Tools.hpp:185
static constexpr double diffShapeFunMBHEXAtCenter7y
derivative of quad shape function
Definition: Tools.hpp:207
static constexpr double diffShapeFunMBHEXAtCenter4y
derivative of quad shape function
Definition: Tools.hpp:189
static constexpr double diffShapeFunMBTRI0x
derivative of triangle shape function
Definition: Tools.hpp:91
static double shapeFunMBTET1(const double x, const double y, const double z)
Definition: Tools.hpp:660
static double shapeFunMBEDGE1(const double x)
Definition: Tools.hpp:612
SEGMENT_MIN_DISTANCE
Definition: Tools.hpp:507
@ SOLUTION_EXIST
Definition: Tools.hpp:508
@ SEGMENT_TWO_AND_TWO_ARE_POINT
Definition: Tools.hpp:511
@ SEGMENT_ONE_IS_POINT
Definition: Tools.hpp:509
@ SEGMENT_TWO_IS_POINT
Definition: Tools.hpp:510
static MoFEMErrorCode getLocalCoordinatesOnReferenceTriNodeTri(const double *elem_coords, const double *glob_coords, const int nb_nodes, double *local_coords)
Get the Local Coordinates On Reference Four Node Tet object.
Definition: Tools.cpp:142
MoFEMErrorCode checkVectorForNotANumber(const Problem *prb_ptr, const RowColData row_or_col, Vec v)
Print all DOFs for which element of vector is not a number.
Definition: Tools.cpp:304
static constexpr std::array< double, 2 > shapeFunMBEDGEAt00
Array of shape function at zero local point on reference element.
Definition: Tools.hpp:62
static constexpr double shapeFunMBEDGE0At00
Definition: Tools.hpp:55
static constexpr double diffShapeFunMBHEXAtCenter0z
derivative of HEX shape function
Definition: Tools.hpp:167
static constexpr double diffShapeFunMBHEXAtCenter1y
derivative of HEX shape function
Definition: Tools.hpp:171
static constexpr double diffShapeFunMBTET2z
derivative of tetrahedral shape function
Definition: Tools.hpp:262
static constexpr double diffShapeFunMBTET3x
derivative of tetrahedral shape function
Definition: Tools.hpp:264
MoFEMErrorCode minTetsQuality(const Range &tets, double &min_quality, Tag th=nullptr, boost::function< double(double, double)> f=[](double a, double b) -> double { return std::min(a, b);})
calculate minimal quality of tetrahedra in range
Definition: Tools.cpp:51
static constexpr double diffShapeFunMBHEXAtCenter5y
derivative of quad shape function
Definition: Tools.hpp:195
static double shapeFunMBTRI0(const double x, const double y)
Definition: Tools.hpp:629
static constexpr double shapeFunMBTET1AtOneThird
Definition: Tools.hpp:300
Tools(const MoFEM::Core &core)
Definition: Tools.hpp:25
static constexpr double diffShapeFunMBTET0x
derivative of tetrahedral shape function
Definition: Tools.hpp:246
static double shapeFunMBTET2(const double x, const double y, const double z)
Definition: Tools.hpp:664
static constexpr double diffShapeFunMBHEXAtCenter2y
derivative of HEX shape function
Definition: Tools.hpp:177
static constexpr double diffShapeFunMBHEXAtCenter3x
derivative of HEX shape function
Definition: Tools.hpp:181
MoFEMErrorCode writeTetsWithQuality(const char *file_name, const char *file_type, const char *options, const Range &tets, Tag th=nullptr, boost::function< bool(double)> f=[](double q) -> bool { if(q<=0) return true;else return false;})
Write file with tetrahedral of given quality.
Definition: Tools.cpp:266
static constexpr double shapeFunMBTET2AtOneThird
Definition: Tools.hpp:302
MoFEMErrorCode getTetsWithQuality(Range &out_tets, const Range &tets, Tag th=nullptr, boost::function< bool(double)> f=[](double q) -> bool { if(q<=0) return true;else return false;})
Get the Tets With Quality.
Definition: Tools.cpp:241
static constexpr double diffShapeFunMBQUADAtCenter3y
derivative of quad shape function
Definition: Tools.hpp:160
static constexpr double diffShapeFunMBQUADAtCenter1y
derivative of quad shape function
Definition: Tools.hpp:152
static MoFEMErrorCode outerProductOfEdgeIntegrationPtsForHex(MatrixDouble &pts, const int edge0, const int edge1, const int edge2)
Definition: Tools.cpp:626
static constexpr double shapeFunMBTRI2At00
Definition: Tools.hpp:114
static constexpr std::array< double, 24 > diffShapeFunMBHEXAtCenter
Definition: Tools.hpp:218
static constexpr double shapeFunMBTET3At000
Definition: Tools.hpp:296
static constexpr std::array< double, 4 > shapeFunMBTETAt000
Array of shape function at zero local point on reference element.
Definition: Tools.hpp:330
static constexpr double diffShapeFunMBHEXAtCenter0x
derivative of HEX shape function
Definition: Tools.hpp:163
static constexpr double diffShapeFunMBQUADAtCenter3x
derivative of quad shape function
Definition: Tools.hpp:158
static double shapeFunMBEDGE0(const double x)
Definition: Tools.hpp:608
static constexpr double diffN_MBEDGE0x
Definition: Tools.hpp:65
static constexpr double diffN_MBEDGE1x
Definition: Tools.hpp:66
static constexpr double diffShapeFunMBHEXAtCenter3y
derivative of quad shape function
Definition: Tools.hpp:183
static constexpr double diffShapeFunMBTRI2x
derivative of triangle shape function
Definition: Tools.hpp:99
static constexpr double diffShapeFunMBHEXAtCenter2x
derivative of HEX shape function
Definition: Tools.hpp:175
static MoFEMErrorCode checkIfPointIsInTet(const double tet_coords[], const double global_coord[], const double tol, bool &result)
Check of point is in tetrahedral.
Definition: Tools.cpp:284
static MoFEMErrorCode getLocalCoordinatesOnReferenceEdgeNodeEdge(const double *elem_coords, const double *glob_coords, const int nb_nodes, double *local_coords)
Get the Local Coordinates On Reference Four Node Tet object.
Definition: Tools.cpp:200
static constexpr double diffShapeFunMBHEXAtCenter7z
derivative of quad shape function
Definition: Tools.hpp:209
static MoFEMErrorCode shapeFunMBTET(double *shape, const double *ksi, const double *eta, const double *zeta, const double nb)
Calculate shape functions on tetrahedron.
Definition: Tools.hpp:673
static constexpr std::array< double, 2 > diffShapeFunMBEDGE
Definition: Tools.hpp:68
static constexpr double diffShapeFunMBTET1y
derivative of tetrahedral shape function
Definition: Tools.hpp:254
static MoFEMErrorCode shapeFunMBEDGE(double *shape, const double *ksi, const int nb)
Calculate shape functions on edge.
Definition: Tools.hpp:617
static double tetVolume(const double *coords)
Calculate volume of tetrahedron.
Definition: Tools.cpp:32
static constexpr double diffShapeFunMBTRI2y
derivative of triangle shape function
Definition: Tools.hpp:101
static double volumeLengthQuality(const double *coords)
Calculate tetrahedron volume length quality.
Definition: Tools.cpp:17
double getTriArea(const EntityHandle tri) const
Get triangle area.
Definition: Tools.cpp:375
static constexpr std::array< double, 3 > shapeFunMBTRIAt00
Array of shape function at zero local point on reference element.
Definition: Tools.hpp:120
static constexpr double diffShapeFunMBHEXAtCenter7x
derivative of HEX shape function
Definition: Tools.hpp:205
static constexpr double diffShapeFunMBTRI0y
derivative of triangle shape function
Definition: Tools.hpp:93
static constexpr double shapeFunMBTET3AtOneThird
Definition: Tools.hpp:304
static constexpr double diffShapeFunMBTET3z
derivative of tetrahedral shape function
Definition: Tools.hpp:268
static constexpr double diffShapeFunMBTET1x
derivative of tetrahedral shape function
Definition: Tools.hpp:252
static constexpr double diffShapeFunMBHEXAtCenter6x
derivative of HEX shape function
Definition: Tools.hpp:199
static constexpr double diffShapeFunMBHEXAtCenter4x
derivative of HEX shape function
Definition: Tools.hpp:187
static constexpr double shapeFunMBTET2At000
Definition: Tools.hpp:295
static constexpr double diffShapeFunMBHEXAtCenter5z
derivative of quad shape function
Definition: Tools.hpp:197
static constexpr double shapeFunMBTET0AtOneThird
Definition: Tools.hpp:298
static double shapeFunMBTRI2(const double x, const double y)
Definition: Tools.hpp:637
static constexpr double diffShapeFunMBHEXAtCenter2z
derivative of HEX shape function
Definition: Tools.hpp:179
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Definition: Tools.cpp:11
static constexpr double diffShapeFunMBHEXAtCenter4z
derivative of quad shape function
Definition: Tools.hpp:191
static constexpr std::array< double, 12 > diffShapeFunMBTET
Definition: Tools.hpp:271
static constexpr double diffShapeFunMBTET2x
derivative of tetrahedral shape function
Definition: Tools.hpp:258
static double getEdgeLength(const double *edge_coords)
Get edge length.
Definition: Tools.cpp:382
MoFEM::Core & cOre
Definition: Tools.hpp:24
static constexpr double diffShapeFunMBQUADAtCenter1x
derivative of quad shape function
Definition: Tools.hpp:150
static constexpr double diffShapeFunMBHEXAtCenter6z
derivative of quad shape function
Definition: Tools.hpp:203
static constexpr std::array< double, 4 > shapeFunMBTETAtOneThird
Array of shape function at center on reference element.
Definition: Tools.hpp:338
static MoFEMErrorCode getTriNormal(const double *coords, double *normal)
Get the Tri Normal objectGet triangle normal.
Definition: Tools.cpp:350
static constexpr double diffShapeFunMBHEXAtCenter1z
derivative of HEX shape function
Definition: Tools.hpp:173
static MoFEMErrorCode shapeFunMBTRI(double *shape, const double *ksi, const double *eta, const int nb)
Calculate shape functions on triangle.
Definition: Tools.hpp:642
static constexpr double diffShapeFunMBTET2y
derivative of tetrahedral shape function
Definition: Tools.hpp:260
static constexpr double diffShapeFunMBHEXAtCenter5x
derivative of HEX shape function
Definition: Tools.hpp:193
static constexpr double diffShapeFunMBTRI1y
derivative of triangle shape function
Definition: Tools.hpp:97
static constexpr double diffShapeFunMBQUADAtCenter0y
derivative of quad shape function
Definition: Tools.hpp:148
base class for all interface classes