votca 2024.2-dev
Loading...
Searching...
No Matches
votca::tools::ReducedEdge Class Reference

Connects two vertices, also stores the vertices between the endpoints. More...

#include <reducededge.h>

Inheritance diagram for votca::tools::ReducedEdge:
Collaboration diagram for votca::tools::ReducedEdge:

Public Member Functions

 ReducedEdge ()=default
 
 ReducedEdge (std::vector< Index > vertices)
 
 ReducedEdge (Index vertex1, Index vertex2)
 
std::vector< IndexgetChain () const
 Returns a vector of vertices that constitute the edge.
 
bool vertexExistInChain (const int &vertex) const
 Provided a vertex this method will determine if it exists within the reduced edge.
 
std::vector< Edgeexpand () const
 Method expands the edge into its parts.
 
bool operator== (const ReducedEdge &edge) const
 Checks if Edges are equivalent.
 
bool operator!= (const ReducedEdge &edge) const
 Checks if Edges are not equivalent.
 
bool operator< (const ReducedEdge &edge) const
 
bool operator> (const ReducedEdge &edge) const
 
bool operator<= (const ReducedEdge &edge) const
 
bool operator>= (const ReducedEdge &edge) const
 
virtual bool operator!= (const Edge &ed) const
 Checks if Edges are not equivalent.
 
virtual bool operator== (const Edge &ed) const
 Checks if Edges are equivalent.
 
virtual bool operator< (const Edge &ed) const
 
virtual bool operator> (const Edge &ed) const
 
virtual bool operator<= (const Edge &ed) const
 
virtual bool operator>= (const Edge &ed) const
 
- Public Member Functions inherited from votca::tools::Edge
 Edge ()=default
 
virtual ~Edge ()=default
 
 Edge (Index ID1, Index ID2)
 
Index getOtherEndPoint (Index ver) const
 Given one of the integers in the edge the other will be output.
 
Index getEndPoint1 () const
 grab the smaller integer
 
Index getEndPoint2 () const
 grab the larger integer
 
bool loop () const
 Checks to see if an edge loops back on itself.
 
bool contains (Index ID) const
 Determine if the edge contains the Index ID.
 

Friends

std::ostream & operator<< (std::ostream &os, const ReducedEdge &edge)
 Print the contents of the edge.
 

Additional Inherited Members

- Protected Attributes inherited from votca::tools::Edge
std::vector< Indexvertices_
 

Detailed Description

Connects two vertices, also stores the vertices between the endpoints.

The edge class stores the ids of two seperate vertices indictating that they are connected (id1,id2). The vertex with the lower id is always at EndPoint1 and the vertex with the large id is always placed at end point 2.

Unlike, the more basic edge class the reduced edge class allows the user to store a chain of vertices that exist between the two endpoints. For instance an edge of the form:

1 - 2 - 3 - 4

Can be stored, in this case EndPoint1 will be vertex 1 and EndPoint2 will be vertex 4. The class name is called a reduced edge because the edge is treated as if it were an edge of only two vertices described as

1 - 4

Definition at line 49 of file reducededge.h.

Constructor & Destructor Documentation

◆ ReducedEdge() [1/3]

votca::tools::ReducedEdge::ReducedEdge ( )
default

◆ ReducedEdge() [2/3]

votca::tools::ReducedEdge::ReducedEdge ( std::vector< Index > vertices)

Creates an edge the smallest integer value will be placed in the id1 spot and the larger in the id2 spot

Definition at line 99 of file reducededge.cc.

◆ ReducedEdge() [3/3]

votca::tools::ReducedEdge::ReducedEdge ( Index vertex1,
Index vertex2 )
inline

Definition at line 57 of file reducededge.h.

Member Function Documentation

◆ expand()

vector< Edge > votca::tools::ReducedEdge::expand ( ) const

Method expands the edge into its parts.

This method will take an expanded edge e.g.

1 - 2 - 3 - 4 - 5

And break it up into its more primitive edges:

1 - 2, 2 - 3, 3 - 4, 4 - 5

These edges will then be placed in a vector and returned.

Returns
vector of edges

Definition at line 116 of file reducededge.cc.

◆ getChain()

std::vector< Index > votca::tools::ReducedEdge::getChain ( ) const
inline

