Ignore:
Timestamp:
Jul 12, 2017, 7:10:31 PM (8 years ago)
Author:
Frederik Heber <frederik.heber@…>
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:
6e5b8d
Parents:
d24ef58
git-author:
Frederik Heber <frederik.heber@…> (05/18/17 17:45:47)
git-committer:
Frederik Heber <frederik.heber@…> (07/12/17 19:10:31)
Message:

Extracted extraction (subset of) nodes from BoostGraph into BreadthFirstSearchGatherer.

  • also added helper namespace BoostGraphHelpers.
  • we now treat the vertex indices and vertex names properly. Before that they had to coincide. Now, the name is the atomic id associated with the node and the index is the boost::graph internal index.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Graph/BoostGraphCreator.hpp

    rd24ef58 rbccbe9  
    1515#endif
    1616
     17#include <map>
    1718#include <vector>
    1819
    1920#include <boost/function.hpp>
    2021#include <boost/graph/adjacency_list.hpp>
     22
     23#include "types.hpp"
    2124
    2225class atom;
     
    3235  //!> typedef for an undirected graph using boost::graph
    3336  typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS,
    34       boost::no_property, boost::no_property > UndirectedGraph;
     37      boost::property<boost::vertex_name_t, atomId_t>, boost::no_property > UndirectedGraph;
    3538  //!> typedef for a map of graph node indices
    36   typedef boost::property_map < boost::adjacency_list <>, boost::vertex_index_t >::type index_map_t;
     39  typedef boost::property_map < UndirectedGraph, boost::vertex_index_t >::type index_map_t;
     40  typedef boost::property_map < UndirectedGraph, boost::vertex_index_t >::const_type const_index_map_t;
     41  //!> typedef for a map of graph node indices
     42  typedef boost::property_map < UndirectedGraph, boost::vertex_name_t >::type name_map_t;
     43  typedef boost::property_map < UndirectedGraph, boost::vertex_name_t >::const_type const_name_map_t;
    3744  //!> typedef for the  predicate to evaluate for adding the current edge or not
    3845  typedef boost::function<bool (const bond &)> predicate_t;
     46  //!> typedef for a Vertex
     47  typedef boost::graph_traits<UndirectedGraph>::vertex_descriptor Vertex;
     48  //!> typedef for vertex iterator
     49  typedef boost::graph_traits<UndirectedGraph>::vertex_iterator vertex_iter;
    3950
     51  //!> typedef for a node id
     52  typedef size_t nodeId_t;
     53  //!> typedef for map converting between node id in graph and the associated atomic id
     54  typedef std::map<atomId_t, nodeId_t> atomids_nodeids_t;
    4055
    4156  /** Creates the boost::graph using all atoms and bonds in the given \a _mol.
     
    89104  }
    90105
     106  /** Returns the node id to a given atom id \a _atomid.
     107   *
     108   * \param _atomid atom id
     109   * \return node id
     110   */
     111  nodeId_t getNodeId(const atomId_t &_atomid) const;
     112
    91113private:
    92114  /** General purpose function that contains the internal logic of walking the
     
    114136  //!> internal graph that is created by creator functions
    115137  UndirectedGraph graph;
     138  //!> external property map for all the atomic ids of each graph node
     139  atomids_nodeids_t atomids_nodeids;
    116140};
    117141
Note: See TracChangeset for help on using the changeset viewer.