xmsgrid  1.0
xms::XmEdge Class Reference

Two integer values representing an edge of an XmUGrid. By default has a direction. Can be sorted to have minimum index first. More...

Public Member Functions

 XmEdge ()
 Default constructor.
 
 XmEdge (int a_pt1, int a_pt2, bool a_sorted=false)
 Constructor. More...
 
 XmEdge (const std::pair< int, int > &a_edge)
 Constructor. More...
 
bool operator< (const XmEdge &a_rhs) const
 Less than operator by first index then second. More...
 
bool operator== (const XmEdge &a_rhs) const
 Equals operator. More...
 
int GetFirst () const
 Get the first index. More...
 
void SetFirst (int a_pt1)
 Set the first index. More...
 
int GetSecond () const
 Get the second index. More...
 
void SetSecond (int a_pt2)
 Set the second index. More...
 
bool IsEquivalent (const XmEdge &a_edge) const
 Test if edge is the same ignoring direction. More...
 
void SortIndexes ()
 Sort the indexes so minimum index is first.
 

Private Attributes

int m_pt1
 First point on the edge.
 
int m_pt2
 Second point on the edge.
 

Detailed Description

Two integer values representing an edge of an XmUGrid. By default has a direction. Can be sorted to have minimum index first.

Definition at line 33 of file XmEdge.h.

Constructor & Destructor Documentation

◆ XmEdge() [1/2]

xms::XmEdge::XmEdge ( int  a_pt1,
int  a_pt2,
bool  a_sorted = false 
)

Constructor.

Parameters
[in]a_pt1The first index.
[in]a_pt2The second index.
[in]a_sortedIf true set the first index to be the minimum index.

Definition at line 58 of file XmEdge.cpp.

References SortIndexes().

◆ XmEdge() [2/2]

xms::XmEdge::XmEdge ( const std::pair< int, int > &  a_edge)
explicit

Constructor.

Parameters
[in]a_edgeThe edge as an int pair.

Definition at line 69 of file XmEdge.cpp.

Member Function Documentation

◆ GetFirst()

◆ GetSecond()

int xms::XmEdge::GetSecond ( ) const

Get the second index.

Returns
The second index.

Definition at line 119 of file XmEdge.cpp.

References m_pt2.

Referenced by xms::XmUGrid::Impl::GetCellEdge(), xms::XmUGrid::Impl::GetEdgeAdjacentCells(), and xms::XmUGrid::Impl::GetPointAdjacentPoints().

◆ IsEquivalent()

bool xms::XmEdge::IsEquivalent ( const XmEdge a_edge) const

Test if edge is the same ignoring direction.

Parameters
a_edgeThe edge to compare against.
Returns
True if edges are same when indexes are in sorted order.

Definition at line 136 of file XmEdge.cpp.

References m_pt1, and m_pt2.

Referenced by xms::XmUGrid::Impl::GetCell2dEdgeAdjacentCell(), xms::XmUGrid::Impl::GetCellEdgeAdjacentCells(), XmEdgeUnitTests::testIsEquivalent(), and xms::XmEdgesEquivalent().

◆ operator<()

bool xms::XmEdge::operator< ( const XmEdge a_rhs) const

Less than operator by first index then second.

Parameters
[in]a_rhsThe edge to compare against.
Returns
true if this edge is less than a_rhs.

Definition at line 79 of file XmEdge.cpp.

References m_pt1, and m_pt2.

◆ operator==()

bool xms::XmEdge::operator== ( const XmEdge a_rhs) const

Equals operator.

Parameters
[in]a_rhsThe edge to compare against.
Returns
true if edges are equal.

Definition at line 95 of file XmEdge.cpp.

References m_pt1, and m_pt2.

◆ SetFirst()

void xms::XmEdge::SetFirst ( int  a_pt1)

Set the first index.

Parameters
[in]a_pt1The first index.

Definition at line 111 of file XmEdge.cpp.

References m_pt1.

◆ SetSecond()

void xms::XmEdge::SetSecond ( int  a_pt2)

Set the second index.

Parameters
[in]a_pt2The second index.

Definition at line 127 of file XmEdge.cpp.

References m_pt2.


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