00001
00002
00003
00004 #if !defined (octave_Quad_options_h)
00005 #define octave_Quad_options_h 1
00006
00007 #include <cfloat>
00008 #include <cmath>
00009
00010
00011
00012 class
00013 Quad_options
00014 {
00015 public:
00016
00017 Quad_options (void) { init (); }
00018
00019 Quad_options (const Quad_options& opt) { copy (opt); }
00020
00021 Quad_options& operator = (const Quad_options& opt)
00022 {
00023 if (this != &opt)
00024 copy (opt);
00025
00026 return *this;
00027 }
00028
00029 ~Quad_options (void) { }
00030
00031 void init (void)
00032 {
00033 x_absolute_tolerance = ::sqrt (DBL_EPSILON);
00034 x_relative_tolerance = ::sqrt (DBL_EPSILON);
00035 x_single_precision_absolute_tolerance = ::sqrt (FLT_EPSILON);
00036 x_single_precision_relative_tolerance = ::sqrt (FLT_EPSILON);
00037 reset = true;
00038 }
00039
00040 void copy (const Quad_options& opt)
00041 {
00042 x_absolute_tolerance = opt.x_absolute_tolerance;
00043 x_relative_tolerance = opt.x_relative_tolerance;
00044 x_single_precision_absolute_tolerance = opt.x_single_precision_absolute_tolerance;
00045 x_single_precision_relative_tolerance = opt.x_single_precision_relative_tolerance;
00046 reset = opt.reset;
00047 }
00048
00049 void set_options (const Quad_options& opt) { copy (opt); }
00050
00051 void set_default_options (void) { init (); }
00052
00053 void set_absolute_tolerance (double val)
00054 { x_absolute_tolerance = val; reset = true; }
00055
00056 void set_relative_tolerance (double val)
00057 { x_relative_tolerance = val; reset = true; }
00058
00059 void set_single_precision_absolute_tolerance (float val)
00060 { x_single_precision_absolute_tolerance = val; reset = true; }
00061
00062 void set_single_precision_relative_tolerance (float val)
00063 { x_single_precision_relative_tolerance = val; reset = true; }
00064 double absolute_tolerance (void) const
00065 { return x_absolute_tolerance; }
00066
00067 double relative_tolerance (void) const
00068 { return x_relative_tolerance; }
00069
00070 float single_precision_absolute_tolerance (void) const
00071 { return x_single_precision_absolute_tolerance; }
00072
00073 float single_precision_relative_tolerance (void) const
00074 { return x_single_precision_relative_tolerance; }
00075
00076 private:
00077
00078 double x_absolute_tolerance;
00079 double x_relative_tolerance;
00080 float x_single_precision_absolute_tolerance;
00081 float x_single_precision_relative_tolerance;
00082
00083 protected:
00084
00085 bool reset;
00086 };
00087
00088 #endif