Changeset c805f7 for src/Fragmentation/Summation/SetValues/SamplingGrid.cpp
- Timestamp:
- Jun 8, 2016, 6:12:12 PM (9 years ago)
- Children:
- e480fc
- Parents:
- c9b843
- git-author:
- Frederik Heber <heber@…> (05/26/16 09:51:07)
- git-committer:
- Frederik Heber <heber@…> (06/08/16 18:12:12)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Summation/SetValues/SamplingGrid.cpp
rc9b843 rc805f7 51 51 52 52 // static instances 53 const double SamplingGrid::zeroOffset[ 3] = { 0., 0., 0. };53 const double SamplingGrid::zeroOffset[NDIM] = { 0., 0., 0. }; 54 54 55 55 SamplingGrid::SamplingGrid() : … … 61 61 } 62 62 63 SamplingGrid::SamplingGrid(const double _begin[ 3],64 const double _end[ 3],63 SamplingGrid::SamplingGrid(const double _begin[NDIM], 64 const double _end[NDIM], 65 65 const int _level) : 66 66 SamplingGridProperties(_begin, _end, _level) … … 71 71 } 72 72 73 SamplingGrid::SamplingGrid(const double _begin[ 3],74 const double _end[ 3],73 SamplingGrid::SamplingGrid(const double _begin[NDIM], 74 const double _end[NDIM], 75 75 const int _level, 76 76 const sampledvalues_t &_sampled_grid) : … … 119 119 status &= (static_cast<const SamplingGridProperties &>(*this) == 120 120 static_cast<const SamplingGridProperties &>(_props)); 121 for(size_t i = 0; i< 3; ++i) {121 for(size_t i = 0; i<NDIM; ++i) { 122 122 status &= begin_window[i] == _props.begin_window[i]; 123 123 status &= end_window[i] == _props.end_window[i]; … … 160 160 if (isCompatible(other)) { 161 161 /// get minimum of window 162 double min_begin_window[ 3];163 double min_end_window[ 3];162 double min_begin_window[NDIM]; 163 double min_end_window[NDIM]; 164 164 bool doShrink = false; 165 for (size_t index=0; index< 3;++index) {165 for (size_t index=0; index<NDIM;++index) { 166 166 if (begin_window[index] <= other.begin_window[index]) { 167 167 min_begin_window[index] = other.begin_window[index]; … … 201 201 if (isCompatible(other)) { 202 202 /// get maximum of window 203 double max_begin_window[ 3];204 double max_end_window[ 3];203 double max_begin_window[NDIM]; 204 double max_end_window[NDIM]; 205 205 bool doExtend = false; 206 for (size_t index=0; index< 3;++index) {206 for (size_t index=0; index<NDIM;++index) { 207 207 if (begin_window[index] >= other.begin_window[index]) { 208 208 max_begin_window[index] = other.begin_window[index]; … … 273 273 } 274 274 void SamplingGrid::setWindowSize( 275 const double _begin_window[ 3],276 const double _end_window[ 3])277 { 278 for (size_t index=0;index< 3;++index) {275 const double _begin_window[NDIM], 276 const double _end_window[NDIM]) 277 { 278 for (size_t index=0;index<NDIM;++index) { 279 279 begin_window[index] = getNearestLowerGridPoint(_begin_window[index], index); 280 280 ASSERT( begin_window[index] >= begin[index], … … 289 289 290 290 void SamplingGrid::setWindow( 291 const double _begin_window[ 3],292 const double _end_window[ 3])291 const double _begin_window[NDIM], 292 const double _end_window[NDIM]) 293 293 { 294 294 setWindowSize(_begin_window, _end_window); … … 299 299 300 300 void SamplingGrid::setDomain( 301 const double _begin[ 3],302 const double _end[ 3])301 const double _begin[NDIM], 302 const double _end[NDIM]) 303 303 { 304 304 setDomainSize(_begin, _end); … … 309 309 310 310 void SamplingGrid::extendWindow( 311 const double _begin_window[ 3],312 const double _end_window[ 3])311 const double _begin_window[NDIM], 312 const double _end_window[NDIM]) 313 313 { 314 314 #ifndef NDEBUG 315 for(size_t index=0;index < 3; ++index) {315 for(size_t index=0;index < NDIM; ++index) { 316 316 // check that we truly have to extend the window 317 317 ASSERT ( begin_window[index] >= _begin_window[index], … … 332 332 #endif 333 333 // copy old window size and values 334 double old_begin_window[ 3];335 double old_end_window[ 3];336 for(size_t index=0;index< 3;++index) {334 double old_begin_window[NDIM]; 335 double old_end_window[NDIM]; 336 for(size_t index=0;index<NDIM;++index) { 337 337 old_begin_window[index] = begin_window[index]; 338 338 old_end_window[index] = end_window[index]; … … 347 347 348 348 void SamplingGrid::shrinkWindow( 349 const double _begin_window[ 3],350 const double _end_window[ 3])349 const double _begin_window[NDIM], 350 const double _end_window[NDIM]) 351 351 { 352 352 #ifndef NDEBUG 353 for(size_t index=0;index < 3; ++index) {353 for(size_t index=0;index < NDIM; ++index) { 354 354 // check that we truly have to shrink the window 355 355 ASSERT ( begin_window[index] <= _begin_window[index], … … 370 370 #endif 371 371 // copy old window size and values 372 double old_begin_window[ 3];373 double old_end_window[ 3];374 for(size_t index=0;index< 3;++index) {372 double old_begin_window[NDIM]; 373 double old_end_window[NDIM]; 374 for(size_t index=0;index<NDIM;++index) { 375 375 old_begin_window[index] = begin_window[index]; 376 376 old_end_window[index] = end_window[index]; … … 393 393 394 394 void SamplingGrid::addOntoWindow( 395 const double _begin_window[ 3],396 const double _end_window[ 3],395 const double _begin_window[NDIM], 396 const double _end_window[NDIM], 397 397 const sampledvalues_t &_sampled_grid, 398 398 const double prefactor) … … 410 410 411 411 void SamplingGrid::addIntoWindow( 412 const double _begin_window[ 3],413 const double _end_window[ 3],412 const double _begin_window[NDIM], 413 const double _end_window[NDIM], 414 414 const sampledvalues_t &_sampled_grid, 415 415 const double prefactor) … … 440 440 (std::numeric_limits<size_t>::round_style == std::round_toward_zero) ? 441 441 0.5 : 0.; // need offset to get to round_toward_nearest behavior 442 for(size_t index=0;index< 3;++index) {442 for(size_t index=0;index<NDIM;++index) { 443 443 if (fabs(end[index] - begin[index]) > std::numeric_limits<double>::epsilon()*1e4) { 444 444 // we refrain from using floor/ceil as the window's starts and ends, … … 465 465 466 466 void SamplingGrid::addWindowOntoWindow( 467 const double larger_wbegin[ 3],468 const double larger_wend[ 3],469 const double smaller_wbegin[ 3],470 const double smaller_wend[ 3],467 const double larger_wbegin[NDIM], 468 const double larger_wend[NDIM], 469 const double smaller_wbegin[NDIM], 470 const double smaller_wend[NDIM], 471 471 sampledvalues_t &dest_sampled_grid, 472 472 const sampledvalues_t &source_sampled_grid, … … 475 475 { 476 476 #ifndef NDEBUG 477 for(size_t index=0;index< 3;++index) {477 for(size_t index=0;index<NDIM;++index) { 478 478 ASSERT( smaller_wbegin[index] >= larger_wbegin[index], 479 479 "SamplingGrid::addWindowOntoWindow() - given smaller window starts earlier than larger window in component " … … 485 485 #endif 486 486 // the only issue are indices 487 size_t pre_offset[ 3];488 size_t post_offset[ 3];489 size_t length[ 3];490 size_t total[ 3];487 size_t pre_offset[NDIM]; 488 size_t post_offset[NDIM]; 489 size_t length[NDIM]; 490 size_t total[NDIM]; 491 491 getDiscreteWindowIndices( 492 492 larger_wbegin, larger_wend, … … 526 526 } 527 527 #endif 528 size_t N[ 3];528 size_t N[NDIM]; 529 529 // size_t counter = 0; 530 530 sampledvalues_t::iterator destiter = dest_sampled_grid.begin(); … … 585 585 if (status) { 586 586 // compare windows 587 for (size_t i=0; i< 3; ++i) {587 for (size_t i=0; i<NDIM; ++i) { 588 588 status &= begin_window[i] == other.begin_window[i]; 589 589 status &= end_window[i] == other.end_window[i];
Note:
See TracChangeset
for help on using the changeset viewer.
