#include <iostream>
#include <fstream>
#include <cstdlib>
#include "mcnpmit.hpp"
#include "moab/CartVect.hpp"
#include <cmath>
Go to the source code of this file.
Functions | |
moab::Interface * | mb_instance () |
MCNPError | next_number (std::string, double &, int &) |
int | how_many_numbers (std::string) |
MCNPError | read_numbers (std::string, int, std::vector< double > &) |
Variables | |
const double | c2pi = 0.1591549430918954 |
int how_many_numbers | ( | std::string | s | ) |
Definition at line 391 of file mcnpmit.cpp.
392 {
393
394 int n = -1;
395 int fpos = 0;
396 double d = 0;
397 MCNPError result = MCNP_SUCCESS;
398
399 while( result != DONE )
400 {
401 result = next_number( s, d, fpos );
402 n++;
403 }
404
405 return n;
406 }
References DONE, MCNP_SUCCESS, and next_number().
Referenced by McnpData::read_mcnpfile().
moab::Interface* mb_instance | ( | ) |
MCNPError next_number | ( | std::string | s, |
double & | d, | ||
int & | p | ||
) |
Definition at line 365 of file mcnpmit.cpp.
366 {
367
368 unsigned int slen = s.length();
369 unsigned int j;
370
371 for( unsigned int i = p; i < slen; i++ )
372 {
373 if( ( ( s[i] >= 48 ) && ( s[i] <= 57 ) ) || ( s[i] == 45 ) )
374 {
375
376 j = s.find( " ", i );
377
378 if( j > slen ) j = slen;
379
380 // Extract the number out of the string
381 d = std::atof( s.substr( i, j - i ).c_str() );
382 p = j + 1;
383
384 return MCNP_SUCCESS;
385 }
386 }
387
388 return DONE;
389 }
References DONE, and MCNP_SUCCESS.
Referenced by McnpData::extract_tally_data(), how_many_numbers(), read_numbers(), and McnpData::read_rotation_matrix().
MCNPError read_numbers | ( | std::string | s, |
int | n, | ||
std::vector< double > & | x | ||
) |
Definition at line 408 of file mcnpmit.cpp.
409 {
410
411 MCNPError result;
412 int fpos = 0;
413 double d;
414
415 for( int i = 0; i < n; i++ )
416 {
417 result = next_number( s, d, fpos );
418 if( result == MCNP_FAILURE ) return MCNP_FAILURE;
419 x.push_back( d );
420 }
421
422 return MCNP_SUCCESS;
423 }
References MCNP_FAILURE, MCNP_SUCCESS, and next_number().
Referenced by McnpData::read_mcnpfile().
const double c2pi = 0.1591549430918954 |
Definition at line 12 of file mcnpmit.cpp.
Referenced by McnpData::transform_point().