Rosetta Core  2014.35
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
core::scoring::EnergyGraph Class Reference

Class to hold the component energies between pairs of residues. Each node represents a residue in its corresponding structure. Each edge in the graph holds a two-body energy map representing the unweighted components of the energy function for those terms with non-zero weight. The EnergyGraph may be accessed from the pose's Energies object, but at a price of an extra score evaluation. This second score evaluation may be avoided if you use the ScoreFunction::score_components( pose ) method. More...

#include <EnergyGraph.hh>

Public Types

typedef graph::Graph parent
 
- Public Types inherited from core::graph::Graph
typedef utility::vector1< Node * > NodeVector
 
typedef Node::EdgeListIter EdgeListIter
 
typedef Node::EdgeListConstIter EdgeListConstIter
 
typedef
utility::pointer::ReferenceCount 
parent
 

Public Member Functions

virtual ~EnergyGraph ()
 
 EnergyGraph (Size num_nodes)
 
 EnergyGraph ()
 
 EnergyGraph (EnergyGraph const &src)
 
EnergyGraph const & operator= (EnergyGraph const &rhs)
 assignment operator – performs a deep copy More...
 
Size n_active_score_types () const
 
bool active_score_types (ScoreTypes const &active)
 Set the active score types, and return true if the new score types are the same as the old score types and the graph state is still good. Returns false if the score types have changed, indicating that the graph has dropped all of its edges;. More...
 
void add_energy_edge (Size index1, Size index2, DistanceSquared dsq)
 Add an energy edge to the graph and store the square distance. More...
 
EnergyNode const * get_energy_node (Size index) const
 Add an energy edge to the graph and set the energies for the non-zero-weighted components of the input emap. void add_energy_edge( Size index1, Size index2, EnergyMap const & emap );. More...
 
EnergyNodeget_energy_node (Size index)
 
EnergyEdgefind_energy_edge (Size n1, Size n2)
 
EnergyEdge const * find_energy_edge (Size n1, Size n2) const
 
virtual void delete_edge (graph::Edge *edge)
 remove an edge from the graph. (NEW AS OF 12/9/07) Never call C++'s "delete" function on an edge pointer directly. Derived classes must implement this function. If they wish to use unordered_object_pools to manage their memory More...
 
void deallocate_arraypoolelement (graph::ArrayPoolElement< Real > &element)
 As an edge is deleted from the graph, it must reliquish hold over its array-pool element so that the element may be reused by new edges. More...
 
utility::vector1< int > const & score_type_2_active () const
 
ScoreTypes const & active_2b_score_types () const
 
graph::ArrayPool< Real > & array_pool ()
 Give non-const access to the array pool – this function should only be called by class EnergyEdge. I wish C++ let me declare this function private and that EnergyEdge could be a "friend" of this function. More...
 
- Public Member Functions inherited from core::graph::Graph
virtual ~Graph ()
 virtual destructor. Derived classes must ensure they've destroyed all their nodes and edges through a call to "destroy_everything" before this function is arrived at More...
 
 Graph ()
 ctor More...
 
 Graph (platform::Size num_nodes)
 num nodes ctor More...
 
 Graph (Graph const &source)
 copy ctor. Must not be called by derived class copy ctors. More...
 
Graphoperator= (Graph const &source)
 assignment operator. source and this must have the same type. More...
 
void copy_connectivity (Graph const &source)
 copy the edge connectivity from a source graph with a potentially unknown type. More...
 
platform::Size num_nodes () const
 the number of nodes in the graph More...
 
void set_num_nodes (platform::Size num_nodes)
 set the number of nodes in the graph – deletes any existing edges in the graph More...
 
Edgeadd_edge (platform::Size node1, platform::Size node2)
 add an edge between two vertices. Invokes "create_edge" from the derived class. Returns a pointer to the edge after its been added, allowing the calling function to immediately set data for this edge. More...
 
Edgeadd_edge (Edge const *example_edge)
 add an edge to this graph copying the data from an edge in another graph. Returns a pointer to the edge after its been added, allowing the calling function to immediately set data for this edge. More...
 
bool get_edge_exists (platform::Size node1, platform::Size node2) const
 is an edge already present in the graph? O(V) worst case. O(1) iff all vertices have O(1) edges More...
 
void drop_all_edges ()
 delete all the edges present in the graph More...
 
void drop_all_edges_for_node (platform::Size node)
 delete all the edges for a single vertex in the graph More...
 
void print_vertices () const
 send summary information to the screen for all vertices in the graph More...
 
void output_connectivity (std::ostream &os) const
 send an edge list to the stream os. More...
 
void output_dimacs (std::ostream &os) const
 describe this graph in dimacs form to the stream os. More...
 
ObjexxFCL::FArray2D_int all_pairs_shortest_paths () const
 O(V^3). Computes all pairs shortest paths using Warshall's algorithm and writes all the path distances to the two-dimensional table. More...
 
Node const * get_node (platform::Size index) const
 
Nodeget_node (platform::Size index)
 
platform::Size num_edges () const
 
EdgeListConstIter const_edge_list_begin () const
 returns a const iterator to the beginning of the (unordered) edge list for the graph. this edge list contains all the edges in the graph, not simply those for a particular vertex More...
 
EdgeListIter edge_list_begin ()
 returns a non-const iterator to the beginning of the (unordered) edge list for the graph. this edge list contains all the edges in the graph, not simply those for a particular vertex More...
 
EdgeListConstIter const_edge_list_end () const
 returns a const iterator to the end of the (unordered) edge list for the graph. this edge list contains all the edges in the graph, not simply those for a particular vertex More...
 
EdgeListIter edge_list_end ()
 returns a non-const iterator to the end of the (unordered) edge list for the graph. this edge list contains all the edges in the graph, not simply those for a particular vertex More...
 
Edgefind_edge (platform::Size node1, platform::Size node2)
 returns a pointer to the edge connecting nodes node1 and node2, if that edge exists in the graph, o.w. returns 0. Focuses the graph on this edge for fast subsequent retrieval. More...
 
Edge const * find_edge (platform::Size node1, platform::Size node2) const
 returns a const pointer to the edge connecting nodes node1 and node2, if that edge exists in the graph, o.w. returns 0. Focuses the graph on this edge for fast subsequent retrieval. More...
 
Edgefocused_edge ()
 returns a pointer to the focused edge More...
 
Edge const * focused_edge () const
 returns a const-pointer to the focused edge More...
 
platform::Size getTotalMemoryUsage () const
 returns a count of all the memory used by every vertex and edge in a graph by invoking the polymorphic count_static_memory and count_dynamic_memory of each (possibly derived) node and edge object as well as for the (possibly derived) graph class. More...
 

Protected Member Functions

virtual Size count_static_memory () const
 
virtual Size count_dynamic_memory () const
 
virtual graph::Nodecreate_new_node (Size index)
 Factory method for node creation. More...
 
virtual graph::Edgecreate_new_edge (Size index1, Size index2)
 Factory method for edge creation. More...
 
virtual graph::Edgecreate_new_edge (graph::Edge const *example_edge)
 Factory copy-constructor method for edge creation. More...
 
- Protected Member Functions inherited from core::graph::Graph
void drop_edge (EdgeListIter edge_iter)
 remove an edge from the entire-graph edge list. Called only by class Edge during its destructor More...
 
void delete_everything ()
 deallocate all nodes and edges from the graph More...
 
boost::unordered_object_pool
< EdgeListElement > & 
edge_list_element_pool ()
 Used by class Node only, this is the pool from which edge lists are to allocate their edge lists elements from. More...
 

Private Attributes

boost::unordered_object_pool
< EnergyEdge > * 
energy_edge_pool_
 
graph::ArrayPool< Realenergy_array_pool_
 
ScoreTypes active_2b_score_types_
 
utility::vector1< intscore_type_2_active_
 these are flag values; <0 has a special meaning, so they need to be ints More...
 

Detailed Description

Class to hold the component energies between pairs of residues. Each node represents a residue in its corresponding structure. Each edge in the graph holds a two-body energy map representing the unweighted components of the energy function for those terms with non-zero weight. The EnergyGraph may be accessed from the pose's Energies object, but at a price of an extra score evaluation. This second score evaluation may be avoided if you use the ScoreFunction::score_components( pose ) method.

Member Typedef Documentation

Constructor & Destructor Documentation

core::scoring::EnergyGraph::~EnergyGraph ( )
virtual
core::scoring::EnergyGraph::EnergyGraph ( Size  num_nodes)

This does not call the base class parent( Size ) constructor since that produces calls to the polymorphic function create_new_node() and polymorphism does not work during constructor intialization.

References core::graph::Graph::set_num_nodes().

core::scoring::EnergyGraph::EnergyGraph ( )

Referenced by count_static_memory().

core::scoring::EnergyGraph::EnergyGraph ( EnergyGraph const &  src)

Notice that this does not call the parent( src ) copy constructor. This is because the copy constructor relies on polymorphic functions which are unavailable during the Graph constructor. Instead, this function waits until parent construction is complete, and relies on the assigmnent operator.

References active_2b_score_types_, active_score_types(), and core::graph::Graph::operator=().

