43 #define _USE_MATH_DEFINES
56 #include "OpenMEEGConfigure.h"
58 #ifdef USE_PROGRESSBAR
59 #define PROGRESSBAR(a,b) progressbar((a),(b))
61 #define PROGRESSBAR(a,b)
67 #define M_PI 3.14159265358979323846
70 #define MU0 (4*M_PI*1e-7)
74 std::string::size_type idx = name.find(
'.');
75 if (idx == std::string::npos) {
76 return std::string(
"");
77 }
else if (name.substr(idx+1).find(
'.') != std::string::npos) {
80 return name.substr(idx+1);
85 static bool first=
true;
86 if (seed==-1 && !first)
97 return double(rand())/RAND_MAX;
106 return (
double)(sqrt(-2*log(x))*cos(2*
M_PI*
drandom()));
110 std::cout << std::endl <<
"| ------ " << argv[0] << std::endl;
111 for(
int i = 1; i < argc; i += 1 )
113 std::cout <<
"| " << argv[i] << std::endl;
115 std::cout <<
"| -----------------------" << std::endl;
118 #ifdef USE_PROGRESSBAR
119 inline void progressbar(
unsigned n,
unsigned N,
unsigned w = 20) {
121 const char* cprog =
".";
122 const char* cprog1 =
"*";
123 const char* cbeg =
"[";
124 const char* cend =
"]";
125 unsigned p = (unsigned)std::min( (
unsigned)floor(1.f*n*(w+1)/N), w);
127 static unsigned pprev = -1;
136 for(
unsigned i = 0; i < (w+2); ++i)
140 for(
unsigned i = 0; i < p; ++i) {
143 for(
unsigned i = p; i < w; ++i) {
159 std::cout <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
160 std::cout <<
"!!!!!!!!!!! WARNING !!!!!!!!!!!" << std::endl;
161 std::cout <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
162 std::cout << message << std::endl;
167 std::string omp_support =
" using OpenMP\n Executing using " + std::to_string(omp_get_max_threads()) +
" threads.";
169 std::string omp_support =
"";
172 std::ostringstream display_info;
174 display_info <<
" version " << version;
175 display_info <<
" compiled at " << __DATE__ <<
" " << __TIME__;
176 display_info << omp_support;
177 std::cout << display_info.str() << std::endl << std::endl;
void disp_argv(int argc, char **argv)
void init_random(int seed)
void warning(std::string message)
std::string getNameExtension(const std::string &name)
void print_version(const char *cmd)