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

#include <MeshPointIdToGlobalIdMap.hpp>

Collaboration diagram for MeshPointIdToGlobalIdMap:

Public Member Functions

 MeshPointIdToGlobalIdMap ()
 Constructor. More...
 
 ~MeshPointIdToGlobalIdMap ()
 Destructor. More...
 
bool exists (const int meshPaneId, const int meshPointId)
 Checks if the point meshPointId of the mesh associated with the provided meshPaneId exists in this MeshPointIdToGlobalIdMap instance. More...
 
int getGlobalId (const int meshPaneId, const int meshPointId)
 Returns the assigned global id to meshPointId of the mesh associated with the provided meshPaneId. More...
 
void insert (const int meshPaneId, const int meshPointId, const int globalId)
 This method constructs a new key-pair for the meshPaneId and meshPointId which maps into globalId and inserts it into the data-structure. More...
 
int size () const
 Returns the size of the map. More...
 

Private Attributes

std::map< std::pair< int, int >
, int > 
local2global
 

Detailed Description

Definition at line 19 of file MeshPointIdToGlobalIdMap.hpp.

Constructor & Destructor Documentation

Constructor.

Postcondition
this ->size( ) == 0.

Definition at line 30 of file MeshPointIdToGlobalIdMap.hpp.

30 { }

Destructor.

Definition at line 35 of file MeshPointIdToGlobalIdMap.hpp.

35 { this ->local2global.clear( ); }

Member Function Documentation

bool exists ( const int  meshPaneId,
const int  meshPointId 
)
inline

Checks if the point meshPointId of the mesh associated with the provided meshPaneId exists in this MeshPointIdToGlobalIdMap instance.

Parameters
meshPaneIdthe pane id of the mesh in query.
meshPointIdthe local point id of the point in query.
Returns
Status true iff exists else false.

Definition at line 44 of file MeshPointIdToGlobalIdMap.hpp.

References MeshPointIdToGlobalIdMap::local2global.

Referenced by MeshPointIdToGlobalIdMap::insert().

45  {
46  std::pair< int, int > keyPair = std::make_pair( meshPaneId, meshPointId );
47  if( this ->local2global.find( keyPair ) != this ->local2global.end( ) )
48  return true;
49  else
50  return false;
51  }

Here is the caller graph for this function:

int getGlobalId ( const int  meshPaneId,
const int  meshPointId 
)
inline

Returns the assigned global id to meshPointId of the mesh associated with the provided meshPaneId.

Parameters
meshPaneIdthe pane id of the mesh in query.
meshPointIdthe point id of the mesh point in query.
Returns
ID the global id assigned to the point.
Postcondition
ID >= 0 or -1 iff ! this ->exists( meshPaneId, meshPoint ).

Definition at line 61 of file MeshPointIdToGlobalIdMap.hpp.

References MeshPointIdToGlobalIdMap::local2global.

Referenced by stitchSolutionData().

62  {
63  std::pair< int, int > keyPair = std::make_pair( meshPaneId, meshPointId );
64  if( this ->local2global.find( keyPair ) != this ->local2global.end( ) )
65  return( this ->local2global[ keyPair ] );
66  else
67  return(-1);
68  }

Here is the caller graph for this function:

void insert ( const int  meshPaneId,
const int  meshPointId,
const int  globalId 
)
inline

This method constructs a new key-pair for the meshPaneId and meshPointId which maps into globalId and inserts it into the data-structure.

Parameters
meshPaneIdthe pane id of the mesh in query.
meshPointIdthe point id of the mesh point in query.
globalIdthe global id assigned to the point.
Precondition
globalId >= 0 && meshPointId >= 0.
this ->exists( meshPaneId, meshPointId ) == false.
Postcondition
this ->exists( meshPaneId, meshPointId ) == true.

Definition at line 80 of file MeshPointIdToGlobalIdMap.hpp.

References MeshPointIdToGlobalIdMap::exists().

Referenced by stitchGrids(), and updateHash().

81  {
82 
83 // std::cout << "Mesh Pane Id: " << meshPaneId << " ";
84 // std::cout << "Mesh Point Id: " << meshPointId << " ";
85 // std::cout << std::endl;
86 // std::cout.flush( );
87 
88  #ifdef ASSERT_ON
89  assert( globalId >= 0 );
90  assert( meshPointId >= 0);
91  assert( !this ->exists( meshPaneId, meshPointId ) );
92  #endif
93 
94  std::pair< int, int > keyPair = std::make_pair( meshPaneId, meshPointId );
95  this ->local2global[ keyPair ] = globalId;
96 
97  #ifdef ASSERT_ON
98  assert( this ->exists( meshPaneId, meshPointId ) );
99  #endif
100 
101  }
bool exists(const int meshPaneId, const int meshPointId)
Checks if the point meshPointId of the mesh associated with the provided meshPaneId exists in this Me...

Here is the call graph for this function:

Here is the caller graph for this function:

int size ( ) const
inline

Returns the size of the map.

Returns
N the number of elements in the map.
Postcondition
N >= 0.

Definition at line 108 of file MeshPointIdToGlobalIdMap.hpp.

108 { return this ->local2global.size( ); }

Member Data Documentation

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

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