Changeset 2199c2 for src/Fragmentation
- Timestamp:
- Sep 12, 2016, 11:48:36 PM (8 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, 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, SaturateAtoms_findBestMatching, 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:
- 450adf
- Parents:
- b67d89
- git-author:
- Frederik Heber <heber@…> (06/29/14 18:02:32)
- git-committer:
- Frederik Heber <heber@…> (09/12/16 23:48:36)
- Location:
- src/Fragmentation/Exporters
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Exporters/SphericalPointDistribution.cpp
rb67d89 r2199c2 255 255 */ 256 256 SphericalPointDistribution::IndexList_t SphericalPointDistribution::findBestMatching( 257 const SphericalPointDistribution:: Polygon_t &_polygon,257 const SphericalPointDistribution::WeightedPolygon_t &_polygon, 258 258 const SphericalPointDistribution::Polygon_t &_newpolygon 259 259 ) … … 262 262 MCS.foundflag = false; 263 263 MCS.bestL2 = std::numeric_limits<double>::max(); 264 MCS.oldpoints.insert(MCS.oldpoints.begin(), _polygon.begin(),_polygon.end() ); 264 for (WeightedPolygon_t::const_iterator iter = _polygon.begin(); 265 iter != _polygon.end(); ++iter) 266 MCS.oldpoints.push_back(iter->first); 265 267 MCS.newpoints.insert(MCS.newpoints.begin(), _newpolygon.begin(),_newpolygon.end() ); 266 268 … … 494 496 SphericalPointDistribution::Polygon_t 495 497 SphericalPointDistribution::matchSphericalPointDistributions( 496 const SphericalPointDistribution:: Polygon_t &_polygon,498 const SphericalPointDistribution::WeightedPolygon_t &_polygon, 497 499 const SphericalPointDistribution::Polygon_t &_newpolygon 498 500 ) 499 501 { 500 SphericalPointDistribution::Polygon_t remainingreturnpolygon; 501 VectorArray_t remainingold(_polygon.begin(), _polygon.end()); 502 SphericalPointDistribution::Polygon_t remainingpoints; 503 VectorArray_t remainingold; 504 for (WeightedPolygon_t::const_iterator iter = _polygon.begin(); 505 iter != _polygon.end(); ++iter) 506 remainingold.push_back(iter->first); 502 507 VectorArray_t remainingnew(_newpolygon.begin(), _newpolygon.end()); 503 508 LOG(2, "INFO: Matching old polygon " << _polygon … … 507 512 // same number of points desired as are present? Do nothing 508 513 LOG(2, "INFO: There are no vacant points to return."); 509 return remaining returnpolygon;514 return remainingpoints; 510 515 } 511 516 -
src/Fragmentation/Exporters/SphericalPointDistribution.hpp
rb67d89 r2199c2 44 44 //!> typedef for the list of points 45 45 typedef std::list<Vector> Polygon_t; 46 //!> typedef for the list of points with integral weights 47 typedef std::list<std::pair<Vector, int> > WeightedPolygon_t; 46 48 47 49 /** General getter function for the distribution of points on the surface. … … 69 71 */ 70 72 static Polygon_t matchSphericalPointDistributions( 71 const Polygon_t &_polygon,73 const WeightedPolygon_t &_polygon, 72 74 const Polygon_t &_newpolygon 73 75 ); … … 113 115 114 116 static IndexList_t findBestMatching( 115 const Polygon_t &_polygon,117 const WeightedPolygon_t &_polygon, 116 118 const Polygon_t &_newpolygon 117 119 ); -
src/Fragmentation/Exporters/unittests/SphericalPointDistributionUnitTest.cpp
rb67d89 r2199c2 90 90 // test with one point, matching trivially 91 91 { 92 SphericalPointDistribution:: Polygon_t polygon;93 polygon += Vector(1.,0.,0.);92 SphericalPointDistribution::WeightedPolygon_t polygon; 93 polygon += std::make_pair(Vector(1.,0.,0.), 1); 94 94 SphericalPointDistribution::Polygon_t newpolygon = 95 95 SPD.get<2>(); … … 105 105 // test with one point, just a flip of axis 106 106 { 107 SphericalPointDistribution:: Polygon_t polygon;108 polygon += Vector(0.,1.,0.);107 SphericalPointDistribution::WeightedPolygon_t polygon; 108 polygon += std::make_pair( Vector(0.,1.,0.), 1); 109 109 SphericalPointDistribution::Polygon_t newpolygon = 110 110 SPD.get<2>(); … … 120 120 // test with one point, just a flip to another axis 121 121 { 122 SphericalPointDistribution:: Polygon_t polygon;123 polygon += Vector(0.,0.,-1.);122 SphericalPointDistribution::WeightedPolygon_t polygon; 123 polygon += std::make_pair( Vector(0.,0.,-1.), 1); 124 124 SphericalPointDistribution::Polygon_t newpolygon = 125 125 SPD.get<2>(); … … 136 136 { 137 137 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 138 SphericalPointDistribution:: Polygon_t polygon;139 polygon += RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI);138 SphericalPointDistribution::WeightedPolygon_t polygon; 139 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 140 140 SphericalPointDistribution::Polygon_t newpolygon = 141 141 SPD.get<2>(); … … 151 151 152 152 void perturbPolygon( 153 SphericalPointDistribution:: Polygon_t &_polygon,153 SphericalPointDistribution::WeightedPolygon_t &_polygon, 154 154 double _amplitude 155 155 ) 156 156 { 157 for (SphericalPointDistribution:: Polygon_t::iterator iter = _polygon.begin();157 for (SphericalPointDistribution::WeightedPolygon_t::iterator iter = _polygon.begin(); 158 158 iter != _polygon.end(); ++iter) { 159 159 Vector perturber; 160 perturber.GetOneNormalVector( (*iter));160 perturber.GetOneNormalVector(iter->first); 161 161 perturber.Scale(_amplitude); 162 *iter = *iter+ perturber;163 ( *iter).Normalize();162 iter->first = iter->first + perturber; 163 (iter->first).Normalize(); 164 164 } 165 165 } … … 254 254 // test with one point, matching trivially 255 255 { 256 SphericalPointDistribution:: Polygon_t polygon;257 polygon += Vector(1.,0.,0.);256 SphericalPointDistribution::WeightedPolygon_t polygon; 257 polygon += std::make_pair( Vector(1.,0.,0.), 1); 258 258 SphericalPointDistribution::Polygon_t newpolygon = 259 259 SPD.get<3>(); … … 269 269 // test with one point, just a flip of x and y axis 270 270 { 271 SphericalPointDistribution:: Polygon_t polygon;272 polygon += Vector(0.,1.,0.);271 SphericalPointDistribution::WeightedPolygon_t polygon; 272 polygon += std::make_pair( Vector(0.,1.,0.), 1); 273 273 SphericalPointDistribution::Polygon_t newpolygon = 274 274 SPD.get<3>(); … … 289 289 // test with two points, matching trivially 290 290 { 291 SphericalPointDistribution::Polygon_t polygon; 292 polygon += Vector(1.,0.,0.), Vector(-0.5, sqrt(3)*0.5,0.); 291 SphericalPointDistribution::WeightedPolygon_t polygon; 292 polygon += std::make_pair( Vector(1.,0.,0.), 1); 293 polygon += std::make_pair( Vector(-0.5, sqrt(3)*0.5,0.), 1); 293 294 SphericalPointDistribution::Polygon_t newpolygon = 294 295 SPD.get<3>(); … … 310 311 { 311 312 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 312 SphericalPointDistribution::Polygon_t polygon; 313 polygon += 314 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 315 RotationAxis.rotateVector(Vector(-0.5, sqrt(3)*0.5,0.), 47.6/180*M_PI); 313 SphericalPointDistribution::WeightedPolygon_t polygon; 314 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 315 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-0.5, sqrt(3)*0.5,0.), 47.6/180*M_PI), 1); 316 316 SphericalPointDistribution::Polygon_t newpolygon = 317 317 SPD.get<3>(); … … 335 335 // test with three points, matching trivially 336 336 { 337 SphericalPointDistribution::Polygon_t polygon; 338 polygon += Vector(1.,0.,0.), Vector(-0.5, sqrt(3)*0.5,0.), Vector(-0.5, -sqrt(3)*0.5,0.); 337 SphericalPointDistribution::WeightedPolygon_t polygon; 338 polygon += std::make_pair( Vector(1.,0.,0.), 1); 339 polygon += std::make_pair( Vector(-0.5, sqrt(3)*0.5,0.), 1); 340 polygon += std::make_pair( Vector(-0.5, -sqrt(3)*0.5,0.), 1); 339 341 SphericalPointDistribution::Polygon_t newpolygon = 340 342 SPD.get<3>(); … … 355 357 { 356 358 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 357 SphericalPointDistribution::Polygon_t polygon; 358 polygon += 359 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 360 RotationAxis.rotateVector(Vector(-0.5, sqrt(3)*0.5,0.), 47.6/180*M_PI), 361 RotationAxis.rotateVector(Vector(-0.5, -sqrt(3)*0.5,0.), 47.6/180*M_PI); 359 SphericalPointDistribution::WeightedPolygon_t polygon; 360 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 361 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-0.5, sqrt(3)*0.5,0.), 47.6/180*M_PI), 1); 362 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-0.5, -sqrt(3)*0.5,0.), 47.6/180*M_PI), 1); 362 363 SphericalPointDistribution::Polygon_t newpolygon = 363 364 SPD.get<3>(); … … 383 384 // test with one point, matching trivially 384 385 { 385 SphericalPointDistribution:: Polygon_t polygon;386 polygon += Vector(1.,0.,0.);386 SphericalPointDistribution::WeightedPolygon_t polygon; 387 polygon += std::make_pair( Vector(1.,0.,0.), 1); 387 388 SphericalPointDistribution::Polygon_t newpolygon = 388 389 SPD.get<4>(); … … 398 399 // test with one point, just a flip of axis 399 400 { 400 SphericalPointDistribution:: Polygon_t polygon;401 polygon += Vector(0.,1.,0.);401 SphericalPointDistribution::WeightedPolygon_t polygon; 402 polygon += std::make_pair( Vector(0.,1.,0.), 1); 402 403 SphericalPointDistribution::Polygon_t newpolygon = 403 404 SPD.get<4>(); … … 418 419 // test with two points, matching trivially 419 420 { 420 SphericalPointDistribution::Polygon_t polygon; 421 polygon += Vector(1.,0.,0.), Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.); 421 SphericalPointDistribution::WeightedPolygon_t polygon; 422 polygon += std::make_pair( Vector(1.,0.,0.), 1); 423 polygon += std::make_pair( Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 1); 422 424 SphericalPointDistribution::Polygon_t newpolygon = 423 425 SPD.get<4>(); … … 438 440 // test with two points, matching trivially, also with slightly perturbed 439 441 { 440 SphericalPointDistribution::Polygon_t polygon; 441 polygon += Vector(1.,0.,0.), Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.); 442 SphericalPointDistribution::WeightedPolygon_t polygon; 443 polygon += std::make_pair( Vector(1.,0.,0.), 1); 444 polygon += std::make_pair( Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 1); 442 445 SphericalPointDistribution::Polygon_t newpolygon = 443 446 SPD.get<4>(); … … 459 462 { 460 463 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 461 SphericalPointDistribution::Polygon_t polygon; 462 polygon += 463 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 464 RotationAxis.rotateVector(Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 47.6/180*M_PI); 464 SphericalPointDistribution::WeightedPolygon_t polygon; 465 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 466 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 47.6/180*M_PI), 1); 465 467 SphericalPointDistribution::Polygon_t newpolygon = 466 468 SPD.get<4>(); … … 484 486 // test with three points, matching trivially 485 487 { 486 SphericalPointDistribution::Polygon_t polygon; 487 polygon += 488 Vector(1.,0.,0.), 489 Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 490 Vector(-1./3.0, -M_SQRT2/3.0, M_SQRT2/sqrt(3)); 488 SphericalPointDistribution::WeightedPolygon_t polygon; 489 polygon += std::make_pair( Vector(1.,0.,0.), 1); 490 polygon += std::make_pair( Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 1); 491 polygon += std::make_pair( Vector(-1./3.0, -M_SQRT2/3.0, M_SQRT2/sqrt(3)), 1); 491 492 SphericalPointDistribution::Polygon_t newpolygon = 492 493 SPD.get<4>(); … … 509 510 { 510 511 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 511 SphericalPointDistribution::Polygon_t polygon; 512 polygon += 513 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 514 RotationAxis.rotateVector(Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 47.6/180*M_PI), 515 RotationAxis.rotateVector(Vector(-1./3.0, -M_SQRT2/3.0, M_SQRT2/sqrt(3)), 47.6/180*M_PI); 512 SphericalPointDistribution::WeightedPolygon_t polygon; 513 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 514 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 47.6/180*M_PI), 1); 515 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1./3.0, -M_SQRT2/3.0, M_SQRT2/sqrt(3)), 47.6/180*M_PI), 1); 516 516 SphericalPointDistribution::Polygon_t newpolygon = 517 517 SPD.get<4>(); … … 543 543 // test with one point, matching trivially 544 544 { 545 SphericalPointDistribution:: Polygon_t polygon;546 polygon += Vector(1.,0.,0.);545 SphericalPointDistribution::WeightedPolygon_t polygon; 546 polygon += std::make_pair( Vector(1.,0.,0.), 1); 547 547 SphericalPointDistribution::Polygon_t newpolygon = 548 548 SPD.get<5>(); … … 558 558 // test with one point, just a flip of axis 559 559 { 560 SphericalPointDistribution:: Polygon_t polygon;561 polygon += Vector(0.,1.,0.);560 SphericalPointDistribution::WeightedPolygon_t polygon; 561 polygon += std::make_pair( Vector(0.,1.,0.), 1); 562 562 SphericalPointDistribution::Polygon_t newpolygon = 563 563 SPD.get<5>(); … … 578 578 // test with two points, matching trivially 579 579 { 580 SphericalPointDistribution::Polygon_t polygon; 581 polygon += Vector(1.,0.,0.), Vector(-1.,0.,0.); 580 SphericalPointDistribution::WeightedPolygon_t polygon; 581 polygon += std::make_pair( Vector(1.,0.,0.), 1); 582 polygon += std::make_pair( Vector(-1.,0.,0.), 1); 582 583 SphericalPointDistribution::Polygon_t newpolygon = 583 584 SPD.get<5>(); … … 599 600 { 600 601 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 601 SphericalPointDistribution::Polygon_t polygon; 602 polygon += 603 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180.*M_PI), 604 RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180.*M_PI); 602 SphericalPointDistribution::WeightedPolygon_t polygon; 603 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180.*M_PI), 1); 604 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180.*M_PI), 1); 605 605 SphericalPointDistribution::Polygon_t newpolygon = 606 606 SPD.get<5>(); … … 619 619 // hence, we just check that they are orthogonal to the first two points 620 620 CPPUNIT_ASSERT_EQUAL( expected.size(), remaining.size() ); 621 for (SphericalPointDistribution:: Polygon_t::const_iterator fixiter = polygon.begin();621 for (SphericalPointDistribution::WeightedPolygon_t::const_iterator fixiter = polygon.begin(); 622 622 fixiter != polygon.end(); ++fixiter) { 623 623 for (SphericalPointDistribution::Polygon_t::const_iterator iter = remaining.begin(); 624 624 iter != remaining.end(); ++iter) { 625 CPPUNIT_ASSERT( ( *fixiter).IsNormalTo(*iter) );625 CPPUNIT_ASSERT( (fixiter->first).IsNormalTo(*iter) ); 626 626 } 627 627 } … … 630 630 // test with three points, matching trivially 631 631 { 632 SphericalPointDistribution::Polygon_t polygon; 633 polygon += 634 Vector(1.,0.,0.), 635 Vector(-1., 0.0, 0.0), 636 Vector(0.0, 1., 0.0); 632 SphericalPointDistribution::WeightedPolygon_t polygon; 633 polygon += std::make_pair( Vector(1.,0.,0.), 1); 634 polygon += std::make_pair( Vector(-1., 0.0, 0.0), 1); 635 polygon += std::make_pair( Vector(0.0, 1., 0.0), 1); 637 636 SphericalPointDistribution::Polygon_t newpolygon = 638 637 SPD.get<5>(); … … 655 654 { 656 655 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 657 SphericalPointDistribution::Polygon_t polygon; 658 polygon += 659 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 660 RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 661 RotationAxis.rotateVector(Vector(0.0, 1., 0.0), 47.6/180*M_PI); 656 SphericalPointDistribution::WeightedPolygon_t polygon; 657 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 658 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 1); 659 polygon += std::make_pair(RotationAxis.rotateVector(Vector(0.0, 1., 0.0), 47.6/180*M_PI), 1); 662 660 SphericalPointDistribution::Polygon_t newpolygon = 663 661 SPD.get<5>(); … … 689 687 // test with one point, matching trivially 690 688 { 691 SphericalPointDistribution:: Polygon_t polygon;692 polygon += Vector(1.,0.,0.);689 SphericalPointDistribution::WeightedPolygon_t polygon; 690 polygon += std::make_pair( Vector(1.,0.,0.), 1); 693 691 SphericalPointDistribution::Polygon_t newpolygon = 694 692 SPD.get<6>(); … … 704 702 // test with one point, just a flip of axis 705 703 { 706 SphericalPointDistribution:: Polygon_t polygon;707 polygon += Vector(0.,1.,0.);704 SphericalPointDistribution::WeightedPolygon_t polygon; 705 polygon += std::make_pair( Vector(0.,1.,0.), 1); 708 706 SphericalPointDistribution::Polygon_t newpolygon = 709 707 SPD.get<6>(); … … 724 722 // test with two points, matching trivially 725 723 { 726 SphericalPointDistribution::Polygon_t polygon; 727 polygon += Vector(1.,0.,0.), Vector(-1.,0.,0.); 724 SphericalPointDistribution::WeightedPolygon_t polygon; 725 polygon += std::make_pair( Vector(1.,0.,0.), 1); 726 polygon += std::make_pair( Vector(-1.,0.,0.), 1); 728 727 SphericalPointDistribution::Polygon_t newpolygon = 729 728 SPD.get<6>(); … … 745 744 { 746 745 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 747 SphericalPointDistribution::Polygon_t polygon; 748 polygon += 749 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 750 RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180*M_PI); 746 SphericalPointDistribution::WeightedPolygon_t polygon; 747 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 748 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180*M_PI), 1); 751 749 SphericalPointDistribution::Polygon_t newpolygon = 752 750 SPD.get<6>(); … … 765 763 // hence, we just check that they are orthogonal to the first two points 766 764 CPPUNIT_ASSERT_EQUAL( expected.size(), remaining.size() ); 767 for (SphericalPointDistribution:: Polygon_t::const_iterator fixiter = polygon.begin();765 for (SphericalPointDistribution::WeightedPolygon_t::const_iterator fixiter = polygon.begin(); 768 766 fixiter != polygon.end(); ++fixiter) { 769 767 for (SphericalPointDistribution::Polygon_t::const_iterator iter = remaining.begin(); 770 768 iter != remaining.end(); ++iter) { 771 CPPUNIT_ASSERT( ( *fixiter).IsNormalTo(*iter) );769 CPPUNIT_ASSERT( (fixiter->first).IsNormalTo(*iter) ); 772 770 } 773 771 } … … 776 774 // test with three points, matching trivially 777 775 { 778 SphericalPointDistribution::Polygon_t polygon; 779 polygon += 780 Vector(1.,0.,0.), 781 Vector(-1., 0.0, 0.0), 782 Vector(0.0, 1., 0.0); 776 SphericalPointDistribution::WeightedPolygon_t polygon; 777 polygon += std::make_pair( Vector(1.,0.,0.), 1); 778 polygon += std::make_pair( Vector(-1., 0.0, 0.0), 1); 779 polygon += std::make_pair( Vector(0.0, 1., 0.0), 1); 783 780 SphericalPointDistribution::Polygon_t newpolygon = 784 781 SPD.get<6>(); … … 801 798 { 802 799 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 803 SphericalPointDistribution::Polygon_t polygon; 804 polygon += 805 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 806 RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 807 RotationAxis.rotateVector(Vector(0.0, 1., 0.0), 47.6/180*M_PI); 800 SphericalPointDistribution::WeightedPolygon_t polygon; 801 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 802 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 1); 803 polygon += std::make_pair(RotationAxis.rotateVector(Vector(0.0, 1., 0.0), 47.6/180*M_PI), 1); 808 804 SphericalPointDistribution::Polygon_t newpolygon = 809 805 SPD.get<6>(); … … 835 831 // test with one point, matching trivially 836 832 { 837 SphericalPointDistribution:: Polygon_t polygon;838 polygon += Vector(1.,0.,0.);833 SphericalPointDistribution::WeightedPolygon_t polygon; 834 polygon += std::make_pair( Vector(1.,0.,0.), 1); 839 835 SphericalPointDistribution::Polygon_t newpolygon = 840 836 SPD.get<7>(); … … 850 846 // test with one point, just a flip of axis 851 847 { 852 SphericalPointDistribution:: Polygon_t polygon;853 polygon += Vector(0.,1.,0.);848 SphericalPointDistribution::WeightedPolygon_t polygon; 849 polygon += std::make_pair( Vector(0.,1.,0.), 1); 854 850 SphericalPointDistribution::Polygon_t newpolygon = 855 851 SPD.get<7>(); … … 870 866 // test with two points, matching trivially 871 867 { 872 SphericalPointDistribution::Polygon_t polygon; 873 polygon += Vector(1.,0.,0.), Vector(-1.,0.,0.); 868 SphericalPointDistribution::WeightedPolygon_t polygon; 869 polygon += std::make_pair( Vector(1.,0.,0.), 1); 870 polygon += std::make_pair( Vector(-1.,0.,0.), 1); 874 871 SphericalPointDistribution::Polygon_t newpolygon = 875 872 SPD.get<7>(); … … 891 888 { 892 889 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 893 SphericalPointDistribution::Polygon_t polygon; 894 polygon += 895 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 896 RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180*M_PI); 890 SphericalPointDistribution::WeightedPolygon_t polygon; 891 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 892 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180*M_PI), 1); 897 893 SphericalPointDistribution::Polygon_t newpolygon = 898 894 SPD.get<7>(); … … 911 907 // hence, we just check that they are orthogonal to the first two points 912 908 CPPUNIT_ASSERT_EQUAL( expected.size(), remaining.size() ); 913 for (SphericalPointDistribution:: Polygon_t::const_iterator fixiter = polygon.begin();909 for (SphericalPointDistribution::WeightedPolygon_t::const_iterator fixiter = polygon.begin(); 914 910 fixiter != polygon.end(); ++fixiter) { 915 911 for (SphericalPointDistribution::Polygon_t::const_iterator iter = remaining.begin(); 916 912 iter != remaining.end(); ++iter) { 917 CPPUNIT_ASSERT( ( *fixiter).IsNormalTo(*iter) );913 CPPUNIT_ASSERT( (fixiter->first).IsNormalTo(*iter) ); 918 914 } 919 915 } … … 922 918 // test with three points, matching trivially 923 919 { 924 SphericalPointDistribution::Polygon_t polygon; 925 polygon += 926 Vector(1.,0.,0.), 927 Vector(-1., 0.0, 0.0), 928 Vector(0.0, 1., 0.0); 920 SphericalPointDistribution::WeightedPolygon_t polygon; 921 polygon += std::make_pair( Vector(1.,0.,0.), 1); 922 polygon += std::make_pair( Vector(-1., 0.0, 0.0), 1); 923 polygon += std::make_pair( Vector(0.0, 1., 0.0), 1); 929 924 SphericalPointDistribution::Polygon_t newpolygon = 930 925 SPD.get<7>(); … … 947 942 { 948 943 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 949 SphericalPointDistribution::Polygon_t polygon; 950 polygon += 951 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 952 RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 953 RotationAxis.rotateVector(Vector(0.0, 1., 0.0), 47.6/180*M_PI); 944 SphericalPointDistribution::WeightedPolygon_t polygon; 945 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 946 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 1); 947 polygon += std::make_pair(RotationAxis.rotateVector(Vector(0.0, 1., 0.0), 47.6/180*M_PI), 1); 954 948 SphericalPointDistribution::Polygon_t newpolygon = 955 949 SPD.get<7>(); … … 981 975 // test with one point, matching trivially 982 976 { 983 SphericalPointDistribution:: Polygon_t polygon;984 polygon += Vector(1.,0.,0.);977 SphericalPointDistribution::WeightedPolygon_t polygon; 978 polygon += std::make_pair( Vector(1.,0.,0.), 1); 985 979 SphericalPointDistribution::Polygon_t newpolygon = 986 980 SPD.get<8>(); … … 996 990 // test with one point, just a flip of axis 997 991 { 998 SphericalPointDistribution:: Polygon_t polygon;999 polygon += Vector(0.,1.,0.);992 SphericalPointDistribution::WeightedPolygon_t polygon; 993 polygon += std::make_pair( Vector(0.,1.,0.), 1); 1000 994 SphericalPointDistribution::Polygon_t newpolygon = 1001 995 SPD.get<8>(); … … 1016 1010 // test with two points, matching trivially 1017 1011 { 1018 SphericalPointDistribution::Polygon_t polygon; 1019 polygon += Vector(1.,0.,0.), Vector(-1.,0.,0.); 1012 SphericalPointDistribution::WeightedPolygon_t polygon; 1013 polygon += std::make_pair( Vector(1.,0.,0.), 1); 1014 polygon += std::make_pair( Vector(-1.,0.,0.), 1); 1020 1015 SphericalPointDistribution::Polygon_t newpolygon = 1021 1016 SPD.get<8>(); … … 1037 1032 { 1038 1033 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 1039 SphericalPointDistribution::Polygon_t polygon; 1040 polygon += 1041 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1042 RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180*M_PI); 1034 SphericalPointDistribution::WeightedPolygon_t polygon; 1035 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 1036 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180*M_PI), 1); 1043 1037 SphericalPointDistribution::Polygon_t newpolygon = 1044 1038 SPD.get<8>(); … … 1057 1051 // hence, we just check that they are orthogonal to the first two points 1058 1052 CPPUNIT_ASSERT_EQUAL( expected.size(), remaining.size() ); 1059 for (SphericalPointDistribution:: Polygon_t::const_iterator fixiter = polygon.begin();1053 for (SphericalPointDistribution::WeightedPolygon_t::const_iterator fixiter = polygon.begin(); 1060 1054 fixiter != polygon.end(); ++fixiter) { 1061 1055 SphericalPointDistribution::Polygon_t::const_iterator expectiter = expected.begin(); … … 1064 1058 // check that points in expected/remaining have same angle to the given ones 1065 1059 // CPPUNIT_ASSERT_EQUAL( (*expectiter).Angle(*fixiter), (*remainiter).Angle(*fixiter) ); 1066 CPPUNIT_ASSERT( fabs( (*expectiter).Angle( *fixiter) - (*remainiter).Angle(*fixiter) )1060 CPPUNIT_ASSERT( fabs( (*expectiter).Angle(fixiter->first) - (*remainiter).Angle(fixiter->first) ) 1067 1061 < std::numeric_limits<double>::epsilon()*1e4 ); 1068 1062 } … … 1072 1066 // test with three points, matching trivially 1073 1067 { 1074 SphericalPointDistribution::Polygon_t polygon; 1075 polygon += 1076 Vector(1.,0.,0.), 1077 Vector(-1., 0.0, 0.0), 1078 Vector(-1./3.0, 2.0*M_SQRT2/3.0, 0.0); 1068 SphericalPointDistribution::WeightedPolygon_t polygon; 1069 polygon += std::make_pair( Vector(1.,0.,0.), 1); 1070 polygon += std::make_pair( Vector(-1., 0.0, 0.0), 1); 1071 polygon += std::make_pair( Vector(-1./3.0, 2.0*M_SQRT2/3.0, 0.0), 1); 1079 1072 SphericalPointDistribution::Polygon_t newpolygon = 1080 1073 SPD.get<8>(); … … 1097 1090 { 1098 1091 Line RotationAxis(zeroVec, Vector(0.2, 0.43, 0.6893248)); 1099 SphericalPointDistribution::Polygon_t polygon; 1100 polygon += 1101 RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1102 RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 1103 RotationAxis.rotateVector(Vector(-1./3.0, 2.0*M_SQRT2/3.0, 0.0), 47.6/180*M_PI); 1092 SphericalPointDistribution::WeightedPolygon_t polygon; 1093 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 1094 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 1); 1095 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1./3.0, 2.0*M_SQRT2/3.0, 0.0), 47.6/180*M_PI), 1); 1104 1096 SphericalPointDistribution::Polygon_t newpolygon = 1105 1097 SPD.get<8>();
Note:
See TracChangeset
for help on using the changeset viewer.