|
| v0.14.0
|
Go to the documentation of this file.
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"};
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 PetscFunctionBegin; \
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, 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, " "); \
394 catch (MoFEMException const &ex) { \
395 SETERRQ(PETSC_COMM_SELF, ex.errorCode, 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, message.c_str()); \
404 catch (std::out_of_range & ex) { \
405 std::string message("Std out of range error: " + std::string(ex.what()) + \
406 " at " + boost::lexical_cast<std::string>(__LINE__) + \
407 " : " + std::string(__FILE__) + " in " + \
408 std::string(PETSC_FUNCTION_NAME)); \
409 SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, message.c_str()); \
411 catch (std::exception const &ex) { \
412 std::string message("Std error: " + std::string(ex.what()) + " at " + \
413 boost::lexical_cast<std::string>(__LINE__) + " : " + \
414 std::string(__FILE__) + " in " + \
415 std::string(PETSC_FUNCTION_NAME)); \
416 SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, message.c_str()); \
429 #define MoFEMFunctionReturn(a) \
432 PetscFunctionReturn(a)
453 #define MoFEMFunctionBeginHot PetscFunctionBeginHot
460 #define MoFEMFunctionReturnHot(a) PetscFunctionReturn(a)
462 #define CHKERRQ_PETSC(n) CHKERRQ(n)
467 #define CHKERRQ_MOAB(a) \
468 if (PetscUnlikely(MB_SUCCESS != (a))) { \
469 std::string error_str = (unsigned)(a) <= (unsigned)MB_FAILURE \
470 ? moab::ErrorCodeStr[a] \
471 : "INVALID ERROR CODE"; \
472 std::string str("MOAB error (" + boost::lexical_cast<std::string>((a)) + \
473 ") " + error_str + " at line " + \
474 boost::lexical_cast<std::string>(__LINE__) + " : " + \
475 std::string(__FILE__)); \
476 SETERRQ(PETSC_COMM_SELF, MOFEM_MOAB_ERROR, str.c_str()); \
497 if ((boost::is_same<BOOST_TYPEOF((n)), \
498 MoFEMErrorCodeGeneric<PetscErrorCode>>::value)) { \
499 CHKERRQ_PETSC((n)); \
500 } else if (boost::is_same<BOOST_TYPEOF((n)), \
501 MoFEMErrorCodeGeneric<moab::ErrorCode>>::value) { \
548 #define CHKERR MoFEM::ErrorChecker<__LINE__>() <<
554 #define MOAB_THROW(err) \
556 if (PetscUnlikely(MB_SUCCESS != (err))) { \
557 std::string error_str = (unsigned)(err) <= (unsigned)MB_FAILURE \
558 ? moab::ErrorCodeStr[err] \
559 : "INVALID ERROR CODE"; \
560 throw MoFEMException(MOFEM_MOAB_ERROR, \
562 boost::lexical_cast<std::string>((err)) + ") " + \
563 error_str + " at line " + \
564 boost::lexical_cast<std::string>(__LINE__) + \
565 " : " + std::string(__FILE__)) \
574 #define THROW_MESSAGE(msg) \
576 throw MoFEM::MoFEMException( \
577 MOFEM_MOFEMEXCEPTION_THROW, \
578 ("MoFEM error " + boost::lexical_cast<std::string>((msg)) + \
579 " at line " + boost::lexical_cast<std::string>(__LINE__) + " : " + \
580 std::string(__FILE__)) \
589 #define CHK_MOAB_THROW(err, msg) \
591 if (PetscUnlikely(static_cast<int>(MB_SUCCESS) != (err))) \
594 throw MoFEMException( \
596 ("MOAB error (" + boost::lexical_cast<std::string>((err)) + ") " + \
597 boost::lexical_cast<std::string>((msg)) + " at line " + \
598 boost::lexical_cast<std::string>(__LINE__) + " : " + \
599 std::string(__FILE__)) \
609 #define CHK_THROW_MESSAGE(err, msg) \
611 if (PetscUnlikely((err) != MOFEM_SUCCESS)) \
612 THROW_MESSAGE(msg); \
619 #define SSTR(x) toString(x)
621 #define TENSOR1_VEC_PTR(VEC) &VEC[0], &VEC[1], &VEC[2]
623 #define SYMMETRIC_TENSOR4_MAT_PTR(MAT) \
624 &MAT(0, 0), &MAT(0, 1), &MAT(0, 2), &MAT(0, 3), &MAT(0, 4), &MAT(0, 5), \
625 &MAT(1, 0), &MAT(1, 1), &MAT(1, 2), &MAT(1, 3), &MAT(1, 4), &MAT(1, 5), \
626 &MAT(2, 0), &MAT(2, 1), &MAT(2, 2), &MAT(2, 3), &MAT(2, 4), &MAT(2, 5), \
627 &MAT(3, 0), &MAT(3, 1), &MAT(3, 2), &MAT(3, 3), &MAT(3, 4), &MAT(3, 5), \
628 &MAT(4, 0), &MAT(4, 1), &MAT(4, 2), &MAT(4, 3), &MAT(4, 4), &MAT(4, 5), \
629 &MAT(5, 0), &MAT(5, 1), &MAT(5, 2), &MAT(5, 3), &MAT(5, 4), &MAT(5, 5)
631 #define TENSOR4_MAT_PTR(MAT) &MAT(0, 0), MAT.size2()
633 #define TENSOR2_MAT_PTR(MAT) \
634 &MAT(0, 0), &MAT(1, 0), &MAT(2, 0), &MAT(3, 0), &MAT(4, 0), &MAT(5, 0), \
635 &MAT(6, 0), &MAT(7, 0), &MAT(8, 0)
637 #define SYMMETRIC_TENSOR2_MAT_PTR(MAT) \
638 &MAT(0, 0), &MAT(0, 1), &MAT(0, 2), &MAT(0, 3), &MAT(0, 4), &MAT(0, 5)
640 #define SYMMETRIC_TENSOR2_VEC_PTR(VEC) \
641 &VEC[0], &VEC[1], &VEC[2], &VEC[3], &VEC[4], &VEC[5]
643 #endif //__DEFINITONS_H__
const static char *const CubitBCNames[]
Names of types of sets and boundary conditions.
@ MOFEM_STD_EXCEPTION_THROW
const static char *const ApproximationBaseNames[]
@ L2
field with C-1 continuity
HVecFormatting
Format in rows of vectorial base functions.
CoordinateTypes
Coodinate system.
@ USER_BASE
user implemented approximation base
FieldSpace
approximation spaces
const static char *const CoordinateTypesNames[]
Coordinate system names.
const static char *const FieldContinuityNames[]
@ MAT_THERMALSET
block name is "MAT_THERMAL"
VERBOSITY_LEVELS
Verbosity levels.
FieldContinuity
Field continuity.
@ BODYFORCESSET
block name is "BODY_FORCES"
@ MAT_ELASTICSET
block name is "MAT_ELASTIC"
@ LASTSPACE
FieldSpace in [ 0, LASTSPACE )
HVecDiffFormatting
Format in rows of vectorial base gradients of base functions.
MoFEMErrorCodes
Error handling.
@ MOFEM_OPERATION_UNSUCCESSFUL
@ MOFEM_MOFEMEXCEPTION_THROW
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
const static char *const FieldSpaceNames[]
@ DISCONTINUOUS
Broken continuity (No effect on L2 space)
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ HCURL
field with continuous tangents
@ MOFEM_DATA_INCONSISTENCY
FieldApproximationBase
approximation base
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
@ MOFEM_ATOM_TEST_INVALID
const static char *const MoFEMErrorCodesNames[]
@ CONTINUOUS
Regular field.
@ HDIV
field with continuous normal traction
@ MAT_MOISTURESET
block name is "MAT_MOISTURE"
DEPRECATED 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.
@ NOFIELD
scalar or vector of scalars describe (no true field)