moab
|
#include <iostream>
#include <fstream>
#include <cstdlib>
#include "mcnpmit.hpp"
#include "moab/CartVect.hpp"
#include "math.h"
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 | pi = 3.141592653589793 |
const double | c2pi = 0.1591549430918954 |
const double | cpi = 0.3183098861837907 |
int how_many_numbers | ( | std::string | s | ) |
Definition at line 375 of file mcnpmit.cpp.
{ 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 440 of file mcnpmit/main.cpp.
{ static moab::Core inst; return &inst; }
MCNPError next_number | ( | std::string | s, |
double & | d, | ||
int & | p | ||
) |
Definition at line 349 of file mcnpmit.cpp.
{ unsigned int slen = s.length(); unsigned int j; std::string sn; 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 391 of file mcnpmit.cpp.
{ 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.
const double cpi = 0.3183098861837907 |
Definition at line 13 of file mcnpmit.cpp.
const double pi = 3.141592653589793 |
Definition at line 11 of file mcnpmit.cpp.