17 #ifndef KOKKOS_HEXELEMENT_HPP 
   18 #define KOKKOS_HEXELEMENT_HPP 
   23 template< 
unsigned NodeCount >
 
   26 template< 
unsigned NodeCount , 
class Device >
 
   35   static const unsigned element_node_count    = 8 ;
 
   36   static const unsigned spatial_dimension     = 3 ;
 
   37   static const unsigned integration_count_1d  = 2 ;
 
   38   static const unsigned function_count_1d     = 2 ;
 
   40   double values_1d [ function_count_1d ][ integration_count_1d ];
 
   41   double derivs_1d [ function_count_1d ][ integration_count_1d ];
 
   42   double weights_1d[ integration_count_1d ];
 
   44   unsigned char eval_map[ element_node_count ][4] ;
 
   48     return 0 == jf ? 0.5 * ( 1.0 - 
x ) : (
 
   49            1 == jf ? 0.5 * ( 1.0 + x ) : 0 );
 
   54     return 0 == jf ? -0.5 : (
 
   60     const unsigned char tmp_map[ element_node_count ][ spatial_dimension ] =
 
   73     const double points_1d[ integration_count_1d ] =
 
   74       { -0.577350269189623 , 0.577350269189623 };
 
   76     for ( 
unsigned i = 0 ; 
i < element_node_count ; ++
i ) {
 
   77       eval_map[
i][0] = tmp_map[
i][0];
 
   78       eval_map[
i][1] = tmp_map[
i][1];
 
   79       eval_map[
i][2] = tmp_map[
i][2];
 
   82     for ( 
unsigned xp = 0 ; xp < integration_count_1d ; ++xp ) {
 
   83     for ( 
unsigned xf = 0 ; xf < function_count_1d ; ++xf ) {
 
   84       values_1d[xp][xf] = eval_value_1d( xf , points_1d[xp] );
 
   85       derivs_1d[xp][xf] = eval_deriv_1d( xf , points_1d[xp] );
 
   96   static const unsigned element_node_count    = 27 ;
 
   97   static const unsigned spatial_dimension     = 3 ;
 
   98   static const unsigned integration_count_1d  = 3 ;
 
   99   static const unsigned function_count_1d     = 3 ;
 
  101   double values_1d [ function_count_1d ][ integration_count_1d ];
 
  102   double derivs_1d [ function_count_1d ][ integration_count_1d ];
 
  103   double weights_1d[ integration_count_1d ];
 
  105   unsigned char eval_map[ element_node_count ][4] ;
 
  115     return 0 == jf ? 0.5 * p * ( p - 1 ) : (
 
  116            1 == jf ? 1.0 - p * p : (
 
  117            2 == jf ? 0.5 * p * ( p + 1 ) : 0 ));
 
  122     return 0 == jf ? p - 0.5 : (
 
  123            1 == jf ? -2.0 * p : (
 
  124            2 == jf ? p + 0.5 : 0 ));
 
  129     const unsigned char tmp_map[ element_node_count ][ spatial_dimension ] =
 
  160     weights_1d[0] = 0.55555555555556 ;
 
  161     weights_1d[1] = 0.88888888888889 ;
 
  162     weights_1d[2] = 0.55555555555556 ;
 
  164     const double points_1d[3] = { -0.774596669241483 ,
 
  168     for ( 
unsigned i = 0 ; 
i < element_node_count ; ++
i ) {
 
  169       eval_map[
i][0] = tmp_map[
i][0];
 
  170       eval_map[
i][1] = tmp_map[
i][1];
 
  171       eval_map[
i][2] = tmp_map[
i][2];
 
  174     for ( 
unsigned xp = 0 ; xp < integration_count_1d ; ++xp ) {
 
  175     for ( 
unsigned xf = 0 ; xf < function_count_1d ; ++xf ) {
 
  176       values_1d[xp][xf] = eval_value_1d( xf , points_1d[xp] );
 
  177       derivs_1d[xp][xf] = eval_deriv_1d( xf , points_1d[xp] );
 
  184 template< 
unsigned NodeCount >
 
  202       const unsigned ipx = tensor_data.eval_map[ip][0] ;
 
  203       const unsigned ipy = tensor_data.eval_map[ip][1] ;
 
  204       const unsigned ipz = tensor_data.eval_map[ip][2] ;
 
  206       weights[ip] = tensor_data.weights_1d[ ipx ] *
 
  207                     tensor_data.weights_1d[ ipy ] *
 
  208                     tensor_data.weights_1d[ ipz ] ;
 
  212         const unsigned jfx = tensor_data.eval_map[jf][0] ;
 
  213         const unsigned jfy = tensor_data.eval_map[jf][1] ;
 
  214         const unsigned jfz = tensor_data.eval_map[jf][2] ;
 
  216         values[ip][jf] = tensor_data.values_1d[ ipx ][ jfx ] *
 
  217                          tensor_data.values_1d[ ipy ][ jfy ] *
 
  218                          tensor_data.values_1d[ ipz ][ jfz ] ;
 
  220         gradients[ip][0][jf] = tensor_data.derivs_1d[ ipx ][ jfx ] *
 
  221                                tensor_data.values_1d[ ipy ][ jfy ] *
 
  222                                tensor_data.values_1d[ ipz ][ jfz ] ;
 
  224         gradients[ip][1][jf] = tensor_data.values_1d[ ipx ][ jfx ] *
 
  225                                tensor_data.derivs_1d[ ipy ][ jfy ] *
 
  226                                tensor_data.values_1d[ ipz ][ jfz ] ;
 
  228         gradients[ip][2][jf] = tensor_data.values_1d[ ipx ][ jfx ] *
 
  229                                tensor_data.values_1d[ ipy ][ jfy ] *
 
  230                                tensor_data.derivs_1d[ ipz ][ jfz ] ;
 
double weights[integration_count]
 
static double eval_value_1d(const unsigned jf, const double p)
 
static const unsigned element_node_count
 
static const unsigned function_count
 
double gradients[integration_count][spatial_dimension][function_count]
 
static double eval_deriv_1d(const unsigned jf, const double p)
 
static double eval_value_1d(const unsigned jf, const double x)
 
static double eval_deriv_1d(const unsigned jf, const double)
 
double values[integration_count][function_count]
 
static const unsigned integration_count
 
static const unsigned spatial_dimension