Returns a vector of vertices that constitute the edge.

Definition at line 61 of file reducededge.h.

◆ operator!=() [1/2]

bool votca::tools::Edge::operator!= ( const Edge & ed) const
virtual

Checks if Edges are not equivalent.

Reimplemented from votca::tools::Edge.

Definition at line 72 of file edge.cc.

◆ operator!=() [2/2]

bool votca::tools::ReducedEdge::operator!= ( const ReducedEdge & edge) const

Checks if Edges are not equivalent.

Definition at line 143 of file reducededge.cc.

◆ operator<() [1/2]

bool votca::tools::Edge::operator< ( const Edge & ed) const
virtual

If the vertices are smaller in value Edge ed1(2,3); Edge ed2(1,5); Edge ed3(4,1); priority is given to the smallest vertex assert(ed2<ed1); // will return true assert(ed3<ed1); // will return true assert(ed3<ed1); // will return true

Reimplemented from votca::tools::Edge.

Definition at line 82 of file edge.cc.

◆ operator<() [2/2]

bool votca::tools::ReducedEdge::operator< ( const ReducedEdge & edge) const

The Reduced Edge follows the same rules as the more basic edge when the EndPoints are differet between the two edges

If the vertices are smaller in value Edge ed1(2,3); Edge ed2(1,5); Edge ed3(4,1); priority is given to the smallest vertex assert(ed2<ed1); // will return true assert(ed3<ed1); // will return true assert(ed3<ed1); // will return true

In the case that the two edges have the same endpoints:

Edge ed4(vector<Index>{ 1, 5, 4}); Edge ed5(vector<Index>{ 1, 2, 3, 4});

The shorter of the two edges is considered smaller assert(ed4<ed5); // will return true

In the case that both edges have the same number of vertices the edge with the first vertex in the chain that is lower in value will be considered smaller.

Edge ed6(vector<Index>{ 1, 2, 5, 4}); assert(ed5<ed6); // will return true;

Definition at line 147 of file reducededge.cc.

◆ operator<=() [1/2]

bool votca::tools::Edge::operator<= ( const Edge & ed) const
virtual

Reimplemented from votca::tools::Edge.

Definition at line 84 of file edge.cc.

◆ operator<=() [2/2]

bool votca::tools::ReducedEdge::operator<= ( const ReducedEdge & edge) const

Definition at line 171 of file reducededge.cc.

◆ operator==() [1/2]

bool votca::tools::Edge::operator== ( const Edge & ed) const
virtual

Checks if Edges are equivalent.

Reimplemented from votca::tools::Edge.

Definition at line 70 of file edge.cc.

◆ operator==() [2/2]

bool votca::tools::ReducedEdge::operator== ( const ReducedEdge & edge) const

Checks if Edges are equivalent.

Definition at line 131 of file reducededge.cc.

◆ operator>() [1/2]

bool votca::tools::Edge::operator> ( const Edge & ed) const
virtual

Reimplemented from votca::tools::Edge.

Definition at line 83 of file edge.cc.

◆ operator>() [2/2]

bool votca::tools::ReducedEdge::operator> ( const ReducedEdge & edge) const

Definition at line 175 of file reducededge.cc.

◆ operator>=() [1/2]

bool votca::tools::Edge::operator>= ( const Edge & ed) const
virtual

Reimplemented from votca::tools::Edge.

Definition at line 85 of file edge.cc.

◆ operator>=() [2/2]

bool votca::tools::ReducedEdge::operator>= ( const ReducedEdge & edge) const

Definition at line 179 of file reducededge.cc.

◆ vertexExistInChain()

bool votca::tools::ReducedEdge::vertexExistInChain ( const int & vertex) const

Provided a vertex this method will determine if it exists within the reduced edge.

Given a reduced edge

1 - 2 - 3 - 4

Calling the method with vertex 3 will return true as the vertex exists within the chain stored by the reduced edge.

Parameters
[in]vertexIndex potential vertex stored in the reduced edge
Returns
bool true if it is in the chain false otherwise

Definition at line 125 of file reducededge.cc.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const ReducedEdge & edge )
friend

Print the contents of the edge.

Definition at line 183 of file reducededge.cc.


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