44 #ifndef KOKKOS_HEXELEMENT_HPP 
   45 #define KOKKOS_HEXELEMENT_HPP 
   50 template< 
unsigned NodeCount >
 
   51 class HexElement_TensorData ;
 
   53 template< 
unsigned NodeCount , 
class Device >
 
   54 class HexElement_TensorEval ;
 
   59 class HexElement_TensorData< 8 > {
 
   62   static const unsigned element_node_count    = 8 ;
 
   63   static const unsigned spatial_dimension     = 3 ;
 
   64   static const unsigned integration_count_1d  = 2 ;
 
   65   static const unsigned function_count_1d     = 2 ;
 
   67   double values_1d [ function_count_1d ][ integration_count_1d ];
 
   68   double derivs_1d [ function_count_1d ][ integration_count_1d ];
 
   69   double weights_1d[ integration_count_1d ];
 
   71   unsigned char eval_map[ element_node_count ][4] ;
 
   75     return 0 == jf ? 0.5 * ( 1.0 - x ) : (
 
   76            1 == jf ? 0.5 * ( 1.0 + x ) : 0 );
 
   81     return 0 == jf ? -0.5 : (
 
   87     const unsigned char tmp_map[ element_node_count ][ spatial_dimension ] =
 
  100     const double points_1d[ integration_count_1d ] =
 
  101       { -0.577350269189623 , 0.577350269189623 };
 
  103     for ( 
unsigned i = 0 ; i < element_node_count ; ++i ) {
 
  104       eval_map[i][0] = tmp_map[i][0];
 
  105       eval_map[i][1] = tmp_map[i][1];
 
  106       eval_map[i][2] = tmp_map[i][2];
 
  109     for ( 
unsigned xp = 0 ; xp < integration_count_1d ; ++xp ) {
 
  110     for ( 
unsigned xf = 0 ; xf < function_count_1d ; ++xf ) {
 
  111       values_1d[xp][xf] = eval_value_1d( xf , points_1d[xp] );
 
  112       derivs_1d[xp][xf] = eval_deriv_1d( xf , points_1d[xp] );
 
  120 class HexElement_TensorData< 27 > {
 
  123   static const unsigned element_node_count    = 27 ;
 
  124   static const unsigned spatial_dimension     = 3 ;
 
  125   static const unsigned integration_count_1d  = 3 ;
 
  126   static const unsigned function_count_1d     = 3 ;
 
  128   double values_1d [ function_count_1d ][ integration_count_1d ];
 
  129   double derivs_1d [ function_count_1d ][ integration_count_1d ];
 
  130   double weights_1d[ integration_count_1d ];
 
  132   unsigned char eval_map[ element_node_count ][4] ;
 
  142     return 0 == jf ? 0.5 * p * ( p - 1 ) : (
 
  143            1 == jf ? 1.0 - p * p : (
 
  144            2 == jf ? 0.5 * p * ( p + 1 ) : 0 ));
 
  149     return 0 == jf ? p - 0.5 : (
 
  150            1 == jf ? -2.0 * p : (
 
  151            2 == jf ? p + 0.5 : 0 ));
 
  156     const unsigned char tmp_map[ element_node_count ][ spatial_dimension ] =
 
  187     weights_1d[0] = 0.55555555555556 ;
 
  188     weights_1d[1] = 0.88888888888889 ;
 
  189     weights_1d[2] = 0.55555555555556 ;
 
  191     const double points_1d[3] = { -0.774596669241483 ,
 
  195     for ( 
unsigned i = 0 ; i < element_node_count ; ++i ) {
 
  196       eval_map[i][0] = tmp_map[i][0];
 
  197       eval_map[i][1] = tmp_map[i][1];
 
  198       eval_map[i][2] = tmp_map[i][2];
 
  201     for ( 
unsigned xp = 0 ; xp < integration_count_1d ; ++xp ) {
 
  202     for ( 
unsigned xf = 0 ; xf < function_count_1d ; ++xf ) {
 
  203       values_1d[xp][xf] = eval_value_1d( xf , points_1d[xp] );
 
  204       derivs_1d[xp][xf] = eval_deriv_1d( xf , points_1d[xp] );
 
  211 template< 
unsigned NodeCount >
 
  212 class HexElement_Data {
 
  229       const unsigned ipx = tensor_data.eval_map[ip][0] ;
 
  230       const unsigned ipy = tensor_data.eval_map[ip][1] ;
 
  231       const unsigned ipz = tensor_data.eval_map[ip][2] ;
 
  233       weights[ip] = tensor_data.weights_1d[ ipx ] *
 
  234                     tensor_data.weights_1d[ ipy ] *
 
  235                     tensor_data.weights_1d[ ipz ] ;
 
  239         const unsigned jfx = tensor_data.eval_map[jf][0] ;
 
  240         const unsigned jfy = tensor_data.eval_map[jf][1] ;
 
  241         const unsigned jfz = tensor_data.eval_map[jf][2] ;
 
  243         values[ip][jf] = tensor_data.values_1d[ ipx ][ jfx ] *
 
  244                          tensor_data.values_1d[ ipy ][ jfy ] *
 
  245                          tensor_data.values_1d[ ipz ][ jfz ] ;
 
  247         gradients[ip][0][jf] = tensor_data.derivs_1d[ ipx ][ jfx ] *
 
  248                                tensor_data.values_1d[ ipy ][ jfy ] *
 
  249                                tensor_data.values_1d[ ipz ][ jfz ] ;
 
  251         gradients[ip][1][jf] = tensor_data.values_1d[ ipx ][ jfx ] *
 
  252                                tensor_data.derivs_1d[ ipy ][ jfy ] *
 
  253                                tensor_data.values_1d[ ipz ][ jfz ] ;
 
  255         gradients[ip][2][jf] = tensor_data.values_1d[ ipx ][ jfx ] *
 
  256                                tensor_data.values_1d[ ipy ][ jfy ] *
 
  257                                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