111 lines
3.7 KiB
C++
111 lines
3.7 KiB
C++
#ifndef DATAHELPER_H
|
||
#define DATAHELPER_H
|
||
|
||
#include <Windows.h>
|
||
#include <QObject>
|
||
#include <QTextStream>
|
||
#include "MemRdWt.h"
|
||
#include "datamanagerdefs.h"
|
||
#pragma execution_character_set("utf-8")
|
||
//#define DefTabNum 10//9 whp change 2020.5.25
|
||
//for 曲线计算
|
||
#define MaxArg 26 // 最大自变量数
|
||
#define DELIMITER 1
|
||
#define VARIABLE 2
|
||
#define MNUMBER 3
|
||
struct DEFAULTTABLE
|
||
{
|
||
public:
|
||
QString TableName;
|
||
QString TableAliasName;
|
||
int ZdNum;
|
||
Slf_OBJECT_FIELD *tinfo;
|
||
//Slf_TABLE_FIELD *tinfo;
|
||
};
|
||
|
||
#pragma endregion 导入表数据定义的函数,可以单独建立动态库文件
|
||
|
||
|
||
class DATAMGS_EXPORT DataHelper
|
||
{
|
||
public:
|
||
DataHelper();
|
||
~DataHelper();
|
||
#pragma region 导入表数据定义的函数,可以单独建立动态库文件
|
||
//whp change 2020.3.9 for 统一离散数据入口
|
||
//static QStringList GetVlidTable(QStringList listFiles);//过滤掉无效数据表
|
||
static QStringList GetVlidTable(int curitemType,QStringList listFiles,QStringList &BadlistFiles);//过滤掉无效数据表
|
||
static int StrType(QString str);//IsNumberStr(QString str)判断字符串是否为数值,是整数还是浮点数
|
||
|
||
static DEFAULTTABLE SetTableInf(QString TableName,QString TableHzName,int num,QStringList ZdName,QStringList HzName,QStringList ZdUnit,QStringList ZdType,QStringList ZdLen,QStringList ZdRes);
|
||
static void InitDefauleTable();
|
||
|
||
static void DelDefauleTable();
|
||
|
||
static int GetSimilarTable(int ZdNum,int *FieldType);//匹配缺省表,返回缺省表序号m=1,BOOL IsSem=1,BOOL DelDubSpa=1);
|
||
static bool IsNullLine(QByteArray line);
|
||
static bool m_IsGc;
|
||
static QStringList GetAllWellName();
|
||
static QStringList GetAllWellRoundName(QString WellName,QStringList& WellRoundFileNameList);
|
||
};
|
||
class Function
|
||
{
|
||
public:
|
||
CMemRdWt *Slffile;
|
||
float val[10];
|
||
//whp add 2011.7.19 for字符型字段计算
|
||
char cval[10][30];
|
||
char *prog;
|
||
//int d_iProgramInCurvePos[MaxCurve];
|
||
// float xx[MaxCurve];
|
||
// -----------------------------
|
||
// 计算产生新曲线定义开始
|
||
//char *prog;
|
||
char token[80];
|
||
char tok_type;
|
||
char vars[MaxArg];
|
||
// A-Z 26 user's variable
|
||
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||
int get_exp(float *result);
|
||
int level2(float *result);
|
||
int level3(float *result);
|
||
int level4(float *result);
|
||
int level5(float *result);
|
||
int level6(float *result);
|
||
int primitive(float *result);
|
||
void get_token();
|
||
void arith(char o,float *r,float *h);
|
||
void unary(char o,float *r);
|
||
void serror(int error);
|
||
void putback();
|
||
int level1(float *result);
|
||
float find_var(char *s,int *ret);
|
||
int is_in(char ch,char *s);
|
||
int isdelim(char c);
|
||
int iswhite(char c);
|
||
//int ComputeCurve(CString csExpress,float sdeps,float edeps,BOOL IsCurrentOpen);
|
||
BOOL GetKey();
|
||
BOOL CheckKey();
|
||
int GetCodeLen(int Code);
|
||
//add whp
|
||
QString csName[MaxArg],csOutName;
|
||
char TempProg[150];
|
||
int GetExpress(QString csExpress);//返回输入变量个数(曲线条数)
|
||
// 计算产生新曲线定义结束
|
||
};
|
||
class Resample
|
||
{
|
||
public:
|
||
static float GetXstep(float x2,float x1);
|
||
static void Linear(float *x,float *y,int n,float *a,float *b);
|
||
static void Parabola(float *x,float *y,int n,float *a,float *b,float *c);
|
||
static void Akima(float *x,float *y,int n,float *a,float *b,float *c,float *d);
|
||
static bool LReSampling(float *aDep,float *aVal,int anp,float *tDep,float *curve,int tnp,int method);
|
||
static void qs(float *datx,float*mr,int left,int right,int Col);
|
||
static void qs(float *datx,short*mr,int left,int right,int Col);
|
||
static void ReOrder(float *mr,int Row,int Col,float *tDep);
|
||
static void ReOrder(short *mr,int Row,int Col,float *tDep);
|
||
static void ReSampling(float *mr,int Row,int Col,float *aDep,float *tDep,int tnp);
|
||
static void ReSampling(short *mr,int Row,int Col,float *aDep,float *tDep,int tnp);
|
||
};
|
||
#endif |