00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef _GOSMOOTHSURFSET_H_
00034 #define _GOSMOOTHSURFSET_H_
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #include "SplineSurface.h"
00055 #include "ConstraintDefinitions.h"
00056 #include <vector>
00057
00058 namespace Go
00059 {
00062
00063
00066 class SmoothSurfSet
00067 {
00068
00069
00070 public:
00072 SmoothSurfSet();
00073
00076 SmoothSurfSet(bool copy_coefs);
00077
00079 virtual
00080 ~SmoothSurfSet();
00081
00092 void attach(std::vector<boost::shared_ptr<SplineSurface> >& insf,
00093 std::vector<std::vector<int> >& coef_known,
00094 int num_side_constraints = 0,
00095 int has_normal_cond = 0);
00096
00097
00098
00104 virtual
00105 void setOptimize(double weight1, double weight2, double weight3);
00106
00117 void setLeastSquares(std::vector<std::vector<double> >& pnts,
00118 std::vector<std::vector<double> >& param_pnts,
00119 std::vector<std::vector<double> >& pnt_weights,
00120 double weight);
00121
00132 int setNormalCond(std::vector<std::vector<double> >& pnts,
00133 std::vector<std::vector<double> >& param_pnts,
00134 std::vector<std::vector<double> >& pnt_weights,
00135 double weight);
00136
00141 void approxOrig(double weight);
00142
00145 void setSideConstraints(std::vector<sideConstraintSet>& constraints);
00146
00147
00148
00149
00150
00151
00153 void setApproxSideConstraints(std::vector<sideConstraintSet>& constraints,
00154 double weight);
00155
00160 int equationSolve(std::vector<boost::shared_ptr<SplineSurface> >& surfaces);
00161
00162
00163 protected:
00164 int kdim_;
00165 int idim_;
00166 int idim1_;
00167 int ider_;
00168
00169 int kncond_;
00170 int knconstraint_;
00171
00172 std::vector<std::vector<int>::iterator> coef_known_;
00173
00174
00175
00176 std::vector<std::vector<int> > pivot_;
00177
00178
00179
00180 std::vector<boost::shared_ptr<SplineSurface> > srfs_;
00181
00182 const int copy_coefs_;
00183
00184
00185
00186 std::vector<std::vector<double> > coef_array_;
00187
00188
00189
00190
00191 std::vector<double> gmat_;
00192 std::vector<double> gright_;
00193
00207 virtual
00208 void getBasis(double *sb1, double *sb2, int kk1, int kk2,
00209 int kleft1, int kleft2, int ider, double *sbasis);
00210
00211
00212 private:
00213
00215 typedef struct integralInfo
00216 {
00217
00218 std::vector<double> vec1, vec2;
00219 double ***integral1;
00220
00221
00222 double ***integral2;
00223
00224
00225 bool integralset;
00226 int der;
00227
00229 integralInfo()
00230 { integral1 = 0; integral2 = 0; integralset = false; der = -1; }
00231
00233 ~integralInfo()
00234 { erase(); }
00235
00240 void resize(int ider, int in1, int in2)
00241 {
00242 int ki, kj;
00243 vec1.resize((ider+1)*in1*in1);
00244 vec2.resize((ider+1)*in2*in2);
00245 std::fill(vec1.begin(), vec1.end(), 0.0);
00246 std::fill(vec2.begin(), vec2.end(), 0.0);
00247
00248 integral1 = new double**[ider+1];
00249 integral2 = new double**[ider+1];
00250
00251 for (ki=0; ki<=ider; ki++)
00252 {
00253 integral1[ki] = new double*[in1];
00254 integral2[ki] = new double*[in2];
00255
00256 for (kj=0; kj<in1; kj++)
00257 integral1[ki][kj] = &vec1[(ki*in1+kj)*in1];
00258
00259 for (kj=0; kj<in2; kj++)
00260 integral2[ki][kj] = &vec2[(ki*in2+kj)*in2];
00261 }
00262
00263 integralset = 0;
00264 der = ider;
00265 }
00266
00268 void erase()
00269 {
00270 int ki;
00271 for (ki=0; ki<=der; ki++)
00272 {
00273 delete [] integral1[ki];
00274 delete [] integral2[ki];
00275 }
00276 delete [] integral1;
00277 delete [] integral2;
00278 integralset = false;
00279 }
00280 } integralInfo;
00281
00282 std::vector<integralInfo> surf_integral_;
00283
00288 void removeKnownCoefs(std::vector<sideConstraintSet>& constraints) const;
00289
00290 };
00291
00293 }
00294
00295 #endif //
00296