8 #ifndef PANECONNECTIVITY_HPP_
9 #define PANECONNECTIVITY_HPP_
17 namespace Rocstar {
namespace Rocin {
namespace Utilities {
22 std::map< int, std::vector< int > >
pconn;
39 assert(
this ->
hasPane( remotePane ) );
43 std::pair< int, int > keyPair = std::make_pair( remotePane, localPoint );
49 int idx =
this ->rmtpanePointPair2Index[ keyPair ];
52 assert(
this ->
pconn[ remotePane ][ idx ] == localPoint );
70 inline int accesspcon(
int &index,
const int *p,
const int size )
74 assert( index >= 0 && index < size );
78 int datum = p[ index ]; ++index;
90 assert( pconnarray != NULL );
95 int numberOfConnections =
this ->accesspcon( idx, pconnarray, size );
97 for(
int connection=0; connection < numberOfConnections; ++connection )
99 int rmtpane =
this ->accesspcon( idx, pconnarray, size );
100 int numnodes =
this ->accesspcon( idx, pconnarray, size );
102 std::vector< int > sharedNodeList;
103 sharedNodeList.resize( numnodes );
107 sharedNodeList[
node ] =
this ->accesspcon( idx, pconnarray, size )-1;
108 std::pair< int, int > keyPair = std::make_pair(rmtpane, sharedNodeList[
node ] );
109 this ->rmtpanePointPair2Index[ keyPair ] = node;
110 this ->point2remotePaneList[ sharedNodeList[ node ] ].push_back( rmtpane );
113 this ->pconn[ rmtpane ] = sharedNodeList;
118 assert(
this ->
pconn.size( ) == pconnarray[ 0 ] );
141 this ->buildPaneConnectivity( pconnarray, size );
158 std::vector< int > rmtpanes;
159 this ->getRemotePaneIdsSharedWithPoint( localPointId, rmtpanes );
162 for(
int i=0;
i < rmtpanes.size( ); ++
i )
166 std::pair< int, int > valuePair = std::make_pair( rmtpanes[
i ],
this ->
getSharedNodeIndex( rmtpanes[ i ], localPointId ) );
169 connections.push_back( valuePair );
183 this ->buildPaneConnectivity( pconnarray, size );
198 inline bool hasPane(
const int paneId )
const {
return(
this ->
pconn.find( paneId ) !=
this ->pconn.end( ) ); }
210 assert(
this ->
hasPane( remotePane ) );
212 return(
this ->
pconn[ remotePane ].size( ) );
224 assert( localPointId >= 0 );
248 rmtpaneIds.begin( ) );
259 if( rmtpanes.size( ) !=
this ->getNumberOfConnections( ) )
260 rmtpanes.resize( this ->getNumberOfConnections( ) );
262 std::map< int, std::vector< int > >::iterator iter =
this ->pconn.begin( );
263 for(
int idx=0; iter !=
this ->pconn.end( ); ++iter, ++idx )
264 rmtpanes[ idx ] = iter ->first;
279 assert(
this ->
hasPane( paneId ) );
280 assert( nodeIndex >= 0 && nodeIndex < this ->
pconn[ paneId ].size( ) );
282 return this ->pconn[ paneId ][ nodeIndex ];
296 assert(
this ->
hasPane( remotePane ) );
298 return(
this ->
pconn[ remotePane ] );
void constructPaneConnectivityFromArray(const int *pconnarray, const int size)
Constructs a PaneConnectivity object from the pcon array returned from Rocmap.
std::map< int, std::vector< int > > point2remotePaneList
Holds a mapping of localpoint ids to remote pane ids.
void buildPaneConnectivity(const int *pconnarray, const int size)
Builds the pane connectivity data-structured from a flat integer array returned from RocMap...
PaneConnectivity(const int *pconnarray, const int size)
Custom constructor.
int getNumberOfNodesSharedWithRemotePane(const int remotePane)
Returns the number of nodes shared with a particular remote pane.
int getNumberOfConnections() const
Returns the number of connections for this instance.
std::vector< int > & getNodesSharedWithRemotePane(const int remotePane)
Returns a reference to the list of nodes shared with the remotePane.
bool hasPane(const int paneId) const
Checks if the pane exists in this instance.
int getSharedPointIdAt(const int paneId, const int nodeIndex)
This method returns the local shared point Id of the given pane at the given index.
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to ** copy
~PaneConnectivity()
Destructor.
void getRemotePaneIdsSharedWithPoint(const int localPointId, std::vector< int > &rmtpaneIds)
This method returns the list of remote panes that share the point associated with the provided localP...
int accesspcon(int &index, const int *p, const int size)
A convenience method which provides safe access to the pconn array by doing bounds checking and memor...
bool hasLocalPoint(const int localPointId) const
This method checks if the local point exists in this instance.
std::map< std::pair< int, int >, int > rmtpanePointPair2Index
Holds a mapping of a (remotePane,localPoint) pair to the index in the shared node list...
int getSharedNodeIndex(const int remotePane, const int localPoint)
Returns the index to the shared node list of the local point that is shared with the given remote pan...
std::map< int, std::vector< int > > pconn
Holds a mapping of remote pane to a list of local ids that are shared.
PaneConnectivity()
Default Constructor.
void getRemotePaneIds(std::vector< int > &rmtpanes)
Returns the remote pane ids that are connected to this instance.
void getPointConnectionPairs(const int localPointId, std::vector< std::pair< int, int > > &connections)
This method returns the point connection pairs for the given local point.