Changeset 8db598


Ignore:
Timestamp:
Mar 1, 2010, 10:10:13 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, 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_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
cb85c2e
Parents:
30d9e7
git-author:
Frederik Heber <heber@…> (03/01/10 20:48:40)
git-committer:
Frederik Heber <heber@…> (03/01/10 22:10:13)
Message:

New class TriangleIntersection List and (hopefully) final fix of CorrelationToSurface().

  • Distances to surface were still calculated between the vector and the triangle plane not the triangle itself. Although functions such as BoundaryTriangleSet::GetClosestPointInsideTriangle had already been written.
  • As in class Tesselation there were many functions that all did the same: Calculate intersections between a point and all closeby triangles and then get the intersection or calculate this minimum distance and so ...
  • ... this was all put into a new class (in a new file): TriangleIntersectionList whose constructor scans all nearby triangles and put the calculates Intersections in the triangle into a list.
  • Functions as IsInside(), GetSmallestDistance(), GetClosestIntersection() and GetClosestTriangle() bring the desired functionality to the outside.
  • Respective functions in class Tesselation just make use of this new class and its member functions.
  • CorrelationToSurface() also directly instantiates this class to effectively use two of its functions.
  • Makefile.am has this new file in its SOURCES and HEADERS.
  • Tesselation:GetDistanceSquaredToSurface() -> Tesselation:GetDistanceToSurface(), FillBoxWithMolecule() has been adapted to this change.

AnalysisCorrelationToSurfaceUnitTest:

  • still has errors in it, as the distance were wrong before (because with respect to triangle plane, not triangle). Hence, the test was corrected.

Signed-off-by: Frederik Heber <heber@…>

