MOAB: Mesh Oriented datABase
(version 5.4.1)
|
#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.
References DONE, MCNP_SUCCESS, and next_number().
Referenced by McnpData::read_mcnpfile().
{ int n = -1; int fpos = 0; double d = 0; MCNPError result = MCNP_SUCCESS; while( result != DONE ) { result = next_number( s, d, fpos ); n++; } return n; }
Definition at line 453 of file main.cpp.
{ static moab::Core inst; return &inst; }
MCNPError next_number | ( | std::string | s, |
double & | d, | ||
int & | p | ||
) |
Definition at line 365 of file mcnpmit.cpp.
References DONE, and MCNP_SUCCESS.
Referenced by McnpData::extract_tally_data(), how_many_numbers(), read_numbers(), and McnpData::read_rotation_matrix().
{ unsigned int slen = s.length(); unsigned int j; for( unsigned int i = p; i < slen; i++ ) { if( ( ( s[i] >= 48 ) && ( s[i] <= 57 ) ) || ( s[i] == 45 ) ) { j = s.find( " ", i ); if( j > slen ) j = slen; // Extract the number out of the string d = std::atof( s.substr( i, j - i ).c_str() ); p = j + 1; return MCNP_SUCCESS; } } return DONE; }
MCNPError read_numbers | ( | std::string | s, |
int | n, | ||
std::vector< double > & | x | ||
) |
Definition at line 408 of file mcnpmit.cpp.
References MCNP_FAILURE, MCNP_SUCCESS, and next_number().
Referenced by McnpData::read_mcnpfile().
{ MCNPError result; int fpos = 0; double d; for( int i = 0; i < n; i++ ) { result = next_number( s, d, fpos ); if( result == MCNP_FAILURE ) return MCNP_FAILURE; x.push_back( d ); } return MCNP_SUCCESS; }
const double c2pi = 0.1591549430918954 |
Definition at line 12 of file mcnpmit.cpp.
Referenced by McnpData::transform_point().