[TEST]UPSTREAM: Pick some source changes from 48080d0a97
* Sync new folder structure
This commit is contained in:
2584
AMSS_NCKU_source/misc/fmisc.f90
Normal file
2584
AMSS_NCKU_source/misc/fmisc.f90
Normal file
File diff suppressed because it is too large
Load Diff
276
AMSS_NCKU_source/misc/fmisc.h
Normal file
276
AMSS_NCKU_source/misc/fmisc.h
Normal file
@@ -0,0 +1,276 @@
|
||||
|
||||
#ifndef FMISC_H
|
||||
#define FMISC_H
|
||||
|
||||
#ifdef fortran1
|
||||
#define f_interp_2 interp_2
|
||||
#define f_pointcopy pointcopy
|
||||
#define f_copy copy
|
||||
#define f_global_interp global_interp
|
||||
#define f_global_interp_ss global_interp_ss
|
||||
#define f_global_interp_ss_2d global_interp_ss_2d
|
||||
#define f_global_interpind global_interpind
|
||||
#define f_global_interpind2d global_interpind2d
|
||||
#define f_global_interpind1d global_interpind1d
|
||||
#define f_l2normhelper l2normhelper
|
||||
#define f_l2normhelper7 l2normhelper7
|
||||
#define f_l2normhelper_sh l2normhelper_sh
|
||||
#define f_l2normhelper_sh_rms l2normhelper_sh_rms
|
||||
#define f_average average
|
||||
#define f_average3 average3
|
||||
#define f_average2 average2
|
||||
#define f_average2p average2p
|
||||
#define f_average2m average2m
|
||||
#define f_lowerboundset lowerboundset
|
||||
#define f_set_value set_value
|
||||
#define f_add_value add_value
|
||||
#define f_array_add array_add
|
||||
#define f_array_copy array_copy
|
||||
#define f_array_subtract array_subtract
|
||||
#define f_fft four1
|
||||
#define f_find_maximum find_maximum
|
||||
#define f_polint polint
|
||||
#define f_d2dump d2dump
|
||||
#endif
|
||||
#ifdef fortran2
|
||||
#define f_interp_2 INTERP_2
|
||||
#define f_pointcopy POINTCOPY
|
||||
#define f_copy COPY
|
||||
#define f_global_interp GLOBAL_INTERP
|
||||
#define f_global_interp_ss GLOBAL_INTERP_SS
|
||||
#define f_global_interp_ss_2d GLOBAL_INTERP_SS_2D
|
||||
#define f_global_interpind GLOBAL_INTERPIND
|
||||
#define f_global_interpind2d GLOBAL_INTERPIND2D
|
||||
#define f_global_interpind1d GLOBAL_INTERPIND1D
|
||||
#define f_l2normhelper L2NORMHELPER
|
||||
#define f_l2normhelper7 L2NORMHELPER7
|
||||
#define f_l2normhelper_sh L2NORMHELPER_SH
|
||||
#define f_l2normhelper_sh_rms L2NORMHELPER_SH_RMS
|
||||
#define f_average AVERAGE
|
||||
#define f_average3 AVERAGE3
|
||||
#define f_average2 AVERAGE2
|
||||
#define f_average2p AVERAGE2P
|
||||
#define f_average2m AVERAGE2M
|
||||
#define f_lowerboundset LOWERBOUNDSET
|
||||
#define f_set_value SET_VALU
|
||||
#define f_add_value ADD_VALUE
|
||||
#define f_array_add ARRAY_ADD
|
||||
#define f_array_copy ARRAY_COPY
|
||||
#define f_array_subtract ARRAY_SUBTRACT
|
||||
#define f_fft FOUR1
|
||||
#define f_find_maximum FIND_MAXIMUM
|
||||
#define f_polint POLINT
|
||||
#define f_d2dump D2DUMP
|
||||
#endif
|
||||
#ifdef fortran3
|
||||
#define f_interp_2 interp_2_
|
||||
#define f_pointcopy pointcopy_
|
||||
#define f_copy copy_
|
||||
#define f_global_interp global_interp_
|
||||
#define f_global_interp_ss global_interp_ss_
|
||||
#define f_global_interp_ss_2d global_interp_ss_2d_
|
||||
#define f_global_interpind global_interpind_
|
||||
#define f_global_interpind2d global_interpind2d_
|
||||
#define f_global_interpind1d global_interpind1d_
|
||||
#define f_l2normhelper l2normhelper_
|
||||
#define f_l2normhelper7 l2normhelper7_
|
||||
#define f_l2normhelper_sh l2normhelper_sh_
|
||||
#define f_l2normhelper_sh_rms l2normhelper_sh_rms_
|
||||
#define f_average average_
|
||||
#define f_average3 average3_
|
||||
#define f_average2 average2_
|
||||
#define f_average2p average2p_
|
||||
#define f_average2m average2m_
|
||||
#define f_lowerboundset lowerboundset_
|
||||
#define f_set_value set_value_
|
||||
#define f_add_value add_value_
|
||||
#define f_array_add array_add_
|
||||
#define f_array_copy array_copy_
|
||||
#define f_array_subtract array_subtract_
|
||||
#define f_fft four1_
|
||||
#define f_find_maximum find_maximum_
|
||||
#define f_polint polint_
|
||||
#define f_d2dump d2dump_
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_pointcopy(int &,
|
||||
double *, double *, int *, double *,
|
||||
double &, double &, double &, double &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_copy(int &,
|
||||
double *, double *, int *, double *,
|
||||
double *, double *, int *, double *,
|
||||
double *, double *);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_global_interp(int *, double *, double *, double *,
|
||||
double *, double &,
|
||||
double &, double &, double &,
|
||||
int &, double *, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_global_interp_ss(int *, double *, double *, double *,
|
||||
double *, double &,
|
||||
double &, double &, double &,
|
||||
int &, double *, int &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_global_interp_ss_2d(int *, double *, double *, int &,
|
||||
double *, double &,
|
||||
double &, double &,
|
||||
int &, double *, int &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_global_interpind(int *, double *, double *, double *,
|
||||
double *, double &,
|
||||
double &, double &, double &,
|
||||
int &, double *, int &,
|
||||
int *, double *, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_global_interpind2d(int *, double *, double *, double *,
|
||||
double *, double &,
|
||||
double &, double &, double &,
|
||||
int &, double *, int &,
|
||||
int *, double *, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_global_interpind1d(int *, double *, double *, double *,
|
||||
double *, double &,
|
||||
double &, double &, double &,
|
||||
int &, double *, int &,
|
||||
int *, double *, int &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_l2normhelper(int *, double *, double *, double *,
|
||||
double &, double &, double &,
|
||||
double &, double &, double &,
|
||||
double *, double &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_l2normhelper7(int *, double *, double *, double *,
|
||||
double &, double &, double &,
|
||||
double &, double &, double &,
|
||||
double *, double *, double *, double *,
|
||||
double *, double *, double *, double *, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_l2normhelper_sh(int *, double *, double *, double *,
|
||||
double &, double &, double &,
|
||||
double &, double &, double &,
|
||||
double *, double &, int &, int &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_l2normhelper_sh_rms(int *, double *, double *, double *,
|
||||
double &, double &, double &,
|
||||
double &, double &, double &,
|
||||
double *, double &, int &, int &, int &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_average(int *, double *, double *, double *);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_average3(int *, double *, double *, double *);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_average2(int *, double *, double *, double *, double *);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_average2p(int *, double *, double *, double *, double *);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_average2m(int *, double *, double *, double *, double *);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_lowerboundset(int *, double *, double &);
|
||||
}
|
||||
|
||||
#if 0
|
||||
extern "C" { void f_interp_2( int *, double *,
|
||||
double &, int &,int &,int &,int &,int &,int &,
|
||||
double &,double &,double &,
|
||||
int &, double *,
|
||||
int &
|
||||
);}
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_set_value(int *, double *, double &);
|
||||
}
|
||||
extern "C"
|
||||
{
|
||||
void f_add_value(int *, double *, double &);
|
||||
}
|
||||
extern "C"
|
||||
{
|
||||
void f_array_add(int *, double *, double *);
|
||||
}
|
||||
extern "C"
|
||||
{
|
||||
void f_array_copy(int *, double *, double *);
|
||||
}
|
||||
extern "C"
|
||||
{
|
||||
void f_array_subtract(int *, double *, double *);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_fft(double *, int &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_find_maximum(int *,
|
||||
double *, double *, double *, double *,
|
||||
double &, double *, int *, int *);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_polint(double *, double *, double &, double &, double &, int &);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void f_d2dump(int &, double *, double *, int *, double *, double *, int &, double *);
|
||||
}
|
||||
#endif /* FMISC_H */
|
||||
1358
AMSS_NCKU_source/misc/misc.C
Normal file
1358
AMSS_NCKU_source/misc/misc.C
Normal file
File diff suppressed because it is too large
Load Diff
94
AMSS_NCKU_source/misc/misc.h
Normal file
94
AMSS_NCKU_source/misc/misc.h
Normal file
@@ -0,0 +1,94 @@
|
||||
|
||||
#ifndef MISC_H
|
||||
#define MISC_H
|
||||
|
||||
#ifdef newc
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
#include <complex>
|
||||
using namespace std;
|
||||
#else
|
||||
#include <iostream.h>
|
||||
#include <iomanip.h>
|
||||
#include <fstream.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <complex.h>
|
||||
#endif
|
||||
|
||||
#include <mpi.h>
|
||||
|
||||
namespace misc
|
||||
{
|
||||
inline string &lTrim(string &ss)
|
||||
{
|
||||
string::iterator p = find_if(ss.begin(), ss.end(), not1(ptr_fun<int, int>(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<int, int>(isspace)));
|
||||
ss.erase(p.base(), ss.end());
|
||||
return ss;
|
||||
}
|
||||
inline string &Trim(string &st)
|
||||
{
|
||||
lTrim(rTrim(st));
|
||||
return st;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
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<double> gaulegf(double x1, double x2, int n, complex<double> 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<double> &f0,
|
||||
std::vector<double> &f1, std::vector<double> &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<double> &f0, std::vector<double> &f1);
|
||||
complex<double> complex_gamma(complex<double> z);
|
||||
complex<double> KummerComplex(const complex<double> a, const complex<double> b, complex<double> x);
|
||||
#if 0
|
||||
complex<double> First_Bessel(const complex<double> a,complex<double> x);
|
||||
#else
|
||||
complex<double> First_Bessel(double a, complex<double> x);
|
||||
#endif
|
||||
complex<double> Rec_Int(const double xmin, const double xmax, complex<double> fun(double x));
|
||||
complex<double> Simpson_Int(const double xmin, const double xmax, complex<double> fun(double x));
|
||||
complex<double> Simpson3o8_Int(const double xmin, const double xmax, complex<double> fun(double x));
|
||||
complex<double> Gauss_Int(const double xmin, const double xmax, complex<double> 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 */
|
||||
Reference in New Issue
Block a user