Member Function Documentation

ScoreTypes const& core::scoring::EnergyGraph::active_2b_score_types ( ) const
inline
bool core::scoring::EnergyGraph::active_score_types ( ScoreTypes const &  active)

Set the active score types, and return true if the new score types are the same as the old score types and the graph state is still good. Returns false if the score types have changed, indicating that the graph has dropped all of its edges;.

The array pool only needs to be resized if the number of active score types has changed; it doesn't have to be resized if the actual active types have changed but the number of active score types has remained constant. However, if either the number or the identity of the active score types have changed, then all old edges in the EnergyGraph should be dropped. The input array "active" must be sorted.

References active_2b_score_types_, core::graph::Graph::drop_all_edges(), energy_array_pool_, and score_type_2_active_.

Referenced by EnergyGraph(), and operator=().

void core::scoring::EnergyGraph::add_energy_edge ( Size  index1,
Size  index2,
DistanceSquared  dsq 
)

Add an energy edge to the graph and store the square distance.

References core::graph::Graph::add_edge().

Referenced by core::scoring::symmetry::SymmetricEnergies::update_neighbor_links().

graph::ArrayPool< Real >& core::scoring::EnergyGraph::array_pool ( )
inline

Give non-const access to the array pool – this function should only be called by class EnergyEdge. I wish C++ let me declare this function private and that EnergyEdge could be a "friend" of this function.

References energy_array_pool_.

Size core::scoring::EnergyGraph::count_dynamic_memory ( ) const
protectedvirtual
Size core::scoring::EnergyGraph::count_static_memory ( ) const
protectedvirtual

Reimplemented from core::graph::Graph.

References EnergyGraph().

Edge * core::scoring::EnergyGraph::create_new_edge ( Size  index1,
Size  index2 
)
protectedvirtual

Factory method for edge creation.

Reimplemented from core::graph::Graph.

References energy_edge_pool_.

Edge * core::scoring::EnergyGraph::create_new_edge ( graph::Edge const *  example_edge)
protectedvirtual

Factory copy-constructor method for edge creation.

Reimplemented from core::graph::Graph.

References energy_edge_pool_.

Node * core::scoring::EnergyGraph::create_new_node ( Size  index)
protectedvirtual

Factory method for node creation.

Reimplemented from core::graph::Graph.

void core::scoring::EnergyGraph::deallocate_arraypoolelement ( graph::ArrayPoolElement< Real > &  element)

As an edge is deleted from the graph, it must reliquish hold over its array-pool element so that the element may be reused by new edges.

References energy_array_pool_.

Referenced by core::scoring::EnergyEdge::~EnergyEdge().

void core::scoring::EnergyGraph::delete_edge ( graph::Edge edge)
virtual

remove an edge from the graph. (NEW AS OF 12/9/07) Never call C++'s "delete" function on an edge pointer directly. Derived classes must implement this function. If they wish to use unordered_object_pools to manage their memory

Reimplemented from core::graph::Graph.

References energy_edge_pool_.

EnergyEdge * core::scoring::EnergyGraph::find_energy_edge ( Size  n1,
Size  n2 
)
EnergyEdge const * core::scoring::EnergyGraph::find_energy_edge ( Size  n1,
Size  n2 
) const
EnergyNode const* core::scoring::EnergyGraph::get_energy_node ( Size  index) const
inline

Add an energy edge to the graph and set the energies for the non-zero-weighted components of the input emap. void add_energy_edge( Size index1, Size index2, EnergyMap const & emap );.

References core::graph::Graph::get_node().

EnergyNode* core::scoring::EnergyGraph::get_energy_node ( Size  index)
inline
Size core::scoring::EnergyGraph::n_active_score_types ( ) const
inline
EnergyGraph const & core::scoring::EnergyGraph::operator= ( EnergyGraph const &  rhs)

assignment operator – performs a deep copy

References active_2b_score_types_, active_score_types(), and core::graph::Graph::operator=().

utility::vector1< int > const& core::scoring::EnergyGraph::score_type_2_active ( ) const
inline

Member Data Documentation

ScoreTypes core::scoring::EnergyGraph::active_2b_score_types_
private
graph::ArrayPool< Real > core::scoring::EnergyGraph::energy_array_pool_
private
boost::unordered_object_pool< EnergyEdge >* core::scoring::EnergyGraph::energy_edge_pool_
private
utility::vector1< int > core::scoring::EnergyGraph::score_type_2_active_
private

these are flag values; <0 has a special meaning, so they need to be ints

Referenced by active_score_types(), and score_type_2_active().


The documentation for this class was generated from the following files: