v0.10.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 
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 MAX_CORE_TMP 1 ///< maximal number of cores
285 #define BITREFEDGES_SIZE 6 ///< number of edges on tetrahedral
286 #define BITREFLEVEL_SIZE 128 ///< max number of refinements
287 #define BITFIELDID_SIZE 32 ///< max number of fields
288 #define BITFEID_SIZE 32 ///< max number of finite elements
289 #define BITPROBLEMID_SIZE 32 ///< max number of problems
290 #define BITINTERFACEUID_SIZE 32
291 
292 #define MYPCOMM_INDEX 0 ///< default communicator number PCOMM
293 
294 // This Is form MOAB
295 #define MB_TYPE_WIDTH 4
296 #define MB_ID_WIDTH (8 * sizeof(EntityHandle) - MB_TYPE_WIDTH)
297 #define MB_TYPE_MASK ((EntityHandle)0xF << MB_ID_WIDTH)
298 // 2^MB_TYPE_WIDTH-1 ------^
299 
300 #define MB_START_ID ((EntityID)1) ///< All entity id's currently start at 1
301 #define MB_END_ID \
302  ((EntityID)MB_ID_MASK) ///< Last id is the complement of the MASK
303 #define MB_ID_MASK (~MB_TYPE_MASK)
304 
305 #define MAX_DOFS_ON_ENTITY 512 ///< Maximal number of DOFs on entity
306 #define MAX_PROCESSORS_NUMBER 1024 ///< Maximal number of processors
307 #define DOF_UID_MASK \
308  (MAX_DOFS_ON_ENTITY - 1) ///< Mask for DOF number on entity form UId
309 #define ENTITY_UID_MASK (~DOF_UID_MASK)
310 
311 #define NOT_USED(x) ((void)(x))
312 
313 /** \brief set barrier start
314  * Run code in sequence, starting from process 0, and ends on last process.
315  *
316  * It can be only used for testing. Do not use that function as a part of these
317  * code.
318  *
319  */
320 #define BARRIER_PCOMM_RANK_START(PCMB) \
321  { \
322  for (unsigned int i = 0; i < PCMB->proc_config().proc_rank(); i++) \
323  MPI_Barrier(PCMB->proc_config().proc_comm()); \
324  };
325 
326 /** \deprecated Do use this macro, instead use BARRIER_PCOMM_RANK_START
327  */
328 #define BARRIER_RANK_START(PCMB) \
329  { \
330  macro_is_deprecated_using_deprecated_function(); \
331  for (unsigned int i = 0; i < PCMB->proc_config().proc_rank(); i++) \
332  MPI_Barrier(PCMB->proc_config().proc_comm()); \
333  };
334 
335 /** \brief set barrier start
336  * Run code in sequence, starting from process 0, and ends on last process.
337  *
338  * It can be only used for testing. Do not use that function as a part of these
339  * code.
340  *
341  */
342 #define BARRIER_PCOMM_RANK_END(PCMB) \
343  { \
344  for (unsigned int i = PCMB->proc_config().proc_rank(); \
345  i < PCMB->proc_config().proc_size(); i++) \
346  MPI_Barrier(PCMB->proc_config().proc_comm()); \
347  };
348 
349 /** \deprecated Do use this macro, instead use BARRIER_PCOMM_RANK_START
350  */
351 #define BARRIER_RANK_END(PCMB) \
352  { \
353  macro_is_deprecated_using_deprecated_function(); \
354  for (unsigned int i = PCMB->proc_config().proc_rank(); \
355  i < PCMB->proc_config().proc_size(); i++) \
356  MPI_Barrier(PCMB->proc_config().proc_comm()); \
357  };
358 
359 /** \brief set barrier start
360  * Run code in sequence, starting from process 0, and ends on last process.
361  *
362  * It can be only used for testing. Do not use that function as a part of these
363  * code.
364  *
365  */
366 #define BARRIER_MOFEM_RANK_START(MOFEM) \
367  { \
368  for (int i = 0; i < (MOFEM)->get_comm_rank(); i++) \
369  MPI_Barrier((MOFEM)->get_comm()); \
370  };
371 
372 /** \brief set barrier start
373  * Run code in sequence, starting from process 0, and ends on last process.
374  *
375  * It can be only used for testing. Do not use that function as a part of these
376  * code.
377  *
378  */
379 #define BARRIER_MOFEM_RANK_END(MOFEM) \
380  { \
381  for (int i = (MOFEM)->get_comm_rank(); i < (MOFEM)->get_comm_size(); i++) \
382  MPI_Barrier((MOFEM)->get_comm()); \
383  };
384 
385 #ifdef __cplusplus
386 extern "C" {
387 #endif
388 
389 /**
390  * \brief Is used to indicate that macro is deprecated
391  * Do nothing just triggers error at the compilation
392  */
394 
395 #ifdef __cplusplus
396 }
397 #endif
398 
399 /**
400  * \brief First executable line of each MoFEM function, used for error handling.
401  Final line of MoFEM functions should be MoFEMFunctionReturn(0);
402 
403  \node Not collective
404 
405  Example
406  \code
407  PetscErrorCode fun() {
408  int something;
409  MoFEMFunctionBegin;
410  MoFEMFunctionReturn(0);
411  }
412  \endcode
413 
414  */
415 #define MoFEMFunctionBegin \
416  PetscFunctionBegin; \
417  try {
418 
419 /**
420  * @brief \brief Catch errors
421  *
422  * Usage in main functions
423  * \code
424  * int main(int argc, char *argv[]) {
425  *
426  * MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
427  *
428  * try {
429  *
430  * // More code here
431  *
432  * }
433  * CATCH_ERRORS;
434  *
435  * return MoFEM::Core::Finalize();
436  *
437  * }
438  * \endcode
439  *
440  */
441 #define CATCH_ERRORS \
442  catch (MoFEMExceptionInitial const &ex) { \
443  return PetscError(PETSC_COMM_SELF, ex.lINE, PETSC_FUNCTION_NAME, __FILE__, \
444  ex.errorCode, PETSC_ERROR_INITIAL, ex.what()); \
445  } \
446  catch (MoFEMExceptionRepeat const &ex) { \
447  return PetscError(PETSC_COMM_SELF, ex.lINE, PETSC_FUNCTION_NAME, __FILE__, \
448  ex.errorCode, PETSC_ERROR_REPEAT, " "); \
449  } \
450  catch (MoFEMException const &ex) { \
451  SETERRQ(PETSC_COMM_SELF, ex.errorCode, ex.errorMessage); \
452  } \
453  catch (boost::bad_weak_ptr & ex) { \
454  std::string message("Boost bad weak ptr: " + std::string(ex.what()) + \
455  " at " + boost::lexical_cast<std::string>(__LINE__) + \
456  " : " + std::string(__FILE__) + " in " + \
457  std::string(PETSC_FUNCTION_NAME)); \
458  SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, message.c_str()); \
459  } \
460  catch (std::out_of_range & ex) { \
461  std::string message("Std out of range error: " + std::string(ex.what()) + \
462  " at " + boost::lexical_cast<std::string>(__LINE__) + \
463  " : " + std::string(__FILE__) + " in " + \
464  std::string(PETSC_FUNCTION_NAME)); \
465  SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, message.c_str()); \
466  } \
467  catch (std::exception const &ex) { \
468  std::string message("Std error: " + std::string(ex.what()) + " at " + \
469  boost::lexical_cast<std::string>(__LINE__) + " : " + \
470  std::string(__FILE__) + " in " + \
471  std::string(PETSC_FUNCTION_NAME)); \
472  SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, message.c_str()); \
473  }
474 
475 /**
476  * \brief Last executable line of each PETSc function used for error handling.
477  * Replaces return()
478  * @param a error code
479  *
480  * \note MoFEMFunctionReturn has to be used with MoFEMFunctionBegin and can be
481  * used only at the end of the function. If is need to return function in
482  * earlier use MoFEMFunctionReturnHot
483  *
484  */
485 #define MoFEMFunctionReturn(a) \
486  } \
487  CATCH_ERRORS \
488  PetscFunctionReturn(a)
489 
490 /**
491  * \brief First executable line of each MoFEM function, used for error
492  handling. Final line of MoFEM functions should be MoFEMFunctionReturn(0); Use
493  of this function allows for lighter profiling by default.
494 
495  \node Not collective
496 
497  Example:
498  \code
499  PetscErrorCode fun() {
500  int something;
501  MoFEMFunctionBeginHot;
502 
503  // some work here
504 
505  MoFEMFunctionReturnHot(0);
506  }
507  \endcode
508 */
509 #define MoFEMFunctionBeginHot PetscFunctionBeginHot
510 
511 /**
512  * \brief Last executable line of each PETSc function used for error handling.
513  * Replaces return()
514  * @param a error code
515  */
516 #define MoFEMFunctionReturnHot(a) PetscFunctionReturn(a)
517 
518 #define CHKERRQ_PETSC(n) CHKERRQ(n)
519 /**
520  * \brief check error code of MoAB function
521  * @param a MoABErrorCode
522  */
523 #define CHKERRQ_MOAB(a) \
524  if (PetscUnlikely(MB_SUCCESS != (a))) { \
525  std::string error_str = (unsigned)(a) <= (unsigned)MB_FAILURE \
526  ? moab::ErrorCodeStr[a] \
527  : "INVALID ERROR CODE"; \
528  std::string str("MOAB error (" + boost::lexical_cast<std::string>((a)) + \
529  ") " + error_str + " at line " + \
530  boost::lexical_cast<std::string>(__LINE__) + " : " + \
531  std::string(__FILE__)); \
532  SETERRQ(PETSC_COMM_SELF, MOFEM_MOAB_ERROR, str.c_str()); \
533  }
534 
535 /**
536  * \brief Check error code of MoFEM/MOAB/PETSc function
537  * @param a MoFEMErrorCode
538  *
539  * \code
540  * MoFEMErrorCode fun() {
541  * MoFEMFunctionBeginHot;
542  * rval = fun_moab(); CHKERRG(rval);
543  * ierr = fun_petsc(); CHKERRG(ierr);
544  * merr = fun_mofem(); CHKERRG(merr);
545  * MoFEMFunctionReturnHot(0);
546  * \endcode
547  *
548  * \note Function detect type of errocode using specialized template function
549  * getErrorType, i.e. condition is evaluated at compilation time.
550  *
551  */
552 #define CHKERRG(n) \
553  if ((boost::is_same<BOOST_TYPEOF((n)), \
554  MoFEMErrorCodeGeneric<PetscErrorCode>>::value)) { \
555  CHKERRQ_PETSC((n)); \
556  } else if (boost::is_same<BOOST_TYPEOF((n)), \
557  MoFEMErrorCodeGeneric<moab::ErrorCode>>::value) { \
558  CHKERRQ_MOAB((n)); \
559  }
560 
561 /**
562  * @brief Inline error check
563  *
564  * \code
565  *
566  * MoFEMErrorCode foo() {
567  * MoFEMFunctionBegin;
568  *
569  * // Call other functions
570  * CHKERR fun_moab();
571  * CHKERR fun_petsc();
572  * CHKERR fun_mofem();
573  *
574  * // Throw error
575  * SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "Some error message");
576  *
577  * MoFEMFunctionReturn(0);
578  * }
579  *
580  * int main(int argc, char *argv[]) {
581  *
582  * // Initailise MoFEM and Petsc
583  * MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
584  *
585  * try {
586  *
587  * moab::Core mb_instance; // MoAB database
588  * moab::Interface &moab = mb_instance;
589  * MoFEM::Core core(moab); // MOFEM database
590  * MoFEM::CoreInterface &m_field = core;
591  *
592  * CHKERR foo(); // Call function
593  *
594  * }
595  * CATCH_ERRORS;
596  *
597  * return MoFEM::Core::Finalize();
598  *
599  * }
600  *
601  * \endcode
602  *
603  */
604 #define CHKERR MoFEM::ErrorChecker<__LINE__>() <<
605 
606 /**
607  * \brief Check error code of MoAB function and throw MoFEM exception
608  * @param a MoABErrorCode
609  */
610 #define MOAB_THROW(a) \
611  { \
612  if (PetscUnlikely(MB_SUCCESS != (a))) { \
613  std::string error_str = (unsigned)(a) <= (unsigned)MB_FAILURE \
614  ? moab::ErrorCodeStr[a] \
615  : "INVALID ERROR CODE"; \
616  std::string str("MOAB error (" + boost::lexical_cast<std::string>((a)) + \
617  ") " + error_str + " at line " + \
618  boost::lexical_cast<std::string>(__LINE__) + " : " + \
619  std::string(__FILE__)); \
620  throw MoFEMException(MOFEM_MOAB_ERROR, str.c_str()); \
621  } \
622  }
623 
624 /**
625  * \brief Throw MoFEM exception
626  * @param a message
627  */
628 #define THROW_MESSAGE(a) \
629  { \
630  throw MoFEMException( \
631  MOFEM_MOFEMEXCEPTION_THROW, \
632  ("MoFEM error " + boost::lexical_cast<std::string>((a)) + \
633  " at line " + boost::lexical_cast<std::string>(__LINE__) + " : " + \
634  std::string(__FILE__)) \
635  .c_str()); \
636  }
637 
638 /**
639  * \brief Convert number to string
640  * @param x number
641  */
642 #define SSTR(x) toString(x)
643 
644 #define TENSOR1_VEC_PTR(VEC) &VEC[0], &VEC[1], &VEC[2]
645 
646 #define SYMMETRIC_TENSOR4_MAT_PTR(MAT) \
647  &MAT(0, 0), &MAT(0, 1), &MAT(0, 2), &MAT(0, 3), &MAT(0, 4), &MAT(0, 5), \
648  &MAT(1, 0), &MAT(1, 1), &MAT(1, 2), &MAT(1, 3), &MAT(1, 4), &MAT(1, 5), \
649  &MAT(2, 0), &MAT(2, 1), &MAT(2, 2), &MAT(2, 3), &MAT(2, 4), &MAT(2, 5), \
650  &MAT(3, 0), &MAT(3, 1), &MAT(3, 2), &MAT(3, 3), &MAT(3, 4), &MAT(3, 5), \
651  &MAT(4, 0), &MAT(4, 1), &MAT(4, 2), &MAT(4, 3), &MAT(4, 4), &MAT(4, 5), \
652  &MAT(5, 0), &MAT(5, 1), &MAT(5, 2), &MAT(5, 3), &MAT(5, 4), &MAT(5, 5)
653 
654 #define TENSOR4_MAT_PTR(MAT) &MAT(0, 0), MAT.size2()
655 
656 #define TENSOR2_MAT_PTR(MAT) \
657  &MAT(0, 0), &MAT(1, 0), &MAT(2, 0), &MAT(3, 0), &MAT(4, 0), &MAT(5, 0), \
658  &MAT(6, 0), &MAT(7, 0), &MAT(8, 0)
659 
660 #define SYMMETRIC_TENSOR2_MAT_PTR(MAT) \
661  &MAT(0, 0), &MAT(0, 1), &MAT(0, 2), &MAT(0, 3), &MAT(0, 4), &MAT(0, 5)
662 
663 #define SYMMETRIC_TENSOR2_VEC_PTR(VEC) \
664  &VEC[0], &VEC[1], &VEC[2], &VEC[3], &VEC[4], &VEC[5]
665 
666 #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:24
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