- Timestamp:
- Jul 12, 2017, 7:10:32 PM (7 years ago)
- Branches:
- Action_Thermostats, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Exclude_Hydrogens_annealWithBondGraph, Fix_Verbose_Codepatterns, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, Recreated_GuiChecks, StoppableMakroAction, TremoloParser_IncreasedPrecision
- Children:
- 0dc8bf2
- Parents:
- 6e5b8d
- git-author:
- Frederik Heber <frederik.heber@…> (05/19/17 09:25:53)
- git-committer:
- Frederik Heber <frederik.heber@…> (07/12/17 19:10:32)
- Location:
- src/Graph
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Graph/BoostGraphCreator.cpp
r6e5b8d r1356af 39 39 40 40 #include <algorithm> 41 #include <iterator>42 41 43 42 #include "CodePatterns/Assert.hpp" 44 #include "CodePatterns/Log.hpp"45 43 46 44 #include "Atom/atom.hpp" 47 #include "Bond/bond.hpp"48 45 #include "molecule.hpp" 49 46 … … 105 102 } 106 103 107 template <typename iterator>108 void BoostGraphCreator::createFromRange(109 const iterator &_begin,110 const iterator &_end,111 const size_t &_no_nodes,112 const predicate_t &_pred113 )114 {115 graph = UndirectedGraph();116 117 // add vertices118 for(iterator iter = _begin; iter != _end; ++iter) {119 const atomId_t atomid = (*iter)->getId();120 Vertex v = boost::add_vertex(atomid, graph);121 const atomId_t vertexname = boost::get(boost::get(boost::vertex_name, graph), v);122 const nodeId_t vertexindex = boost::get(boost::get(boost::vertex_index, graph), v);123 LOG(2, "DEBUG: Adding node " << vertexindex << " associated to atom #" << vertexname);124 ASSERT( vertexname == atomid,125 "BoostGraphCreator::createFromRange() - atomid "+toString(atomid)126 +" is not name of vertex "+toString(vertexname)+".");127 atomids_nodeids.insert( std::make_pair(vertexname, vertexindex) );128 }129 130 // add edges131 for(iterator iter = _begin; iter != _end; ++iter) {132 LOG(2, "DEBUG: Looking at atom " << (*iter)->getId());133 const BondList& ListOfBonds = (*iter)->getListOfBonds();134 for(BondList::const_iterator bonditer = ListOfBonds.begin();135 bonditer != ListOfBonds.end(); ++bonditer) {136 LOG(2, "DEBUG: Looking at bond " << *(*bonditer));137 const atomId_t leftid = (*bonditer)->leftatom->getId();138 const nodeId_t leftnodeid = getNodeId(leftid);139 const atomId_t rightid = (*bonditer)->rightatom->getId();140 const nodeId_t rightnodeid = getNodeId(rightid);141 // only pick each bond once and evaluate predicate142 if ((leftid == (*iter)->getId())143 && (_pred(**bonditer))) {144 LOG(3, "DEBUG: ADDING edge " << leftnodeid << " <-> " << rightnodeid);145 boost::add_edge(leftnodeid, rightnodeid, graph);146 } else {147 LOG(3, "DEBUG: Discarding edge " << leftnodeid << " <-> " << rightnodeid);148 }149 }150 }151 LOG(2, "DEBUG: We have " << getNumVertices() << " nodes and " << getNumEdges()152 << " edges in the molecule graph.");153 }154 155 -
src/Graph/BoostGraphCreator.hpp
r6e5b8d r1356af 116 116 nodeId_t getNodeId(const atomId_t &_atomid) const; 117 117 118 private:119 118 /** General purpose function that contains the internal logic of walking the 120 119 * bonds of a set of atoms given by \a _begin and \a _end iterators and … … 145 144 }; 146 145 146 #include "BoostGraphCreator_impl.hpp" 147 147 148 148 149 #endif /* GRAPH_BOOSTGRAPHCREATOR_HPP_ */ -
src/Graph/Makefile.am
r6e5b8d r1356af 17 17 Graph/BoostGraphCreator.hpp \ 18 18 Graph/BoostGraphHelpers.hpp \ 19 Graph/BoostGraphCreator_impl.hpp \ 19 20 Graph/BreadthFirstSearchGatherer.hpp \ 20 21 Graph/BuildInducedSubgraph.hpp \ … … 23 24 Graph/DepthFirstSearchAnalysis.hpp \ 24 25 Graph/ListOfLocalAtoms.hpp 25 26 26 27 27 noinst_LTLIBRARIES += libMolecuilderGraph.la
Note:
See TracChangeset
for help on using the changeset viewer.