Changeset 2888 in Sophya for trunk/SophyaLib/TArray/tarray.cc
- Timestamp:
- Jan 4, 2006, 7:25:32 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/tarray.cc
r2884 r2888 360 360 } 361 361 362 //! Give value (in \b double) for element at position \b ip.. 362 /*! 363 \brief Return the value (as a MuTyV) for element at position \b ip in the array. 364 This method is used for conversion between arrays of different types. 365 \param ip : element position in the array 366 */ 363 367 template <class T> 364 368 MuTyV & TArray<T>::ValueAtPosition(sa_size_t ip) const 365 369 { 366 370 #ifdef SO_BOUNDCHECKING 367 if (ip >= totsize_) throw( ParmError("TArray<T>::ValueAtPosition(sa_size_t ip) Out-of-bound Error") ); 371 if ( (ip >= totsize_) || (ip < 0) ) 372 throw( ParmError("TArray<T>::ValueAtPosition(sa_size_t ip) Out-of-bound Error") ); 368 373 #endif 369 374 my_mtv = *(mNDBlock.Begin()+Offset(ip)); 375 return( my_mtv ); 376 } 377 378 /*! 379 \brief Return the value (as a MuTyV) for element at position \b ip in the datablock. 380 This method is used for conversion between arrays of different types. 381 \param ip : element position in the array DataBlock, regardless of 382 the array memory organisation 383 */ 384 template <class T> 385 MuTyV & TArray<T>::ValueAtPositionDB(sa_size_t ip) const 386 { 387 #ifdef SO_BOUNDCHECKING 388 if ( (ip >= mNDBlock.Size() ) || (ip < 0) ) 389 throw( ParmError("TArray<T>::ValueAtPositionDB(sa_size_t ip) Out-of-bound Error") ); 390 #endif 391 my_mtv = *(mNDBlock.Begin()+ip); 370 392 return( my_mtv ); 371 393 } … … 1113 1135 --- Appel explicite de l'operateur de conversion sur l'objet MuTyV 1114 1136 */ 1115 for(k=0, ka=0; k<gpas; k+=step, ka+=stepa) 1116 a.ValueAtPosition(offa+ka).Convert(pe[k]); 1137 /* ----- Janvier 2006 ------ 1138 Un bug important etait semble-t-il present depuis longtemps 1139 On appelait a.ValueAtPosition(ip) qui renvoie l'element ip en tenant compte 1140 de la structure du tableau , alors qu'on veut acceder l'element ip du datablock 1141 Methode ValueAtPositionDB(ip) ajoute et utilisee a la place de ValueAtPosition(ip) 1142 */ 1143 for(k=0, ka=0; k<gpas; k+=step, ka+=stepa) 1144 a.ValueAtPositionDB(offa+ka).Convert(pe[k]); 1117 1145 //REMPLACE Suite pb compil gcc4 pe[k] = a.ValueAtPosition(offa+ka).operator T(); 1118 1146 }
Note:
See TracChangeset
for help on using the changeset viewer.