Changeset 2506 in Sophya
- Timestamp:
- Mar 15, 2004, 5:46:56 PM (22 years ago)
- Location:
- trunk/SophyaLib/NTools
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/NTools/cspline.cc
r2322 r2506 44 44 if( x != NULL && y != NULL) ComputeCSpline(); 45 45 46 END_CONSTRUCTOR47 46 } 48 47 … … 56 55 , YP1(yp1), YPn(ypn), X(NULL), Y(NULL), Y2(NULL), tmp(NULL) 57 56 { 58 END_CONSTRUCTOR59 57 } 60 58 … … 125 123 printf("CSpline::SetNewTab_Erreur: X[%d]>=X[%d] (%g>=%g)\n" 126 124 ,i-1,i,X[i-1],X[i]); 127 THROW(inconsistentErr);125 throw ParmError(PExcLongMessage("")); 128 126 } 129 127 } … … 219 217 if( corrupt_Y2 ) { 220 218 cout<<"CSpline::CSplineInt: calcul des coef du spline corrupted"<<endl; 221 THROW(inconsistentErr);219 throw ParmError(PExcLongMessage("")); 222 220 } 223 221 … … 234 232 cout<<"CSpline::CSplineInt: pout khi="<<khi<<" klo="<<klo 235 233 <<" memes valeurs de X[]: "<<X[khi]<<endl; 236 THROW(inconsistentErr);234 throw ParmError(PExcLongMessage("")); 237 235 } 238 236 … … 293 291 if( x1 != NULL && x2 != NULL && y != NULL) ComputeCSpline(); 294 292 295 END_CONSTRUCTOR296 293 } 297 294 … … 306 303 , Nel_S(0), S(NULL), Sint(NULL), tmp(NULL) 307 304 { 308 END_CONSTRUCTOR309 305 } 310 306 … … 391 387 { printf("CSpline::SetNewTab_Erreur: X1[%d]>=X1[%d] (%g>=%g)\n" 392 388 ,i-1,i,X1[i-1],X1[i]); 393 THROW(inconsistentErr); }389 throw ParmError(PExcLongMessage("")); } 394 390 for(int j=0;j<Nel2;j++) Ytmp[j*Nel1+i] = y[j*Nel1+ind[i]]; 395 391 } … … 402 398 { printf("CSpline::SetNewTab_Erreur: X2[%d]>=X2[%d] (%g>=%g)\n" 403 399 ,j-1,j,X2[j-1],X2[j]); 404 THROW(inconsistentErr); }400 throw ParmError(PExcLongMessage("")); } 405 401 for(int i=0;i<Nel1;i++) Y[j*Nel1+i] = Ytmp[j*Nel1+ind[i]]; 406 402 } -
trunk/SophyaLib/NTools/dates.cc
r2322 r2506 44 44 #endif 45 45 SetZone(p); 46 END_CONSTRUCTOR;47 46 } 48 47 … … 54 53 { 55 54 SetZone(nom); 56 END_CONSTRUCTOR57 55 } 58 56 … … 94 92 dstStopMonth = Date::mois_Mars; 95 93 dstOffset = 1; 96 } else THROW(parmErr);94 } else throw ParmError("TimeZone::SetZone() "); 97 95 } 98 96 … … 104 102 { 105 103 Date dt = date; 106 if (dt.MM < 0 || dt.JJ < 0) THROW(inconsistentErr)104 if (dt.MM < 0 || dt.JJ < 0) throw ParmError(PExcLongMessage("")); 107 105 if (dt.hh >= 0) dt += gmtOffset/24.0; // date "fictive" en local d'hiver 108 106 else dt.ss = dt.hh = dt.mm = 0; // minuit local si heure indeterminee … … 185 183 //-- 186 184 { 187 if (mois<1 || mois>12) THROW(inconsistentErr);185 if (mois<1 || mois>12) throw ParmError(PExcLongMessage("")); 188 186 189 187 switch(mois) { … … 265 263 //-- 266 264 { 267 if (UndetTime() && !AllUndetTime()) THROW(inconsistentErr);268 if (UndetDate() && !AllUndetDate()) THROW(inconsistentErr);265 if (UndetTime() && !AllUndetTime()) throw ParmError(PExcLongMessage("")); 266 if (UndetDate() && !AllUndetDate()) throw ParmError(PExcLongMessage("")); 269 267 double t=0; 270 268 if (!UndetDate()) { … … 341 339 ss = TM->tm_sec; 342 340 nuit = 0; 343 END_CONSTRUCTOR344 341 } 345 342 … … 351 348 : JJ(J), MM(M), AA(A), hh(h), mm(m), ss(s), timeZone(gTimeZone), nuit(0) 352 349 { 353 END_CONSTRUCTOR354 350 } 355 351 … … 364 360 { 365 361 Set(t); 366 END_CONSTRUCTOR367 362 } 368 363 … … 388 383 { 389 384 Set(date,heure,tOpt); 390 END_CONSTRUCTOR391 385 } 392 386 … … 403 397 { 404 398 Set(date,heure,tOpt); 405 END_CONSTRUCTOR406 399 } 407 400 … … 435 428 if (p[0] == '?' && (p[1] == '?' || p[1] == '/')) JJ = -1; 436 429 else { 437 if (!isdigit(p[0])) THROW(inconsistentErr);438 if (!isdigit(p[1]) && p[1] != '/') THROW(inconsistentErr);430 if (!isdigit(p[0])) ParmError(PExcLongMessage("")); 431 if (!isdigit(p[1]) && p[1] != '/') ParmError(PExcLongMessage("")); 439 432 JJ = atoi(p); 440 if (JJ <= 0) THROW(inconsistentErr);433 if (JJ <= 0) ParmError(PExcLongMessage("")); 441 434 } 442 435 443 436 if (p[1] == '/') p += 2; 444 437 else if (p[2] == '/') p+= 3; 445 else THROW(inconsistentErr);438 else ParmError(PExcLongMessage("")); 446 439 447 440 if (p[0] == '?' && (p[1] == '?' || p[1] == '/')) MM = -1; 448 441 else { 449 if (!isdigit(p[0])) THROW(inconsistentErr);450 if (!isdigit(p[1]) && p[1] != '/') THROW(inconsistentErr);442 if (!isdigit(p[0])) ParmError(PExcLongMessage("")); 443 if (!isdigit(p[1]) && p[1] != '/') ParmError(PExcLongMessage("")); 451 444 MM = atoi(p); 452 if (MM <= 0 || MM >12) THROW(inconsistentErr);445 if (MM <= 0 || MM >12) ParmError(PExcLongMessage("")); 453 446 } 454 447 455 448 if (p[1] == '/') p += 2; 456 449 else if (p[2] == '/') p+= 3; 457 else THROW(inconsistentErr);450 else ParmError(PExcLongMessage("")); 458 451 459 452 if (p[0] == '?') AA = -1; 460 453 else { 461 if (!isdigit(p[0])) THROW(inconsistentErr);462 if (!isdigit(p[1])) THROW(inconsistentErr);454 if (!isdigit(p[0])) ParmError(PExcLongMessage("")); 455 if (!isdigit(p[1])) ParmError(PExcLongMessage("")); 463 456 AA = atoi(p); 464 457 if (AA < 100 && AA >= 0 && date[6] != '0') AA += 1900; 465 458 } 466 459 467 if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA)) THROW(inconsistentErr);460 if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA)) ParmError(PExcLongMessage("")); 468 461 469 462 } else if (strlen(date)==4) { // Code EROS de date 470 463 if (date[0] == '?') AA = -1; 471 464 else { 472 if (!isdigit(date[0])) THROW(inconsistentErr);465 if (!isdigit(date[0])) ParmError(PExcLongMessage("")); 473 466 AA = 1990 + date[0] - '0'; 474 467 } … … 476 469 if (date[1] == '?') MM = -1; 477 470 else { 478 if (!isalpha(date[1])) THROW(inconsistentErr);471 if (!isalpha(date[1])) ParmError(PExcLongMessage("")); 479 472 if (islower(date[1])) 480 473 MM = date[1] - 'a' + 1; 481 474 else 482 475 MM = date[1] - 'A' + 1; 483 if (MM<1 || MM>12) THROW(inconsistentErr);476 if (MM<1 || MM>12) ParmError(PExcLongMessage("")); 484 477 } 485 478 486 479 if (date[2] == '?' && date[3] == '?') JJ = -1; 487 480 else { 488 if (!isdigit(date[2])) THROW(inconsistentErr);489 if (!isdigit(date[3])) THROW(inconsistentErr);481 if (!isdigit(date[2])) ParmError(PExcLongMessage("")); 482 if (!isdigit(date[3])) ParmError(PExcLongMessage("")); 490 483 JJ = atoi(date+2); 491 484 } 492 485 493 if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA)) THROW(inconsistentErr);486 if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA)) ParmError(PExcLongMessage("")); 494 487 nuit = 1; 495 } else THROW(inconsistentErr); // Mauvaise longueur488 } else ParmError(PExcLongMessage("")); // Mauvaise longueur 496 489 } else { // Pas de date 497 490 JJ = MM = AA = -1; … … 502 495 if (p[0] == '?' && (p[1] == '?' || p[1] == ':')) hh = -1; 503 496 else { 504 if (!isdigit(p[0])) THROW(inconsistentErr);505 if (!isdigit(p[1]) && p[1] != ':') THROW(inconsistentErr);497 if (!isdigit(p[0])) ParmError(PExcLongMessage("")); 498 if (!isdigit(p[1]) && p[1] != ':') ParmError(PExcLongMessage("")); 506 499 hh = atoi(p); 507 500 } … … 509 502 if (p[1] == ':') p += 2; 510 503 else if (p[2] == ':') p+= 3; 511 else THROW(inconsistentErr);504 else ParmError(PExcLongMessage("")); 512 505 513 506 if (p[0] == '?' && (p[1] == '?' || p[1] == ':')) mm = -1; 514 507 else { 515 if (!isdigit(p[0])) THROW(inconsistentErr);516 if (!isdigit(p[1]) && p[1] != '/') THROW(inconsistentErr);508 if (!isdigit(p[0])) ParmError(PExcLongMessage("")); 509 if (!isdigit(p[1]) && p[1] != '/') ParmError(PExcLongMessage("")); 517 510 mm = atoi(p); 518 511 } … … 520 513 if (p[1] == ':') p += 2; 521 514 else if (p[2] == ':') p+= 3; 522 else THROW(inconsistentErr);515 else ParmError(PExcLongMessage("")); 523 516 524 517 if (p[0] == '?') ss = -1; 525 518 else { 526 if (!isdigit(p[0])) THROW(inconsistentErr);519 if (!isdigit(p[0])) ParmError(PExcLongMessage("")); 527 520 ss = atoi(p); 528 521 } … … 585 578 586 579 if (dt.AA != -1) { 587 if (dt.AA < 1990 || dt.AA > 2016) THROW(inconsistentErr);580 if (dt.AA < 1990 || dt.AA > 2016) ParmError(PExcLongMessage("")); 588 581 int i = dt.AA - 1990; 589 582 if (i<10) … … 771 764 //-- 772 765 { 773 if (a.UndetTime() != b.UndetTime()) THROW(inconsistentErr);774 if (a.UndetDate() != b.UndetDate()) THROW(inconsistentErr);766 if (a.UndetTime() != b.UndetTime()) ParmError(PExcLongMessage("")); 767 if (a.UndetDate() != b.UndetDate()) ParmError(PExcLongMessage("")); 775 768 return a.GetDays() - b.GetDays(); 776 769 } -
trunk/SophyaLib/NTools/generaldata.cc
r2344 r2506 95 95 } 96 96 97 END_CONSTRUCTOR98 97 } 99 98 … … 106 105 , BuffVar(NULL), BuffVarR4(NULL) 107 106 { 108 END_CONSTRUCTOR109 107 } 110 108 -
trunk/SophyaLib/NTools/generalfit.cc
r2407 r2506 39 39 deltaParm = new double[nPar]; 40 40 tmpParm = new double[nPar]; 41 END_CONSTRUCTOR42 41 } 43 42 … … 197 196 ASSERT( nPar>0 ); 198 197 deltaParm = new double[nPar]; 199 END_CONSTRUCTOR200 198 } 201 199 … … 329 327 } ENDTRY 330 328 331 END_CONSTRUCTOR332 329 } 333 330 … … 371 368 } ENDTRY 372 369 373 END_CONSTRUCTOR374 370 } 375 371 … … 452 448 #endif 453 449 FileStep = fopen(filename,"w"); 454 if(FileStep==NULL) THROW(nullPtrErr);450 if(FileStep==NULL) throw NullPtrError("GeneralFit::WriteStep()"); 455 451 } 456 452 -
trunk/SophyaLib/NTools/imageop.cc
r832 r2506 29 29 #define CHECKIMG2(_img_,_x_,_y_) \ 30 30 if ((_x_ >= (_img_).siz_x) || (_y_ >= (_img_).siz_y) || \ 31 (_x_ < 0) || (_y_ < 0)) THROW(rangeCheckErr); \32 if (!(_img_).ImagePtr()) THROW(nullPtrErr)31 (_x_ < 0) || (_y_ < 0)) throw RangeCheckError("imageop.cc - CHECKIMG2") ; \ 32 if (!(_img_).ImagePtr()) throw NullPtrError("imageop.cc - CHECKIMG2") 33 33 #else 34 34 #if defined(IMGVOIDCHECK) -
trunk/SophyaLib/NTools/integ.cc
r2423 r2506 444 444 GLInteg::AddBound(double x) 445 445 { 446 if (x<=mXMin || x>=mXMax) THROW(rangeCheckErr);446 if (x<=mXMin || x>=mXMax) throw RangeCheckError("GLInteg::AddBound()") ; 447 447 // On introduira les classes d'exections apres reflexion et de maniere systematique (Rz+cmv) 448 448 // if (x<=mXMin || x>=mXMax) throw range_error("GLInteg::AddBound bound outside interval"); -
trunk/SophyaLib/NTools/perandom.cc
r2322 r2506 27 27 for(int_4 j=0; j<nBin; j++) 28 28 (*this)(j) /= (*this)(nBin-1); 29 END_CONSTRUCTOR30 29 } 31 30 … … 48 47 for(int_4 j=0; j<nBin; j++) 49 48 (*this)(j) /= (*this)(nBin-1); 50 END_CONSTRUCTOR51 49 } 52 50 … … 65 63 for(int_4 j=0; j<nBin; j++) 66 64 (*this)(j) /= (*this)(nBin-1); 67 END_CONSTRUCTOR68 65 } 69 66 … … 151 148 152 149 nx = nBinX; 153 END_CONSTRUCTOR154 150 } 155 151 … … 179 175 delete[] tabX; 180 176 nx = nBinX; 181 END_CONSTRUCTOR182 177 } 183 178 -
trunk/SophyaLib/NTools/poly.cc
r2344 r2506 20 20 : TVector<r_8>(degre+1), dirty(0), deg(0) 21 21 { 22 END_CONSTRUCTOR23 22 } 24 23 … … 27 26 :TVector<r_8>(a), dirty(a.dirty), deg(a.deg) 28 27 { 29 END_CONSTRUCTOR30 28 } 31 29 … … 96 94 return Root2(roots(0),roots(1)); 97 95 default : 98 THROW(parmErr);96 throw ParmError("Poly::Roots()") ; 99 97 } 100 98 } … … 106 104 { 107 105 UpdateDegIfDirty(); 108 if (deg != 1) THROW(sizeMismatchErr);106 if (deg != 1) ParmError("Poly::Root1() deg!= 1") ; 109 107 110 108 if (Element(1) == 0) return 0; … … 118 116 { 119 117 UpdateDegIfDirty(); 120 if (deg != 2) THROW(sizeMismatchErr);118 if (deg != 2) throw SzMismatchError("Poly::Root2() deg != 2") ; 121 119 122 120 double delta = Element(1)*Element(1) - 4*Element(0)*Element(2); … … 227 225 { 228 226 int n = x.NElts(); 229 if (n != (int)y.NElts()) THROW(sizeMismatchErr);227 if (n != (int)y.NElts()) throw SzMismatchError("Poly::Fit() "); 230 228 231 229 Realloc(degre); … … 262 260 { 263 261 int n = x.NElts(); 264 if (n != (int)y.NElts()) THROW(sizeMismatchErr);265 if (n != (int)erry2.NElts()) THROW(sizeMismatchErr);262 if (n != (int)y.NElts()) throw SzMismatchError("Poly::Fit() "); 263 if (n != (int)erry2.NElts()) throw SzMismatchError("Poly::Fit() ") ; 266 264 267 265 Realloc(degre); … … 288 286 Poly Poly::power(int n) const // a accelerer !!! 289 287 { 290 if (n < 0) THROW(rangeCheckErr);288 if (n < 0) throw RangeCheckError("Poly::power() n<0 "); 291 289 if (n == 0) { Poly r(0); r[0] = 1; return r;} 292 290 if (n == 1) { return *this; } … … 358 356 maxDegX(degreX), maxDegY(degreY), degX(0), degY(0), deg(0) 359 357 { 360 END_CONSTRUCTOR361 358 } 362 359 … … 370 367 for (int j=0; j<=degY; j++) 371 368 Coef(i,j) = polX[i]*polY[j]; 372 END_CONSTRUCTOR373 369 } 374 370 … … 379 375 degX(a.degX), degY(a.degY), deg(a.deg) 380 376 { 381 END_CONSTRUCTOR382 377 } 383 378 … … 467 462 { 468 463 int n = x.NElts(); 469 if (n != (int)y.NElts()) THROW(sizeMismatchErr);470 if (n != (int)z.NElts()) THROW(sizeMismatchErr);464 if (n != (int)y.NElts()) throw SzMismatchError("Poly2::Fit() - 1"); 465 if (n != (int)z.NElts()) throw SzMismatchError("Poly2::Fit() - 2"); 471 466 472 467 Realloc(degreX, degreY); … … 510 505 { 511 506 int n = x.NElts(); 512 if (n != (int)y.NElts()) THROW(sizeMismatchErr);513 if (n != (int)z.NElts()) THROW(sizeMismatchErr);514 if (n != (int)errz2.NElts()) THROW(sizeMismatchErr);507 if (n != (int)y.NElts()) throw SzMismatchError("Poly2::Fit() - 3"); 508 if (n != (int)z.NElts()) throw SzMismatchError("Poly2::Fit() - 4"); 509 if (n != (int)errz2.NElts()) throw SzMismatchError("Poly2::Fit() - 5"); 515 510 516 511 Realloc(degreX, degreY); … … 551 546 { 552 547 int n = x.NElts(); 553 if (n != (int)y.NElts()) THROW(sizeMismatchErr);554 if (n != (int)z.NElts()) THROW(sizeMismatchErr);548 if (n != (int)y.NElts()) throw SzMismatchError("Poly2::Fit() - 6"); 549 if (n != (int)z.NElts()) throw SzMismatchError("Poly2::Fit() - 7"); 555 550 556 551 Realloc(degre, degre); // certains vaudront 0, impose. … … 604 599 { 605 600 int n = x.NElts(); 606 if (n != (int)y.NElts()) THROW(sizeMismatchErr);607 if (n != (int)z.NElts()) THROW(sizeMismatchErr);608 if (n != (int)errz2.NElts()) THROW(sizeMismatchErr);601 if (n != (int)y.NElts()) throw SzMismatchError("Poly2::Fit() - 8"); 602 if (n != (int)z.NElts()) throw SzMismatchError("Poly2::Fit() - 9"); 603 if (n != (int)errz2.NElts()) throw SzMismatchError("Poly2::Fit() - 10"); 609 604 610 605 Realloc(degre, degre); … … 733 728 Poly2 Poly2::power(int n) const 734 729 { 735 if (n < 0) THROW(rangeCheckErr);730 if (n < 0) throw RangeCheckError("Poly2::power(n<0) "); 736 731 if (n == 0) { Poly2 r(0); r.Coef(0,0) = 1; return r;} 737 732 if (n == 1) { return *this; } -
trunk/SophyaLib/NTools/poly.h
r1584 r2506 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: poly.h,v 1.1 0 2001-07-19 08:33:49ansari Exp $3 // $Id: poly.h,v 1.11 2004-03-15 16:46:56 ansari Exp $ 4 4 // 5 5 … … 176 176 //! Return index of coefficient of X^dx * Y^dy in the vector 177 177 inline int IndCoef(int dx, int dy) const { 178 if (dx>maxDegX || dy>maxDegY) THROW(rangeCheckErr);178 if (dx>maxDegX || dy>maxDegY) throw RangeCheckError("Poly2::IndCoef()"); 179 179 return dx + (maxDegX+1)*dy; 180 180 } … … 189 189 //! Return coefficient of X^dx * Y^dy 190 190 inline double& Coef(int dx, int dy) { 191 if (dx>maxDegX || dy>maxDegY) THROW(rangeCheckErr);191 if (dx>maxDegX || dy>maxDegY) throw RangeCheckError("Poly2::Coef() "); 192 192 dirty = 1; return Element(IndCoef(dx,dy)); 193 193 } -
trunk/SophyaLib/NTools/simplesort.cc
r244 r2506 1 1 // 2 // $Id: simplesort.cc,v 1. 2 1999-04-22 16:18:50ansari Exp $2 // $Id: simplesort.cc,v 1.3 2004-03-15 16:46:56 ansari Exp $ 3 3 // 4 4 … … 18 18 SimpleSort::SimpleSort(int nElts) 19 19 : numElts(nElts), index(new TRIPAIRE[nElts]) 20 {END_CONSTRUCTOR} 20 { 21 } 21 22 22 23 SimpleSort::~SimpleSort()
Note:
See TracChangeset
for help on using the changeset viewer.