Commit 5aecfbaf authored by Carter Edwards's avatar Carter Edwards
Browse files

Kokkos example: Add 'node_global_index( local_index )' method to the finite element fixuture.

parent 385d3834
......@@ -178,6 +178,14 @@ public:
unsigned node_grid( unsigned inode , unsigned iaxis ) const
{ return m_node_grid(inode,iaxis); }
KOKKOS_INLINE_FUNCTION
size_t node_global_index( unsigned local ) const
{
const unsigned node_grid[SpaceDim] =
{ m_node_grid(local,0) , m_node_grid(local,1) , m_node_grid(local,2) };
return m_box_part.global_node_id( node_grid );
}
KOKKOS_INLINE_FUNCTION
double node_coord( unsigned inode , unsigned iaxis ) const
{ return m_node_coord(inode,iaxis); }
......
......@@ -209,6 +209,14 @@ public:
size_t( c[2] - m_owns_node_box[j][2][0] ) ) );
}
KOKKOS_INLINE_FUNCTION
size_t global_node_id( const unsigned c[] ) const
{
return size_t( c[0] - m_global_node_box[0][0] ) + size_t( m_global_node_box[0][1] - m_global_node_box[0][0] ) * (
size_t( c[1] - m_global_node_box[1][0] ) + size_t( m_global_node_box[1][1] - m_global_node_box[1][0] ) * (
size_t( c[2] - m_global_node_box[2][0] ) ) );
}
//----------------------------------------
KOKKOS_INLINE_FUNCTION
......
......@@ -178,6 +178,14 @@ public:
unsigned node_grid( unsigned inode , unsigned iaxis ) const
{ return m_node_grid(inode,iaxis); }
KOKKOS_INLINE_FUNCTION
size_t node_global_index( unsigned local ) const
{
const unsigned node_grid[SpaceDim] =
{ m_node_grid(local,0) , m_node_grid(local,1) , m_node_grid(local,2) };
return m_box_part.global_node_id( node_grid );
}
KOKKOS_INLINE_FUNCTION
double node_coord( unsigned inode , unsigned iaxis ) const
{ return m_node_coord(inode,iaxis); }
......
......@@ -209,6 +209,14 @@ public:
size_t( c[2] - m_owns_node_box[j][2][0] ) ) );
}
KOKKOS_INLINE_FUNCTION
size_t global_node_id( const unsigned c[] ) const
{
return size_t( c[0] - m_global_node_box[0][0] ) + size_t( m_global_node_box[0][1] - m_global_node_box[0][0] ) * (
size_t( c[1] - m_global_node_box[1][0] ) + size_t( m_global_node_box[1][1] - m_global_node_box[1][0] ) * (
size_t( c[2] - m_global_node_box[2][0] ) ) );
}
//----------------------------------------
KOKKOS_INLINE_FUNCTION
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment