#ifndef MISC_H #define MISC_H #ifdef newc #include #include #include #include #include #include #include #include #include #include using namespace std; #else #include #include #include #include #include #include #include #endif #include namespace misc { inline string &lTrim(string &ss) { string::iterator p = find_if(ss.begin(), ss.end(), not1(ptr_fun(isspace))); ss.erase(ss.begin(), p); return ss; } inline string &rTrim(string &ss) { string::reverse_iterator p = find_if(ss.rbegin(), ss.rend(), not1(ptr_fun(isspace))); ss.erase(p.base(), ss.end()); return ss; } inline string &Trim(string &st) { lTrim(rTrim(st)); return st; } template void swap(T &a, T &b) { T c = a; a = b; b = c; } void tillherecheck(int myrank); void tillherecheck(const char str[]); void tillherecheck(MPI_Comm Comm_here, int out_rank, const char str[]); void tillherecheck(MPI_Comm Comm_here, int out_rank, const string str); int parse_parts(string str, string &sgrp, string &skey, string &sval, int &ind); int parse_parts(string str, string &sgrp, string &skey, string &sval, int &ind1, int &ind2); int parse_parts(string str, string &sgrp, string &skey, string &sval, int &ind1, int &ind2, int &ind3); void gaulegf(double x1, double x2, double *x, double *w, int n); complex gaulegf(double x1, double x2, int n, complex fun(double x)); void inversearray(double *aa, int NN); double fact(int N); double Wigner_d_function(int l, int m, int s, double costheta); int num_of_str(char *c); void TVDrungekutta3(const int N, const double dT, double *f0, double *f1, double *f_rhs, const int RK4); void rungekutta4(const int N, const double dT, double *f0, double *f1, double *f_rhs, const int RK4); void rungekutta4(const double dT, const std::vector &f0, std::vector &f1, std::vector &f_rhs, const int RK4); void dividBlock(const int DIM, int *shape_here, double *bbox_here, const int pices, double *picef, int *shape_res, double *bbox_res, const int min_width); void swapvector(std::vector &f0, std::vector &f1); complex complex_gamma(complex z); complex KummerComplex(const complex a, const complex b, complex x); #if 0 complex First_Bessel(const complex a,complex x); #else complex First_Bessel(double a, complex x); #endif complex Rec_Int(const double xmin, const double xmax, complex fun(double x)); complex Simpson_Int(const double xmin, const double xmax, complex fun(double x)); complex Simpson3o8_Int(const double xmin, const double xmax, complex fun(double x)); complex Gauss_Int(const double xmin, const double xmax, complex fun(double x)); void FFT(short int dir, long m, double *x, double *y); void Low_Pass_Filt(const int NN, double *a); void polyinterp(double t, double &rr, double *ti, double *ri, const int ORD); void polyinterp_d1(double t, double &rr, double *ti, double *ri, const int ORD); void next2power(long int Nin, long int &Nout, int &M); int MYpow2(int i); } #endif /* MISC_H */