SingularityInfo.h

00001 //===========================================================================
00002 // GoTools - SINTEF Geometry Tools
00003 //
00004 // GoTools module: Intersections, version 1.0
00005 //
00006 // Copyright (C) 2000-2007 SINTEF ICT, Applied Mathematics, Norway.
00007 //
00008 // This program is free software; you can redistribute it and/or          
00009 // modify it under the terms of the GNU General Public License            
00010 // as published by the Free Software Foundation version 2 of the License. 
00011 //
00012 // This program is distributed in the hope that it will be useful,        
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of         
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          
00015 // GNU General Public License for more details.                           
00016 //
00017 // You should have received a copy of the GNU General Public License      
00018 // along with this program; if not, write to the Free Software            
00019 // Foundation, Inc.,                                                      
00020 // 59 Temple Place - Suite 330,                                           
00021 // Boston, MA  02111-1307, USA.                                           
00022 //
00023 // Contact information: E-mail: tor.dokken@sintef.no                      
00024 // SINTEF ICT, Department of Applied Mathematics,                         
00025 // P.O. Box 124 Blindern,                                                 
00026 // 0314 Oslo, Norway.                                                     
00027 //
00028 // Other licenses are also available for this software, notably licenses
00029 // for:
00030 // - Building commercial software.                                        
00031 // - Building software whose source code you wish to keep private.        
00032 //===========================================================================
00033 #ifndef _SINGULARITYINFO_H
00034 #define _SINGULARITYINFO_H
00035 
00036 
00037 #include "Point.h"
00038 #include <vector>
00039 #include <boost/shared_ptr.hpp>
00040 
00041 
00042 namespace Go {
00045 
00046 
00047 
00050 
00051 class SingularityInfo {
00052 public:
00054     SingularityInfo();
00055 
00060     SingularityInfo(boost::shared_ptr<SingularityInfo> previous,
00061                     bool use_previous = false);
00062 
00069     SingularityInfo(boost::shared_ptr<SingularityInfo> previous,
00070                     int missing_dir);
00071 
00075     bool hasPoint()
00076     { return (param_sing_.size() > 0); }
00077 
00081     int getNmbPoints(int nmb_par)
00082     { return param_sing_.size()/nmb_par; }
00083 
00087     double getParam(int dir);
00088 
00090     void addIterationCount()
00091     { 
00092         nmb_iter_++; 
00093         iteration_done_ = true;
00094     }
00095 
00102     void addSimpleCount(bool simple1, bool simple2)
00103     {
00104         if (simple1)
00105             nmb_simple1_++;
00106         if (simple2)
00107             nmb_simple2_++;
00108     }
00109 
00113     void setSingularPoint(double* par, int nmb_par);
00114 
00118     void addSingularPoint(double* par, int nmb_par);
00119 
00124     Point getPoint(int idx, int nmb_par);
00125 
00128     bool iterationDone()
00129     { return iteration_done_; }
00130 
00133     bool iterationSucceed()
00134     { return iteration_succeed_; }
00135 
00139     int nmbSimple1()
00140     { return nmb_simple1_; }
00141 
00145     int nmbSimple2()
00146     { return nmb_simple2_; }
00147 
00151     void setHighPriSing(double* par, int nmb_par);
00152 
00155     void setHighPriSingType(SingularityClassification type)
00156     { high_pri_type_ = type; }
00157                   
00160     SingularityClassification hasHighPriSing()
00161     { return (high_pri_sing_.size() == 0) ? NO_SING : high_pri_type_; }
00162 
00167     double getHighPriSing(int idx)
00168     { return high_pri_sing_[idx]; }
00169 
00172     std::vector<double> getHighPriSing()
00173     { return high_pri_sing_; }
00174 
00175     // Remove singularities outside the current domain
00176     void cleanUp(std::vector<double> start,
00177                  std::vector<double> end,
00178                  double tol);
00179 
00180 private:
00181     // Data members
00182 
00183     // Number of iterations for singularity or closest point performed
00184     // downward in the recursion
00185     int nmb_iter_;   
00186 
00187     // How often this iteration has succeeded
00188     int nmb_success_;
00189 
00190     // How often the first intersection object is characterized as
00191     // simple (only relevant in surface-surface intersection)
00192     int nmb_simple1_;
00193 
00194     // How often the second intersection object (if any) is
00195     // characterized as simple (only relevant in surface-surface
00196     // intersection)
00197     int nmb_simple2_;
00198 
00199     // Last found singularity or closest point (parameter values)
00200     std::vector<double> param_sing_;
00201 
00202     // If any iteration for singularity or closest point is performed
00203     // at this recursion level
00204     bool iteration_done_;
00205 
00206     // If the last iteration found a singularity
00207     bool iteration_succeed_;
00208 
00209     // Existence of high priority singularity
00210     SingularityClassification high_pri_type_;
00211 
00212     // Parameter of high priority singularity
00213     std::vector<double> high_pri_sing_;
00214 };
00215 
00216 
00218 } // namespace Go
00219 
00220 
00221 #endif // _SINGULARITYINFO_H
00222 
00223 

Generated on Fri Nov 23 12:24:33 2007 for GoTools Intersections Library by  doxygen 1.5.1