Location:
src
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r30d9e7 r8db598  
    88ANALYSISHEADER = analysis_bonds.hpp analysis_correlation.hpp
    99
    10 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp
    11 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp
     10SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp triangleintersectionlist.cpp vector.cpp verbose.cpp
     11HEADER = ${ANALYSISHEADER} ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp triangleintersectionlist.cpp vector.hpp verbose.hpp
    1212
    1313BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB)
  • src/analysis_correlation.cpp

    r30d9e7 r8db598  
    1515#include "tesselation.hpp"
    1616#include "tesselationhelpers.hpp"
     17#include "triangleintersectionlist.hpp"
    1718#include "vector.hpp"
    1819#include "verbose.hpp"
     
    255256
    256257  if ((Surface == NULL) || (LC == NULL) || (molecules->ListOfMolecules.empty())) {
    257     Log() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl;
     258    eLog() << Verbose(1) <<"No Tesselation, no LinkedCell or no molecule given." << endl;
    258259    return outmap;
    259260  }
     
    261262  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    262263    if ((*MolWalker)->ActiveFlag) {
    263       Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    264       atom *Walker = (*MolWalker)->start;
    265       while (Walker->next != (*MolWalker)->end) {
    266         Walker = Walker->next;
    267         Log() << Verbose(3) << "Current atom is " << *Walker << "." << endl;
     264      Log() << Verbose(1) << "Current molecule is " << (*MolWalker)->name << "." << endl;
     265      atom *Walker = (*MolWalker)->start;
     266      while (Walker->next != (*MolWalker)->end) {
     267        Walker = Walker->next;
     268        //Log() << Verbose(1) << "Current atom is " << *Walker << "." << endl;
    268269        if ((type == NULL) || (Walker->type == type)) {
    269           triangle = Surface->FindClosestTriangleToVector(Walker->node, LC );
    270           if (triangle != NULL) {
    271             distance = DistanceToTrianglePlane(Walker->node, triangle);
    272             outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) );
    273           }
    274         }
    275       }
    276     }
     270          TriangleIntersectionList Intersections(Walker->node,Surface,LC);
     271          distance = Intersections.GetSmallestDistance();
     272          triangle = Intersections.GetClosestTriangle();
     273          outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> (Walker, triangle) ) );
     274        }
     275      }
     276    } else
     277      Log() << Verbose(1) << "molecule " << (*MolWalker)->name << " is not active." << endl;
     278
    277279
    278280  return outmap;
     
    413415  Info FunctionInfo(__func__);
    414416  *file << "BinStart\tTriangle" << endl;
    415   for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
    416     *file << setprecision(8) << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl;
    417   }
    418 };
    419 
     417  if (!map->empty())
     418    for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
     419      *file << setprecision(8) << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl;
     420    }
     421};
     422
  • src/boundary.cpp

    r30d9e7 r8db598  
    904904              FillIt = false;
    905905            } else {
    906               const double distance = (TesselStruct[(*ListRunner)]->GetDistanceSquaredToSurface(Inserter, LCList[(*ListRunner)]));
    907               FillIt = FillIt && (distance > boundary*boundary) && ((MaxDistance < 0) || (MaxDistance*MaxDistance > distance));
     906              const double distance = (TesselStruct[(*ListRunner)]->GetDistanceToSurface(Inserter, LCList[(*ListRunner)]));
     907              FillIt = FillIt && (distance > boundary) && ((MaxDistance < 0) || (MaxDistance > distance));
    908908            }
    909909          }
  • src/tesselation.cpp

    r30d9e7 r8db598  
    1414#include "tesselation.hpp"
    1515#include "tesselationhelpers.hpp"
     16#include "triangleintersectionlist.hpp"
    1617#include "vector.hpp"
    1718#include "verbose.hpp"
     
    474475};
    475476
    476 /** Finds the point on the triangle \a *BTS through which the line defined by \a *MolCenter and \a *x crosses.
    477  * We call Vector::GetIntersectionWithPlane() to receive the intersection point with the plane
     477/** Finds the point on the triangle to the point \a *x.
     478 * We call Vector::GetIntersectionWithPlane() with \a * and the center of the triangle to receive an intersection point.
     479 * Then we check the in-plane part (the part projected down onto plane). We check whether it crosses one of the
     480 * boundary lines. If it does, we return this intersection as closest point, otherwise the projected point down.
    478481 * Thus we test if it's really on the plane and whether it's inside the triangle on the plane or not.
    479482 * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line
     
    32223225};
    32233226
    3224 
    32253227/** Finds the triangle that is closest to a given Vector \a *x.
    32263228 * \param *out output stream for debugging
     
    33153317 * \param *out output stream for debugging
    33163318 * \param *x Vector to look from
     3319 * \param &distance contains found distance on return
    33173320 * \return list of BoundaryTriangleSet of nearest triangles or NULL.
    33183321 */
     
    33583361bool Tesselation::IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const
    33593362{
    3360   return (GetDistanceSquaredToSurface(Point, LC) < MYEPSILON);
    3361 }
     3363  Info FunctionInfo(__func__);
     3364  TriangleIntersectionList Intersections(&Point,this,LC);
     3365
     3366  return Intersections.IsInside();
     3367};
    33623368
    33633369/** Returns the distance to the surface given by the tesselation.
     
    34323438};
    34333439
    3434 /** Calculates distance to a tesselated surface.
     3440/** Calculates minimum distance from \a&Point to a tesselated surface.
    34353441 * Combines \sa FindClosestTrianglesToVector() and \sa GetDistanceSquaredToTriangle().
    34363442 * \param &Point point to calculate distance from
     
    34383444 * \return distance squared to closest point on surface
    34393445 */
    3440 double Tesselation::GetDistanceSquaredToSurface(const Vector &Point, const LinkedCell* const LC) const
    3441 {
    3442   BoundaryTriangleSet *triangle = FindClosestTriangleToVector(&Point, LC);
    3443   const double distance = GetDistanceSquaredToTriangle(Point, triangle);
    3444   return Min(distance, LC->RADIUS);
     3446double Tesselation::GetDistanceToSurface(const Vector &Point, const LinkedCell* const LC) const
     3447{
     3448  Info FunctionInfo(__func__);
     3449  TriangleIntersectionList Intersections(&Point,this,LC);
     3450
     3451  return Intersections.GetSmallestDistance();
     3452};
     3453
     3454/** Calculates minimum distance from \a&Point to a tesselated surface.
     3455 * Combines \sa FindClosestTrianglesToVector() and \sa GetDistanceSquaredToTriangle().
     3456 * \param &Point point to calculate distance from
     3457 * \param *LC needed for finding closest points fast
     3458 * \return distance squared to closest point on surface
     3459 */
     3460BoundaryTriangleSet * Tesselation::GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell* const LC) const
     3461{
     3462  Info FunctionInfo(__func__);
     3463  TriangleIntersectionList Intersections(&Point,this,LC);
     3464
     3465  return Intersections.GetClosestTriangle();
    34453466};
    34463467
  • src/tesselation.hpp

    r30d9e7 r8db598  
    318318    bool IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const;
    319319    double GetDistanceSquaredToTriangle(const Vector &Point, const BoundaryTriangleSet* const triangle) const;
    320     double GetDistanceSquaredToSurface(const Vector &Point, const LinkedCell* const LC) const;
     320    double GetDistanceToSurface(const Vector &Point, const LinkedCell* const LC) const;
     321    BoundaryTriangleSet * GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell* const LC) const;
    321322    bool AddBoundaryPoint(TesselPoint * Walker, const int n);
    322323    DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector *x, const LinkedCell* LC) const;
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    r30d9e7 r8db598  
    6060
    6161  // construct molecule (tetraeder of hydrogens) base
     62  TestSurfaceMolecule = new molecule(tafel);
     63  Walker = new atom();
     64  Walker->type = hydrogen;
     65  Walker->node->Init(1., 0., 1. );
     66  TestSurfaceMolecule->AddAtom(Walker);
     67  Walker = new atom();
     68  Walker->type = hydrogen;
     69  Walker->node->Init(0., 1., 1. );
     70  TestSurfaceMolecule->AddAtom(Walker);
     71  Walker = new atom();
     72  Walker->type = hydrogen;
     73  Walker->node->Init(1., 1., 0. );
     74  TestSurfaceMolecule->AddAtom(Walker);
     75  Walker = new atom();
     76  Walker->type = hydrogen;
     77  Walker->node->Init(0., 0., 0. );
     78  TestSurfaceMolecule->AddAtom(Walker);
     79
     80  // check that TestMolecule was correctly constructed
     81  CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->AtomCount, 4 );
     82
     83  TestList = new MoleculeListClass;
     84  TestSurfaceMolecule->ActiveFlag = true;
     85  TestList->insert(TestSurfaceMolecule);
     86
     87  // init tesselation and linked cell
     88  Surface = new Tesselation;
     89  LC = new LinkedCell(TestSurfaceMolecule, 5.);
     90  FindNonConvexBorder(TestSurfaceMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
     91
     92  // add outer atoms
    6293  TestMolecule = new molecule(tafel);
    6394  Walker = new atom();
    64   Walker->type = hydrogen;
    65   Walker->node->Init(1., 0., 1. );
    66   TestMolecule->AddAtom(Walker);
    67   Walker = new atom();
    68   Walker->type = hydrogen;
    69   Walker->node->Init(0., 1., 1. );
    70   TestMolecule->AddAtom(Walker);
    71   Walker = new atom();
    72   Walker->type = hydrogen;
    73   Walker->node->Init(1., 1., 0. );
    74   TestMolecule->AddAtom(Walker);
    75   Walker = new atom();
    76   Walker->type = hydrogen;
    77   Walker->node->Init(0., 0., 0. );
    78   TestMolecule->AddAtom(Walker);
    79 
    80   // check that TestMolecule was correctly constructed
    81   CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
    82 
    83   TestList = new MoleculeListClass;
     95  Walker->type = carbon;
     96  Walker->node->Init(4., 0., 4. );
     97  TestMolecule->AddAtom(Walker);
     98  Walker = new atom();
     99  Walker->type = carbon;
     100  Walker->node->Init(0., 4., 4. );
     101  TestMolecule->AddAtom(Walker);
     102  Walker = new atom();
     103  Walker->type = carbon;
     104  Walker->node->Init(4., 4., 0. );
     105  TestMolecule->AddAtom(Walker);
     106  // add inner atoms
     107  Walker = new atom();
     108  Walker->type = carbon;
     109  Walker->node->Init(0.5, 0.5, 0.5 );
     110  TestMolecule->AddAtom(Walker);
    84111  TestMolecule->ActiveFlag = true;
    85112  TestList->insert(TestMolecule);
    86 
    87   // init tesselation and linked cell
    88   Surface = new Tesselation;
    89   FindNonConvexBorder(TestMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
    90   LC = new LinkedCell(TestMolecule, 5.);
    91   CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
    92   CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() );
    93   CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->TrianglesOnBoundary.size() );
    94 
    95   // add outer atoms
    96   Walker = new atom();
    97   Walker->type = carbon;
    98   Walker->node->Init(4., 0., 4. );
    99   TestMolecule->AddAtom(Walker);
    100   Walker = new atom();
    101   Walker->type = carbon;
    102   Walker->node->Init(0., 4., 4. );
    103   TestMolecule->AddAtom(Walker);
    104   Walker = new atom();
    105   Walker->type = carbon;
    106   Walker->node->Init(4., 4., 0. );
    107   TestMolecule->AddAtom(Walker);
    108   // add inner atoms
    109   Walker = new atom();
    110   Walker->type = carbon;
    111   Walker->node->Init(0.5, 0.5, 0.5 );
    112   TestMolecule->AddAtom(Walker);
    113113
    114114  // init maps
     
    136136
    137137
     138/** Checks whether setup() does the right thing.
     139 */
     140void AnalysisCorrelationToSurfaceUnitTest::SurfaceTest()
     141{
     142  CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->AtomCount );
     143  CPPUNIT_ASSERT_EQUAL( 4, TestMolecule->AtomCount );
     144  CPPUNIT_ASSERT_EQUAL( (size_t)2, TestList->ListOfMolecules.size() );
     145  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
     146  CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() );
     147  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->TrianglesOnBoundary.size() );
     148};
     149
    138150void AnalysisCorrelationToSurfaceUnitTest::CorrelationToSurfaceTest()
    139151{
    140152  // do the pair correlation
    141153  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
     154//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    142155  CPPUNIT_ASSERT( surfacemap != NULL );
    143156  CPPUNIT_ASSERT_EQUAL( (size_t)4, surfacemap->size() );
     
    149162  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
    150163  // put pair correlation into bins and check with no range
     164//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    151165  binmap = BinData( surfacemap, 0.5, 0., 0. );
    152166  CPPUNIT_ASSERT_EQUAL( (size_t)1, binmap->size() );
    153   //OutputCorrelation ( binmap );
     167  OutputCorrelation ( (ofstream *)&cout, binmap );
    154168  tester = binmap->begin();
    155169  CPPUNIT_ASSERT_EQUAL( 0., tester->first );
     
    162176  BinPairMap::iterator tester;
    163177  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
     178//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    164179  // ... and check with [0., 2.] range
    165180  binmap = BinData( surfacemap, 0.5, 0., 2. );
    166181  CPPUNIT_ASSERT_EQUAL( (size_t)5, binmap->size() );
    167   //OutputCorrelation ( binmap );
     182//  OutputCorrelation ( (ofstream *)&cout, binmap );
    168183  tester = binmap->begin();
    169184  CPPUNIT_ASSERT_EQUAL( 0., tester->first );
     
    179194  BinPairMap::iterator tester;
    180195  surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC );
     196//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    181197  // put pair correlation into bins and check with no range
    182198  binmap = BinData( surfacemap, 0.5, 0., 0. );
     
    184200  OutputCorrelation ( (ofstream *)&cout, binmap );
    185201  // inside point is first and must have negative value
    186   tester = binmap->lower_bound(2.95); // start depends on the min value and
     202  tester = binmap->lower_bound(4.25-0.5); // start depends on the min value and
    187203  CPPUNIT_ASSERT( tester != binmap->end() );
    188204  CPPUNIT_ASSERT_EQUAL( 3, tester->second );
    189205  // inner point
    190   tester = binmap->lower_bound(-0.5);
     206  tester = binmap->lower_bound(0.);
    191207  CPPUNIT_ASSERT( tester != binmap->end() );
    192208  CPPUNIT_ASSERT_EQUAL( 1, tester->second );
     
    197213  BinPairMap::iterator tester;
    198214  surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC );
     215//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    199216  // ... and check with [0., 2.] range
    200217  binmap = BinData( surfacemap, 0.5, -2., 4. );
    201218  CPPUNIT_ASSERT_EQUAL( (size_t)13, binmap->size() );
    202   OutputCorrelation ( (ofstream *)&cout, binmap );
     219//  OutputCorrelation ( (ofstream *)&cout, binmap );
    203220  // three outside points
    204   tester = binmap->lower_bound(3.);
     221  tester = binmap->lower_bound(4.25-0.5);
    205222  CPPUNIT_ASSERT( tester != binmap->end() );
    206223  CPPUNIT_ASSERT_EQUAL( 3, tester->second );
    207224  // inner point
    208   tester = binmap->lower_bound(-0.5);
     225  tester = binmap->lower_bound(0.);
    209226  CPPUNIT_ASSERT( tester != binmap->end() );
    210227  CPPUNIT_ASSERT_EQUAL( 1, tester->second );
    211 
    212228};
    213229
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp

    r30d9e7 r8db598  
    2323{
    2424    CPPUNIT_TEST_SUITE( AnalysisCorrelationToSurfaceUnitTest ) ;
     25    CPPUNIT_TEST ( SurfaceTest );
    2526    CPPUNIT_TEST ( CorrelationToSurfaceTest );
    2627    CPPUNIT_TEST ( CorrelationToSurfaceHydrogenBinNoRangeTest );
     
    3334      void setUp();
    3435      void tearDown();
     36      void SurfaceTest();
    3537      void CorrelationToSurfaceTest();
    3638      void CorrelationToSurfaceHydrogenBinNoRangeTest();
     
    4345      MoleculeListClass *TestList;
    4446      molecule *TestMolecule;
     47      molecule *TestSurfaceMolecule;
    4548      element *hydrogen;
    4649      element *carbon;
Note: See TracChangeset for help on using the changeset viewer.