36 #ifndef MAT_MATINCLUDE
37 #define MAT_MATINCLUDE
55 #define MAT_OMP_INIT enum omp_failType {noFail = 0, standardFail, matFail}; \
56 volatile omp_failType omp_fail = noFail; \
57 std::exception omp_exce; \
58 Failure omp_matFail; \
61 #define MAT_OMP_START try {
62 #define MAT_OMP_END } \
63 catch(Failure & omp_fail_caught) { \
64 omp_fail = matFail; omp_matFail = omp_fail_caught; } \
65 catch(std::exception & omp_exce_caught) { \
66 omp_fail = standardFail; omp_exce = omp_exce_caught; }
67 #define MAT_OMP_FINALIZE if(omp_fail) \
68 { std::cerr<<"Exception was thrown in OpenMP parallel region\n"; \
70 case standardFail: throw omp_exce; break; \
71 case matFail: throw omp_matFail; break; \
72 default: throw Failure("Odd error in omp parallel loop\n");} \
78 #define MAT_OMP_FINALIZE
85 static unsigned int nProcs;
86 static unsigned int matrixParallelLevel;
92 throw Failure(
"mat::Params::getNProcs(): nProcs == 0 Forgot to call setNProcs()?");
105 if (matrixParallelLevel == 0)
106 throw Failure(
"mat::Params::getMatrixParallelLevel(): matrixParallelLevel == 0 Forgot to call setMatrixParallelLevel()?");
107 return matrixParallelLevel;
114 matrixParallelLevel = mPL;
127 template<
typename Treal>
129 throw Failure(
"getPrecision() : The used type is not supported by"
134 return std::numeric_limits<long double>::epsilon();
138 return std::numeric_limits<double>::epsilon();
142 return std::numeric_limits<float>::epsilon();