Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PaneConnectivity Class Reference

#include <PaneConnectivity.hpp>

Collaboration diagram for PaneConnectivity:

Public Member Functions

 PaneConnectivity ()
 Default Constructor. More...
 
 PaneConnectivity (const int *pconnarray, const int size)
 Custom constructor. More...
 
 ~PaneConnectivity ()
 Destructor. More...
 
void getPointConnectionPairs (const int localPointId, std::vector< std::pair< int, int > > &connections)
 This method returns the point connection pairs for the given local point. More...
 
void constructPaneConnectivityFromArray (const int *pconnarray, const int size)
 Constructs a PaneConnectivity object from the pcon array returned from Rocmap. More...
 
int getNumberOfConnections () const
 Returns the number of connections for this instance. More...
 
bool hasPane (const int paneId) const
 Checks if the pane exists in this instance. More...
 
int getNumberOfNodesSharedWithRemotePane (const int remotePane)
 Returns the number of nodes shared with a particular remote pane. More...
 
bool hasLocalPoint (const int localPointId) const
 This method checks if the local point exists in this instance. More...
 
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 localPointId. More...
 
void getRemotePaneIds (std::vector< int > &rmtpanes)
 Returns the remote pane ids that are connected to this instance. More...
 
int getSharedPointIdAt (const int paneId, const int nodeIndex)
 This method returns the local shared point Id of the given pane at the given index. More...
 
std::vector< int > & getNodesSharedWithRemotePane (const int remotePane)
 Returns a reference to the list of nodes shared with the remotePane. More...
 

Private Member Functions

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 pane. More...
 
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 memory corruption checking. More...
 
void buildPaneConnectivity (const int *pconnarray, const int size)
 Builds the pane connectivity data-structured from a flat integer array returned from RocMap. More...
 

Private Attributes

std::map< int, std::vector< int > > pconn
 Holds a mapping of remote pane to a list of local ids that are shared. More...
 
std::map< int, std::vector< int > > point2remotePaneList
 Holds a mapping of localpoint ids to remote pane ids. More...
 
std::map< std::pair< int, int >
, int > 
rmtpanePointPair2Index
 Holds a mapping of a (remotePane,localPoint) pair to the index in the shared node list. More...
 

Detailed Description

Definition at line 19 of file PaneConnectivity.hpp.

Constructor & Destructor Documentation

PaneConnectivity ( )
inline

Default Constructor.

Postcondition
this ->getNumberOfConnection( ) == 0.

Definition at line 129 of file PaneConnectivity.hpp.

129 { }
PaneConnectivity ( const int *  pconnarray,
const int  size 
)
inline

Custom constructor.

Builds a PaneConnectivity data-structured from the pconnarray returned from Roccom.

Parameters
pconnarraythe pcon connectivity array.
sizethe size of the pconnarray.
Precondition
pconnarray != NULL
Postcondition
this ->getNumberOfConnections( ) == pconnarray[ 0 ].

Definition at line 139 of file PaneConnectivity.hpp.

140  {
141  this ->buildPaneConnectivity( pconnarray, size );
142  }
~PaneConnectivity ( )
inline

Destructor.

Definition at line 147 of file PaneConnectivity.hpp.

147 { }

Member Function Documentation

int accesspcon ( int &  index,
const int *  p,
const int  size 
)
inlineprivate

A convenience method which provides safe access to the pconn array by doing bounds checking and memory corruption checking.

After, the access transaction is complete, the index is also automatically incremented.

Parameters
indexthe index to access.
pthe pcon array.
sizethe size of the pcon array.
Returns
p[ index ] the datum at the given index
Precondition
index >= 0 && index < size.
p != NULL.
Postcondition
index == index+1.

Definition at line 70 of file PaneConnectivity.hpp.

71  {
72 
73  #ifdef ASSERT_ON
74  assert( index >= 0 && index < size );
75  assert( p != NULL );
76  #endif
77 
78  int datum = p[ index ]; ++index;
79  return datum;
80  }
void buildPaneConnectivity ( const int *  pconnarray,
const int  size 
)
inlineprivate

Builds the pane connectivity data-structured from a flat integer array returned from RocMap.

Parameters
pconnarraythe pconn array returned from Rocmap.
sizethe size of the pconn array.

