Changeset 5b1e5e for src/Fragmentation/Summation/SetValues/SamplingGrid.cpp
- Timestamp:
- Sep 14, 2016, 6:42:52 PM (9 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, Candidate_v1.7.0, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
- Children:
- e51f2c
- Parents:
- 028790
- git-author:
- Frederik Heber <heber@…> (05/26/16 09:51:07)
- git-committer:
- Frederik Heber <heber@…> (09/14/16 18:42:52)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Summation/SetValues/SamplingGrid.cpp
r028790 r5b1e5e 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.
