Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
mcnpmit.cpp File Reference
#include <iostream>
#include <fstream>
#include <cstdlib>
#include "mcnpmit.hpp"
#include "moab/CartVect.hpp"
#include <cmath>
+ Include dependency graph for mcnpmit.cpp:

Go to the source code of this file.

Functions

moab::Interfacemb_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

◆ how_many_numbers()

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().

◆ mb_instance()

moab::Interface* mb_instance ( )

Definition at line 453 of file main.cpp.

454 {
455  static moab::Core inst;
456  return &inst;
457 }

◆ next_number()

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().

◆ read_numbers()

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().

Variable Documentation

◆ c2pi

const double c2pi = 0.1591549430918954

Definition at line 12 of file mcnpmit.cpp.

Referenced by McnpData::transform_point().