Definition at line 87 of file PaneConnectivity.hpp.

References PaneConnectivity::pconn.

88  {
89  #ifdef ASSERT_ON
90  assert( pconnarray != NULL );
91  assert( size >= 0 );
92  #endif
93 
94  int idx = 0;
95  int numberOfConnections = this ->accesspcon( idx, pconnarray, size );
96 
97  for( int connection=0; connection < numberOfConnections; ++connection )
98  {
99  int rmtpane = this ->accesspcon( idx, pconnarray, size );
100  int numnodes = this ->accesspcon( idx, pconnarray, size );
101 
102  std::vector< int > sharedNodeList;
103  sharedNodeList.resize( numnodes );
104 
105  for( int node = 0; node < numnodes; ++node )
106  {
107  sharedNodeList[ node ] = this ->accesspcon( idx, pconnarray, size )-1; /* Note, pconn is 1-based, not 0-based so 1 is subtracted */
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 );
111  }
112 
113  this ->pconn[ rmtpane ] = sharedNodeList;
114 
115  }
116 
117  #ifdef ASSERT_ON
118  assert( this ->pconn.size( ) == pconnarray[ 0 ] );
119  #endif
120 
121  }
Definition: adj.h:150
std::map< int, std::vector< int > > pconn
Holds a mapping of remote pane to a list of local ids that are shared.
void constructPaneConnectivityFromArray ( const int *  pconnarray,
const int  size 
)
inline

Constructs a PaneConnectivity object from the pcon array returned from Rocmap.

Parameters
pconnarraythe pcon connectivity array.
sizethe size of the pconnarray.
Precondition
pconnarray != NULL
Postcondition
this ->getNumberOfConnections( ) == pconnarray[ 0 ].

Definition at line 181 of file PaneConnectivity.hpp.

182  {
183  this ->buildPaneConnectivity( pconnarray, size );
184  }
std::vector< int >& getNodesSharedWithRemotePane ( const int  remotePane)
inline

Returns a reference to the list of nodes shared with the remotePane.

Parameters
remotePanethe id of the remote pane that has shared nodes with this instance.
Returns
NodeList a reference to list of shared nodes.
Note
NodeList cannot be changed by the client of this method.
Precondition
this ->hasPane( remotePane ) == true.
Postcondition
NodeList.size( ) == this ->getNumberOfNodesSharedWithRemotePane( remotePane ).

Definition at line 293 of file PaneConnectivity.hpp.

References PaneConnectivity::hasPane(), and PaneConnectivity::pconn.

Referenced by maskPoints().

294  {
295  #ifdef ASSERT_ON
296  assert( this ->hasPane( remotePane ) );
297  #endif
298  return( this ->pconn[ remotePane ] );
299  }
bool hasPane(const int paneId) const
Checks if the pane exists in this instance.
std::map< int, std::vector< int > > pconn
Holds a mapping of remote pane to a list of local ids that are shared.

Here is the call graph for this function:

Here is the caller graph for this function:

int getNumberOfConnections ( ) const
inline

Returns the number of connections for this instance.

Returns
N the number of inter-zone connections.
Postcondition
N >= 0.

Definition at line 191 of file PaneConnectivity.hpp.

191 { return this ->pconn.size( ); }
int getNumberOfNodesSharedWithRemotePane ( const int  remotePane)
inline

Returns the number of nodes shared with a particular remote pane.

Parameters
remotePanethe remote pane in query.
Returns
N the number of nodes share with the remote pane.
Precondition
this ->hasPane( remotePane ) == true.
Postcondition
N >= 0.

Definition at line 207 of file PaneConnectivity.hpp.

References PaneConnectivity::hasPane(), and PaneConnectivity::pconn.

Referenced by maskPoints().

208  {
209  #ifdef ASSERT_ON
210  assert( this ->hasPane( remotePane ) );
211  #endif
212  return( this ->pconn[ remotePane ].size( ) );
213  }
bool hasPane(const int paneId) const
Checks if the pane exists in this instance.
std::map< int, std::vector< int > > pconn
Holds a mapping of remote pane to a list of local ids that are shared.

Here is the call graph for this function:

Here is the caller graph for this function:

void getPointConnectionPairs ( const int  localPointId,
std::vector< std::pair< int, int > > &  connections 
)
inline

This method returns the point connection pairs for the given local point.

Parameters
localPointIdthe point id in query.
connectionsthe list of connection pairs.
Note
A connection pair consists of the remotePaneId and sharedNodeIndex to the

Definition at line 155 of file PaneConnectivity.hpp.

References PaneConnectivity::getSharedNodeIndex(), and i.

156  {
157 
158  std::vector< int > rmtpanes;
159  this ->getRemotePaneIdsSharedWithPoint( localPointId, rmtpanes );
160 
161 
162  for( int i=0; i < rmtpanes.size( ); ++i )
163  {
164 // std::cout << rmtpanes[ i ] << " " << localPointId << std::endl;
165 
166  std::pair< int, int > valuePair = std::make_pair( rmtpanes[ i ], this ->getSharedNodeIndex( rmtpanes[ i ], localPointId ) );
167 
168 // std::cout << valuePair.first << " " << valuePair.second << std::endl;
169  connections.push_back( valuePair );
170  }
171 
172  }
blockLoc i
Definition: read.cpp:79
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...

Here is the call graph for this function:

void getRemotePaneIds ( std::vector< int > &  rmtpanes)
inline

Returns the remote pane ids that are connected to this instance.

Parameters
rmtpanesvector where the remote pane ids will be stored.
Postcondition
rmtpanes.size( ) == this ->getNumberOfConnections( );
this ->hasPane( rmtpanes[ i ] ) == true, for 0 <= i <= rmtpances.size( ).

Definition at line 257 of file PaneConnectivity.hpp.

Referenced by maskPoints().

258  {
259  if( rmtpanes.size( ) != this ->getNumberOfConnections( ) )
260  rmtpanes.resize( this ->getNumberOfConnections( ) );
261 
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;
265  }

Here is the caller graph for this function:

void getRemotePaneIdsSharedWithPoint ( const int  localPointId,
std::vector< int > &  rmtpaneIds 
)
inline

This method returns the list of remote panes that share the point associated with the provided localPointId.

Parameters
localPointIdthe local point id.
rmtpaneIdsthe list of remote pane ids.
Precondition
this ->hasLocalPoint( locaPointId ) == true.

Definition at line 239 of file PaneConnectivity.hpp.

References copy, PaneConnectivity::hasLocalPoint(), and PaneConnectivity::point2remotePaneList.

240  {
241  #ifdef ASSERT_ON
242  assert( this ->hasLocalPoint( localPointId ) );
243  #endif
244 
245  rmtpaneIds.resize( this ->point2remotePaneList[ localPointId ].size( ) );
246  std::copy( this ->point2remotePaneList[ localPointId ].begin( ),
247  this ->point2remotePaneList[ localPointId ].end( ),
248  rmtpaneIds.begin( ) );
249  }
std::map< int, std::vector< int > > point2remotePaneList
Holds a mapping of localpoint ids to remote pane ids.
*********************************************************************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
Definition: roccomf90.h:20
bool hasLocalPoint(const int localPointId) const
This method checks if the local point exists in this instance.

Here is the call graph for this function:

int getSharedNodeIndex ( const int  remotePane,
const int  localPoint 
)
inlineprivate

Returns the index to the shared node list of the local point that is shared with the given remote pane.

Parameters
remotePanethe remote pane id.
localPointthe local point id.
Returns
idx the index to the shared node list.
Precondition
this ->hasPane( remotePane ) == true.
this ->hasLocalPoint( localPoint ) == true.
Postcondition
this ->pconn[ remotePane ][ idx ] == localPoint.

Definition at line 35 of file PaneConnectivity.hpp.

References PaneConnectivity::hasLocalPoint(), PaneConnectivity::hasPane(), PaneConnectivity::pconn, and PaneConnectivity::rmtpanePointPair2Index.

Referenced by PaneConnectivity::getPointConnectionPairs().

