Changeset 1103 in Sophya for trunk/SophyaLib/TArray/tarray.cc
- Timestamp:
- Jul 27, 2000, 2:00:10 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/tarray.cc
r1099 r1103 200 200 { 201 201 string exmsg = "TArray<T>::CloneOrShare()"; 202 if (!UpdateSizes(a .ndim_, a.size_, a.step_, a.offset_, exmsg)) throw( ParmError(exmsg) );202 if (!UpdateSizes(a, exmsg)) throw( ParmError(exmsg) ); 203 203 mNDBlock.CloneOrShare(a.mNDBlock); 204 if (mInfo) {delete mInfo; mInfo = NULL;} 205 if (a.mInfo) mInfo = new DVList(*(a.mInfo)); 204 206 } 205 207 … … 209 211 { 210 212 string exmsg = "TArray<T>::Share()"; 211 if (!UpdateSizes(a .ndim_, a.size_, a.step_, a.offset_, exmsg)) throw( ParmError(exmsg) );213 if (!UpdateSizes(a, exmsg)) throw( ParmError(exmsg) ); 212 214 mNDBlock.Share(a.mNDBlock); 215 if (mInfo) {delete mInfo; mInfo = NULL;} 216 if (a.mInfo) mInfo = new DVList(*(a.mInfo)); 213 217 } 214 218 … … 363 367 */ 364 368 template <class T> 365 TArray<T>& TArray<T>::SetSeq(Sequence seq)369 TArray<T>& TArray<T>::SetSeq(Sequence const & seq) 366 370 { 367 371 if (NbDimensions() < 1) 368 372 throw RangeCheckError("TArray<T>::SetSeq(Sequence ) - Not Allocated Array ! "); 373 369 374 T * pe; 370 375 uint_8 j,k; 371 if (AvgStep() > 0) { // regularly spaced elements 372 uint_8 step = AvgStep(); 373 pe = Data(); 374 for(k=0; k<totsize_; k++ ) pe[k*step] = (T) seq(k); 375 } 376 else { // Non regular data spacing ... 377 // uint_4 ka = MaxSizeKA(); 378 uint_4 ka = 0; 379 uint_8 step = Step(ka); 380 uint_8 gpas = Size(ka); 381 uint_8 naxa = Size()/Size(ka); 382 for(j=0; j<naxa; j++) { 383 pe = mNDBlock.Begin()+Offset(ka,j); 384 for(k=0; k<gpas; k++) pe[k*step] = (T) seq(j*gpas+k); 385 } 376 int ka; 377 if (arrtype_ == 0) ka = 0; 378 else ka = macoli_; 379 uint_8 step = Step(ka); 380 uint_8 gpas = Size(ka); 381 uint_8 naxa = Size()/Size(ka); 382 for(j=0; j<naxa; j++) { 383 pe = mNDBlock.Begin()+Offset(ka,j); 384 #if !defined(__GNUG__) 385 for(k=0; k<gpas; k++) pe[k*step] = (T) seq(j*gpas+k); 386 #else 387 // g++ (up to 2.95.1) se melange les pinceaux s'il y a le cast (T) pour l'instanciation des complexes 388 for(k=0; k<gpas; k++) pe[k*step] = seq(j*gpas+k); 389 #endif 386 390 } 387 391 return(*this);
Note:
See TracChangeset
for help on using the changeset viewer.