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