diff --git a/CGAL_Core/include/CGAL/CORE/CoreDefs.h b/CGAL_Core/include/CGAL/CORE/CoreDefs.h index a2a29ad7835..8393a76e61a 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreDefs.h +++ b/CGAL_Core/include/CGAL/CORE/CoreDefs.h @@ -81,14 +81,22 @@ namespace CORE { /** The normal behavior is to abort when an invalid expression * is constructed. This flag can be used to turn off this abort. * In any case, an error message will be printed */ +#ifdef CGAL_NO_ATOMIC +CGAL_GLOBAL_STATE_VAR(bool, AbortFlag, true) +#else CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, AbortFlag, true) +#endif /// Invalid Flag -- initiallly value is non-negative /** If the Abort Flag is false, then the Invalid flag will be set to * a negative value whenever an invalid expression is constructed. * It is the user's responsibility to check this flag and to make * it non-negative again. */ +#ifdef CGAL_NO_ATOMIC +CGAL_GLOBAL_STATE_VAR(int, InvalidFlag, 0) +#else CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, InvalidFlag, 0) +#endif /// Escape Precision in bits CGAL_GLOBAL_STATE_VAR(extLong, EscapePrec, CORE_posInfty) @@ -100,7 +108,11 @@ CGAL_GLOBAL_STATE_VAR(long, EscapePrecFlag, 0) /// Escape Precision Warning Flag /** this flag is true by default, and will cause a warning to be printed when EscapePrec is reached */ - CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, EscapePrecWarning, true) +#ifdef CGAL_NO_ATOMIC +CGAL_GLOBAL_STATE_VAR(bool, EscapePrecWarning, true) +#else +CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, EscapePrecWarning, true) +#endif // These following two values determine the precision of computing // approximations in Expr. @@ -118,7 +130,11 @@ CGAL_GLOBAL_STATE_VAR(extLong, defAbsPrec, CORE_posInfty) "controls the printout precision of std::cout for BigFloat" Perhaps, we should merge defOutputDigits and defBigFloatOutputDigits? */ +#ifdef CGAL_NO_ATOMIC + CGAL_GLOBAL_STATE_VAR(long, defBigFloatOutputDigits, 10) +#else CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, defBigFloatOutputDigits, 10) +#endif /// default input precision in digits for converting a string to a Real or Expr /** This value can be CORE_INFTY */ @@ -128,11 +144,19 @@ CGAL_GLOBAL_STATE_VAR(extLong, defInputDigits, CORE_posInfty) /** This value cannot be CORE_INFTY See also defBigFloatOutputDigits. (it really should be an int, as in std::cout.setprecision(int)). */ +#ifdef CGAL_NO_ATOMIC +CGAL_GLOBAL_STATE_VAR(long, defOutputDigits, 10) // == get_static_defBigFloatOutputDigits() +#else CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, defOutputDigits, 10) // == get_static_defBigFloatOutputDigits() +#endif /// default input precision in digits for converting a string to a BigFloat /** This value cannot be CORE_INFTY. */ +#ifdef CGAL_NO_ATOMIC +CGAL_GLOBAL_STATE_VAR(long, defBigFloatInputDigits, 16) +#else CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, defBigFloatInputDigits, 16) +#endif inline long @@ -151,15 +175,42 @@ CGAL_GLOBAL_STATE_VAR(extLong, defBFsqrtAbsPrec, 54) ////////////////////////////////////////////////////////////// /// floating point filter flag +#ifdef CGAL_NO_ATOMIC +CGAL_GLOBAL_STATE_VAR(bool, fpFilterFlag, true) +#else CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, fpFilterFlag, true) +#endif + + /// if true, evaluation of expressions would be incremental +#ifdef CGAL_NO_ATOMIC +CGAL_GLOBAL_STATE_VAR(bool, incrementalEvalFlag, true) +#else CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, incrementalEvalFlag, true) +#endif + + /// progressive evaluation flag +#ifdef CGAL_NO_ATOMIC +CGAL_GLOBAL_STATE_VAR(bool, progressiveEvalFlag, true) +#else CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, progressiveEvalFlag, true) +#endif + + /// rational reduction flag +#ifdef CGAL_NO_ATOMIC +CGAL_GLOBAL_STATE_VAR(bool, rationalReduceFlag, false) +#else CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, rationalReduceFlag, false) +#endif + /// default initial (bit) precision for AddSub Progressive Evaluation +#ifdef CGAL_NO_ATOMIC +CGAL_GLOBAL_STATE_VAR(long, defInitialProgressivePrec, 64) +#else CGAL_GLOBAL_STATE_VAR(CGAL::cpp11::atomic, defInitialProgressivePrec, 64) +#endif ////////////////////////////////////////////////////////////// // methods for setting global precision parameters diff --git a/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h b/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h index 51c40abb12d..1df38d0e864 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h +++ b/CGAL_Core/include/CGAL/CORE/CoreDefs_impl.h @@ -57,15 +57,22 @@ int IOErrorFlag = 0; /** * If AbortFlag is true when invalid expression is constructed, system will abort */ - +#ifdef CGAL_NO_ATOMIC +bool AbortFlag = true; +#else CGAL::cpp11::atomic AbortFlag(true); +#endif /** * InvalidFlag is set to negative whenever an invalid expression is constructed. * The user has the responsibility to reset to non-negative value. */ +#ifdef CGAL_NO_ATOMIC +int InvalidFlag = 0; +#else CGAL::cpp11::atomic InvalidFlag(0); +#endif /* ************************************************************ * PRECISION PARAMETERS @@ -97,7 +104,11 @@ long EscapePrecFlag = 0; /// Escape Precision Warning Flag /** this flag is true by default, and will cause a warning to be printed when EscapePrec is reached */ +#ifdef CGAL_NO_ATOMIC +bool EscapePrecWarning = true; +#else CGAL::cpp11::atomic EscapePrecWarning(true); +#endif /** The Composite Precision [defAbsPrec, defRelPrec] * determines the precision to which an Expr evaluates its @@ -113,11 +124,19 @@ extLong defAbsPrec = CORE_posInfty; extLong defRelPrec = 60; /** number of BigFloat digits to print out */ +#ifdef CGAL_NO_ATOMIC +long defBigFloatOutputDigits = 10; +#else CGAL::cpp11::atomic defBigFloatOutputDigits(10); +#endif /** NORMALLY, we like to make this equal to defBigFloatOutputDigits * 8/3/01, Chee: re-introduced this parameter */ +#ifdef CGAL_NO_ATOMIC +long defOutputDigits = 10; +#else CGAL::cpp11::atomic defOutputDigits(10); // == defBigFloatOutputDigits; +#endif /** String Input Precision */ @@ -130,7 +149,11 @@ extLong defInputDigits = CORE_posInfty; /** This controls the absolute error in converting from string to BigFloat * The absolute error will be at most 10^{-defInputDigits} */ +#ifdef CGAL_NO_ATOMIC +long defBigFloatInputDigits = 16; +#else CGAL::cpp11::atomic defBigFloatInputDigits(16); +#endif /* ************************************************************ * EVALUATION FLAGS @@ -138,25 +161,44 @@ CGAL::cpp11::atomic defBigFloatInputDigits(16); /** Floating Point filter * true = turn on floating point filter */ +#ifdef CGAL_NO_ATOMIC +bool fpFilterFlag = true; +#else CGAL::cpp11::atomic fpFilterFlag(true); +#endif /** IncrementaL evaluation flag * incremental evaluation is requested, This means, we try to use previous * approximate values to improve an approximation */ +#ifdef CGAL_NO_ATOMIC +bool incrementalEvalFlag = true; +#else CGAL::cpp11::atomic incrementalEvalFlag(true); +#endif /** Progressive evaluation flag * true = turn on progressive evaluation flag */ +#ifdef CGAL_NO_ATOMIC +bool progressiveEvalFlag = true; +#else CGAL::cpp11::atomic progressiveEvalFlag(true); +#endif /** Initial progressive evaluation precision * Used by AddSubRep */ +#ifdef CGAL_NO_ATOMIC +long defInitialProgressivePrec = 64; +#else CGAL::cpp11::atomic defInitialProgressivePrec(64); +#endif /** RATIONAL REDUCTION FLAG * true = turn on rational reduction */ +#ifdef CGAL_NO_ATOMIC +bool rationalReduceFlag = false; +#else CGAL::cpp11::atomic rationalReduceFlag(false); - +#endif #endif // CGAL_HEADER_ONLY } //namespace CORE diff --git a/CGAL_Core/include/CGAL/CORE/Filter.h b/CGAL_Core/include/CGAL/CORE/Filter.h index 2cd4709c1ee..132b0ebac84 100644 --- a/CGAL_Core/include/CGAL/CORE/Filter.h +++ b/CGAL_Core/include/CGAL/CORE/Filter.h @@ -42,6 +42,7 @@ #include #include #include +#include #if !defined CGAL_CFG_NO_CPP0X_ISFINITE #define CGAL_CORE_finite(x) std::isfinite(x) @@ -180,7 +181,7 @@ public: /// helper function (to avoid warning under some compilers) static double getDoubleInfty() { - return 2*DBL_MAX; + return std::numeric_limits::infinity(); } //@} }; //filteredFp class