Ignore:
Timestamp:
Apr 27, 2010, 2:25:42 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
90c4460
Parents:
1561e2 (diff), 2bc713 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'Analysis_PairCorrelation' into StructureRefactoring

Conflicts:

molecuilder/src/Makefile.am
molecuilder/src/World.cpp
molecuilder/src/World.hpp
molecuilder/src/boundary.cpp
molecuilder/src/builder.cpp
molecuilder/src/log.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/periodentafel.cpp
molecuilder/src/tesselation.cpp
molecuilder/src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
molecuilder/src/unittests/Makefile.am
molecuilder/src/unittests/bondgraphunittest.cpp
molecuilder/src/unittests/gslvectorunittest.cpp
molecuilder/src/unittests/logunittest.cpp
molecuilder/src/unittests/tesselation_boundarytriangleunittest.hpp
molecuilder/src/vector.cpp
molecuilder/tests/Tesselations/defs.in

Conflicts have been many and too numerous to listen here, just the few general cases

  • new molecule() replaced by World::getInstance().createMolecule()
  • new atom() replaced by World::getInstance().createAtom() where appropriate.
  • Some DoLog()s added interfered with changes to the message produced by Log() << Verbose(.) << ...
  • DoLog() has been erroneously added to TestRunner.cpp as well, there cout is appropriate
  • ...

Additionally, there was a bug in atom::clone(), sort was set to atom::nr of the atom to clone not of the clone itself. This caused a failure of the fragmentation.

This merge has been fully checked from a clean build directory with subsequent configure,make all install and make check.
It configures, compiles and runs all test cases and the test suite without errors.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    r1561e2 r075729  
    7070
    7171  // construct molecule (tetraeder of hydrogens) base
     72  TestSurfaceMolecule = World::getInstance().createMolecule();
     73  Walker = World::getInstance().createAtom();
     74  Walker->type = hydrogen;
     75  Walker->node->Init(1., 0., 1. );
     76  TestSurfaceMolecule->AddAtom(Walker);
     77  Walker = World::getInstance().createAtom();
     78  Walker->type = hydrogen;
     79  Walker->node->Init(0., 1., 1. );
     80  TestSurfaceMolecule->AddAtom(Walker);
     81  Walker = World::getInstance().createAtom();
     82  Walker->type = hydrogen;
     83  Walker->node->Init(1., 1., 0. );
     84  TestSurfaceMolecule->AddAtom(Walker);
     85  Walker = World::getInstance().createAtom();
     86  Walker->type = hydrogen;
     87  Walker->node->Init(0., 0., 0. );
     88  TestSurfaceMolecule->AddAtom(Walker);
     89
     90  // check that TestMolecule was correctly constructed
     91  CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->AtomCount, 4 );
     92
     93  TestList = World::getInstance().getMolecules();
     94  TestSurfaceMolecule->ActiveFlag = true;
     95  TestList->insert(TestSurfaceMolecule);
     96
     97  // init tesselation and linked cell
     98  Surface = new Tesselation;
     99  LC = new LinkedCell(TestSurfaceMolecule, 5.);
     100  FindNonConvexBorder(TestSurfaceMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
     101
     102  // add outer atoms
    72103  TestMolecule = World::getInstance().createMolecule();
    73104  Walker = World::getInstance().createAtom();
    74   Walker->type = hydrogen;
    75   Walker->node->Init(1., 0., 1. );
    76   TestMolecule->AddAtom(Walker);
    77   Walker = World::getInstance().createAtom();
    78   Walker->type = hydrogen;
    79   Walker->node->Init(0., 1., 1. );
    80   TestMolecule->AddAtom(Walker);
    81   Walker = World::getInstance().createAtom();
    82   Walker->type = hydrogen;
    83   Walker->node->Init(1., 1., 0. );
    84   TestMolecule->AddAtom(Walker);
    85   Walker = World::getInstance().createAtom();
    86   Walker->type = hydrogen;
    87   Walker->node->Init(0., 0., 0. );
    88   TestMolecule->AddAtom(Walker);
    89 
    90   // check that TestMolecule was correctly constructed
    91   CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
    92 
    93   TestList = World::getInstance().getMolecules();
     105  Walker->type = carbon;
     106  Walker->node->Init(4., 0., 4. );
     107  TestMolecule->AddAtom(Walker);
     108  Walker = World::getInstance().createAtom();
     109  Walker->type = carbon;
     110  Walker->node->Init(0., 4., 4. );
     111  TestMolecule->AddAtom(Walker);
     112  Walker = World::getInstance().createAtom();
     113  Walker->type = carbon;
     114  Walker->node->Init(4., 4., 0. );
     115  TestMolecule->AddAtom(Walker);
     116  // add inner atoms
     117  Walker = World::getInstance().createAtom();
     118  Walker->type = carbon;
     119  Walker->node->Init(0.5, 0.5, 0.5 );
     120  TestMolecule->AddAtom(Walker);
    94121  TestMolecule->ActiveFlag = true;
    95122  TestList->insert(TestMolecule);
    96 
    97   // init tesselation and linked cell
    98   Surface = new Tesselation;
    99   FindNonConvexBorder(TestMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
    100   LC = new LinkedCell(TestMolecule, 5.);
    101   CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
    102   CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() );
    103   CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->TrianglesOnBoundary.size() );
    104 
    105   // add outer atoms
    106   Walker = World::getInstance().createAtom();
    107   Walker->type = carbon;
    108   Walker->node->Init(4., 0., 4. );
    109   TestMolecule->AddAtom(Walker);
    110   Walker = World::getInstance().createAtom();
    111   Walker->type = carbon;
    112   Walker->node->Init(0., 4., 4. );
    113   TestMolecule->AddAtom(Walker);
    114   Walker = World::getInstance().createAtom();
    115   Walker->type = carbon;
    116   Walker->node->Init(4., 4., 0. );
    117   TestMolecule->AddAtom(Walker);
    118   // add inner atoms
    119   Walker = World::getInstance().createAtom();
    120   Walker->type = carbon;
    121   Walker->node->Init(0.5, 0.5, 0.5 );
    122   TestMolecule->AddAtom(Walker);
    123123
    124124  // init maps
     
    145145
    146146
     147/** Checks whether setup() does the right thing.
     148 */
     149void AnalysisCorrelationToSurfaceUnitTest::SurfaceTest()
     150{
     151  CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->AtomCount );
     152  CPPUNIT_ASSERT_EQUAL( 4, TestMolecule->AtomCount );
     153  CPPUNIT_ASSERT_EQUAL( (size_t)2, TestList->ListOfMolecules.size() );
     154  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() );
     155  CPPUNIT_ASSERT_EQUAL( (size_t)6, Surface->LinesOnBoundary.size() );
     156  CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->TrianglesOnBoundary.size() );
     157};
     158
    147159void AnalysisCorrelationToSurfaceUnitTest::CorrelationToSurfaceTest()
    148160{
    149161  // do the pair correlation
    150162  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
     163//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    151164  CPPUNIT_ASSERT( surfacemap != NULL );
    152165  CPPUNIT_ASSERT_EQUAL( (size_t)4, surfacemap->size() );
     
    158171  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
    159172  // put pair correlation into bins and check with no range
     173//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    160174  binmap = BinData( surfacemap, 0.5, 0., 0. );
    161175  CPPUNIT_ASSERT_EQUAL( (size_t)1, binmap->size() );
    162   //OutputCorrelation ( binmap );
     176  OutputCorrelation ( (ofstream *)&cout, binmap );
    163177  tester = binmap->begin();
    164178  CPPUNIT_ASSERT_EQUAL( 0., tester->first );
     
    171185  BinPairMap::iterator tester;
    172186  surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC );
     187//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    173188  // ... and check with [0., 2.] range
    174189  binmap = BinData( surfacemap, 0.5, 0., 2. );
    175190  CPPUNIT_ASSERT_EQUAL( (size_t)5, binmap->size() );
    176   //OutputCorrelation ( binmap );
     191//  OutputCorrelation ( (ofstream *)&cout, binmap );
    177192  tester = binmap->begin();
    178193  CPPUNIT_ASSERT_EQUAL( 0., tester->first );
     
    188203  BinPairMap::iterator tester;
    189204  surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC );
     205//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    190206  // put pair correlation into bins and check with no range
    191207  binmap = BinData( surfacemap, 0.5, 0., 0. );
    192   CPPUNIT_ASSERT_EQUAL( (size_t)2, binmap->size() );
    193   OutputCorrelation ( (ofstream *)&cout, binmap );
     208  //OutputCorrelation ( (ofstream *)&cout, binmap );
     209  CPPUNIT_ASSERT_EQUAL( (size_t)9, binmap->size() );
    194210  // inside point is first and must have negative value
    195   tester = binmap->lower_bound(2.95); // start depends on the min value and
     211  tester = binmap->lower_bound(4.25-0.5); // start depends on the min value and
    196212  CPPUNIT_ASSERT( tester != binmap->end() );
    197213  CPPUNIT_ASSERT_EQUAL( 3, tester->second );
    198214  // inner point
    199   tester = binmap->lower_bound(-0.5);
     215  tester = binmap->lower_bound(0.);
    200216  CPPUNIT_ASSERT( tester != binmap->end() );
    201217  CPPUNIT_ASSERT_EQUAL( 1, tester->second );
     
    206222  BinPairMap::iterator tester;
    207223  surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC );
     224//  OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap );
    208225  // ... and check with [0., 2.] range
    209226  binmap = BinData( surfacemap, 0.5, -2., 4. );
     227  //OutputCorrelation ( (ofstream *)&cout, binmap );
    210228  CPPUNIT_ASSERT_EQUAL( (size_t)13, binmap->size() );
    211   OutputCorrelation ( (ofstream *)&cout, binmap );
    212229  // three outside points
    213   tester = binmap->lower_bound(3.);
     230  tester = binmap->lower_bound(4.25-0.5);
    214231  CPPUNIT_ASSERT( tester != binmap->end() );
    215232  CPPUNIT_ASSERT_EQUAL( 3, tester->second );
    216233  // inner point
    217   tester = binmap->lower_bound(-0.5);
     234  tester = binmap->lower_bound(0.);
    218235  CPPUNIT_ASSERT( tester != binmap->end() );
    219236  CPPUNIT_ASSERT_EQUAL( 1, tester->second );
    220 
    221 };
     237};
Note: See TracChangeset for help on using the changeset viewer.