Changeset 1314 in Sophya for trunk/SophyaLib/TArray/basarr.cc
- Timestamp:
- Nov 9, 2000, 6:45:46 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/basarr.cc
r1156 r1314 417 417 //#ifdef SO_BOUNDCHECKING 418 418 if (rest != 0) 419 throw PError("BaseArray::Offset(sa_size_t ip) GUG !!! rest != 0");419 throw PError("BaseArray::Offset(sa_size_t ip) BUG !!! rest != 0"); 420 420 //#endif 421 421 // if (rest != 0) cerr << " BUG ---- BaseArray::Offset( " << ip << " )" << rest << endl; … … 426 426 for(k=0; k<ndim_; k++) off += idx[k]*step_[k]; 427 427 return (off); 428 } 429 //! return index of element \b ip, along the five array axes 430 void BaseArray::IndexAtPosition(sa_size_t ip, sa_size_t & ix, sa_size_t & iy, 431 sa_size_t & iz, sa_size_t & it, sa_size_t & iu) const 432 { 433 ix = iy = iz = it = iu = 0; 434 if ( (ndim_ < 1) || (ip == 0) ) return; 435 if (ip >= totsize_) 436 throw RangeCheckError("BaseArray::IndexAtPosition(...) Out of range index ip"); 437 sa_size_t idx[BASEARRAY_MAXNDIMS]; 438 int_4 k; 439 sa_size_t rest = ip; 440 for(k=0; k<ndim_; k++) { 441 idx[k] = rest%size_[k]; rest /= size_[k]; 442 if (rest == 0) break; 443 } 444 if (rest != 0) 445 throw PError("BaseArray::IndexAtPosition(...) BUG !!! rest != 0"); 446 ix = idx[0]; 447 iy = idx[1]; 448 iz = idx[2]; 449 it = idx[3]; 450 iu = idx[4]; 451 return; 428 452 } 429 453
Note:
See TracChangeset
for help on using the changeset viewer.