36  {
37 
38  #ifdef ASSERT_ON
39  assert( this ->hasPane( remotePane ) );
40  assert( this ->hasLocalPoint( localPoint ) );
41  #endif
42 
43  std::pair< int, int > keyPair = std::make_pair( remotePane, localPoint );
44 
45  #ifdef ASSERT_ON
46  assert( this ->rmtpanePointPair2Index.find( keyPair ) != this ->rmtpanePointPair2Index.end( ) );
47  #endif
48 
49  int idx = this ->rmtpanePointPair2Index[ keyPair ];
50 
51  #ifdef ASSERT_ON
52  assert( this ->pconn[ remotePane ][ idx ] == localPoint );
53  #endif
54 
55  return idx;
56  }
bool hasPane(const int paneId) const
Checks if the pane exists in this instance.
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...
std::map< int, std::vector< int > > pconn
Holds a mapping of remote pane to a list of local ids that are shared.

Here is the call graph for this function:

Here is the caller graph for this function:

int getSharedPointIdAt ( const int  paneId,
const int  nodeIndex 
)
inline

This method returns the local shared point Id of the given pane at the given index.

Parameters
paneIdthe pane id in query.
nodeIndexthe index of the point in query.
Returns
localID the local mesh point id of given pane.
Precondition
this ->hasPane( paneId ) == true.
nodeIndex >= 0 && nodeIndex < this ->pconn[ paneId ].size( ).
Postcondition
localID >= 0 && localID < N where N is the number of nodes in the mesh at the given pane.

Definition at line 276 of file PaneConnectivity.hpp.

References PaneConnectivity::hasPane(), and PaneConnectivity::pconn.

277  {
278  #ifdef ASSERT_ON
279  assert( this ->hasPane( paneId ) );
280  assert( nodeIndex >= 0 && nodeIndex < this ->pconn[ paneId ].size( ) );
281  #endif
282  return this ->pconn[ paneId ][ nodeIndex ];
283  }
bool hasPane(const int paneId) const
Checks if the pane exists in this instance.
std::map< int, std::vector< int > > pconn
Holds a mapping of remote pane to a list of local ids that are shared.

Here is the call graph for this function:

bool hasLocalPoint ( const int  localPointId) const
inline

This method checks if the local point exists in this instance.

Parameters
localPointIdthe local point id.
Returns
Status true if the local point exists, else false.
Precondition
localPointId >= 0.

Definition at line 221 of file PaneConnectivity.hpp.

References PaneConnectivity::point2remotePaneList.

Referenced by PaneConnectivity::getRemotePaneIdsSharedWithPoint(), and PaneConnectivity::getSharedNodeIndex().

222  {
223  #ifdef ASSERT_ON
224  assert( localPointId >= 0 );
225  #endif
226 
227  if( this ->point2remotePaneList.find( localPointId ) != this ->point2remotePaneList.end( ) )
228  return true;
229  else
230  return false;
231  }
std::map< int, std::vector< int > > point2remotePaneList
Holds a mapping of localpoint ids to remote pane ids.

Here is the caller graph for this function:

bool hasPane ( const int  paneId) const
inline

Checks if the pane exists in this instance.

Parameters
paneIdthe (remote) paneId to check.
Returns
Status true if the pane exists, else false.

Definition at line 198 of file PaneConnectivity.hpp.

References PaneConnectivity::pconn.

Referenced by PaneConnectivity::getNodesSharedWithRemotePane(), PaneConnectivity::getNumberOfNodesSharedWithRemotePane(), PaneConnectivity::getSharedNodeIndex(), and PaneConnectivity::getSharedPointIdAt().

198 { return( this ->pconn.find( paneId ) != this ->pconn.end( ) ); }
std::map< int, std::vector< int > > pconn
Holds a mapping of remote pane to a list of local ids that are shared.

Here is the caller graph for this function:

Member Data Documentation

std::map< int, std::vector< int > > pconn
private
std::map< int, std::vector< int > > point2remotePaneList
private

Holds a mapping of localpoint ids to remote pane ids.

Definition at line 23 of file PaneConnectivity.hpp.

Referenced by PaneConnectivity::getRemotePaneIdsSharedWithPoint(), and PaneConnectivity::hasLocalPoint().

std::map< std::pair< int, int >, int > rmtpanePointPair2Index
private

Holds a mapping of a (remotePane,localPoint) pair to the index in the shared node list.

Definition at line 24 of file PaneConnectivity.hpp.

Referenced by PaneConnectivity::getSharedNodeIndex().


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