- Timestamp:
- Mar 5, 2010, 1:45:35 PM (15 years ago)
- 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. - Location:
- src
- Files:
-
- 5 added
- 9 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
src/Makefile.am
r7dc102 rcb2146 32 32 LEGACYHEADER = Legacy/oldmenu.hpp 33 33 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 34 DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp \ 35 Descriptors/AtomIdDescriptor.cpp \ 36 Descriptors/AtomTypeDescriptor.cpp \ 37 Descriptors/MoleculeDescriptor.cpp \ 38 Descriptors/MoleculeIdDescriptor.cpp 39 40 DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp \ 41 Descriptors/AtomIdDescriptor.hpp \ 42 Descriptors/AtomTypeDescriptor.hpp \ 43 Descriptors/MoleculeDescriptor.hpp \ 44 Descriptors/MoleculeIdDescriptor.hpp 36 45 37 46 SOURCE = ${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 18 18 19 19 private: 20 map<st ring,string> moreData;20 map<std::string, std::string> moreData; 21 21 }; 22 22 -
src/World.cpp
r7dc102 rcb2146 159 159 /******************************* IDManagement *****************************/ 160 160 161 // Atoms 162 161 163 atomId_t World::getNextAtomId(){ 162 164 // see if we can reuse some Id … … 199 201 } 200 202 } 203 204 // Molecules 205 201 206 /******************************* Iterators ********************************/ 202 207 -
src/World.hpp
r7dc102 rcb2146 151 151 // Atoms 152 152 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 { 154 159 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 155 169 AtomIterator(); 156 170 AtomIterator(AtomDescriptor, World*); … … 191 205 // Molecules 192 206 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 { 194 213 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 195 222 MoleculeIterator(); 196 223 MoleculeIterator(MoleculeDescriptor, World*); -
src/atom.cpp
r7dc102 rcb2146 306 306 } 307 307 308 int atom::getId() {308 atomId_t atom::getId() { 309 309 return id; 310 310 } -
src/atom.hpp
r7dc102 rcb2146 79 79 void setWorld(World*); 80 80 81 virtual int getId();81 virtual atomId_t getId(); 82 82 virtual bool changeId(atomId_t newId); 83 83 -
src/unittests/AtomDescriptorTest.cpp
r7dc102 rcb2146 6 6 */ 7 7 8 #include " DescriptorUnittest.hpp"8 #include "AtomDescriptorTest.hpp" 9 9 10 10 #include <cppunit/CompilerOutputter.h> … … 25 25 /********************************************** Test classes **************************************/ 26 26 // Registers the fixture into the 'registry' 27 CPPUNIT_TEST_SUITE_REGISTRATION( DescriptorUnittest );27 CPPUNIT_TEST_SUITE_REGISTRATION( AtomDescriptorTest ); 28 28 29 29 // set up and tear down 30 void DescriptorUnittest::setUp(){30 void AtomDescriptorTest::setUp(){ 31 31 World::get(); 32 32 for(int i=0;i<ATOM_COUNT;++i){ 33 33 atoms[i]= World::get()->createAtom(); 34 atomIds[i] 34 atomIds[i]= atoms[i]->getId(); 35 35 } 36 36 } 37 void DescriptorUnittest::tearDown(){ 37 38 void AtomDescriptorTest::tearDown(){ 38 39 World::destroy(); 39 40 } 40 41 41 42 // some helper functions 42 bool hasAll(std::vector<atom*> atoms,int ids[ATOM_COUNT], std::set<int> excluded = std::set<int>()){43 static bool hasAllAtoms(std::vector<atom*> atoms,atomId_t ids[ATOM_COUNT], std::set<atomId_t> excluded = std::set<atomId_t>()){ 43 44 for(int i=0;i<ATOM_COUNT;++i){ 44 int id = ids[i];45 atomId_t id = ids[i]; 45 46 if(!excluded.count(id)){ 46 47 std::vector<atom*>::iterator iter; … … 58 59 } 59 60 60 bool hasNoDuplicates(std::vector<atom*> atoms){61 std::set< int> found;61 static bool hasNoDuplicateAtoms(std::vector<atom*> atoms){ 62 std::set<atomId_t> found; 62 63 std::vector<atom*>::iterator iter; 63 64 for(iter=atoms.begin();iter!=atoms.end();++iter){ … … 71 72 72 73 73 void DescriptorUnittest::AtomBaseSetsTest(){74 void AtomDescriptorTest::AtomBaseSetsTest(){ 74 75 std::vector<atom*> allAtoms = World::get()->getAllAtoms(AllAtoms()); 75 CPPUNIT_ASSERT_EQUAL( true , hasAll (allAtoms,atomIds));76 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicate s(allAtoms));76 CPPUNIT_ASSERT_EQUAL( true , hasAllAtoms(allAtoms,atomIds)); 77 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicateAtoms(allAtoms)); 77 78 78 79 std::vector<atom*> noAtoms = World::get()->getAllAtoms(NoAtoms()); 79 80 CPPUNIT_ASSERT_EQUAL( true , noAtoms.empty()); 80 81 } 81 void DescriptorUnittest::AtomIdTest(){82 void AtomDescriptorTest::AtomIdTest(){ 82 83 // test Atoms from boundaries and middle of the set 83 84 atom* testAtom; … … 93 94 94 95 // find some ID that has not been created 95 int outsideId =-1;96 atomId_t outsideId=0; 96 97 bool res = false; 97 while(!res) { 98 ++outsideId; 98 for(outsideId=0;!res;++outsideId) { 99 99 res = true; 100 100 for(int i = 0; i < ATOM_COUNT; ++i){ … … 106 106 CPPUNIT_ASSERT(!testAtom); 107 107 } 108 void DescriptorUnittest::AtomCalcTest(){108 void AtomDescriptorTest::AtomCalcTest(){ 109 109 // test some elementary set operations 110 110 { 111 111 std::vector<atom*> testAtoms = World::get()->getAllAtoms(AllAtoms()||NoAtoms()); 112 CPPUNIT_ASSERT_EQUAL( true , hasAll (testAtoms,atomIds));113 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicate s(testAtoms));112 CPPUNIT_ASSERT_EQUAL( true , hasAllAtoms(testAtoms,atomIds)); 113 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicateAtoms(testAtoms)); 114 114 } 115 115 116 116 { 117 117 std::vector<atom*> testAtoms = World::get()->getAllAtoms(NoAtoms()||AllAtoms()); 118 CPPUNIT_ASSERT_EQUAL( true , hasAll (testAtoms,atomIds));119 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicate s(testAtoms));118 CPPUNIT_ASSERT_EQUAL( true , hasAllAtoms(testAtoms,atomIds)); 119 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicateAtoms(testAtoms)); 120 120 } 121 121 … … 137 137 { 138 138 std::vector<atom*> testAtoms = World::get()->getAllAtoms(!NoAtoms()); 139 CPPUNIT_ASSERT_EQUAL( true , hasAll (testAtoms,atomIds));140 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicate s(testAtoms));139 CPPUNIT_ASSERT_EQUAL( true , hasAllAtoms(testAtoms,atomIds)); 140 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicateAtoms(testAtoms)); 141 141 } 142 142 … … 144 144 { 145 145 std::vector<atom*> testAtoms = World::get()->getAllAtoms(AllAtoms()&&(!AtomById(atomIds[ATOM_COUNT/2]))); 146 std::set< int> excluded;146 std::set<atomId_t> excluded; 147 147 excluded.insert(atomIds[ATOM_COUNT/2]); 148 CPPUNIT_ASSERT_EQUAL( true , hasAll (testAtoms,atomIds,excluded));149 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicate s(testAtoms));148 CPPUNIT_ASSERT_EQUAL( true , hasAllAtoms(testAtoms,atomIds,excluded)); 149 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicateAtoms(testAtoms)); 150 150 CPPUNIT_ASSERT_EQUAL( (size_t)(ATOM_COUNT-1), testAtoms.size()); 151 151 } -
src/unittests/AtomDescriptorTest.hpp
r7dc102 rcb2146 1 1 /* 2 * DescriptorUnittest.hpp2 * AtomDescriptorTest.hpp 3 3 * 4 4 * Created on: Feb 9, 2010 … … 6 6 */ 7 7 8 #ifndef DESCRIPTORUNITTEST_HPP_9 #define DESCRIPTORUNITTEST_HPP_8 #ifndef ATOMDESCRIPTORTEST_HPP_ 9 #define ATOMDESCRIPTORTEST_HPP_ 10 10 11 11 #include <cppunit/extensions/HelperMacros.h> 12 13 #include "defs.hpp" 12 14 13 15 #define ATOM_COUNT (10) … … 15 17 class atom; 16 18 17 class DescriptorUnittest : public CppUnit::TestFixture19 class AtomDescriptorTest : public CppUnit::TestFixture 18 20 { 19 CPPUNIT_TEST_SUITE( DescriptorUnittest );21 CPPUNIT_TEST_SUITE( AtomDescriptorTest ); 20 22 CPPUNIT_TEST ( AtomBaseSetsTest ); 21 23 CPPUNIT_TEST ( AtomIdTest ); … … 33 35 private: 34 36 atom *atoms [ATOM_COUNT]; 35 int atomIds [ATOM_COUNT];37 atomId_t atomIds [ATOM_COUNT]; 36 38 }; 37 39 38 #endif /* DESCRIPTORUNITTEST_HPP_ */40 #endif /* ATOMDESCRIPTORTEST_HPP_ */ -
src/unittests/Makefile.am
r7dc102 rcb2146 12 12 AnalysisCorrelationToSurfaceUnitTest \ 13 13 AnalysisPairCorrelationUnitTest \ 14 atomsCalculationTest \ 15 AtomDescriptorTest \ 14 16 BondGraphUnitTest \ 17 CacheableTest \ 15 18 GSLMatrixSymmetricUnitTest \ 16 19 GSLMatrixUnitTest \ … … 20 23 ListOfBondsUnitTest \ 21 24 LogUnitTest \ 25 manipulateAtomsTest \ 22 26 MemoryUsageObserverUnitTest \ 23 27 MemoryAllocatorUnitTest \ 28 MoleculeDescriptorTest \ 29 ObserverTest \ 30 ParserUnitTest \ 24 31 StackClassUnitTest \ 25 32 TesselationUnitTest \ … … 27 34 Tesselation_InOutsideUnitTest \ 28 35 VectorUnitTest \ 29 ObserverTest \ 30 CacheableTest \ 31 DescriptorUnittest \ 32 ParserUnitTest \ 33 manipulateAtomsTest \ 34 atomsCalculationTest \ 35 ${MENUTESTS} 36 36 ${MENUTESTS} 37 38 37 39 38 40 check_PROGRAMS = $(TESTS) … … 44 46 TESTSOURCES = \ 45 47 ActOnAllUnitTest.cpp \ 48 ActionSequenceTest.cpp \ 46 49 analysisbondsunittest.cpp \ 47 50 AnalysisCorrelationToPointUnitTest.cpp \ 48 51 AnalysisCorrelationToSurfaceUnitTest.cpp \ 49 52 AnalysisPairCorrelationUnitTest.cpp \ 53 AtomDescriptorTest.cpp \ 54 atomsCalculationTest.cpp \ 50 55 bondgraphunittest.cpp \ 56 CacheableTest.cpp \ 57 DescriptorUnittest.cpp \ 51 58 gslmatrixsymmetricunittest.cpp \ 52 59 gslmatrixunittest.cpp \ … … 56 63 listofbondsunittest.cpp \ 57 64 logunittest.cpp \ 65 manipulateAtomsTest.cpp \ 58 66 memoryallocatorunittest.cpp \ 59 67 memoryusageobserverunittest.cpp \ 68 MoleculeDescriptorTest.cpp \ 69 ObserverTest.cpp \ 70 ParserUnitTest.cpp \ 60 71 stackclassunittest.cpp \ 61 72 tesselationunittest.cpp \ 62 73 tesselation_boundarytriangleunittest.cpp \ 63 74 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 72 76 73 77 TESTHEADERS = \ … … 119 123 MemoryUsageObserverUnitTest_LDADD = ${ALLLIBS} 120 124 125 MoleculeDescriptorTest_SOURCES = UnitTestMain.cpp MoleculeDescriptorTest.cpp MoleculeDescriptorTest.hpp 126 MoleculeDescriptorTest_LDADD = ${ALLLIBS} 127 121 128 StackClassUnitTest_SOURCES = UnitTestMain.cpp stackclassunittest.cpp stackclassunittest.hpp 122 129 StackClassUnitTest_LDADD = ${ALLLIBS} … … 143 150 CacheableTest_LDADD = ${ALLLIBS} 144 151 145 DescriptorUnittest_SOURCES = UnitTestMain.cpp DescriptorUnittest.cpp DescriptorUnittest.hpp146 DescriptorUnittest_LDADD = ${ALLLIBS}152 AtomDescriptorTest_SOURCES = UnitTestMain.cpp AtomDescriptorTest.cpp AtomDescriptorTest.hpp 153 AtomDescriptorTest_LDADD = ${ALLLIBS} 147 154 148 155 ParserUnitTest_SOURCES = UnitTestMain.cpp ParserUnitTest.cpp ParserUnitTest.hpp -
src/unittests/atomsCalculationTest.cpp
r7dc102 rcb2146 30 30 class AtomStub : public atom { 31 31 public: 32 AtomStub( int _id) :32 AtomStub(atomId_t _id) : 33 33 atom(), 34 34 id(_id), … … 36 36 {} 37 37 38 virtual int getId(){38 virtual atomId_t getId(){ 39 39 return id; 40 40 } … … 46 46 bool manipulated; 47 47 private: 48 int id;48 atomId_t id; 49 49 }; 50 50 -
src/unittests/manipulateAtomsTest.cpp
r7dc102 rcb2146 34 34 {} 35 35 36 virtual int getId(){36 virtual atomId_t getId(){ 37 37 return id; 38 38 } … … 44 44 bool manipulated; 45 45 private: 46 int id;46 atomId_t id; 47 47 }; 48 48
Note:
See TracChangeset
for help on using the changeset viewer.