Changeset 3501d2
- Timestamp:
- Dec 3, 2012, 9:49:06 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:
- bf42a0
- Parents:
- 2a0eb0
- git-author:
- Frederik Heber <heber@…> (09/19/12 10:11:12)
- git-committer:
- Frederik Heber <heber@…> (12/03/12 09:49:06)
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Fragmentation.cpp
r2a0eb0 r3501d2 136 136 LOG(1, "Looking at bond structure stored in adjacency file and comparing to present one ... "); 137 137 138 CheckAgainstAdjacencyFile FileChecker( World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection());139 FragmentationToDo = FragmentationToDo && FileChecker( File);138 CheckAgainstAdjacencyFile FileChecker(File); 139 FragmentationToDo = FragmentationToDo && FileChecker(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection()); 140 140 } 141 141 -
src/Graph/CheckAgainstAdjacencyFile.cpp
r2a0eb0 r3501d2 51 51 #include "World.hpp" 52 52 53 CheckAgainstAdjacencyFile::CheckAgainstAdjacencyFile(World::AtomSet::const_iterator AtomMapBegin, World::AtomSet::const_iterator AtomMapEnd) : 53 /** Constructor of class CheckAgainstAdjacencyFile. 54 * 55 * \param File file to parser 56 */ 57 CheckAgainstAdjacencyFile::CheckAgainstAdjacencyFile(std::istream &File) : 54 58 status(true), 55 59 NonMatchNumber(0) 56 60 { 57 CreateInternalMap(AtomMapBegin, AtomMapEnd);61 ParseInExternalMap(File); 58 62 } 59 63 … … 113 117 * @param AtomMapEnd iterator pointing past end of map (think of World's SelectionIterator) 114 118 */ 115 void CheckAgainstAdjacencyFile::CreateInternalMap(World::AtomSet::const_iterator &AtomMapBegin, World::AtomSet::const_iterator &AtomMapEnd)119 void CheckAgainstAdjacencyFile::CreateInternalMap(World::AtomSet::const_iterator AtomMapBegin, World::AtomSet::const_iterator AtomMapEnd) 116 120 { 117 121 InternalAtomBondMap.clear(); … … 136 140 137 141 /** Checks contents of adjacency file against bond structure in structure molecule. 138 * \param File file to parser139 142 * \return true - structure is equal, false - not equivalence 140 143 */ 141 bool CheckAgainstAdjacencyFile::operator()( std::istream &File)144 bool CheckAgainstAdjacencyFile::operator()(World::AtomSet::const_iterator AtomMapBegin, World::AtomSet::const_iterator AtomMapEnd) 142 145 { 143 146 LOG(0, "STATUS: Looking at bond structure stored in adjacency file and comparing to present one ... "); … … 145 148 bool status = true; 146 149 147 status = status && ParseInExternalMap(File); 150 if (InternalAtomBondMap.empty()) 151 CreateInternalMap(AtomMapBegin, AtomMapEnd); 152 148 153 status = status && CompareInternalExternalMap(); 149 154 -
src/Graph/CheckAgainstAdjacencyFile.hpp
r2a0eb0 r3501d2 28 28 friend class CheckAgainstAdjacencyFileTest; 29 29 public: 30 CheckAgainstAdjacencyFile( World::AtomSet::const_iterator AtomMapBegin, World::AtomSet::const_iterator AtomMapEnd);30 CheckAgainstAdjacencyFile(std::istream &File); 31 31 ~CheckAgainstAdjacencyFile(); 32 32 33 bool operator()( std::istream &File);33 bool operator()(World::AtomSet::const_iterator AtomMapBegin, World::AtomSet::const_iterator AtomMapEnd); 34 34 35 35 private: … … 47 47 ValuesSet getValues(const AtomBondRange&_range) const; 48 48 49 void CreateInternalMap(World::AtomSet::const_iterator &AtomMapBegin, World::AtomSet::const_iterator &AtomMapEnd);49 void CreateInternalMap(World::AtomSet::const_iterator AtomMapBegin, World::AtomSet::const_iterator AtomMapEnd); 50 50 bool ParseInExternalMap(std::istream &File); 51 51 bool CompareInternalExternalMap(); -
src/Graph/unittests/CheckAgainstAdjacencyFileUnitTest.cpp
r2a0eb0 r3501d2 101 101 void CheckAgainstAdjacencyFileTest::setUp() 102 102 { 103 // failing asserts should be thrown 104 ASSERT_DO(Assert::Throw); 105 103 106 const element *hydrogen = World::getInstance().getPeriode()->FindElement(1); 104 107 CPPUNIT_ASSERT(hydrogen != NULL); 105 106 // failing asserts should be thrown107 ASSERT_DO(Assert::Throw);108 108 109 109 TestMolecule = World::getInstance().createMolecule(); … … 148 148 void CheckAgainstAdjacencyFileTest::CreateInternalMapTest() 149 149 { 150 std::stringstream input; 151 CheckAgainstAdjacencyFile fileChecker(input); 150 152 World::getInstance().selectAllAtoms(AllAtoms()); 151 CheckAgainstAdjacencyFile fileChecker(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection()); 153 const World &world = World::getInstance(); 154 fileChecker.CreateInternalMap(world.beginAtomSelection(), world.endAtomSelection()); 152 155 153 156 // check size (it's 8*2 + 2*1 = 18 keys) … … 178 181 std::stringstream input(adjacencyfile); 179 182 World::getInstance().selectAllAtoms(NoAtoms()); 180 CheckAgainstAdjacencyFile fileChecker( World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection());181 fileChecker. ParseInExternalMap(input);183 CheckAgainstAdjacencyFile fileChecker(input); 184 fileChecker.CreateInternalMap(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection()); 182 185 183 186 // check size (it's 8*2 + 2*1 = 18 keys) … … 204 207 void CheckAgainstAdjacencyFileTest::CompareInternalExternalMapTest() 205 208 { 206 World::getInstance().selectAllAtoms(AllAtoms());207 CheckAgainstAdjacencyFile fileChecker( World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection());209 std::stringstream input(adjacencyfile); 210 CheckAgainstAdjacencyFile fileChecker(input); 208 211 209 212 // assert non-equality before parsing … … 213 216 214 217 // parse 215 std::stringstream input(adjacencyfile);216 fileChecker. ParseInExternalMap(input);218 World::getInstance().selectAllAtoms(AllAtoms()); 219 fileChecker.CreateInternalMap(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection()); 217 220 218 221 // assert equality after parsing … … 228 231 { 229 232 World::getInstance().selectAllAtoms(AllAtoms()); 230 CheckAgainstAdjacencyFile fileChecker(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection());231 233 { 232 234 // parse right 233 235 std::stringstream input(adjacencyfile); 234 CPPUNIT_ASSERT( fileChecker(input) ); 236 CheckAgainstAdjacencyFile fileChecker(input); 237 CPPUNIT_ASSERT( fileChecker(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection()) ); 235 238 } 236 239 { 237 240 // parse wrong1 238 241 std::stringstream input(wrongadjacencyfile1); 239 CPPUNIT_ASSERT( !fileChecker(input) ); 242 CheckAgainstAdjacencyFile fileChecker(input); 243 CPPUNIT_ASSERT( !fileChecker(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection()) ); 240 244 } 241 245 { … … 244 248 #ifndef NDEBUG 245 249 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 246 CPPUNIT_ASSERT_THROW( fileChecker(input), Assert::AssertionFailure );250 CPPUNIT_ASSERT_THROW( CheckAgainstAdjacencyFile fileChecker(input), Assert::AssertionFailure ); 247 251 #else 248 CPPUNIT_ASSERT( !fileChecker(input) ); 252 CheckAgainstAdjacencyFile fileChecker(input); 253 CPPUNIT_ASSERT( !fileChecker(World::getInstance().beginAtomSelection(), World::getInstance().endAtomSelection()) ); 249 254 #endif 250 255 }
Note:
See TracChangeset
for help on using the changeset viewer.