10 const double LinearHex::corner[8][3] = { { -1, -1, -1 }, { 1, -1, -1 }, { 1, 1, -1 }, { -1, 1, -1 },
11 { -1, -1, 1 }, { 1, -1, 1 }, { 1, 1, 1 }, { -1, 1, 1 } };
26 assert( params && verts );
29 for(
unsigned i = 0; i < 8; ++i )
31 const double params_p = 1 + params[0] *
corner[i][0];
32 const double eta_p = 1 + params[1] *
corner[i][1];
33 const double zeta_p = 1 + params[2] *
corner[i][2];
34 const double dNi_dparams =
corner[i][0] * eta_p * zeta_p;
35 const double dNi_deta =
corner[i][1] * params_p * zeta_p;
36 const double dNi_dzeta =
corner[i][2] * params_p * eta_p;
37 ( *J )( 0, 0 ) += dNi_dparams * verts[i * ndim + 0];
38 ( *J )( 1, 0 ) += dNi_dparams * verts[i * ndim + 1];
39 ( *J )( 2, 0 ) += dNi_dparams * verts[i * ndim + 2];
40 ( *J )( 0, 1 ) += dNi_deta * verts[i * ndim + 0];
41 ( *J )( 1, 1 ) += dNi_deta * verts[i * ndim + 1];
42 ( *J )( 2, 1 ) += dNi_deta * verts[i * ndim + 2];
43 ( *J )( 0, 2 ) += dNi_dzeta * verts[i * ndim + 0];
44 ( *J )( 1, 2 ) += dNi_dzeta * verts[i * ndim + 1];
45 ( *J )( 2, 2 ) += dNi_dzeta * verts[i * ndim + 2];
58 assert( params && field && num_tuples != -1 );
59 for(
int i = 0; i < num_tuples; i++ )
61 for(
unsigned i = 0; i < 8; ++i )
64 ( 1 + params[0] *
corner[i][0] ) * ( 1 + params[1] *
corner[i][1] ) * ( 1 + params[2] *
corner[i][2] );
65 for(
int j = 0; j < num_tuples; j++ )
66 result[j] += N_i * field[i * num_tuples + j];
68 for(
int i = 0; i < num_tuples; i++ )
82 assert( field && verts && num_tuples != -1 );
85 for(
int i = 0; i < num_tuples; i++ )
101 rval =
evalFcn( x.
array(), field, ndim, num_tuples, NULL, tmp_result );
106 for(
int i = 0; i < num_tuples; i++ )
107 result[i] += tmp_result[i] * tmp_det;
122 const double iter_tol,
123 const double inside_tol,
128 assert( posn && verts );
129 return EvalSet::evaluate_reverse( eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol, work, params,
145 if( nverts != 8 )
MB_SET_ERR( MB_FAILURE,
"Incorrect vertex count for passed hex :: expected value = 8 " );
146 if( ientDim != 2 )
MB_SET_ERR( MB_FAILURE,
"Requesting normal for unsupported dimension :: expected value = 2 " );
147 if( facet > 6 || facet < 0 )
MB_SET_ERR( MB_FAILURE,
"Incorrect local face id :: expected value = one of 0-5" );
155 for(
int i = 0; i < 3; i++ )
157 x0[i] = verts[3 * id1 + i] - verts[3 * id0 + i];
158 x1[i] = verts[3 * id2 + i] - verts[3 * id0 + i];
161 double a = x0[1] * x1[2] - x1[1] * x0[2];
162 double b = x1[0] * x0[2] - x0[0] * x1[2];
163 double c = x0[0] * x1[1] - x1[0] * x0[1];
164 double nrm = sqrt( a * a + b * b + c * c );
166 if( nrm > std::numeric_limits< double >::epsilon() )