v0.9.0
definitions.h
Go to the documentation of this file.
1 /** \file definitions.h
2  * \brief useful compiler directives and definitions
3  */
4 
5 /* MoFEM is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License as published by the
7  * Free Software Foundation, either version 3 of the License, or (at your
8  * option) any later version.
9  *
10  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13  * License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
17  */
18 
19 #ifndef __DEFINITONS_H__
20 #define __DEFINITONS_H__
21 
22 // taken from http://stackoverflow.com/questions/295120/c-mark-as-deprecated
23 #ifdef __GNUC__
24 #define DEPRECATED __attribute__((deprecated))
25 #elif defined(_MSC_VER)
26 #define DEPRECATED __declspec(deprecated)
27 #else
28 #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
29 #define DEPRECATED
30 #endif
31 
32 /** \brief Interfaces IDs
33  *
34  * To manage different complexities related to field, finite elements mesh
35  * refinements, etc. a appropriate interfaces related to each complexities are
36  * created. Interfaces by itself could vary by functionality or the same
37  * function can me managed with two interfaces with waring level of abstraction.
38  *
39  */
40 enum Interfaces {
41  UNKNOWNINTERFACE = 1 << 0,
42  // Field Interface
43  CORE_INTERFACE = 1 << 0 | 1 << 1,
44  DEPRECATED_CORE_INTERFACE = 1 << 0 | 1 << 2,
45  PROBLEMSMANAGER_INTERFACE = 1 << 0 | 1 << 3,
46  MATRIX_MANAGER_INTERFACE = 1 << 0 | 1 << 4,
47  SIMPLE_INTERFACE = 1 << 0 | 1 << 5,
48  COMM_INTERFACE = 1 << 0 | 1 << 6,
49  MESH_REFINE = 1 << 1 | 1 << 2,
50  PRISM_INTEFACE = 1 << 1 | 1 << 3,
51  SERIES_RECORDER = 1 << 1 | 1 << 4,
52  ISMANAGER_INTERFACE = 1 << 1 | 1 << 5,
53  VECMANAGER_INTERFACE = 1 << 1 | 1 << 6,
54  FIELDBLAS_INTERFACE = 1 << 1 | 1 << 7,
55  BITREFMANAGER_INTERFACE = 1 << 1 | 1 << 8,
56  TOOLS = 1 << 1 | 1 << 10,
57  // Independent Interfaces
58  TETGEN_INTERFACE = 1 << 2 | 1 << 3,
59  MED_INTERFACE = 1 << 2 | 1 << 4,
60  NODEMERGER_INTERFACE = 1 << 2 | 1 << 5,
61  BITLEVELCOUPLER_INTERFACE = 1 << 2 | 1 << 6,
62  PRISMSFROMSURFACE_INTERFACE = 1 << 2 | 1 << 7,
63  MESHSETSMANAGER_INTERFACE = 1 << 2 | 1 << 8,
64  COORDSSYSTEMMANAGER_INTERFACE = 1 << 2 | 1 << 9,
65  CUTMESH_INTERFACE = 1 << 2 | 1 << 10,
66  FIELDEVALUATOR_INTERFACE = 1 << 2 | 1 << 11
67 };
68 
70  // Loop Methods
71  KSP_METHOD = 1 << 3 | 1 << 4,
72  SNES_METHOD = 1 << 3 | 1 << 5,
73  TS_METHOD = 1 << 3 | 1 << 6,
74  BASIC_METHOD = 1 << 3 | 1 << 4 | 1 << 5 | 1 << 6,
75  FE_METHOD = 1 << 3 | 1 << 4 | 1 << 5 | 1 << 6 | 1 << 7,
76  ENTITY_METHOD = 1 << 3 | 1 << 4 | 1 << 5 | 1 << 6 | 1 << 9,
77  DOF_METHOD = 1 << 3 | 1 << 4 | 1 << 5 | 1 << 6 | 1 << 9,
78 };
79 
80 /**
81  * \brief interfaces for PETSc DM interfaces
82  */
84  UNKNOWN_DM_INTERFACE = 1 << 4 | 1 << 5,
85  DMCTX_INTERFACE = 1 << 4 | 1 << 6
86 };
87 
88 /**
89  * \brief Interfaces uses to manage base functions
90  */
95  KERNEL_BASE_FUNCTION_INTERFACE = 1 << 5 | 1 << 9,
96  JACOBI_BASE_FUNCTION_INTERFACE = 1 << 5 | 1 << 10,
98  ENT_BASE_FUNCTION_INTERFACE = 1 << 5 | 1 << 6 | 1 << 7,
99  TET_BASE_FUNCTION_INTERFACE = 1 << 5 | 1 << 6 | 1 << 8,
100  TRI_BASE_FUNCTION_INTERFACE = 1 << 5 | 1 << 6 | 1 << 9,
101  EDGE_BASE_FUNCTION_INTERFACE = 1 << 5 | 1 << 6 | 1 << 10,
102  FATPRISM_BASE_FUNCTION_INTERFACE = 1 << 5 | 1 << 6 | 1 << 11,
103  FLATPRISM_BASE_FUNCTION_INTERFACE = 1 << 5 | 1 << 6 | 1 << 12,
104  QUAD_BASE_FUNCTION_INTERFACE = 1 << 5 | 1 << 6 | 1 << 13
105 };
106 
107 /** \brief Error handling
108  *
109  * This is complementary to PETSC error codes. The numerical values for
110  * these are defined in include/petscerror.h. The names are defined in err.c
111  *
112  * MoAB error messages are defined in moab/Types.hpp
113  *
114  */
128 };
129 
130 const static char *const MoFEMErrorCodesNames[] = {
131  "MOFEM_SUCCESS",
132  "MOFEM_DATA_INCONSISTENCY",
133  "MOFEM_NOT_IMPLEMENTED",
134  "MOFEM_NOT_FOUND",
135  "MOFEM_OPERATION_UNSUCCESSFUL",
136  "MOFEM_IMPOSIBLE_CASE",
137  "MOFEM_INVALID_DATA",
138  "MOFEM_MOFEMEXCEPTION_THROW",
139  "MOFEM_STD_EXCEPTION_THROW",
140  "MOFEM_ATOM_TEST_INVALID",
141  "MOFEM_MOAB_ERROR"};
142 
143 /// \brief approximation base
145  NOBASE = 0,
147  1, ///< Ainsworth Cole (Legendre) approx. base \cite NME:NME847
148  AINSWORTH_LOBATTO_BASE, ///< Like AINSWORTH_LEGENDRE_BASE but with Lobatto
149  ///< base instead Legendre \cite beriot2015efficient
150  AINSWORTH_BERNSTEIN_BEZIER_BASE, ///< See \cite ainsworth2011bernstein and
151  ///< \cite ainsworth2018bernstein
152  DEMKOWICZ_JACOBI_BASE, ///< Construction of base is by Demkowicz \cite
153  ///< fuentes2015orientation
154  USER_BASE, ///< user implemented approximation base
156 };
157 
158 const static char *const ApproximationBaseNames[] = {
159  "NOBASE",
160  "AINSWORTH_LEGENDRE_BASE",
161  "AINSWORTH_LOBATTO_BASE",
162  "AINSWORTH_BERNSTEIN_BEZIER_BASE",
163  "DEMKOWICZ_JACOBI_BASE",
164  "USER_BASE",
165  "LASTBASE"};
166 
167 /// \brief approximation spaces
169  NOSPACE = 0,
170  NOFIELD = 1, ///< scalar or vector of scalars describe (no true field)
171  H1, ///< continuous field
172  HCURL, ///< field with continuous tangents
173  HDIV, ///< field with continuous normal traction
174  L2, ///< field with C-1 continuity
175  LASTSPACE ///< FieldSpace in [ 0, LASTSPACE )
176 };
177 
178 const static char *const FieldSpaceNames[] = {
179  "NOSPACE", "NOFIELD", "H1", "HCURL", "HDIV", "L2", "LASTSPACE"};
180 
181 /// \brief Those types control how functions respond on arguments, f.e. error
182 /// handling
183 enum MoFEMTypes { MF_ZERO = 0, MF_EXCL = 1 << 0, MF_EXIST = 1 << 1 };
184 
185 /// \brief RowColData
187 
188 /**
189  * Controls adjency multi_index container (e.g. BYROW is adjacenciecy by field
190  * on on rows), see \ref MoFEM::FieldEntityEntFiniteElementAdjacencyMap
191  *
192  */
193 enum ByWhat {
194  BYROW = 1 << 0,
195  BYCOL = 1 << 1,
196  BYDATA = 1 << 2,
197  BYROWDATA = 1 << 0 | 1 << 2,
198  BYCOLDATA = 1 << 1 | 1 << 2,
199  BYROWCOL = 1 << 0 | 1 << 1,
200  BYALL = 1 << 0 | 1 << 1 | 1 << 2
201 };
202 
203 /**
204  * \brief Types of sets and boundary conditions
205  *
206  */
207 enum CubitBC {
209  NODESET = 1 << 0,
210  SIDESET = 1 << 1,
211  BLOCKSET = 1 << 2,
212  MATERIALSET = 1 << 3,
213  DISPLACEMENTSET = 1 << 4,
214  FORCESET = 1 << 5,
215  PRESSURESET = 1 << 6,
216  VELOCITYSET = 1 << 7,
217  ACCELERATIONSET = 1 << 8,
218  TEMPERATURESET = 1 << 9,
219  HEATFLUXSET = 1 << 10,
220  INTERFACESET = 1 << 11,
221  UNKNOWNNAME = 1 << 12,
222  MAT_ELASTICSET = 1 << 13, ///< block name is "MAT_ELASTIC"
223  MAT_INTERFSET = 1 << 14,
224  MAT_THERMALSET = 1 << 15, ///< block name is "MAT_THERMAL"
225  BODYFORCESSET = 1 << 16, ///< block name is "BODY_FORCES"
226  MAT_MOISTURESET = 1 << 17, ///< block name is "MAT_MOISTURE"
227  DIRICHLET_BC = 1 << 18,
228  NEUMANN_BC = 1 << 19,
229  LASTSET_BC = 1 << 20
230 };
231 
232 // OFF_DEPRECATED static const unsigned int UNKNOWNCUBITNAME = UNKNOWNNAME;
233 // OFF_DEPRECATED static const unsigned int LASTCUBITSET = LASTSET_BC;
234 
235 /**
236  * \brief Names of types of sets and boundary conditions
237  */
238 const static char *const CubitBCNames[] = {
239  "UNKNOWNSET", "NODESET", "SIDESET", "BLOCKSET",
240  "MATERIALSET", "DISPLACEMENTSET", "FORCESET", "PRESSURESET",
241  "VELOCITYSET", "ACCELERATIONSET", "TEMPERATURESET", "HEATFLUXSET",
242  "INTERFACESET", "UNKNOWNNAME", "MAT_ELASTICSET", "MAT_INTERFSET",
243  "MAT_THERMALSET", "BODYFORCESSET", "MAT_MOISTURESET", "DIRICHLET_BC",
244  "NEUMANN_BC", "LASTSET_BC"};
245 
246 /**
247  * \brief Format in rows of vectorial base functions
248  */
250 
251 /**
252  * \brief Format in rows of vectorial base gradients of base functions
253  */
255  HVEC0_0 = 0,
264 };
265 
266 /**
267  * \brief Verbosity levels
268  */
271  QUIET = 0,
276 };
277 
278 #define BITREFEDGES_SIZE 6 ///< number of edges on tetrahedral
279 #define BITREFLEVEL_SIZE 128 ///< max number of refinements
280 #define BITFIELDID_SIZE 32 ///< max number of fields
281 #define BITFEID_SIZE 32 ///< max number of finite elements
282 #define BITPROBLEMID_SIZE 32 ///< max number of problems
283 #define BITINTERFACEUID_SIZE 32
284 
285 #define MYPCOMM_INDEX 0 ///< default communicator number PCOMM
286 
287 // This Is form MOAB
288 #define MB_TYPE_WIDTH 4
289 #define MB_ID_WIDTH (8 * sizeof(EntityHandle) - MB_TYPE_WIDTH)
290 #define MB_TYPE_MASK ((EntityHandle)0xF << MB_ID_WIDTH)
291 // 2^MB_TYPE_WIDTH-1 ------^
292 
293 #define MB_START_ID ((EntityID)1) ///< All entity id's currently start at 1
294 #define MB_END_ID \
295  ((EntityID)MB_ID_MASK) ///< Last id is the complement of the MASK
296 #define MB_ID_MASK (~MB_TYPE_MASK)
297 
298 #define MAX_DOFS_ON_ENTITY 512 ///< Maximal number of DOFs on entity
299 #define DOF_UID_MASK \
300  (MAX_DOFS_ON_ENTITY - 1) ///< Mask for DOF number on entity form UId
301 #define ENTITY_UID_MASK (~DOF_UID_MASK)
302 
303 #define NOT_USED(x) ((void)(x))
304 
305 /** \brief set barrier start
306  * Run code in sequence, starting from process 0, and ends on last process.
307  *
308  * It can be only used for testing. Do not use that function as a part of these
309  * code.
310  *
311  */
312 #define BARRIER_PCOMM_RANK_START(PCMB) \
313  { \
314  for (unsigned int i = 0; i < PCMB->proc_config().proc_rank(); i++) \
315  MPI_Barrier(PCMB->proc_config().proc_comm()); \
316  };
317 
318 /** \deprecated Do use this macro, instead use BARRIER_PCOMM_RANK_START
319  */
320 #define BARRIER_RANK_START(PCMB) \
321  { \
322  macro_is_deprecated_using_deprecated_function(); \
323  for (unsigned int i = 0; i < PCMB->proc_config().proc_rank(); i++) \
324  MPI_Barrier(PCMB->proc_config().proc_comm()); \
325  };
326 
327 /** \brief set barrier start
328  * Run code in sequence, starting from process 0, and ends on last process.
329  *
330  * It can be only used for testing. Do not use that function as a part of these
331  * code.
332  *
333  */
334 #define BARRIER_PCOMM_RANK_END(PCMB) \
335  { \
336  for (unsigned int i = PCMB->proc_config().proc_rank(); \
337  i < PCMB->proc_config().proc_size(); i++) \
338  MPI_Barrier(PCMB->proc_config().proc_comm()); \
339  };
340 
341 /** \deprecated Do use this macro, instead use BARRIER_PCOMM_RANK_START
342  */
343 #define BARRIER_RANK_END(PCMB) \
344  { \
345  macro_is_deprecated_using_deprecated_function(); \
346  for (unsigned int i = PCMB->proc_config().proc_rank(); \
347  i < PCMB->proc_config().proc_size(); i++) \
348  MPI_Barrier(PCMB->proc_config().proc_comm()); \
349  };
350 
351 /** \brief set barrier start
352  * Run code in sequence, starting from process 0, and ends on last process.
353  *
354  * It can be only used for testing. Do not use that function as a part of these
355  * code.
356  *
357  */
358 #define BARRIER_MOFEM_RANK_START(MOFEM) \
359  { \
360  for (int i = 0; i < (MOFEM)->get_comm_rank(); i++) \
361  MPI_Barrier((MOFEM)->get_comm()); \
362  };
363 
364 /** \brief set barrier start
365  * Run code in sequence, starting from process 0, and ends on last process.
366  *
367  * It can be only used for testing. Do not use that function as a part of these
368  * code.
369  *
370  */
371 #define BARRIER_MOFEM_RANK_END(MOFEM) \
372  { \
373  for (int i = (MOFEM)->get_comm_rank(); i < (MOFEM)->get_comm_size(); i++) \
374  MPI_Barrier((MOFEM)->get_comm()); \
375  };
376 
377 #ifdef __cplusplus
378 extern "C" {
379 #endif
380 
381 /**
382  * \brief Is used to indicate that macro is deprecated
383  * Do nothing just triggers error at the compilation
384  */
386 
387 #ifdef __cplusplus
388 }
389 #endif
390 
391 /**
392  * \brief First executable line of each MoFEM function, used for error handling.
393  Final line of MoFEM functions should be MoFEMFunctionReturn(0);
394 
395  \node Not collective
396 
397  Example
398  \code
399  PetscErrorCode fun() {
400  int something;
401  MoFEMFunctionBegin;
402  MoFEMFunctionReturn(0);
403  }
404  \endcode
405 
406  */
407 #define MoFEMFunctionBegin \
408  PetscFunctionBegin; \
409  try {
410 
411 /**
412  * @brief \brief Catch errors
413  *
414  * Usage in main functions
415  * \code
416  * int main(int argc, char *argv[]) {
417  *
418  * MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
419  *
420  * try {
421  *
422  * // More code here
423  *
424  * }
425  * CATCH_ERRORS;
426  *
427  * return MoFEM::Core::Finalize();
428  *
429  * }
430  * \endcode
431  *
432  */
433 #define CATCH_ERRORS \
434  catch (MoFEMExceptionInitial const &ex) { \
435  return PetscError(PETSC_COMM_SELF, ex.lINE, PETSC_FUNCTION_NAME, __FILE__, \
436  ex.errorCode, PETSC_ERROR_INITIAL, ex.what()); \
437  } \
438  catch (MoFEMExceptionRepeat const &ex) { \
439  return PetscError(PETSC_COMM_SELF, ex.lINE, PETSC_FUNCTION_NAME, __FILE__, \
440  ex.errorCode, PETSC_ERROR_REPEAT, " "); \
441  } \
442  catch (MoFEMException const &ex) { \
443  SETERRQ(PETSC_COMM_SELF, ex.errorCode, ex.errorMessage); \
444  } \
445  catch (boost::bad_weak_ptr & ex) { \
446  std::string message("Boost bad weak ptr: " + std::string(ex.what()) + \
447  " at " + boost::lexical_cast<std::string>(__LINE__) + \
448  " : " + std::string(__FILE__) + " in " + \
449  std::string(PETSC_FUNCTION_NAME)); \
450  SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, message.c_str()); \
451  } \
452  catch (std::out_of_range & ex) { \
453  std::string message("Std out of range error: " + std::string(ex.what()) + \
454  " at " + boost::lexical_cast<std::string>(__LINE__) + \
455  " : " + std::string(__FILE__) + " in " + \
456  std::string(PETSC_FUNCTION_NAME)); \
457  SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, message.c_str()); \
458  } \
459  catch (std::exception const &ex) { \
460  std::string message("Std error: " + std::string(ex.what()) + " at " + \
461  boost::lexical_cast<std::string>(__LINE__) + " : " + \
462  std::string(__FILE__) + " in " + \
463  std::string(PETSC_FUNCTION_NAME)); \
464  SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, message.c_str()); \
465  }
466 
467 /**
468  * \brief Last executable line of each PETSc function used for error handling.
469  * Replaces return()
470  * @param a error code
471  *
472  * \note MoFEMFunctionReturn has to be used with MoFEMFunctionBegin and can be
473  * used only at the end of the function. If is need to return function in
474  * earlier use MoFEMFunctionReturnHot
475  *
476  */
477 #define MoFEMFunctionReturn(a) \
478  } \
479  CATCH_ERRORS \
480  PetscFunctionReturn(a)
481 
482 /**
483  * \brief First executable line of each MoFEM function, used for error
484  handling. Final line of MoFEM functions should be MoFEMFunctionReturn(0); Use
485  of this function allows for lighter profiling by default.
486 
487  \node Not collective
488 
489  Example:
490  \code
491  PetscErrorCode fun() {
492  int something;
493  MoFEMFunctionBeginHot;
494 
495  // some work here
496 
497  MoFEMFunctionReturnHot(0);
498  }
499  \endcode
500 */
501 #define MoFEMFunctionBeginHot PetscFunctionBeginHot
502 
503 /**
504  * \brief Last executable line of each PETSc function used for error handling.
505  * Replaces return()
506  * @param a error code
507  */
508 #define MoFEMFunctionReturnHot(a) PetscFunctionReturn(a)
509 
510 #define CHKERRQ_PETSC(n) CHKERRQ(n)
511 /**
512  * \brief check error code of MoAB function
513  * @param a MoABErrorCode
514  */
515 #define CHKERRQ_MOAB(a) \
516  if (PetscUnlikely(MB_SUCCESS != (a))) { \
517  std::string error_str = (unsigned)(a) <= (unsigned)MB_FAILURE \
518  ? moab::ErrorCodeStr[a] \
519  : "INVALID ERROR CODE"; \
520  std::string str("MOAB error (" + boost::lexical_cast<std::string>((a)) + \
521  ") " + error_str + " at line " + \
522  boost::lexical_cast<std::string>(__LINE__) + " : " + \
523  std::string(__FILE__)); \
524  SETERRQ(PETSC_COMM_SELF, MOFEM_MOAB_ERROR, str.c_str()); \
525  }
526 
527 /**
528  * \brief Check error code of MoFEM/MOAB/PETSc function
529  * @param a MoFEMErrorCode
530  *
531  * \code
532  * MoFEMErrorCode fun() {
533  * MoFEMFunctionBeginHot;
534  * rval = fun_moab(); CHKERRG(rval);
535  * ierr = fun_petsc(); CHKERRG(ierr);
536  * merr = fun_mofem(); CHKERRG(merr);
537  * MoFEMFunctionReturnHot(0);
538  * \endcode
539  *
540  * \note Function detect type of errocode using specialized template function
541  * getErrorType, i.e. condition is evaluated at compilation time.
542  *
543  */
544 #define CHKERRG(n) \
545  if ((boost::is_same<BOOST_TYPEOF((n)), \
546  MoFEMErrorCodeGeneric<PetscErrorCode>>::value)) { \
547  CHKERRQ_PETSC((n)); \
548  } else if (boost::is_same<BOOST_TYPEOF((n)), \
549  MoFEMErrorCodeGeneric<moab::ErrorCode>>::value) { \
550  CHKERRQ_MOAB((n)); \
551  }
552 
553 /**
554  * @brief Inline error check
555  *
556  * \code
557  *
558  * MoFEMErrorCode foo() {
559  * MoFEMFunctionBegin;
560  *
561  * // Call other functions
562  * CHKERR fun_moab();
563  * CHKERR fun_petsc();
564  * CHKERR fun_mofem();
565  *
566  * // Throw error
567  * SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "Some error message");
568  *
569  * MoFEMFunctionReturn(0);
570  * }
571  *
572  * int main(int argc, char *argv[]) {
573  *
574  * // Initailise MoFEM and Petsc
575  * MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
576  *
577  * try {
578  *
579  * moab::Core mb_instance; // MoAB database
580  * moab::Interface &moab = mb_instance;
581  * MoFEM::Core core(moab); // MOFEM database
582  * MoFEM::CoreInterface &m_field = core;
583  *
584  * CHKERR foo(); // Call function
585  *
586  * }
587  * CATCH_ERRORS;
588  *
589  * return MoFEM::Core::Finalize();
590  *
591  * }
592  *
593  * \endcode
594  *
595  */
596 #define CHKERR MoFEM::ErrorCheckerCode<__LINE__>() <<
597 
598 /**
599  * \brief Check error code of MoAB function and throw MoFEM exception
600  * @param a MoABErrorCode
601  */
602 #define MOAB_THROW(a) \
603  { \
604  if (PetscUnlikely(MB_SUCCESS != (a))) { \
605  std::string error_str = (unsigned)(a) <= (unsigned)MB_FAILURE \
606  ? moab::ErrorCodeStr[a] \
607  : "INVALID ERROR CODE"; \
608  std::string str("MOAB error (" + boost::lexical_cast<std::string>((a)) + \
609  ") " + error_str + " at line " + \
610  boost::lexical_cast<std::string>(__LINE__) + " : " + \
611  std::string(__FILE__)); \
612  throw MoFEMException(MOFEM_MOAB_ERROR, str.c_str()); \
613  } \
614  }
615 
616 /**
617  * \brief Throw MoFEM exception
618  * @param a message
619  */
620 #define THROW_MESSAGE(a) \
621  { \
622  throw MoFEMException( \
623  MOFEM_MOFEMEXCEPTION_THROW, \
624  ("MoFEM error " + boost::lexical_cast<std::string>((a)) + \
625  " at line " + boost::lexical_cast<std::string>(__LINE__) + " : " + \
626  std::string(__FILE__)) \
627  .c_str()); \
628  }
629 
630 /**
631  * \brief Convert number to string
632  * @param x number
633  */
634 #define SSTR(x) toString(x)
635 
636 #define TENSOR1_VEC_PTR(VEC) &VEC[0], &VEC[1], &VEC[2]
637 
638 #define SYMMETRIC_TENSOR4_MAT_PTR(MAT) \
639  &MAT(0, 0), &MAT(0, 1), &MAT(0, 2), &MAT(0, 3), &MAT(0, 4), &MAT(0, 5), \
640  &MAT(1, 0), &MAT(1, 1), &MAT(1, 2), &MAT(1, 3), &MAT(1, 4), &MAT(1, 5), \
641  &MAT(2, 0), &MAT(2, 1), &MAT(2, 2), &MAT(2, 3), &MAT(2, 4), &MAT(2, 5), \
642  &MAT(3, 0), &MAT(3, 1), &MAT(3, 2), &MAT(3, 3), &MAT(3, 4), &MAT(3, 5), \
643  &MAT(4, 0), &MAT(4, 1), &MAT(4, 2), &MAT(4, 3), &MAT(4, 4), &MAT(4, 5), \
644  &MAT(5, 0), &MAT(5, 1), &MAT(5, 2), &MAT(5, 3), &MAT(5, 4), &MAT(5, 5)
645 
646 #define TENSOR4_MAT_PTR(MAT) &MAT(0, 0), MAT.size2()
647 
648 #define TENSOR2_MAT_PTR(MAT) \
649  &MAT(0, 0), &MAT(1, 0), &MAT(2, 0), &MAT(3, 0), &MAT(4, 0), &MAT(5, 0), \
650  &MAT(6, 0), &MAT(7, 0), &MAT(8, 0)
651 
652 #define SYMMETRIC_TENSOR2_MAT_PTR(MAT) \
653  &MAT(0, 0), &MAT(0, 1), &MAT(0, 2), &MAT(0, 3), &MAT(0, 4), &MAT(0, 5)
654 
655 #define SYMMETRIC_TENSOR2_VEC_PTR(VEC) \
656  &VEC[0], &VEC[1], &VEC[2], &VEC[3], &VEC[4], &VEC[5]
657 
658 #endif //__DEFINITONS_H__
field with continuous normal traction
Definition: definitions.h:173
user implemented approximation base
Definition: definitions.h:154
block name is "MAT_MOISTURE"
Definition: definitions.h:226
HVecFormatting
Format in rows of vectorial base functions.
Definition: definitions.h:249
scalar or vector of scalars describe (no true field)
Definition: definitions.h:170
static const char *const MoFEMErrorCodesNames[]
Definition: definitions.h:130
RowColData
RowColData.
Definition: definitions.h:186
DMInterfaces
interfaces for PETSc DM interfaces
Definition: definitions.h:83
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:175
static const char *const ApproximationBaseNames[]
Definition: definitions.h:158
Interfaces
Interfaces IDs.
Definition: definitions.h:40
HVecDiffFormatting
Format in rows of vectorial base gradients of base functions.
Definition: definitions.h:254
FieldApproximationBase
approximation base
Definition: definitions.h:144
VERBOSITY_LEVELS
Verbosity levels.
Definition: definitions.h:269
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:146
block name is "MAT_THERMAL"
Definition: definitions.h:224
ByWhat
Definition: definitions.h:193
block name is "BODY_FORCES"
Definition: definitions.h:225
static const char *const FieldSpaceNames[]
Definition: definitions.h:178
field with continuous tangents
Definition: definitions.h:172
BaseIntefaces
Interfaces uses to manage base functions.
Definition: definitions.h:91
CubitBC
Types of sets and boundary conditions.
Definition: definitions.h:207
FieldSpace
approximation spaces
Definition: definitions.h:168
block name is "MAT_ELASTIC"
Definition: definitions.h:222
#define DEPRECATED
Definition: definitions.h:29
LoopInterfaces
Definition: definitions.h:69
DEPRECATED void macro_is_deprecated_using_deprecated_function()
Is used to indicate that macro is deprecated Do nothing just triggers error at the compilation.
Definition: Core.cpp:20
continuous field
Definition: definitions.h:171
MoFEMErrorCodes
Error handling.
Definition: definitions.h:115
static const char *const CubitBCNames[]
Names of types of sets and boundary conditions.
Definition: definitions.h:238
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
Definition: definitions.h:183
field with C-1 continuity
Definition: definitions.h:174