1 #include "TestUtil.hpp"
16 const CartVect cube_corners[8] = {
CartVect( 0, 0, 0 ),
CartVect( 1, 0, 0 ),
CartVect( 1, 1, 0 ),
CartVect( 0, 1, 0 ),
17 CartVect( 0, 0, 1 ),
CartVect( 1, 0, 1 ),
CartVect( 1, 1, 1 ),
CartVect( 0, 1, 1 ) };
28 x += ( 1 - xi[0] ) * ( 1 - xi[1] ) * ( 1 - xi[2] ) * corners[0];
29 x += ( 1 + xi[0] ) * ( 1 - xi[1] ) * ( 1 - xi[2] ) * corners[1];
30 x += ( 1 + xi[0] ) * ( 1 + xi[1] ) * ( 1 - xi[2] ) * corners[2];
31 x += ( 1 - xi[0] ) * ( 1 + xi[1] ) * ( 1 - xi[2] ) * corners[3];
32 x += ( 1 - xi[0] ) * ( 1 - xi[1] ) * ( 1 + xi[2] ) * corners[4];
33 x += ( 1 + xi[0] ) * ( 1 - xi[1] ) * ( 1 + xi[2] ) * corners[5];
34 x += ( 1 + xi[0] ) * ( 1 + xi[1] ) * ( 1 + xi[2] ) * corners[6];
35 x += ( 1 - xi[0] ) * ( 1 + xi[1] ) * ( 1 + xi[2] ) * corners[7];
41 min = max = corners[0];
42 for(
unsigned i = 1; i < 8; ++i )
43 for(
unsigned d = 0; d < 3; ++d )
44 if( corners[i][d] < min[d] )
45 min[d] = corners[i][d];
46 else if( corners[i][d] > max[d] )
47 max[d] = corners[i][d];
52 return fabs( xi[0] ) <= 1 && fabs( xi[1] ) <= 1 && fabs( xi[2] ) <= 1;
61 const double EPS1 = 1e-6;
64 std::vector< CartVect > cube_corners2;
67 for( xi[0] = -1; xi[0] <= 1; xi[0] += 0.2 )
69 for( xi[1] = -1; xi[1] <= 1; xi[1] += 0.2 )
71 for( xi[2] = -1; xi[2] <= 1; xi[2] += 0.2 )
74 result_xi = hex.
ievaluate( pt, EPS1 / 10 );
75 double dum = EPS1 / 10;
78 CHECK_REAL_EQUAL( xi[0], result_xi[0], EPS1 );
79 CHECK_REAL_EQUAL( xi[1], result_xi[1], EPS1 );
80 CHECK_REAL_EQUAL( xi[2], result_xi[2], EPS1 );
86 std::vector< CartVect > hex_corners2;
89 for( xi[0] = -1; xi[0] <= 1; xi[0] += 0.2 )
91 for( xi[1] = -1; xi[1] <= 1; xi[1] += 0.2 )
93 for( xi[2] = -1; xi[2] <= 1; xi[2] += 0.2 )
96 result_xi = hex2.
ievaluate( pt, EPS1 / 10 );
97 double dum = EPS1 / 10;
100 CHECK_REAL_EQUAL( xi[0], result_xi[0], EPS1 );
101 CHECK_REAL_EQUAL( xi[1], result_xi[1], EPS1 );
102 CHECK_REAL_EQUAL( xi[2], result_xi[2], EPS1 );
110 for( x[0] = -1; x[0] <= 2; x[0] += 0.4 )
112 for( x[1] = -1; x[1] <= 2; x[1] += 0.4 )
114 for( x[2] = -1; x[2] <= 2; x[2] += 0.4 )
116 bool in_box = x[0] >= min[0] && x[0] <= max[0] && x[1] >= min[1] && x[1] <= max[1] && x[2] >= min[2] &&
118 if( in_box )
continue;
119 result_xi = hex.
ievaluate( x, EPS1 / 10 );
120 double dum = EPS1 / 10;
131 for( x[0] = -1; x[0] <= 3; x[0] += 0.5 )
133 for( x[1] = -2; x[1] <= 4; x[1] += 0.5 )
135 for( x[2] = -1; x[2] <= 2; x[2] += 0.4 )
137 bool in_box = x[0] >= min[0] && x[0] <= max[0] && x[1] >= min[1] && x[1] <= max[1] && x[2] >= min[2] &&
139 if( in_box )
continue;
142 result_xi = hex2.
ievaluate( x, EPS1 / 10 );