VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkPolynomialSolversUnivariate.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 ========================================================================= 00015 Copyright 2007 Sandia Corporation. 00016 Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00017 license for use of this work by or on behalf of the 00018 U.S. Government. Redistribution and use in source and binary forms, with 00019 or without modification, are permitted provided that this Notice and any 00020 statement of authorship are reproduced on all copies. 00021 00022 Contact: pppebay@sandia.gov,dcthomp@sandia.gov 00023 00024 =========================================================================*/ 00051 #ifndef __vtkPolynomialSolversUnivariate_h 00052 #define __vtkPolynomialSolversUnivariate_h 00053 00054 #include "vtkObject.h" 00055 00056 class VTK_COMMON_EXPORT vtkPolynomialSolversUnivariate : public vtkObject 00057 { 00058 public: 00059 static vtkPolynomialSolversUnivariate *New(); 00060 vtkTypeRevisionMacro(vtkPolynomialSolversUnivariate,vtkObject); 00061 void PrintSelf(ostream& os, vtkIndent indent); 00062 static ostream& PrintPolynomial( ostream& os, double* P, int degP ); 00063 00065 00092 static int HabichtBisectionSolve( 00093 double* P, int d, double* a, double* upperBnds, double tol ); 00094 static int HabichtBisectionSolve( 00095 double* P, int d, double* a, double* upperBnds, double tol, 00096 int intervalType ); 00097 static int HabichtBisectionSolve( 00098 double* P, int d, double* a, double* upperBnds, double tol, 00099 int intervalType, bool divideGCD ); 00101 00103 00124 static int SturmBisectionSolve( 00125 double* P, int d, double* a, double* upperBnds, double tol ); 00126 static int SturmBisectionSolve( 00127 double* P, int d, double* a, double* upperBnds, double tol, 00128 int intervalType ); 00129 static int SturmBisectionSolve( 00130 double* P, int d, double* a, double* upperBnds, double tol, 00131 int intervalType, bool divideGCD ); 00133 00135 00140 static int FilterRoots( 00141 double* P, int d, double *upperBnds, int rootcount, double diameter ); 00143 00152 static int LinBairstowSolve( double* c, int d, double* r, double& tolerance ); 00153 00162 static int FerrariSolve( double* c, double* r, int* m, double tol ); 00163 00176 static int TartagliaCardanSolve( double* c, double* r, int* m, double tol ); 00177 00179 00183 static void SetDivisionTolerance( double tol ); 00184 static double GetDivisionTolerance(); 00186 00187 protected: 00188 vtkPolynomialSolversUnivariate() {}; 00189 ~vtkPolynomialSolversUnivariate() {}; 00190 00191 static double DivisionTolerance; 00192 00193 private: 00194 vtkPolynomialSolversUnivariate(const vtkPolynomialSolversUnivariate&); // Not implemented. 00195 void operator=(const vtkPolynomialSolversUnivariate&); // Not implemented. 00196 }; 00197 00198 #ifndef DBL_EPSILON 00199 # define VTK_DBL_EPSILON 2.2204460492503131e-16 00200 #else // DBL_EPSILON 00201 # define VTK_DBL_EPSILON DBL_EPSILON 00202 #endif // DBL_EPSILON 00203 00204 #ifndef DBL_MIN 00205 # define VTK_DBL_MIN 2.2250738585072014e-308 00206 #else // DBL_MIN 00207 # define VTK_DBL_MIN DBL_MIN 00208 #endif // DBL_MIN 00209 00210 #endif