MOAB: Mesh Oriented datABase  (version 5.2.1)
mcnpmit.cpp File Reference
#include <iostream>
#include <fstream>
#include <cstdlib>
#include "mcnpmit.hpp"
#include "moab/CartVect.hpp"
#include "math.h"
+ Include dependency graph for mcnpmit.cpp:

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

Function Documentation

int how_many_numbers ( std::string  s)

Definition at line 391 of file mcnpmit.cpp.

References DONE, MCNP_SUCCESS, n, 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;
}
moab::Interface* mb_instance ( )

Definition at line 448 of file tools/mcnpmit/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, n, 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;
}

Variable Documentation

const double c2pi = 0.1591549430918954

Definition at line 12 of file mcnpmit.cpp.

Referenced by McnpData::transform_point().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines