//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //===========================================================================

SmoothSurf.h

Go to the documentation of this file.
00001 #ifndef _SMOOTHSURF_H_
00002 #define _SMOOTHSURF_H_
00003 
00004 
00005 //   -----------------------------------------------------------------------
00006 //      Interface file for class SmoothSurf
00007 //   -----------------------------------------------------------------------
00008 //
00009 //       Used to modify a tensor product B-spline surface with respect
00010 //       to conditions on smoothness, editing constraints and boundary
00011 //       conditions.
00012 //
00013 //       Implementation of the member functions are given in the
00014 //       following files:
00015 //
00016 //          1. SmoothSurf.C
00017 //
00018 //   -----------------------------------------------------------------------
00019 //    Written by: Vibeke Skytt                            08-11.1993.
00020 //    Revised by: Vibeke Skytt                               09.1995
00021 //    Revised by: Vibeke Skytt                               04.1998
00022 //   -----------------------------------------------------------------------
00023 
00024 #include "GoTools/geometry/SplineSurface.h"
00025 #include "GoTools/creators/ConstraintDefinitions.h"
00026 
00027 #include <vector>
00028 
00029 
00030 namespace Go
00031 {
00032 
00035 class GO_API SmoothSurf
00036 {
00037 
00038 public:
00040     SmoothSurf();
00041 
00044     SmoothSurf(bool copy_coefs);
00045 
00047     virtual
00048     ~SmoothSurf();
00049 
00060     void attach(boost::shared_ptr<SplineSurface>& insf, int seem[], int coef_known[],
00061                 int num_side_constraints = 0, int has_normal_cond = 0);
00062 
00067     virtual
00068     void setOptimize(const double weight1, const double weight2,
00069                      const double weight3);
00070 
00080     void setLeastSquares(std::vector<double>& pnts,
00081                          std::vector<double>& param_pnts,
00082                          std::vector<double>& pnt_weights,
00083                          const double weight);
00084 
00095     int setNormalCond(std::vector<double>& pnts,
00096                       std::vector<double>& param_pnts,
00097                       std::vector<double>&  pnt_weights,
00098                       const double weight);
00099 
00104     void approxOrig(double weight);
00105 
00111     virtual
00112     void setPeriodicity(int pardir,
00113                        int cont,
00114                        double weight1,
00115                        double weight2);
00116 
00117 
00120     void setSideConstraints(std::vector<sideConstraint>& constraints);
00121 
00126     int equationSolve(boost::shared_ptr<SplineSurface>& surf);
00127 
00128 
00129 protected:
00130     int norm_dim_;         // If the problem has normal-conditions: 3, otherwise: 1
00131     int idim_;             // Dimension of geomtry space. 
00132     int kdim_;             // Dimension of homogeneous space.
00133     int idim1_;            // Dimension of projective space (for rationals).
00134     int ider_;             // Maximum derivative involved in the computations. 
00135     bool integralset_; //
00136 
00137     // Rational case
00138     bool rational_;    // Is surface rational?
00139     boost::shared_ptr<SplineSurface> bspline_surface_; // 1-dimensional rational surface with
00140                                                        // 0's as control values, and weights from 
00141                                                        // input surface. Used to calculate B-spline
00142                                                        // products for the rational case
00143 
00144     int cont_seem_[2];     // Number of rows affected by continuity at a seem
00145     // for each parameter direction.
00146     int kncond_;           // Size of matrix system (# unknown coefficents + # side constraints)
00147     int knconstraint_;     // Number of side constraints.
00148     const int kpointer_; // If coefknown_[ki] >= kpointer_, the coefficients indexed by
00149                    // ki & coefknown_[ki] - kpointer_ should be equal.
00150 
00151     int *coefknown_; // Array indicating the status of coefficients, i.e.
00152                      // free, fixed, not involved, equal to a given coefficients.
00153                      // 0: not known, 1: known, 2: not of interest (i.e. assumed known).
00154                      // >= kpointer_: the coefficients indexed by
00155                      //               ki & coefknown_[ki] - kpointer_ should be equal.
00156     std::vector<int> pivot_;    // Array giving the position of the free coefficients
00157     // in the equation system.
00158 
00159     // Parameters defining the spline space.
00160     boost::shared_ptr<SplineSurface> srf_;        // Pointer to input surface.
00161     int kk1_, kk2_;         // Order of surface in both parameter directions.    
00162     int kn1_, kn2_;         // Number of coefficients of surface.                
00163     std::vector<double>::const_iterator st1_;    // Pointer to knot vector of 
00164     // surface in 1. par. dir. 
00165     std::vector<double>::const_iterator st2_;    // Pointer to knot vector of 
00166     // surface in 2. par. dir. 
00167 
00168     const bool copy_coefs_;
00169 
00171     std::vector<double> coef_array_; // Only used if copy_coefs_ == true
00172     std::vector<double>::iterator scoef_;   // Pointer to surface coefficients.      
00173 
00175     std::vector<double> gmat_;         // Matrix at left side of equation system.  
00176     std::vector<double> gright_;       // Right side of equation system.      
00177 
00179     virtual
00180     void releaseScratch(); 
00181 
00183     virtual
00184     void prepareIntegral();
00185 
00197     virtual
00198     void getBasis(const double *sb1, const double *sb2, int kleft1, int kleft2,
00199                   int ider, double *sbasis);
00200 
00204     void preparePeriodicity(int seem[]);
00205 
00210     void setOptimizeNonrational(const double weight1, const double weight2,
00211                                 const double weight3);
00212 
00217     void setOptimizeRational(const double weight1, const double weight2,
00218                              const double weight3);
00219 
00225     void approxOrigNonrational(double weight);
00226 
00232     void approxOrigRational(double weight);
00233 
00236     void setC1AtSeem(int pardir, double weight);
00237 
00240     void setC2AtSeem(int pardir, double weight);
00241 
00244     void setRationalCnAtSeem(int pardir, int cn, double weight1, double weight2);
00245 
00248     virtual
00249     int adjustAtSeem();
00250 
00251 
00252 private:
00253 
00254     // Parameters used in integration
00255     std::vector<double> vec1_, vec2_;
00256     double ***integral1_;  // Array used to store integrals of inner product
00257     // of derivatives of B-splines in 1. par. dir.  
00258     double ***integral2_;  // Array used to store integrals of inner product
00259     // of derivatives of B-splines in 2. par. dir.  
00260 
00261 
00262 }; // end of class SmoothSurf
00263 
00264 
00265 } // end of namespace Go
00266 
00267 #endif
Generated on Tue Sep 21 15:44:16 2010 for GoTools Core by  doxygen 1.6.3