BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/CORE/CoreDefs.h
Go to the documentation of this file.
00001 /****************************************************************************
00002  * Core Library Version 1.7, August 2004
00003  * Copyright (c) 1995-2004 Exact Computation Project
00004  * All rights reserved.
00005  *
00006  * This file is part of CORE (http://cs.nyu.edu/exact/core/); you may
00007  * redistribute it under the terms of the Q Public License version 1.0.
00008  * See the file LICENSE.QPL distributed with CORE.
00009  *
00010  * Licensees holding a valid commercial license may use this file in
00011  * accordance with the commercial license agreement provided with the
00012  * software.
00013  *
00014  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00015  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00016  *
00017  *
00018  * File: CoreDefs.h
00019  * Synopsis:
00020  *       This contains useful Core Library global parameters which
00021  *       users may modify at runtime or compile time
00022  *       For each parameter, we provide corresponding methods to
00023  *       modify or examine the values.
00024  *
00025  * Written by 
00026  *       Chee Yap <yap@cs.nyu.edu>
00027  *       Chen Li <chenli@cs.nyu.edu>
00028  *       Zilin Du <zilin@cs.nyu.edu>
00029  *
00030  * WWW URL: http://cs.nyu.edu/exact/
00031  * Email: exact@cs.nyu.edu
00032  *
00033  * $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Core/include/CGAL/CORE/CoreDefs.h $
00034  * $Id: CoreDefs.h 37060 2007-03-13 18:10:39Z reichel $
00035  ***************************************************************************/
00036 
00037 #ifndef _CORE_COREDEFS_H_
00038 #define _CORE_COREDEFS_H_
00039 
00040 #include <CGAL/CORE/extLong.h>
00041 
00042 CORE_BEGIN_NAMESPACE
00043 
00045 // defined constants
00047 
00049 #define DEFAULT_CORE_LEVEL 3
00050 
00052 #define CORE_INFTY  (CORE_posInfty)
00053 
00055 // global precision parameters
00057 
00059 
00062 extern bool AbortFlag;
00063 
00065 
00069 extern int InvalidFlag;
00070 
00072 extern extLong EscapePrec;
00073 
00075 
00076 extern long EscapePrecFlag;
00077 
00079 
00081 extern bool EscapePrecWarning;
00082 
00083 // These following two values determine the precision of computing
00084 // approximations in Expr.
00085 
00087 extern extLong defRelPrec;
00089 extern extLong defAbsPrec;
00090 
00092 
00095 /*  QUESTION: the following comment seems to contradict the above comment:
00096         "controls the printout precision of std::cout for BigFloat"
00097     Perhaps, we should merge defOutputDigits and defBigFloatOutputDigits?
00098     */
00099 extern long defBigFloatOutputDigits;
00100 
00102 
00103 extern extLong defInputDigits;
00104 
00106 
00109 extern long defOutputDigits;
00110 
00112 
00113 extern long defBigFloatInputDigits;
00114 
00116 extern extLong defBFdivRelPrec;
00117 
00119 extern extLong defBFsqrtAbsPrec;
00120 
00122 // Mode parameters: incremental, progressive, filters
00124 
00126 extern bool fpFilterFlag;
00128 extern bool incrementalEvalFlag;
00130 extern bool progressiveEvalFlag;
00132 extern bool rationalReduceFlag;
00134 extern long defInitialProgressivePrec;
00135 
00137 // methods for setting global precision parameters
00138 //      including: scientific vs. positional format
00139 //      All the set methods return the previous global value if any
00141 
00143 
00145 inline void setDefaultPrecision(const extLong &r, const extLong &a) {
00146   defRelPrec = r;
00147   defAbsPrec = a;
00148 }
00149 
00151 inline extLong setDefaultRelPrecision(const extLong &r) {
00152   extLong old = defRelPrec;
00153   defRelPrec = r;
00154   return old;
00155 }
00156 
00158 inline extLong setDefaultAbsPrecision(const extLong &a) {
00159   extLong old = defAbsPrec;
00160   defAbsPrec = a;
00161   return old;
00162 }
00163 
00165 
00166 inline extLong setDefaultInputDigits(const extLong &d) {
00167   extLong old = defInputDigits;
00168   defInputDigits = d;
00169   return old;
00170 }
00171 
00173 inline long setDefaultOutputDigits(long d = defOutputDigits,
00174                                    std::ostream& o = std::cout) {
00175   long old = defOutputDigits;
00176   defOutputDigits = d;
00177   o.precision(d);
00178   return old;
00179 }
00180 
00182 inline long setDefaultBFInputDigits(long d) {
00183   long old = defBigFloatInputDigits;
00184   defBigFloatInputDigits = d;
00185   return old;
00186 }
00187 
00189 inline long setDefaultBFOutputDigits(long d) {
00190   long old = defBigFloatOutputDigits;
00191   defBigFloatOutputDigits = d;
00192   return old;
00193 }
00194 
00196 inline bool setFpFilterFlag(bool f) {
00197   bool oldf = fpFilterFlag;
00198   fpFilterFlag = f;
00199   return oldf;
00200 }
00201 
00203 inline bool setIncrementalEvalFlag(bool f) {
00204   bool oldf = incrementalEvalFlag;
00205   incrementalEvalFlag = f;
00206   return oldf;
00207 }
00208 
00210 inline bool setProgressiveEvalFlag(bool f) {
00211   bool oldf = progressiveEvalFlag;
00212   progressiveEvalFlag = f;
00213   return oldf;
00214 }
00215 
00217 inline long setDefInitialProgressivePrec(long n) {
00218   long oldn = defInitialProgressivePrec;
00219   defInitialProgressivePrec = n;
00220   return oldn;
00221 }
00222 
00224 inline bool setRationalReduceFlag(bool f) {
00225   bool oldf = rationalReduceFlag;
00226   rationalReduceFlag = f;
00227   return oldf;
00228 }
00229 
00231 
00236 inline void CORE_init(long d) {
00237   defAbsPrec = CORE_posInfty;
00238   defOutputDigits = d;
00239   std::setprecision(defOutputDigits);
00240 }
00241 
00243 inline void setScientificFormat(std::ostream& o = std::cout) {
00244   o.setf(std::ios::scientific, std::ios::floatfield);
00245 }
00246 
00248 inline void setPositionalFormat(std::ostream& o = std::cout) {
00249   o.setf(std::ios::fixed, std::ios::floatfield);
00250 }
00251 
00252 CORE_END_NAMESPACE
00253 #endif // _CORE_COREDEFS_H_
00254 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines