Changeset cb2146 for src


Ignore:
Timestamp:
Mar 5, 2010, 1:45:35 PM (15 years ago)
Author:
Saskia Metzler <metzler@…>
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:
9131f3
Parents:
7dc102 (diff), 31af19 (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:

solve merge conflict

Merge commit 'till/StructureRefactoring' into StateAndFormatParser

Conflicts:

molecuilder/src/unittests/Makefile.am

Location:
src
Files:
5 added
9 edited
2 moved

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r7dc102 rcb2146  
    3232LEGACYHEADER = Legacy/oldmenu.hpp
    3333
    34 DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp Descriptors/AtomIdDescriptor.cpp Descriptors/AtomTypeDescriptor.cpp Descriptors/MoleculeDescriptor.cpp
    35 DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp Descriptors/AtomIdDescriptor.hpp Descriptors/AtomTypeDescriptor.hpp Descriptors/MoleculeDescriptor.hpp
     34DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp \
     35                                   Descriptors/AtomIdDescriptor.cpp \
     36                                   Descriptors/AtomTypeDescriptor.cpp \
     37                                   Descriptors/MoleculeDescriptor.cpp \
     38                                   Descriptors/MoleculeIdDescriptor.cpp
     39                                   
     40DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp \
     41                                   Descriptors/AtomIdDescriptor.hpp \
     42                                   Descriptors/AtomTypeDescriptor.hpp \
     43                                   Descriptors/MoleculeDescriptor.hpp \
     44                                   Descriptors/MoleculeIdDescriptor.hpp
    3645
    3746SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PARSERSOURCE} ${PATTERNSOURCE} ${UISOURCE} ${DESCRIPTORSOURCE} ${LEGACYSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp lists.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 World.cpp WorldIterators.cpp
  • src/Parser/TremoloParser.hpp

    r7dc102 rcb2146  
    1818
    1919private:
    20   map<string, string> moreData;
     20  map<std::string, std::string> moreData;
    2121};
    2222
  • src/World.cpp

    r7dc102 rcb2146  
    159159/******************************* IDManagement *****************************/
    160160
     161// Atoms
     162
    161163atomId_t World::getNextAtomId(){
    162164  // see if we can reuse some Id
     
    199201  }
    200202}
     203
     204// Molecules
     205
    201206/******************************* Iterators ********************************/
    202207
  • src/World.hpp

    r7dc102 rcb2146  
    151151  // Atoms
    152152
    153   class AtomIterator {
     153  class AtomIterator :
     154    public std::iterator<std::iterator_traits<AtomSet::iterator>::difference_type,
     155                         std::iterator_traits<AtomSet::iterator>::value_type,
     156                         std::iterator_traits<AtomSet::iterator>::pointer,
     157                         std::iterator_traits<AtomSet::iterator>::reference>
     158  {
    154159  public:
     160
     161    typedef AtomSet::iterator _Iter;
     162    typedef _Iter::value_type value_type;
     163    typedef _Iter::difference_type difference_type;
     164    typedef _Iter::pointer pointer;
     165    typedef _Iter::reference reference;
     166    typedef _Iter::iterator_category iterator_category;
     167
     168
    155169    AtomIterator();
    156170    AtomIterator(AtomDescriptor, World*);
     
    191205  // Molecules
    192206
    193   class MoleculeIterator {
     207  class MoleculeIterator :
     208    public std::iterator<std::iterator_traits<MoleculeSet::iterator>::difference_type,
     209                         std::iterator_traits<MoleculeSet::iterator>::value_type,
     210                         std::iterator_traits<MoleculeSet::iterator>::pointer,
     211                         std::iterator_traits<MoleculeSet::iterator>::reference>
     212  {
    194213  public:
     214
     215    typedef MoleculeSet::iterator _Iter;
     216    typedef _Iter::value_type value_type;
     217    typedef _Iter::difference_type difference_type;
     218    typedef _Iter::pointer pointer;
     219    typedef _Iter::reference reference;
     220    typedef _Iter::iterator_category iterator_category;
     221
    195222    MoleculeIterator();
    196223    MoleculeIterator(MoleculeDescriptor, World*);
  • src/atom.cpp

    r7dc102 rcb2146  
    306306}
    307307
    308 int atom::getId() {
     308atomId_t atom::getId() {
    309309  return id;
    310310}
  • src/atom.hpp

    r7dc102 rcb2146  
    7979  void setWorld(World*);
    8080
    81   virtual int getId();
     81  virtual atomId_t getId();
    8282  virtual bool changeId(atomId_t newId);
    8383
  • src/unittests/AtomDescriptorTest.cpp

    r7dc102 rcb2146  
    66 */
    77
    8 #include "DescriptorUnittest.hpp"
     8#include "AtomDescriptorTest.hpp"
    99
    1010#include <cppunit/CompilerOutputter.h>
     
    2525/********************************************** Test classes **************************************/
    2626// Registers the fixture into the 'registry'
    27 CPPUNIT_TEST_SUITE_REGISTRATION( DescriptorUnittest );
     27CPPUNIT_TEST_SUITE_REGISTRATION( AtomDescriptorTest );
    2828
    2929// set up and tear down
    30 void DescriptorUnittest::setUp(){
     30void AtomDescriptorTest::setUp(){
    3131  World::get();
    3232  for(int i=0;i<ATOM_COUNT;++i){
    3333    atoms[i]= World::get()->createAtom();
    34     atomIds[i] = atoms[i]->getId();
     34    atomIds[i]= atoms[i]->getId();
    3535  }
    3636}
    37 void DescriptorUnittest::tearDown(){
     37
     38void AtomDescriptorTest::tearDown(){
    3839  World::destroy();
    3940}
    4041
    4142// some helper functions
    42 bool hasAll(std::vector<atom*> atoms,int ids[ATOM_COUNT], std::set<int> excluded = std::set<int>()){
     43static bool hasAllAtoms(std::vector<atom*> atoms,atomId_t ids[ATOM_COUNT], std::set<atomId_t> excluded = std::set<atomId_t>()){
    4344  for(int i=0;i<ATOM_COUNT;++i){
    44     int id = ids[i];
     45    atomId_t id = ids[i];
    4546    if(!excluded.count(id)){
    4647      std::vector<atom*>::iterator iter;
     
    5859}
    5960
    60 bool hasNoDuplicates(std::vector<atom*> atoms){
    61   std::set<int> found;
     61static bool hasNoDuplicateAtoms(std::vector<atom*> atoms){
     62  std::set<atomId_t> found;
    6263  std::vector<atom*>::iterator iter;
    6364  for(iter=atoms.begin();iter!=atoms.end();++iter){
     
    7172
    7273
    73 void DescriptorUnittest::AtomBaseSetsTest(){
     74void AtomDescriptorTest::AtomBaseSetsTest(){
    7475  std::vector<atom*> allAtoms = World::get()->getAllAtoms(AllAtoms());
    75   CPPUNIT_ASSERT_EQUAL( true , hasAll(allAtoms,atomIds));
    76   CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicates(allAtoms));
     76  CPPUNIT_ASSERT_EQUAL( true , hasAllAtoms(allAtoms,atomIds));
     77  CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicateAtoms(allAtoms));
    7778
    7879  std::vector<atom*> noAtoms = World::get()->getAllAtoms(NoAtoms());
    7980  CPPUNIT_ASSERT_EQUAL( true , noAtoms.empty());
    8081}
    81 void DescriptorUnittest::AtomIdTest(){
     82void AtomDescriptorTest::AtomIdTest(){
    8283  // test Atoms from boundaries and middle of the set
    8384  atom* testAtom;
     
    9394
    9495  // find some ID that has not been created
    95   int outsideId =-1;
     96  atomId_t outsideId=0;
    9697  bool res = false;
    97   while(!res) {
    98     ++outsideId;
     98  for(outsideId=0;!res;++outsideId) {
    9999    res = true;
    100100    for(int i = 0; i < ATOM_COUNT; ++i){
     
    106106  CPPUNIT_ASSERT(!testAtom);
    107107}
    108 void DescriptorUnittest::AtomCalcTest(){
     108void AtomDescriptorTest::AtomCalcTest(){
    109109  // test some elementary set operations
    110110  {
    111111    std::vector<atom*> testAtoms = World::get()->getAllAtoms(AllAtoms()||NoAtoms());
    112     CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms,atomIds));
    113     CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicates(testAtoms));
     112    CPPUNIT_ASSERT_EQUAL( true , hasAllAtoms(testAtoms,atomIds));
     113    CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicateAtoms(testAtoms));
    114114  }
    115115
    116116  {
    117117    std::vector<atom*> testAtoms = World::get()->getAllAtoms(NoAtoms()||AllAtoms());
    118     CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms,atomIds));
    119     CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicates(testAtoms));
     118    CPPUNIT_ASSERT_EQUAL( true , hasAllAtoms(testAtoms,atomIds));
     119    CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicateAtoms(testAtoms));
    120120  }
    121121
     
    137137  {
    138138    std::vector<atom*> testAtoms = World::get()->getAllAtoms(!NoAtoms());
    139     CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms,atomIds));
    140     CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicates(testAtoms));
     139    CPPUNIT_ASSERT_EQUAL( true , hasAllAtoms(testAtoms,atomIds));
     140    CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicateAtoms(testAtoms));
    141141  }
    142142
     
    144144  {
    145145    std::vector<atom*> testAtoms = World::get()->getAllAtoms(AllAtoms()&&(!AtomById(atomIds[ATOM_COUNT/2])));
    146     std::set<int> excluded;
     146    std::set<atomId_t> excluded;
    147147    excluded.insert(atomIds[ATOM_COUNT/2]);
    148     CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms,atomIds,excluded));
    149     CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicates(testAtoms));
     148    CPPUNIT_ASSERT_EQUAL( true , hasAllAtoms(testAtoms,atomIds,excluded));
     149    CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicateAtoms(testAtoms));
    150150    CPPUNIT_ASSERT_EQUAL( (size_t)(ATOM_COUNT-1), testAtoms.size());
    151151  }
  • src/unittests/AtomDescriptorTest.hpp

    r7dc102 rcb2146  
    11/*
    2  * DescriptorUnittest.hpp
     2 * AtomDescriptorTest.hpp
    33 *
    44 *  Created on: Feb 9, 2010
     
    66 */
    77
    8 #ifndef DESCRIPTORUNITTEST_HPP_
    9 #define DESCRIPTORUNITTEST_HPP_
     8#ifndef ATOMDESCRIPTORTEST_HPP_
     9#define ATOMDESCRIPTORTEST_HPP_
    1010
    1111#include <cppunit/extensions/HelperMacros.h>
     12
     13#include "defs.hpp"
    1214
    1315#define ATOM_COUNT (10)
     
    1517class atom;
    1618
    17 class DescriptorUnittest : public CppUnit::TestFixture
     19class AtomDescriptorTest : public CppUnit::TestFixture
    1820{
    19   CPPUNIT_TEST_SUITE( DescriptorUnittest );
     21  CPPUNIT_TEST_SUITE( AtomDescriptorTest );
    2022  CPPUNIT_TEST ( AtomBaseSetsTest );
    2123  CPPUNIT_TEST ( AtomIdTest );
     
    3335private:
    3436  atom *atoms [ATOM_COUNT];
    35   int atomIds [ATOM_COUNT];
     37  atomId_t atomIds [ATOM_COUNT];
    3638};
    3739
    38 #endif /* DESCRIPTORUNITTEST_HPP_ */
     40#endif /* ATOMDESCRIPTORTEST_HPP_ */
  • src/unittests/Makefile.am

    r7dc102 rcb2146  
    1212  AnalysisCorrelationToSurfaceUnitTest \
    1313  AnalysisPairCorrelationUnitTest \
     14  atomsCalculationTest \
     15  AtomDescriptorTest \
    1416  BondGraphUnitTest \
     17  CacheableTest \
    1518  GSLMatrixSymmetricUnitTest \
    1619  GSLMatrixUnitTest \
     
    2023  ListOfBondsUnitTest \
    2124  LogUnitTest \
     25  manipulateAtomsTest \
    2226  MemoryUsageObserverUnitTest \
    2327  MemoryAllocatorUnitTest \
     28  MoleculeDescriptorTest \
     29  ObserverTest \
     30  ParserUnitTest \
    2431  StackClassUnitTest \
    2532  TesselationUnitTest \
     
    2734  Tesselation_InOutsideUnitTest \
    2835  VectorUnitTest \
    29   ObserverTest \
    30   CacheableTest \
    31   DescriptorUnittest \
    32   ParserUnitTest \
    33   manipulateAtomsTest \
    34   atomsCalculationTest \
    35   ${MENUTESTS} 
    36    
     36  ${MENUTESTS}
     37 
     38
    3739 
    3840check_PROGRAMS = $(TESTS)
     
    4446TESTSOURCES = \
    4547  ActOnAllUnitTest.cpp \
     48  ActionSequenceTest.cpp \
    4649  analysisbondsunittest.cpp \
    4750  AnalysisCorrelationToPointUnitTest.cpp \
    4851  AnalysisCorrelationToSurfaceUnitTest.cpp  \
    4952  AnalysisPairCorrelationUnitTest.cpp \
     53  AtomDescriptorTest.cpp \
     54  atomsCalculationTest.cpp \
    5055  bondgraphunittest.cpp \
     56  CacheableTest.cpp \
     57  DescriptorUnittest.cpp \
    5158  gslmatrixsymmetricunittest.cpp \
    5259  gslmatrixunittest.cpp \
     
    5663  listofbondsunittest.cpp \
    5764  logunittest.cpp \
     65  manipulateAtomsTest.cpp \
    5866  memoryallocatorunittest.cpp  \
    5967  memoryusageobserverunittest.cpp \
     68  MoleculeDescriptorTest.cpp \
     69  ObserverTest.cpp \
     70  ParserUnitTest.cpp \
    6071  stackclassunittest.cpp \
    6172  tesselationunittest.cpp \
    6273  tesselation_boundarytriangleunittest.cpp \
    6374  tesselation_insideoutsideunittest.cpp \
    64   vectorunittest.cpp \
    65   ObserverTest.cpp \
    66   CacheableTest.cpp \
    67   DescriptorUnittest.cpp \
    68   ParserUnitTest.cpp \
    69   manipulateAtomsTest.cpp \
    70   atomsCalculationTest.cpp \
    71   ActionSequenceTest.cpp
     75  vectorunittest.cpp
    7276
    7377TESTHEADERS = \
     
    119123MemoryUsageObserverUnitTest_LDADD = ${ALLLIBS}
    120124
     125MoleculeDescriptorTest_SOURCES = UnitTestMain.cpp MoleculeDescriptorTest.cpp MoleculeDescriptorTest.hpp
     126MoleculeDescriptorTest_LDADD = ${ALLLIBS}
     127
    121128StackClassUnitTest_SOURCES = UnitTestMain.cpp stackclassunittest.cpp stackclassunittest.hpp
    122129StackClassUnitTest_LDADD = ${ALLLIBS}
     
    143150CacheableTest_LDADD = ${ALLLIBS}
    144151
    145 DescriptorUnittest_SOURCES = UnitTestMain.cpp DescriptorUnittest.cpp DescriptorUnittest.hpp
    146 DescriptorUnittest_LDADD = ${ALLLIBS}
     152AtomDescriptorTest_SOURCES = UnitTestMain.cpp AtomDescriptorTest.cpp AtomDescriptorTest.hpp
     153AtomDescriptorTest_LDADD = ${ALLLIBS}
    147154
    148155ParserUnitTest_SOURCES = UnitTestMain.cpp ParserUnitTest.cpp ParserUnitTest.hpp
  • src/unittests/atomsCalculationTest.cpp

    r7dc102 rcb2146  
    3030class AtomStub : public atom {
    3131public:
    32   AtomStub(int _id) :
     32  AtomStub(atomId_t _id) :
    3333  atom(),
    3434  id(_id),
     
    3636  {}
    3737
    38   virtual int getId(){
     38  virtual atomId_t getId(){
    3939    return id;
    4040  }
     
    4646  bool manipulated;
    4747private:
    48   int id;
     48  atomId_t id;
    4949};
    5050
  • src/unittests/manipulateAtomsTest.cpp

    r7dc102 rcb2146  
    3434  {}
    3535
    36   virtual int getId(){
     36  virtual atomId_t getId(){
    3737    return id;
    3838  }
     
    4444  bool manipulated;
    4545private:
    46   int id;
     46  atomId_t id;
    4747};
    4848
Note: See TracChangeset for help on using the changeset viewer.