12 const double c2pi = 0.1591549430918954;
27 for(
int i = 0; i < 4; i++ )
29 for(
int j = 0; j < 4; j++ )
61 for(
int i = 0; i < 16; i++ )
91 std::vector< double > xvec[3];
94 std::ifstream mcnpfile;
98 std::cout <<
"Unable to open MCNP data file." << std::endl;
101 std::cout << std::endl;
102 std::cout <<
"Reading MCNP input file..." << std::endl;
110 while( !mcnpfile.eof() )
113 mcnpfile.getline( line, 10000 );
128 for(
int i = 0; i < 4; i++ )
130 mcnpfile.getline( line, 10000 );
139 for(
int i = 0; i < 3; i++ )
150 mcnpfile.getline( line, 10000 );
168 for(
int i = 0; i < nv[0] - 1; i++ )
170 for(
int j = 0; j < nv[1] - 1; j++ )
172 for(
int k = 0; k < nv[2] - 1; k++ )
174 vijk = vstart + ( i + j * nv[0] + k * nv[0] * nv[1] );
179 connect[1] = vijk + 1;
180 connect[2] = vijk + 1 + nv[0];
181 connect[3] = vijk + nv[0];
182 connect[4] = vijk + nv[0] * nv[1];
183 connect[5] = vijk + 1 + nv[0] * nv[1];
184 connect[6] = vijk + 1 + nv[0] + nv[0] * nv[1];
185 connect[7] = vijk + nv[0] + nv[0] * nv[1];
187 MBresult =
MBI->create_element(
moab::MBHEX, connect, 8, elemhandle );
191 mcnpfile.getline( line, 10000 );
236 std::cout <<
"SUCCESS! Read in " <<
elem_handles.
size() <<
" elements!" << std::endl << std::endl;
246 if( ( s.find(
"Box" ) < 100 ) || ( s.find(
"xyz" ) < 100 ) )
248 else if( s.find(
"Cyl" ) < 100 )
250 else if( s.find(
"Sph" ) < 100 )
264 for(
int j = 0; j < 4; j++ )
279 unsigned int num_verts = n[0] * n[1] * n[2];
281 coords =
new double[3 * num_verts];
301 for(
int k = 0; k < n[2]; k++ )
303 for(
int j = 0; j < n[1]; j++ )
305 for(
int i = 0; i < n[0]; i++ )
307 unsigned int ijk = 3 * ( k * n[0] * n[1] + j * n[0] + i );
308 coords[ijk] = x[0][i];
309 coords[ijk + 1] = x[1][j];
310 coords[ijk + 2] = x[2][k];
345 for(
int i = 0; i < 3; i++ )
353 MBresult =
MBI->tag_set_data(
tally_tag, &handle, 1, &d );
368 unsigned int slen = s.length();
371 for(
unsigned int i = p; i < slen; i++ )
373 if( ( ( s[i] >= 48 ) && ( s[i] <= 57 ) ) || ( s[i] == 45 ) )
376 j = s.find(
" ", i );
378 if( j > slen ) j = slen;
381 d = std::atof( s.substr( i, j - i ).c_str() );
399 while( result !=
DONE )
415 for(
int i = 0; i < n; i++ )
431 for(
unsigned int i = 0; i < 3; i++ )
433 q[i] = p[0] * rmat[4 * i] + p[1] * rmat[4 * i + 1] + p[2] * rmat[4 * i + 2] + rmat[4 * i + 3];
445 r[0] = sqrt( q[0] * q[0] + q[1] * q[1] );
447 r[2] =
c2pi * ( atan2( q[1], q[0] ) );