9 #ifndef PYNE_KMMHYNANYFF5BFMEYIP7TUNLHA 10 #define PYNE_KMMHYNANYFF5BFMEYIP7TUNLHA 22 #include <sys/types.h> 29 #define isnan(x) std::isnan(x) 32 #define isnan(x) __isnand((double)x) 36 #define isnan(x) ((x) != (x)) 39 #ifndef JSON_IS_AMALGAMATION 40 #define JSON_IS_AMALGAMATION 54 static std::string digits =
"0123456789";
56 static std::string alphabet =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
58 static std::string words =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
63 std::string to_str(
int t);
64 std::string to_str(
unsigned int t);
65 std::string to_str(
double t);
66 std::string to_str(
bool t);
71 double to_dbl(std::string s);
77 extern double (*
endftod)(
char * s);
79 void use_fast_endftod();
94 std::string
get_flag(
char line[],
int max_l);
124 double slope (
double x2,
double y2,
double x1,
double y1);
128 double solve_line (
double x,
double x2,
double y2,
double x1,
double y1);
130 double tanh(
double x);
131 double coth(
double x);
139 extern bool USE_WARNINGS;
165 virtual const char*
what()
const throw()
167 std::string FNFstr (
"File not found: ");
168 if (!filename.empty())
171 return (
const char *) FNFstr.c_str();
175 std::string filename;
182 #endif // PYNE_KMMHYNANYFF5BFMEYIP7TUNLHA double to_dbl(std::string s)
Converts a valid string to a float using atof().
Definition: utils.cpp:78
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
Definition: data.cpp:835
std::string get_flag(char line[], int max_l)
Definition: utils.cpp:179
std::string natural_naming(std::string name)
Definition: utils.cpp:253
std::string last_char(std::string s)
Returns the last character in a string.
Definition: utils.cpp:228
double coth(double x)
The hyperbolic cotangent function.
Definition: utils.cpp:303
std::string PYNE_DATA
Path to the directory containing the PyNE data.
Definition: utils.cpp:13
bool ternary_ge(int a, int b, int c)
Returns true if a <= b <= c and flase otherwise.
Definition: utils.cpp:240
std::string to_lower(std::string s)
Returns an all lower case copy of the string.
Definition: utils.cpp:158
bool contains_substring(std::string s, std::string substr)
Returns true if substr is in s.
Definition: utils.cpp:246
bool toggle_warnings()
Toggles warnings on and off.
Definition: utils.cpp:343
double endftod_f(char *s)
Converts a string from ENDF format to a float.
Definition: utils.cpp:137
std::string NUC_DATA_PATH
Path to the nuc_data.h5 file.
Definition: utils.h:50
double endftod_cpp(char *s)
Definition: utils.cpp:82
~FileNotFound()
default destructor
Definition: utils.h:156
std::string slice_from_end(std::string s, int n=-1, int l=1)
Definition: utils.cpp:234
FileNotFound()
default constructor
Definition: utils.h:153
int to_int(std::string s)
Converts a string of digits to an int using atoi().
Definition: utils.cpp:74
virtual const char * what() const
Creates a helpful error message.
Definition: utils.h:165
std::string to_upper(std::string s)
switches endftod to fast cpp version
Definition: utils.cpp:151
double slope(double x2, double y2, double x1, double y1)
Finds the slope of a line from the points (x1, y1) and (x2, y2).
Definition: utils.cpp:288
FileNotFound(std::string fname)
constructor with the filename fname.
Definition: utils.h:159
std::string capitalize(std::string s)
Returns a capitalized copy of the string.
Definition: utils.cpp:166
void warning(std::string s)
Prints a warning message.
Definition: utils.cpp:348
A container representing enrichment cascades.
Definition: _atomic_data.h:7
std::string replace_all_substrings(std::string s, std::string substr, std::string repstr)
Replaces all instance of substr in s with repstr.
Definition: utils.cpp:216
bool file_exists(std::string strfilename)
Returns true if the file can be found.
Definition: utils.cpp:311
void pyne_start()
Initializes PyNE based on environment.
Definition: utils.cpp:16
double(* endftod)(char *s)
endftod function pointer. defaults to fortran
Definition: utils.cpp:145
std::string remove_characters(std::string s, std::string chars)
Removes all characters in the string chars from s.
Definition: utils.cpp:207
double solve_line(double x, double x2, double y2, double x1, double y1)
Definition: utils.cpp:294
double tanh(double x)
The hyperbolic tangent function.
Definition: utils.cpp:299
std::string remove_substring(std::string s, std::string substr)
Creates a copy of s with all instances of substr taken out.
Definition: utils.cpp:196