Ignore:
Timestamp:
Aug 20, 2014, 1:06:16 PM (11 years ago)
Author:
Frederik Heber <heber@…>
Children:
1cde4e8
Parents:
1ae9aa
git-author:
Frederik Heber <heber@…> (06/30/14 09:35:42)
git-committer:
Frederik Heber <heber@…> (08/20/14 13:06:16)
Message:

SphericalPointDistribution is now working with bond degree weights.

  • recurseMatching() now works on IndexTupleList_t.
  • also rewrote calculatePairwiseDistances() and calculateErrorOfMatching().
  • L1THRESHOLD in recurseMatching() moved over to class body.
  • increased verbosity level of ...Matching() functions by one, added note on eventually chosen matching and why.
  • we assert that bestL2 is not too large.
  • FIX: calculateErrorOfMatching() did not use absolute value of gap for L1 error.
  • TESTS: Regresssion test FragmentMolecule-cycles working again.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Exporters/unittests/SphericalPointDistributionUnitTest.cpp

    r1ae9aa r23c605  
    638638}
    639639
     640/** UnitTest for matchSphericalPointDistributions() with four points and weights
     641 * not all equal to one.
     642 */
     643void SphericalPointDistributionTest::matchSphericalPointDistributionsTest_multiple()
     644{
     645  SphericalPointDistribution SPD(1.);
     646
     647  // test with four points: one point having weight of two
     648  {
     649    SphericalPointDistribution::WeightedPolygon_t polygon;
     650    polygon += std::make_pair( Vector(1.,0.,0.), 2);
     651    SphericalPointDistribution::Polygon_t newpolygon =
     652        SPD.get<4>();
     653    SphericalPointDistribution::Polygon_t expected;
     654    expected += Vector(-0.5773502691896,-5.551115123126e-17,0.8164965809277);
     655    expected += Vector(-0.5773502691896,-5.551115123126e-17,-0.8164965809277);
     656    SphericalPointDistribution::Polygon_t remaining =
     657        SphericalPointDistribution::matchSphericalPointDistributions(
     658            polygon,
     659            newpolygon);
     660//    std::cout << std::setprecision(13) << "Matched polygon is " << remaining << std::endl;
     661    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     662  }
     663
     664  // test with five points: one point having weight of two
     665  {
     666    SphericalPointDistribution::WeightedPolygon_t polygon;
     667    polygon += std::make_pair( Vector(1.,0.,0.), 2);
     668    SphericalPointDistribution::Polygon_t newpolygon =
     669        SPD.get<5>();
     670    SphericalPointDistribution::Polygon_t expected;
     671    expected += Vector(-0.7071067811865,0.7071067811865,0);
     672    expected += Vector(-0.3535533905933,-0.3535533905933,0.8660254037844);
     673    expected += Vector(-0.3535533905933,-0.3535533905933,-0.8660254037844);
     674    SphericalPointDistribution::Polygon_t remaining =
     675        SphericalPointDistribution::matchSphericalPointDistributions(
     676            polygon,
     677            newpolygon);
     678//    std::cout << std::setprecision(13) << "Matched polygon is " << remaining << std::endl;
     679    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     680  }
     681
     682
     683  // test with five points: one point having weight of two, one weight of one
     684  {
     685    SphericalPointDistribution::WeightedPolygon_t polygon;
     686    polygon += std::make_pair( Vector(M_SQRT1_2,M_SQRT1_2,0.), 2);
     687    polygon += std::make_pair( Vector(-1.,0.,0.), 1);
     688    SphericalPointDistribution::Polygon_t newpolygon =
     689        SPD.get<5>();
     690    SphericalPointDistribution::Polygon_t expected;
     691    expected += Vector(0.3535533786708,-0.3535533955317,-0.8660254066357);
     692    expected += Vector(0.3535534025157,-0.3535533856548,0.8660254009332);
     693    SphericalPointDistribution::Polygon_t remaining =
     694        SphericalPointDistribution::matchSphericalPointDistributions(
     695            polygon,
     696            newpolygon);
     697//    std::cout << std::setprecision(13) << "Matched polygon is " << remaining << std::endl;
     698    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     699  }
     700
     701  // test with six points: two points each having weight of two
     702  {
     703    SphericalPointDistribution::WeightedPolygon_t polygon;
     704    polygon += std::make_pair( Vector(M_SQRT1_2,-M_SQRT1_2,0.), 2);
     705    polygon += std::make_pair( Vector(-M_SQRT1_2,M_SQRT1_2,0.), 2);
     706    SphericalPointDistribution::Polygon_t newpolygon =
     707        SPD.get<6>();
     708    SphericalPointDistribution::Polygon_t expected;
     709    expected += Vector(0.,0.,-1.);
     710    expected += Vector(0.,0.,1.);
     711    SphericalPointDistribution::Polygon_t remaining =
     712        SphericalPointDistribution::matchSphericalPointDistributions(
     713            polygon,
     714            newpolygon);
     715//    std::cout << std::setprecision(13) << "Matched polygon is " << remaining << std::endl;
     716    CPPUNIT_ASSERT_EQUAL( expected, remaining );
     717  }
     718}
     719
    640720/** UnitTest for matchSphericalPointDistributions() with five points
    641721 */
Note: See TracChangeset for help on using the changeset viewer.