43 #define _USE_MATH_DEFINES 52 #include "OpenMEEGConfigure.h" 54 #ifdef USE_PROGRESSBAR 55 #define PROGRESSBAR(a,b) progressbar((a),(b)) 57 #define PROGRESSBAR(a,b) 63 #define M_PI 3.14159265358979323846 66 #define MU0 (4*M_PI*1e-7) 70 std::string::size_type idx = name.find(
'.');
71 if (idx == std::string::npos) {
72 return std::string(
"");
73 }
else if (name.substr(idx+1).find(
'.') != std::string::npos) {
76 return name.substr(idx+1);
81 static bool first=
true;
82 if (seed==-1 && !first)
93 return double(rand())/RAND_MAX;
102 return (
double)(sqrt(-2*log(x))*cos(2*
M_PI*
drandom()));
106 std::cout << std::endl <<
"| ------ " << argv[0] << std::endl;
107 for(
int i = 1; i < argc; i += 1 )
109 std::cout <<
"| " << argv[i] << std::endl;
111 std::cout <<
"| -----------------------" << std::endl;
114 #ifdef USE_PROGRESSBAR 115 inline void progressbar(
unsigned n,
unsigned N,
unsigned w = 20) {
117 const char* cprog =
".";
118 const char* cprog1 =
"*";
119 const char* cbeg =
"[";
120 const char* cend =
"]";
121 unsigned p = (unsigned)std::min( (
unsigned)floor(1.f*n*(w+1)/N), w);
123 static unsigned pprev = -1;
132 for(
unsigned i = 0; i < (w+2); ++i)
136 for(
unsigned i = 0; i < p; ++i) {
139 for(
unsigned i = p; i < w; ++i) {
155 std::cout <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
156 std::cout <<
"!!!!!!!!!!! WARNING !!!!!!!!!!!" << std::endl;
157 std::cout <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
158 std::cout << message << std::endl;
162 std::cout << cmd <<
" version " << version <<
" compiled at " << __DATE__ <<
" " << __TIME__ << 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)