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