6#ifndef __DEFINITONS_H__
7#define __DEFINITONS_H__
12#define DEPRECATED __attribute__((deprecated))
13#elif defined(_MSC_VER)
14#define DEPRECATED __declspec(deprecated)
16#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
46 "MOFEM_DATA_INCONSISTENCY",
47 "MOFEM_NOT_IMPLEMENTED",
49 "MOFEM_OPERATION_UNSUCCESSFUL",
50 "MOFEM_IMPOSSIBLE_CASE",
52 "MOFEM_MOFEMEXCEPTION_THROW",
53 "MOFEM_STD_EXCEPTION_THROW",
54 "MOFEM_ATOM_TEST_INVALID",
74 "AINSWORTH_LEGENDRE_BASE",
75 "AINSWORTH_LOBATTO_BASE",
76 "AINSWORTH_BERNSTEIN_BEZIER_BASE",
77 "DEMKOWICZ_JACOBI_BASE",
93 "NOSPACE",
"NOFIELD",
"H1",
"HCURL",
"HDIV",
"L2",
"LASTSPACE"};
122 "Cylindrical",
"Spherical"};
150 BYALL = 1 << 0 | 1 << 1 | 1 << 2
189 "UNKNOWNSET",
"NODESET",
"SIDESET",
"BLOCKSET",
190 "MATERIALSET",
"DISPLACEMENTSET",
"FORCESET",
"PRESSURESET",
191 "VELOCITYSET",
"ACCELERATIONSET",
"TEMPERATURESET",
"HEATFLUXSET",
192 "INTERFACESET",
"UNKNOWNNAME",
"MAT_ELASTICSET",
"MAT_INTERFSET",
193 "MAT_THERMALSET",
"BODYFORCESSET",
"MAT_MOISTURESET",
"DIRICHLET_BC",
194 "NEUMANN_BC",
"LASTSET_BC"};
228#define MYPCOMM_INDEX 0
230#define MAX_CORE_TMP 1
231#define BITREFEDGES_SIZE 32
232#define BITREFLEVEL_SIZE 64
233#define BITFIELDID_SIZE 32
234#define BITFEID_SIZE 32
235#define BITPROBLEMID_SIZE 32
236#define BITINTERFACEUID_SIZE 32
239#define MB_TYPE_WIDTH 4
240#define MB_ID_WIDTH (8 * sizeof(EntityHandle) - MB_TYPE_WIDTH)
241#define MB_TYPE_MASK ((EntityHandle)0xF << MB_ID_WIDTH)
244#define MB_START_ID ((EntityID)1)
246 ((EntityID)MB_ID_MASK)
247#define MB_ID_MASK (~MB_TYPE_MASK)
249#define MAX_DOFS_ON_ENTITY 512
250#define MAX_PROCESSORS_NUMBER 1024
251#define DOF_UID_MASK \
252 (MAX_DOFS_ON_ENTITY - 1)
253#define ENTITY_UID_MASK (~DOF_UID_MASK)
255#define NOT_USED(x) ((void)(x))
264#define BARRIER_PCOMM_RANK_START(PCMB) \
266 for (unsigned int i = 0; i < PCMB->proc_config().proc_rank(); i++) \
267 MPI_Barrier(PCMB->proc_config().proc_comm()); \
272#define BARRIER_RANK_START(PCMB) \
274 macro_is_deprecated_using_deprecated_function(); \
275 for (unsigned int i = 0; i < PCMB->proc_config().proc_rank(); i++) \
276 MPI_Barrier(PCMB->proc_config().proc_comm()); \
286#define BARRIER_PCOMM_RANK_END(PCMB) \
288 for (unsigned int i = PCMB->proc_config().proc_rank(); \
289 i < PCMB->proc_config().proc_size(); i++) \
290 MPI_Barrier(PCMB->proc_config().proc_comm()); \
295#define BARRIER_RANK_END(PCMB) \
297 macro_is_deprecated_using_deprecated_function(); \
298 for (unsigned int i = PCMB->proc_config().proc_rank(); \
299 i < PCMB->proc_config().proc_size(); i++) \
300 MPI_Barrier(PCMB->proc_config().proc_comm()); \
310#define BARRIER_MOFEM_RANK_START(MOFEM) \
312 for (int i = 0; i < (MOFEM)->get_comm_rank(); i++) \
313 MPI_Barrier((MOFEM)->get_comm()); \
323#define BARRIER_MOFEM_RANK_END(MOFEM) \
325 for (int i = (MOFEM)->get_comm_rank(); i < (MOFEM)->get_comm_size(); i++) \
326 MPI_Barrier((MOFEM)->get_comm()); \
359#define MoFEMFunctionBegin \
360 PetscFunctionBeginUser; \
385#define CATCH_ERRORS \
386 catch (MoFEMExceptionInitial const &ex) { \
387 return PetscError(PETSC_COMM_SELF, ex.lINE, PETSC_FUNCTION_NAME, __FILE__, \
388 ex.errorCode, PETSC_ERROR_INITIAL, "%s", ex.what()); \
390 catch (MoFEMExceptionRepeat const &ex) { \
391 return PetscError(PETSC_COMM_SELF, ex.lINE, PETSC_FUNCTION_NAME, __FILE__, \
392 ex.errorCode, PETSC_ERROR_REPEAT, "%s", " "); \
394 catch (MoFEMException const &ex) { \
395 SETERRQ(PETSC_COMM_SELF, ex.errorCode, "%s", ex.errorMessage); \
397 catch (boost::bad_weak_ptr & ex) { \
398 std::string message("Boost bad weak ptr: " + std::string(ex.what()) + \
399 " at " + boost::lexical_cast<std::string>(__LINE__) + \
400 " : " + std::string(__FILE__) + " in " + \
401 std::string(PETSC_FUNCTION_NAME)); \
402 SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, "%s", \
405 catch (std::out_of_range & ex) { \
406 std::string message("Std out of range error: " + std::string(ex.what()) + \
407 " at " + boost::lexical_cast<std::string>(__LINE__) + \
408 " : " + std::string(__FILE__) + " in " + \
409 std::string(PETSC_FUNCTION_NAME)); \
410 SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, "%s", \
413 catch (std::exception const &ex) { \
414 std::string message("Std error: " + std::string(ex.what()) + " at " + \
415 boost::lexical_cast<std::string>(__LINE__) + " : " + \
416 std::string(__FILE__) + " in " + \
417 std::string(PETSC_FUNCTION_NAME)); \
418 SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, "%s", \
432#define MoFEMFunctionReturn(a) \
435 PetscFunctionReturn(a)
456#define MoFEMFunctionBeginHot PetscFunctionBeginHot
463#define MoFEMFunctionReturnHot(a) PetscFunctionReturn(a)
465#define CHKERRQ_PETSC(n) CHKERRQ(n)
470#define CHKERRQ_MOAB(a) \
471 if (PetscUnlikely(MB_SUCCESS != (a))) { \
472 std::string error_str = (unsigned)(a) <= (unsigned)MB_FAILURE \
473 ? moab::ErrorCodeStr[a] \
474 : "INVALID ERROR CODE"; \
475 std::string str("MOAB error (" + boost::lexical_cast<std::string>((a)) + \
476 ") " + error_str + " at line " + \
477 boost::lexical_cast<std::string>(__LINE__) + " : " + \
478 std::string(__FILE__)); \
479 SETERRQ(PETSC_COMM_SELF, MOFEM_MOAB_ERROR, "%s", str.c_str()); \
500 if ((boost::is_same<BOOST_TYPEOF((n)), \
501 MoFEMErrorCodeGeneric<PetscErrorCode>>::value)) { \
502 CHKERRQ_PETSC((n)); \
503 } else if (boost::is_same<BOOST_TYPEOF((n)), \
504 MoFEMErrorCodeGeneric<moab::ErrorCode>>::value) { \
551#define CHKERR MoFEM::ErrorChecker<__LINE__>() <<
557#define MOAB_THROW(err) \
559 if (PetscUnlikely(MB_SUCCESS != (err))) { \
560 std::string error_str = (unsigned)(err) <= (unsigned)MB_FAILURE \
561 ? moab::ErrorCodeStr[err] \
562 : "INVALID ERROR CODE"; \
563 throw MoFEMException(MOFEM_MOAB_ERROR, \
565 boost::lexical_cast<std::string>((err)) + ") " + \
566 error_str + " at line " + \
567 boost::lexical_cast<std::string>(__LINE__) + \
568 " : " + std::string(__FILE__)) \
577#define THROW_MESSAGE(msg) \
579 throw MoFEM::MoFEMException( \
580 MOFEM_MOFEMEXCEPTION_THROW, \
581 ("MoFEM error " + boost::lexical_cast<std::string>((msg)) + \
582 " at line " + boost::lexical_cast<std::string>(__LINE__) + " : " + \
583 std::string(__FILE__)) \
592#define CHK_MOAB_THROW(err, msg) \
594 if (PetscUnlikely(static_cast<int>(MB_SUCCESS) != (err))) \
597 throw MoFEMException( \
599 ("MOAB error (" + boost::lexical_cast<std::string>((err)) + ") " + \
600 boost::lexical_cast<std::string>((msg)) + " at line " + \
601 boost::lexical_cast<std::string>(__LINE__) + " : " + \
602 std::string(__FILE__)) \
612#define CHK_THROW_MESSAGE(err, msg) \
614 if (PetscUnlikely((err) != MOFEM_SUCCESS)) \
615 THROW_MESSAGE(msg); \
622#define SSTR(x) toString(x)
624#define TENSOR1_VEC_PTR(VEC) &VEC[0], &VEC[1], &VEC[2]
626#define SYMMETRIC_TENSOR4_MAT_PTR(MAT) \
627 &MAT(0, 0), &MAT(0, 1), &MAT(0, 2), &MAT(0, 3), &MAT(0, 4), &MAT(0, 5), \
628 &MAT(1, 0), &MAT(1, 1), &MAT(1, 2), &MAT(1, 3), &MAT(1, 4), &MAT(1, 5), \
629 &MAT(2, 0), &MAT(2, 1), &MAT(2, 2), &MAT(2, 3), &MAT(2, 4), &MAT(2, 5), \
630 &MAT(3, 0), &MAT(3, 1), &MAT(3, 2), &MAT(3, 3), &MAT(3, 4), &MAT(3, 5), \
631 &MAT(4, 0), &MAT(4, 1), &MAT(4, 2), &MAT(4, 3), &MAT(4, 4), &MAT(4, 5), \
632 &MAT(5, 0), &MAT(5, 1), &MAT(5, 2), &MAT(5, 3), &MAT(5, 4), &MAT(5, 5)
634#define TENSOR4_MAT_PTR(MAT) &MAT(0, 0), MAT.size2()
636#define TENSOR2_MAT_PTR(MAT) \
637 &MAT(0, 0), &MAT(1, 0), &MAT(2, 0), &MAT(3, 0), &MAT(4, 0), &MAT(5, 0), \
638 &MAT(6, 0), &MAT(7, 0), &MAT(8, 0)
640#define SYMMETRIC_TENSOR2_MAT_PTR(MAT) \
641 &MAT(0, 0), &MAT(0, 1), &MAT(0, 2), &MAT(0, 3), &MAT(0, 4), &MAT(0, 5)
643#define SYMMETRIC_TENSOR2_VEC_PTR(VEC) \
644 &VEC[0], &VEC[1], &VEC[2], &VEC[3], &VEC[4], &VEC[5]
VERBOSITY_LEVELS
Verbosity levels.
static const char *const MoFEMErrorCodesNames[]
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
FieldApproximationBase
approximation base
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base nme:nme847.
@ USER_BASE
user implemented approximation base
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
static const char *const CoordinateTypesNames[]
Coordinate system names.
static const char *const FieldContinuityNames[]
FieldSpace
approximation spaces
@ L2
field with C-1 continuity
@ LASTSPACE
FieldSpace in [ 0, LASTSPACE )
@ NOFIELD
scalar or vector of scalars describe (no true field)
@ HCURL
field with continuous tangents
@ HDIV
field with continuous normal traction
FieldContinuity
Field continuity.
@ CONTINUOUS
Regular field.
@ DISCONTINUOUS
Broken continuity (No effect on L2 space)
static const char *const FieldSpaceNames[]
void macro_is_deprecated_using_deprecated_function()
Is used to indicate that macro is deprecated Do nothing just triggers error at the compilation.
CubitBC
Types of sets and boundary conditions.
@ BODYFORCESSET
block name is "BODY_FORCES"
@ MAT_ELASTICSET
block name is "MAT_ELASTIC"
@ MAT_THERMALSET
block name is "MAT_THERMAL"
@ MAT_MOISTURESET
block name is "MAT_MOISTURE"
HVecFormatting
Format in rows of vectorial base functions.
MoFEMErrorCodes
Error handling.
@ MOFEM_STD_EXCEPTION_THROW
@ MOFEM_MOFEMEXCEPTION_THROW
@ MOFEM_OPERATION_UNSUCCESSFUL
@ MOFEM_ATOM_TEST_INVALID
@ MOFEM_DATA_INCONSISTENCY
static const char *const ApproximationBaseNames[]
CoordinateTypes
Coodinate system.
static const char *const CubitBCNames[]
Names of types of sets and boundary conditions.
HVecDiffFormatting
Format in rows of vectorial base gradients of base functions.