initial upload
This commit is contained in:
89
archive/xyz2shc/head_func.h
Normal file
89
archive/xyz2shc/head_func.h
Normal file
@@ -0,0 +1,89 @@
|
||||
#ifndef _HEAD_FUNC_H
|
||||
#define _HEAD_FUNC_H
|
||||
#include "iostream"
|
||||
#include "fstream"
|
||||
#include "sstream"
|
||||
#include "string.h"
|
||||
#include "cmath"
|
||||
#include "iomanip"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "unistd.h"
|
||||
#include "vector"
|
||||
#include "map"
|
||||
#include "algorithm"
|
||||
#include "ctime"
|
||||
#include "omp.h"
|
||||
#include "random"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//数学常量
|
||||
#define BDL_MAX 1e+30
|
||||
#define BDL_MIN -1e+30
|
||||
#define ZERO 1e-20
|
||||
//物理常量
|
||||
#define WGS84_PoleRadius 6356752.314//WGS84椭球极半径
|
||||
#define WGS84_EquatorRadius 6378137.0//WGS84椭球长半径
|
||||
#define EarthRadius 6371000.0
|
||||
#define MoonRadius 1738000.0
|
||||
#define Pi (4.0*atan(1.0))
|
||||
//宏函数
|
||||
#define MAX(a,b) (a>b?a:b)
|
||||
#define MIN(a,b) (a<b?a:b)
|
||||
#define SetToBox(a,b,in) (MAX(a,MIN(b,in))) //如果in在a和b之间返回in 否则返回边界值
|
||||
//终端显示控制符
|
||||
#define BOLDRED "\033[1m\033[31m"
|
||||
#define BOLDGREEN "\033[1m\033[32m"
|
||||
#define BOLDYELLOW "\033[1m\033[33m"
|
||||
#define BOLDBLUE "\033[1m\033[34m"
|
||||
#define UNDERLINE "\033[1m\033[4m"
|
||||
#define RESET "\033[0m"
|
||||
#define MOVEUP(x) printf("\033[%dA", (x))
|
||||
#define MOVEDOWN(x) printf("\033[%dB", (x))
|
||||
#define MOVELEFT(x) printf("\033[%dD", (x))
|
||||
#define MOVERIGHT(x) printf("\033[%dC", (x))
|
||||
#define MOVETO(y,x) printf("\033[%d;%dH", (y), (x))
|
||||
#define CLEARLINE "\033[K"
|
||||
#define CLEARALL "\033[2J"
|
||||
//数据结构
|
||||
typedef vector<int> _1iArray;
|
||||
typedef vector<double> _1dArray;
|
||||
typedef vector<string> _1sArray;
|
||||
typedef vector<vector<int> > _2iArray;
|
||||
typedef vector<vector<double> > _2dArray;
|
||||
typedef map<int,int> _i2iMap;
|
||||
|
||||
struct spoint{
|
||||
int id = -1;
|
||||
double phi = BDL_MAX, theta = BDL_MAX, rad = BDL_MAX;
|
||||
};
|
||||
typedef vector<spoint> spointArray;
|
||||
|
||||
struct obspoint : spoint{
|
||||
double val = BDL_MAX, dev = BDL_MAX;
|
||||
};
|
||||
typedef vector<obspoint> obspointArray;
|
||||
|
||||
/*************************全局函数********************************/
|
||||
double sign(double);
|
||||
stringstream str2ss(string); //将string转换为stringstream
|
||||
int open_infile(ifstream&,char*); //测试打开输入文件 如果成功则返回0并输出信息 否则返回1
|
||||
int open_outfile(ofstream&,char*); //测试打开输出文件 如果成功则返回0并输出信息 否则返回1
|
||||
double ellipRadius(double,double,double); //计算一个参考椭球或者参考球在指定纬度位置的半径
|
||||
/*************************球谐系数操作********************************/
|
||||
//计算伴随勒让德函数递推系数
|
||||
_2dArray get_Anm_array(int);
|
||||
_2dArray get_Bnm_array(int);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user