logplus/Slfio/include/MemRdWt.h
2025-10-29 17:23:30 +08:00

230 lines
7.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __MemRdWt_H__
#define __MemRdWt_H__
#include "LogIO.h"
#include "CStringType.h"
#define SetVariable(s) float s;
#define FB(arg) #arg
#define InitName(arg) FB(arg)
#define GetVALUE(S,a,b) memmove(&S,a.yy,b*sizeof(float));
#define SetVALUE(a,S,b) memmove(a.yy,&S,b*sizeof(float));
#define GetPosValue(S,a,pos,b) memmove(&S,&a.yy[pos-1],b*sizeof(float));
#define SetPosValue(a,S,pos,b) memmove(&a.yy[pos-1],&S,b*sizeof(float));
#define DefVariable(ParName,InName,OutName) SetVariable(ParName);\
SetVariable(InName);\
SetVariable(OutName);
#define GetINWaveValue(WF,POS) memmove(WF,&INP.yy[INP.InpPos[POS-1]],INP.InpLen[POS-1]*sizeof(float));
#define GetINValue(GR,POS,NO) memmove(&GR,&INP.yy[INP.InpPos[POS-1]],NO*sizeof(float));
#define SetOUTWaveValue(WF,POS) memmove(&OUTP.yy[OUTP.OutPos[POS-1]],WF,OUTP.OutLen[POS-1]*sizeof(float));
#define SetOUTValue(GR,POS,NO) memmove(&OUTP.yy[OUTP.OutPos[POS-1]],&GR,NO*sizeof(float));
#define GetHDValue(GR,DEP,NO) memmove(&GR,&HD.DEP,NO*sizeof(float));
#define MAX_STR_LEN 64
struct OUTC_STRU
{
int Noo;
char Name[8192];
char Script[8192];
char Unit[8192];
};
struct ErrorInf{
int ErrorNo;
char ErrorStr[128];
};
struct INC_STRU
{
int Noi;
char Name[8192];
char Script[8192];
char Unit[8192];
};
struct INP_STRU
{
int InpPos[1024],InpLen[1024];
float yy[20560];
};
struct OUTP_STRU
{
int OutPos[1024],OutLen[1024];
float yy[20560];
};
struct CONC_STRU
{
int Noc;
char Name[8192];
char Script[8192];//变量描述
char Unit[8192];//变量单位
char Options[8192];//变量选项
char ValType[8192];//变量分类:如孔隙度计算,泥质计算
};
struct CON_STRU
{
float yy[1024];
char stryy[8192];
};
struct HD_STRU
{
float Dep,//输入运行深度
Depo,//输出运行深度
Sdep,//层段起始深度
Edep,//层段结束深度
Rlev,//输入曲线最小深度间隔,也是输出曲线的深度间隔
StartDep,//井起始深度,也是输入曲线的最小深度
EndDep;//井结束深度,也是输入曲线的最大深度
char Param[256],//解释参数卡
Plot[256];//绘图模板
float Stdep,//参数控制的最浅深度
Endep;////参数控制的最深深度
char buffer[500];
};
struct LogType
{
int Type[1024];
union DATATYPE {
Slf_CURVE mCurve;
Slf_FMT mFmt;
Slf_TDT mTdt;
Slf_WAVE mWave;
} addr[1024];
};
QString SLFIO_EXPORT getStrValue(char *stryy,int pos);//stryy 输入字符串缓冲器pos 参数号,1开始
class SLFIO_EXPORT CMemRdWt : public CLogIO
{
private:
struct INC_STRU *INC;
struct OUTC_STRU *OUTC;
struct INP_STRU *INP;
struct OUTP_STRU *OUTP;
struct CONC_STRU *CONC;
struct CON_STRU *CON;
struct HD_STRU *HD;
struct LogType *OutCurveType;
struct ErrorInf *SlfError;
const char *ConstFileName;
float StartDep,EndDep,Rlev;
float RunSdep,RunEdep;
Slf_CHANNEL m_Channel;
Slf_WAVE m_Wave;
Slf_CURVE m_Curve;
public:
char **InData ;
char **OutData;
int *InCurveNo,*OutCurveNo;
char *ConstBuffer;
float *InSdep,*InEdep,*OutSdep,*OutEdep;
int Inflag;
int SaveFlag;
public:
CMemRdWt();
CMemRdWt(const char *wellname,bool mconst=FALSE,int FileType=0);
~CMemRdWt();
void Initialize(bool mconst=FALSE);
void BackData();
void RestoreData();
void DeleteInCurve(int i);
void DeleteOutCurve(int i);
void CloseData();
void ChangeName(struct INC_STRU *Inc,
struct OUTC_STRU *Outc,
struct CONC_STRU *Conc,
struct CON_STRU *Con
);
void Save();
bool Open(const char *wellname,unsigned int nOpenFlags=modeReadWrite,int BlockLen=1024,int MaxObjectNumber=1024, int MachineType=MACHINE_TYPE,int FileType=0);
void GetVal(int no,int Len,void *Data,float *yy);
void SetVal(int no,int Len,void *Data,float *yy);
bool AddInCurve(char *mCurve);
bool AddInCurve(int i,char *mCurve);
void AddOutCurve(Slf_CURVE *mcurve);
void AddOutCurve(int i,Slf_CURVE *mcurve);
int GetSamplePos(float depth,int no,int inout=0);
void CopyCurve(CMemRdWt & SourceData,float SourceStartDepth,float SourceEndDepth,float DecDepth,int SourceCurveNo,int DecCurveNo);
void CopyCurve(char *SourceData,int i,int j,float DecDepth,int DecCurveNo);
void CopyCurve( int SourceCurve,float SourceStartDepth,float SourceEndDepth,float DecDepth,int SourceCurveNo,int DecCurveNo);
void CopyCurve(CMemRdWt &SourceData,float SourceStartDepth,float SourceEndDepth,float DecDepth,char* SourceCurve,char* DecCurve);
void SetDepthDelta(float sdep,float edep,float rlev=0.125);
char *OpenCord(const char* mConstFileName);
void SaveCord(const char* mConstFileName,char *pBuf=NULL);
char * GetParam();
void In (float Depth=-99999,int No=-1);
void Out (float Depth=-99999,int No=-1);
void Inn (float Depth=-99999,int No=-1);
void Outt (float Depth=-99999,int No=-1);
void InOut(float Depth=-99999,int No=-1);
void SetStruct(
struct INC_STRU *Inc,
struct OUTC_STRU *Outc,
struct INP_STRU *Inp,
struct OUTP_STRU *Outp,
struct CONC_STRU *Conc,
struct CON_STRU *Con,
struct HD_STRU *Hd,
struct LogType *OutType=NULL,
struct ErrorInf *errorinf=NULL
);
void OutSave(int i);
void InSave(int i);
//private:
int Const();
public:
void Close();
void LoadOldStruct();
CString GetWellName();
void GetWellName(char *);
bool EShiftDepth(char *Name,char *pParam=NULL);
bool EShiftCurveDepth(char *Name,int Count=0,float *dep1=NULL,float *dep2=NULL);
bool EShiftFMTDepth(char *Name,int Count=0,float *dep1=NULL,float *dep2=NULL);
bool EShiftTDTDepth(char *Name,int Count=0,float *dep1=NULL,float *dep2=NULL);
bool EShiftTableDepth(char *Name,int Count=0,float *dep1=NULL,float *dep2=NULL);
void epshft(int iPos,int Len,int CodeLen,float rlevs,float d_sdep,float d_edep,float dold1,float dold2,float dnew1,float dnew2,int flg,char *d_flLogData,char *d_flSavLogData);
float epshft(float dest,float rlevs,float d_sdep,float d_edep,float dold1,float dold2,float dnew1,float dnew2);
void round(float *d,float d1,float d2,float rlevs,float stdeps,int ids);
void inter(int iPos,int nLen,int CodeLen,float d_sdep,float d_edep,float a,float d,float oldd,float rlevs,char *d_flLogData,char *d_flSavLogData,float *yy);
void DepthSort(float *xxx,int number);
int GetInCurveName(int CurveNo,char *InName);
int GetOutCurveName(int CurveNo,char *OutName);
private:
struct INC_STRU *OldINC;
struct OUTC_STRU *OldOUTC;
struct INP_STRU *OldINP;
struct OUTP_STRU *OldOUTP;
struct CONC_STRU *OldCONC;
struct CON_STRU *OldCON;
struct HD_STRU *OldHD;
struct LogType *OldOutCurveType;
struct ErrorInf *OldSlfError;
public:
bool EShiftWFDepth(char *Name,int Count,float *dep1,float *dep2);
bool EShiftDepth(char *Name,int m_nDepPairsNum,float *FirstDep,float *SecondDep);
void CorrectAllObjectsDepth(float deltadepth);
void CorrectObjectDepth(int index,float deltadepth);
ErrorInf &GetSlfError()
{
if(SlfError) return *SlfError;
else {
ErrorInf te;
te.ErrorNo=0;
te.ErrorStr[0]=0;
return te;
}
}
bool isfirstrun;
float ZoneSdep,ZoneEdep;
bool EshiftStreamDepth(char *Name,int Count,float *dep1,float *dep2);
int GetInCurveCount();
int GetOutCurveCount();
void Innn(float Depth=-99999,int No=-1);
bool CurveExist(int no);
bool CurveExist(char*name);
};
#endif