Changeset 0fad93
- Timestamp:
- Dec 3, 2012, 9:50:01 AM (12 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:
- 5197e5
- Parents:
- 91207d
- git-author:
- Frederik Heber <heber@…> (09/20/12 16:31:44)
- git-committer:
- Frederik Heber <heber@…> (12/03/12 09:50:01)
- Location:
- src
- Files:
-
- 5 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FragmentationAction/FragmentationAction.cpp
r91207d r0fad93 41 41 #include "Fragmentation/Graph.hpp" 42 42 #include "Fragmentation/HydrogenSaturation_enum.hpp" 43 #include "Graph/ CheckAgainstAdjacencyFile.hpp"43 #include "Graph/AdjacencyList.hpp" 44 44 #include "Graph/DepthFirstSearchAnalysis.hpp" 45 45 #include "Helpers/defs.hpp" … … 95 95 filename = params.prefix.get() + ADJACENCYFILE; 96 96 File.open(filename.c_str(), ios::out); 97 CheckAgainstAdjacencyFileFileChecker(File);97 AdjacencyList FileChecker(File); 98 98 99 99 DepthFirstSearchAnalysis DFS; -
src/Fragmentation/Fragmentation.cpp
r91207d r0fad93 54 54 #include "Fragmentation/UniqueFragments.hpp" 55 55 #include "Graph/BondGraph.hpp" 56 #include "Graph/ CheckAgainstAdjacencyFile.hpp"56 #include "Graph/AdjacencyList.hpp" 57 57 #include "Graph/ListOfLocalAtoms.hpp" 58 58 #include "molecule.hpp" … … 66 66 * \param _saturation whether to treat hydrogen special and saturate dangling bonds or not 67 67 */ 68 Fragmentation::Fragmentation(molecule *_mol, CheckAgainstAdjacencyFile&_FileChecker, const enum HydrogenSaturation _saturation) :68 Fragmentation::Fragmentation(molecule *_mol, AdjacencyList &_FileChecker, const enum HydrogenSaturation _saturation) : 69 69 mol(_mol), 70 70 saturation(_saturation), … … 124 124 { 125 125 const std::vector<atomId_t> globalids = getGlobalIdsFromLocalIds(*mol, atomids); 126 FragmentationToDo = FragmentationToDo && FileChecker (globalids);126 FragmentationToDo = FragmentationToDo && FileChecker.CheckAgainstSubset(globalids); 127 127 } 128 128 -
src/Fragmentation/Fragmentation.hpp
r91207d r0fad93 27 27 class atom; 28 28 class AtomMask_t; 29 class CheckAgainstAdjacencyFile;29 class AdjacencyList; 30 30 class KeySet; 31 31 class molecule; … … 34 34 { 35 35 public: 36 Fragmentation(molecule *_mol, CheckAgainstAdjacencyFile&_FileChecker, const enum HydrogenSaturation _saturation);36 Fragmentation(molecule *_mol, AdjacencyList &_FileChecker, const enum HydrogenSaturation _saturation); 37 37 ~Fragmentation(); 38 38 … … 64 64 const enum HydrogenSaturation saturation; 65 65 //!> reference to an external adjacency for comparison 66 CheckAgainstAdjacencyFile&FileChecker;66 AdjacencyList &FileChecker; 67 67 //!> Resulting Graph with all keysets 68 68 Graph TotalGraph; -
src/Graph/AdjacencyList.cpp
r91207d r0fad93 22 22 23 23 /* 24 * CheckAgainstAdjacencyFile.cpp24 * AdjacencyList.cpp 25 25 * 26 26 * Created on: Mar 3, 2011 … … 40 40 #include <utility> 41 41 42 #include " CheckAgainstAdjacencyFile.hpp"42 #include "AdjacencyList.hpp" 43 43 44 44 #include "Atom/atom.hpp" … … 51 51 #include "World.hpp" 52 52 53 /** Constructor of class CheckAgainstAdjacencyFile.53 /** Constructor of class AdjacencyList. 54 54 * 55 55 * \param File file to parser 56 56 */ 57 CheckAgainstAdjacencyFile::CheckAgainstAdjacencyFile(std::istream &File) :57 AdjacencyList::AdjacencyList(std::istream &File) : 58 58 NonMatchNumber(0) 59 59 { … … 63 63 } 64 64 65 CheckAgainstAdjacencyFile::~CheckAgainstAdjacencyFile()65 AdjacencyList::~AdjacencyList() 66 66 {} 67 67 … … 71 71 * @return true - everything ok, false - error while parsing 72 72 */ 73 bool CheckAgainstAdjacencyFile::ParseInInternalMap(std::istream &File)73 bool AdjacencyList::ParseInInternalMap(std::istream &File) 74 74 { 75 75 if (File.fail()) { … … 113 113 * @param atomids set of atomic ids to check (must be global ids, i.e. from atom::getId()) 114 114 */ 115 void CheckAgainstAdjacencyFile::CreateExternalMap(const atomids_t &atomids)115 void AdjacencyList::CreateExternalMap(const atomids_t &atomids) 116 116 { 117 117 ExternalAtomBondMap.clear(); … … 120 120 const atomId_t WalkerId = *iter; 121 121 ASSERT(WalkerId != (size_t)-1, 122 " CheckAgainstAdjacencyFile::CreateExternalMap() - Walker has no id.");122 "AdjacencyList::CreateExternalMap() - Walker has no id."); 123 123 const atom *Walker = World::getInstance().getAtom(AtomById(WalkerId)); 124 124 ASSERT( Walker != NULL, 125 " CheckAgainstAdjacencyFile::CreateExternalMap() - Walker id "+toString(*iter)125 "AdjacencyList::CreateExternalMap() - Walker id "+toString(*iter) 126 126 +" is not associated to any of World's atoms."); 127 127 const BondList& ListOfBonds = Walker->getListOfBonds(); … … 132 132 const atomId_t id = (*Runner)->GetOtherAtom(Walker)->getId(); 133 133 ASSERT(id != (size_t)-1, 134 " CheckAgainstAdjacencyFile::CreateExternalMap() - OtherAtom has not id.");134 "AdjacencyList::CreateExternalMap() - OtherAtom has not id."); 135 135 ExternalAtomBondMap.insert( std::make_pair(WalkerId, id) ); 136 136 } … … 141 141 * \return true - structure is equal, false - not equivalence 142 142 */ 143 bool CheckAgainstAdjacencyFile::operator()(const atomids_t &atomids)143 bool AdjacencyList::CheckAgainstSubset(const atomids_t &atomids) 144 144 { 145 145 LOG(0, "STATUS: Looking at bond structure of given ids and comparing against stored in adjacency file... "); … … 156 156 } 157 157 158 CheckAgainstAdjacencyFile::KeysSet CheckAgainstAdjacencyFile::getKeys(const CheckAgainstAdjacencyFile::AtomBondRange &_range) const158 AdjacencyList::KeysSet AdjacencyList::getKeys(const AdjacencyList::AtomBondRange &_range) const 159 159 { 160 160 KeysSet Keys; … … 167 167 } 168 168 169 CheckAgainstAdjacencyFile::ValuesSet CheckAgainstAdjacencyFile::getValues(const CheckAgainstAdjacencyFile::AtomBondRange&_range) const169 AdjacencyList::ValuesSet AdjacencyList::getValues(const AdjacencyList::AtomBondRange&_range) const 170 170 { 171 171 ValuesSet Values; … … 208 208 * @return true - both maps are the same, false - both maps diverge by NonMatchNumber counts. 209 209 */ 210 bool CheckAgainstAdjacencyFile::CompareInternalExternalMap()210 bool AdjacencyList::CompareInternalExternalMap() 211 211 { 212 212 NonMatchNumber = 0; -
src/Graph/AdjacencyList.hpp
r91207d r0fad93 1 1 /* 2 * CheckAgainstAdjacencyFile.hpp2 * AdjacencyList.hpp 3 3 * 4 4 * Created on: Mar 3, 2011 … … 6 6 */ 7 7 8 #ifndef CHECKAGAINSTADJACENCYFILE_HPP_9 #define CHECKAGAINSTADJACENCYFILE_HPP_8 #ifndef ADJACENCYLIST_HPP_ 9 #define ADJACENCYLIST_HPP_ 10 10 11 11 // include config.h … … 23 23 class atom; 24 24 25 /** This class contains the bond structure inside an internal map of atoms which 26 * each bond neighbor parsed from an external file. 25 /** This class contains the adjacency structure inside an internal map of atoms. 26 * 27 * The adjacency structure is either from a file or from a given set of atoms. 27 28 * 28 29 * We may compare a subset of atoms against this internal bond structure. It is 29 30 * true it is a true subset of the bond structure. 30 31 */ 31 class CheckAgainstAdjacencyFile32 class AdjacencyList 32 33 { 33 34 //!> Unit test is granted access to internal data 34 friend class CheckAgainstAdjacencyFileTest;35 friend class AdjacencyListTest; 35 36 public: 36 CheckAgainstAdjacencyFile(std::istream &File);37 ~CheckAgainstAdjacencyFile();38 39 37 typedef std::vector<atomId_t> atomids_t; 40 38 41 bool operator()(const atomids_t &atoms); 39 AdjacencyList(std::istream &File); 40 AdjacencyList(const atomids_t &atoms); 41 ~AdjacencyList(); 42 43 bool CheckAgainstSubset(const atomids_t &atoms); 42 44 43 45 private: … … 59 61 }; 60 62 61 #endif /* CHECKAGAINSTADJACENCYFILE_HPP_ */63 #endif /* ADJACENCYLIST_HPP_ */ -
src/Graph/Makefile.am
r91207d r0fad93 6 6 Graph/BreadthFirstSearchAdd.cpp \ 7 7 Graph/BuildInducedSubgraph.cpp \ 8 Graph/ CheckAgainstAdjacencyFile.cpp \8 Graph/AdjacencyList.cpp \ 9 9 Graph/ConnectedSubgraph.cpp \ 10 10 Graph/CyclicStructureAnalysis.cpp \ … … 15 15 Graph/BreadthFirstSearchAdd.hpp \ 16 16 Graph/BuildInducedSubgraph.hpp \ 17 Graph/ CheckAgainstAdjacencyFile.hpp \17 Graph/AdjacencyList.hpp \ 18 18 Graph/ConnectedSubgraph.hpp \ 19 19 Graph/CyclicStructureAnalysis.hpp \ -
src/Graph/unittests/AdjacencyListUnitTest.cpp
r91207d r0fad93 22 22 23 23 /* 24 * CheckAgainstAdjacencyFileUnitTest.cpp24 * AdjacencyListUnitTest.cpp 25 25 * 26 26 * Created on: Oct 17, 2011 … … 33 33 #endif 34 34 35 #include " CheckAgainstAdjacencyFileUnitTest.hpp"35 #include "AdjacencyListUnitTest.hpp" 36 36 37 37 #include <cppunit/CompilerOutputter.h> … … 52 52 #include "Element/element.hpp" 53 53 #include "Element/periodentafel.hpp" 54 #include "Graph/ CheckAgainstAdjacencyFile.hpp"54 #include "Graph/AdjacencyList.hpp" 55 55 #include "molecule.hpp" 56 56 #include "World.hpp" … … 63 63 /********************************************** Test classes **************************************/ 64 64 // Registers the fixture into the 'registry' 65 CPPUNIT_TEST_SUITE_REGISTRATION( CheckAgainstAdjacencyFileTest );65 CPPUNIT_TEST_SUITE_REGISTRATION( AdjacencyListTest ); 66 66 67 67 static std::string adjacencyfile ="\ … … 115 115 116 116 // set up and tear down 117 void CheckAgainstAdjacencyFileTest::setUp()117 void AdjacencyListTest::setUp() 118 118 { 119 119 // failing asserts should be thrown … … 148 148 } 149 149 150 void CheckAgainstAdjacencyFileTest::tearDown()150 void AdjacencyListTest::tearDown() 151 151 { 152 152 comparisonMap.clear(); … … 161 161 } 162 162 163 /** Unit tests for CheckAgainstAdjacencyFile::CreateExternalMap().164 * 165 */ 166 void CheckAgainstAdjacencyFileTest::CreateExternalMapTest()163 /** Unit tests for AdjacencyList::CreateExternalMap(). 164 * 165 */ 166 void AdjacencyListTest::CreateExternalMapTest() 167 167 { 168 168 std::stringstream input; 169 CheckAgainstAdjacencyFilefileChecker(input);169 AdjacencyList fileChecker(input); 170 170 fileChecker.CreateExternalMap(atomIds); 171 171 … … 190 190 } 191 191 192 /** Unit tests for CheckAgainstAdjacencyFile::ParseInInternalMap().193 * 194 */ 195 void CheckAgainstAdjacencyFileTest::ParseInInternalMapTest()192 /** Unit tests for AdjacencyList::ParseInInternalMap(). 193 * 194 */ 195 void AdjacencyListTest::ParseInInternalMapTest() 196 196 { 197 197 std::stringstream input(adjacencyfile); 198 CheckAgainstAdjacencyFilefileChecker(input);198 AdjacencyList fileChecker(input); 199 199 std::vector<atomId_t> noids; 200 200 fileChecker.CreateExternalMap(noids); … … 218 218 } 219 219 220 /** Unit tests for CheckAgainstAdjacencyFile::CompareInternalExternalMap().221 * 222 */ 223 void CheckAgainstAdjacencyFileTest::CompareInternalExternalMapTest()220 /** Unit tests for AdjacencyList::CompareInternalExternalMap(). 221 * 222 */ 223 void AdjacencyListTest::CompareInternalExternalMapTest() 224 224 { 225 225 std::stringstream input(adjacencyfile); 226 CheckAgainstAdjacencyFilefileChecker(input);226 AdjacencyList fileChecker(input); 227 227 228 228 // assert equality before parsing (empty sets should always return true) … … 240 240 } 241 241 242 /** Unit tests for CheckAgainstAdjacencyFile::operator()().243 * 244 */ 245 void CheckAgainstAdjacencyFileTest::operatorTest()242 /** Unit tests for AdjacencyList::operator()(). 243 * 244 */ 245 void AdjacencyListTest::CheckAgainstSubsetTest() 246 246 { 247 247 { 248 248 // parse right 249 249 std::stringstream input(adjacencyfile); 250 CheckAgainstAdjacencyFilefileChecker(input);251 CPPUNIT_ASSERT( fileChecker (atomIds) );250 AdjacencyList fileChecker(input); 251 CPPUNIT_ASSERT( fileChecker.CheckAgainstSubset(atomIds) ); 252 252 } 253 253 { 254 254 // parse wrong1 (more atoms in the world than in file, hence wrong) 255 255 std::stringstream input(wrongadjacencyfile1); 256 CheckAgainstAdjacencyFilefileChecker(input);257 CPPUNIT_ASSERT( !fileChecker (atomIds) );256 AdjacencyList fileChecker(input); 257 CPPUNIT_ASSERT( !fileChecker.CheckAgainstSubset(atomIds) ); 258 258 } 259 259 { … … 264 264 // parse wrong1 (more atoms in the world than in file, hence wrong) 265 265 std::stringstream input(wrongadjacencyfile1); 266 CheckAgainstAdjacencyFilefileChecker(input);267 CPPUNIT_ASSERT( fileChecker (validids) );266 AdjacencyList fileChecker(input); 267 CPPUNIT_ASSERT( fileChecker.CheckAgainstSubset(validids) ); 268 268 } 269 269 { 270 270 // parse wrong2 (there is no atom 10, but present in file. hence true) 271 271 std::stringstream input(wrongadjacencyfile2); 272 CheckAgainstAdjacencyFilefileChecker(input);273 CPPUNIT_ASSERT( !fileChecker (atomIds) );272 AdjacencyList fileChecker(input); 273 CPPUNIT_ASSERT( !fileChecker.CheckAgainstSubset(atomIds) ); 274 274 } 275 275 { 276 276 // parse wrong3 (6 is not connected) 277 277 std::stringstream input(wrongadjacencyfile3); 278 CheckAgainstAdjacencyFilefileChecker(input);279 CPPUNIT_ASSERT( !fileChecker (atomIds) );280 } 281 } 278 AdjacencyList fileChecker(input); 279 CPPUNIT_ASSERT( !fileChecker.CheckAgainstSubset(atomIds) ); 280 } 281 } -
src/Graph/unittests/AdjacencyListUnitTest.hpp
r91207d r0fad93 1 1 /* 2 * CheckAgainstAdjacencyFileUnitTest.hpp2 * AdjacencyListUnitTest.hpp 3 3 * 4 4 * Created on: Oct 17, 2011 … … 6 6 */ 7 7 8 #ifndef CHECKADJACENCYAGAINSTFILEUNITTEST_HPP_9 #define CHECKADJACENCYAGAINSTFILEUNITTEST_HPP_8 #ifndef UNITTEST_HPP_ 9 #define UNITTEST_HPP_ 10 10 11 11 // include config.h … … 17 17 #include <cppunit/extensions/HelperMacros.h> 18 18 19 #include "Graph/ CheckAgainstAdjacencyFile.hpp"19 #include "Graph/AdjacencyList.hpp" 20 20 #include "types.hpp" 21 21 … … 27 27 class World; 28 28 29 class CheckAgainstAdjacencyFileTest : public CppUnit::TestFixture29 class AdjacencyListTest : public CppUnit::TestFixture 30 30 { 31 CPPUNIT_TEST_SUITE( CheckAgainstAdjacencyFileTest );31 CPPUNIT_TEST_SUITE( AdjacencyListTest ); 32 32 CPPUNIT_TEST ( CreateExternalMapTest ); 33 33 CPPUNIT_TEST ( ParseInInternalMapTest ); 34 34 CPPUNIT_TEST ( CompareInternalExternalMapTest ); 35 CPPUNIT_TEST ( operatorTest );35 CPPUNIT_TEST ( CheckAgainstSubsetTest ); 36 36 CPPUNIT_TEST_SUITE_END(); 37 37 … … 43 43 void ParseInInternalMapTest(); 44 44 void CompareInternalExternalMapTest(); 45 void operatorTest();45 void CheckAgainstSubsetTest(); 46 46 47 47 private: 48 CheckAgainstAdjacencyFile::AtomBondMap comparisonMap;48 AdjacencyList::AtomBondMap comparisonMap; 49 49 std::vector<atom *> atoms; 50 50 std::vector<atomId_t> atomIds; … … 52 52 }; 53 53 54 #endif /* CHECKADJACENCYAGAINSTFILEUNITTEST_HPP_ */54 #endif /* UNITTEST_HPP_ */ -
src/Graph/unittests/Makefile.am
r91207d r0fad93 3 3 4 4 GRAPHTESTSSOURCES = \ 5 ../Graph/unittests/ BondGraphUnitTest.cpp \6 ../Graph/unittests/ CheckAgainstAdjacencyFileUnitTest.cpp5 ../Graph/unittests/AdjacencyListUnitTest.cpp \ 6 ../Graph/unittests/BondGraphUnitTest.cpp 7 7 8 8 GRAPHTESTSHEADERS = \ 9 ../Graph/unittests/ BondGraphUnitTest.hpp \10 ../Graph/unittests/ CheckAgainstAdjacencyFileUnitTest.hpp9 ../Graph/unittests/AdjacencyListUnitTest.hpp \ 10 ../Graph/unittests/BondGraphUnitTest.hpp 11 11 12 12 GRAPHTESTS = \ 13 BondGraphUnitTest \14 CheckAgainstAdjacencyFileUnitTest13 AdjacencyListUnitTest \ 14 BondGraphUnitTest 15 15 16 16 … … 32 32 33 33 34 AdjacencyListUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \ 35 ../Graph/unittests/AdjacencyListUnitTest.cpp \ 36 ../Graph/unittests/AdjacencyListUnitTest.hpp 37 AdjacencyListUnitTest_LDADD = ${ALLLIBS} 38 34 39 BondGraphUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \ 35 40 ../Graph/unittests/BondGraphUnitTest.cpp \ … … 37 42 BondGraphUnitTest_LDADD = ${GRAPHLIBS} 38 43 39 CheckAgainstAdjacencyFileUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \40 ../Graph/unittests/CheckAgainstAdjacencyFileUnitTest.cpp \41 ../Graph/unittests/CheckAgainstAdjacencyFileUnitTest.hpp42 CheckAgainstAdjacencyFileUnitTest_LDADD = ${ALLLIBS}43 44 44 45 45
Note:
See TracChangeset
for help on using the changeset viewer.