From 9ef6542bbedd9abc1260e253be6d6e9e0f8f8a01 Mon Sep 17 00:00:00 2001 From: "DESKTOP-450PEFP\\mainc" Date: Sun, 10 May 2026 22:27:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=97=E6=B3=95=E6=A8=A1=E7=89=88=E7=94=9F?= =?UTF-8?q?=E6=88=90=E7=9A=84=E4=B9=B1=E7=A0=81=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/example_plugin/ActionDialog.cpp | 78 ++ app/example_plugin/ActionDialog.h | 45 + app/example_plugin/ActionDialog.ui | 19 + app/example_plugin/example_plugin.cpp | 29 +- app/example_plugin/example_plugin.pro | 1 + app/fdsa4_test/Att_c_find.h | 9 + app/fdsa4_test/CBUIprogram.cpp | 1606 +++++++++++++++++++++++++ app/fdsa4_test/Ecc_Co.h | 5 + app/fdsa4_test/FindPeak.h | 5 + app/fdsa4_test/InArray_self.cpp | 32 + app/fdsa4_test/InArray_self.h | 6 + app/fdsa4_test/Inputtuban.h | 9 + app/fdsa4_test/Rate_Co.h | 5 + app/fdsa4_test/SLG_plate.h | 11 + app/fdsa4_test/S_per.h | 6 + app/fdsa4_test/Thcav_Co.h | 5 + app/fdsa4_test/Zc_Zm_comb.h | 8 + app/fdsa4_test/fdsa4_test.pro | 22 +- app/fdsa4_test/fftw3.h | 415 +++++++ app/fdsa4_test/findcc.cpp | 29 + app/fdsa4_test/findcc.h | 6 + app/fdsa4_test/hilbert.h | 9 + app/fdsa4_test/maxInArray.h | 9 + app/fdsa4_test/test0531.000 | 430 +++++++ 24 files changed, 2788 insertions(+), 11 deletions(-) create mode 100644 app/example_plugin/ActionDialog.cpp create mode 100644 app/example_plugin/ActionDialog.h create mode 100644 app/example_plugin/ActionDialog.ui create mode 100644 app/fdsa4_test/Att_c_find.h create mode 100644 app/fdsa4_test/CBUIprogram.cpp create mode 100644 app/fdsa4_test/Ecc_Co.h create mode 100644 app/fdsa4_test/FindPeak.h create mode 100644 app/fdsa4_test/InArray_self.cpp create mode 100644 app/fdsa4_test/InArray_self.h create mode 100644 app/fdsa4_test/Inputtuban.h create mode 100644 app/fdsa4_test/Rate_Co.h create mode 100644 app/fdsa4_test/SLG_plate.h create mode 100644 app/fdsa4_test/S_per.h create mode 100644 app/fdsa4_test/Thcav_Co.h create mode 100644 app/fdsa4_test/Zc_Zm_comb.h create mode 100644 app/fdsa4_test/fftw3.h create mode 100644 app/fdsa4_test/findcc.cpp create mode 100644 app/fdsa4_test/findcc.h create mode 100644 app/fdsa4_test/hilbert.h create mode 100644 app/fdsa4_test/maxInArray.h create mode 100644 app/fdsa4_test/test0531.000 diff --git a/app/example_plugin/ActionDialog.cpp b/app/example_plugin/ActionDialog.cpp new file mode 100644 index 0000000..1c2939b --- /dev/null +++ b/app/example_plugin/ActionDialog.cpp @@ -0,0 +1,78 @@ +#include "ActionDialog.h" +#include +#include +#include + +#pragma execution_character_set("utf-8") +CActionDialog::CActionDialog(QWidget* parent):QDialog(parent) +, mNARMS(250) +{ + //pushButton + uiDlg = new Ui_ActionDialog(); + uiDlg->setupUi(this); + + // 初始化按钮 + initActions(); +} + +CActionDialog::~CActionDialog() +{ + +} +void CActionDialog::paintEvent( QPaintEvent * event ) +{ + +} +void CActionDialog::init() +{ + +} + +void CActionDialog::initActions() +{ + QAction* pAct1 = new QAction("Act1"); // 按钮1 + pAct1->setProperty("icon_v", "icon/11.png"); // 设置按钮icon属性 + pAct1->setToolTip("PluginDialog按钮1Tip"); // 设置按钮Tip + // + connect(pAct1, &QAction::triggered, this, &CActionDialog::onAction1Func); + + QAction* pAct2 = new QAction("Act2"); + pAct2->setProperty("icon_v", "icon/bin.png"); + pAct2->setToolTip("PluginDialog按钮2Tip"); + connect(pAct2, &QAction::triggered, this, &CActionDialog::onAction2Func); + + QAction* pAct3 = new QAction("Act3"); + pAct3->setProperty("icon_v", "icon/black.png"); + pAct3->setToolTip("PluginDialog按钮2Tip111"); + connect(pAct3, &QAction::triggered, this, &CActionDialog::onAction3Func); + + QAction* pAct4 = new QAction("Act4"); + pAct4->setProperty("icon_v", "icon/black.png"); + pAct4->setToolTip("PluginDialog按钮4Tip111"); + + m_listAction << pAct1; + m_listAction << pAct2; + m_listAction << pAct3; + m_listAction << pAct4; +} + +QList CActionDialog::getListAction() +{ + return m_listAction; +} + +void CActionDialog::onAction1Func() +{ + QMessageBox::information(NULL, "提示", "example_plugin 我是按钮111111弹窗"); +} + +void CActionDialog::onAction2Func() +{ + QMessageBox::information(NULL, "提示", "example_plugin 我是按钮222222弹窗"); +} + +void CActionDialog::onAction3Func() +{ + QMessageBox::information(NULL, "提示", "example_plugin 我是按钮333333弹窗"); +} + diff --git a/app/example_plugin/ActionDialog.h b/app/example_plugin/ActionDialog.h new file mode 100644 index 0000000..359c0e9 --- /dev/null +++ b/app/example_plugin/ActionDialog.h @@ -0,0 +1,45 @@ +#ifndef ACTION_DIALOG +#define ACTION_DIALOG +#include +#include +#include "ui_ActionDialog.h" + +#pragma once +#include + +class CActionDialog:public QDialog +{ +Q_OBJECT +protected: + void paintEvent( QPaintEvent * event ); +public: + CActionDialog(QWidget* parent); + ~CActionDialog(); + void init(); + + // 初始化按钮,显示在平台右侧ToolBar + void initActions(); + + // 平台获取该模块中自定义的QAction + QList getListAction(); + +public: + float m_StartDep = 0.0f; + float m_EndDep = 0.0f; + int mNARMS = 0; +private: + Ui_ActionDialog *uiDlg; + + QList m_listAction; + +public: + + +public slots: + // QAction的槽函数处理 + void onAction1Func(); + void onAction2Func(); + void onAction3Func(); + +}; +#endif diff --git a/app/example_plugin/ActionDialog.ui b/app/example_plugin/ActionDialog.ui new file mode 100644 index 0000000..c46c753 --- /dev/null +++ b/app/example_plugin/ActionDialog.ui @@ -0,0 +1,19 @@ + + + ActionDialog + + + + 0 + 0 + 425 + 304 + + + + Dialog + + + + + diff --git a/app/example_plugin/example_plugin.cpp b/app/example_plugin/example_plugin.cpp index db01c67..42927f9 100644 --- a/app/example_plugin/example_plugin.cpp +++ b/app/example_plugin/example_plugin.cpp @@ -3,6 +3,7 @@ #include "basefun.h" #include "DepthProgress.h" #include "PluginDialog.h" +#include "ActionDialog.h" #include "pythonhandler.h" Slf_WAVE mWave[1]; @@ -47,10 +48,12 @@ extern "C"{ __declspec (dllexport) int example_plugin(); //改成自己的工程名 //以下两行代码用于创建自定义界面来控制参数的对话框,如果不需开发者自己定义对话框,则不需要这两行及下面的InitDialog函数初始化 - __declspec (dllexport) QDialog* InitDialog(QWidget *pF); - __declspec( dllexport ) CPluginDialog *PLGDialog=NULL; +// __declspec (dllexport) QDialog* InitDialog(QWidget *pF); +// __declspec( dllexport ) CPluginDialog *PLGDialog=NULL; - __declspec( dllexport ) void* getAction_CApi(int* count); + __declspec( dllexport ) CActionDialog *ActDialog=NULL; + + __declspec( dllexport ) void* getAction_CApi(QWidget *pF, int* count); __declspec (dllexport) int Init(); __declspec (dllexport) int Finish(); @@ -70,19 +73,25 @@ int Init() } //此部分用于创建对话框,该第一话框将被显示在平台的参数区 //如果需要独立显示对话框,则不需熬此函数 +//QDialog* InitDialog(QWidget *pF) +//{ +// PLGDialog=new CPluginDialog(pF); +// return PLGDialog; +//} -QDialog* InitDialog(QWidget *pF) + +QDialog* InitActDialog(QWidget *pF) { - PLGDialog=new CPluginDialog(pF); - return PLGDialog; + ActDialog=new CActionDialog(pF); + return ActDialog; } // 实现 -void* getAction_CApi(int* count) +void* getAction_CApi(QWidget *pF, int* count) { - if(PLGDialog == nullptr) - InitDialog(nullptr); - QList actions = PLGDialog->getListAction(); + if(ActDialog == nullptr) + InitActDialog(pF); + QList actions = ActDialog->getListAction(); int ncnt = actions.size(); *count = ncnt; diff --git a/app/example_plugin/example_plugin.pro b/app/example_plugin/example_plugin.pro index 214d8a4..a70f2d5 100644 --- a/app/example_plugin/example_plugin.pro +++ b/app/example_plugin/example_plugin.pro @@ -51,4 +51,5 @@ CONFIG(debug, debug|release){ } FORMS += \ + ActionDialog.ui \ PluginDialog.ui diff --git a/app/fdsa4_test/Att_c_find.h b/app/fdsa4_test/Att_c_find.h new file mode 100644 index 0000000..b5fcaa6 --- /dev/null +++ b/app/fdsa4_test/Att_c_find.h @@ -0,0 +1,9 @@ +#ifndef __ATT_C_FIND_H__ +#define __ATT_C_FIND_H__ + + + +__declspec(dllexport) void Att_c_find2(float Att_c[72], float ATT[72], float Thickness, float Zm_end[72], float constant1); + + +#endif \ No newline at end of file diff --git a/app/fdsa4_test/CBUIprogram.cpp b/app/fdsa4_test/CBUIprogram.cpp new file mode 100644 index 0000000..4777734 --- /dev/null +++ b/app/fdsa4_test/CBUIprogram.cpp @@ -0,0 +1,1606 @@ +#include "MemRdWt.h" +#include "math.h" +#include "BaseFun.h" +#include +#include "DepthProgress.h" +#include +#include +#include +//#include +#include +#include +#include +#include"fftw3.h" +#include"Att_c_find.h" +#include"hilbert.h" +#include"Inputtuban.h" +//#include"maxInArray.h" +#include"SLG_plate.h" +#include"Zc_Zm_comb.h" +#include"S_per.h" +#include"Ecc_Co.h" +#include"FindPeak.h" +#include"InArray_self.h" +#include"Rate_Co.h" +#include"Thcav_Co.h" +#include"findcc.h" + +#ifdef BOOL +#undef BOOL +#endif +#include + +using namespace std; +#define PI (float)3.1415926 +#define NN 300 +#define NFFT 80 +//FILE* fpF,*fpF1,*fpN1,*fpN,*fpR,*fpR1,*fp11,*fp12,*fp13,*fpSPR; +//FILE* fpJc; +//FILE* fpR1,*fpR2,*fpR3,*fpR4,*fpR5,*fpR6,*fpR7; +//------------------------޸---------------------------------------------- +Slf_WAVE mWave[1]; +using namespace std; +#define OUTNAME "OUT1" + +extern "C"{ + + //------------------------------------------------------------------޸---------------------------------------------------------------------------------- + _declspec (dllexport) struct INC_STRU INC={12, + "FWGN:Զ,raw;; \ + FWST:Զӳ,s;;\ + NWGN:,raw;;\ + NWST:ӳ,s;; \ + RWGN:,raw;;\ + RWST:ӳ,s;; \ + MWAVE:ཬ,s;; \ + MWGN:ཬ,raw;; \ + MWST:ཬӳ,s;; \ + W80F:¶,;; \ + RB:λ,();; \ + RPS:,r/s;;"}; + _declspec (dllexport) struct INP_STRU INP; + //_declspec (dllexport) struct OUTC_STRU OUTC={18, "ATT:˥;;\ + RATE:Ч;;\ + ATTC:׺˥;;\ + ZCC:׺迹;;\ + SLG:Һ״̬;;\ + THC:׹ܺ;;\ + AMP:׹ڱڴֲڶ;;\ + SPR_ALL:ռ;;\ + LPR_ALL:Һռ;;\ + GPR_ALL:ռ;;\ + THCAV:׹ƽ;;\ + THCMN:׹С;;\ + THCMX:׹;;\ + ECM:ж;;\ + CEM:׹ܾж;;\ + THerr:׹ܺȼ;;\ + THLR:׹ʧ;;\ + THCSD:׼;;"}; + // + ////8, "ATT:36˥ֵ;dB/m; RATE:72εĹЧֵ;%; ATTC:׺˥;none; ZCC:׺迹;MRayI; SLG:׺Һ״̬;none; THC:׹ܺ;mm;AMP:׹ڲ״̬;none;SLGall:;none;" + //_declspec (dllexport) struct OUTP_STRU OUTP; + _declspec (dllexport) struct HD_STRU HD={0.0,9999.0,0.0,0.0,0.0,0.0,0.0,"CBUIprogram.INP","CBUIprogram.TLP"}; + __declspec (dllexport) struct CONC_STRU CONC={32, + "CTH:׹ܺ,mm;;;;10.54;\ + CT:ˮ;;;;1;\ + IT:׹ܳߴ,mm;;;;139.7;\ + MT:ཬ;;;;1;\ + STEV:׹,m/s;;;;5200;\ + ZM1:ཬ迹,MRayls;;;;1.5;\ + LSM:ƽѡ;;;;2;\ + BW:Ч;;;;0.08;\ + CON1:˥У,dB/m;;;;-35;\ + CON2:У;;;;0.01;\ + CON3:;;;;0.55;\ + RWD:񲨿ʱ,s;;;;20;\ + RWL:ʱ,s;;;;30;\ + FPS:ķѰʼ;;;;20;\ + FPE:ķѰֹ;;;;300;\ + RM1:Ƶǰ,kHz;;;;20;\ + RM2:Ƶ,kHz;;;;40;\ + RL:ʱ򴰳,s;;;;48;\ + S1:ֵֹ,%;;;;10;\ + S2:нֵֹ,%;;;;70;\ + S3:ýֵֹ,%;;;;90;\ + L1:Һýֵֹ,%;;;;10;\ + L2:Һнֵֹ,%;;;;20;\ + L3:Һֵֹ,%;;;;90;\ + G1:ֵֹ,%;;;;90;\ + CCMX:ܲ޽ֵֹ,m;;;;2;\ + CCMN:ܲ޽ֵֹ,m;;;;1;\ + NSR:,s;;;;400;\ + FSR:Զ,s;;;;400;\ + RSR:񲨲,s;;;;400;\ + CID:,mm;;;;29.5;\ + CD:ķ,mm;;;;27.2;" + }; + _declspec (dllexport) struct CON_STRU CON={10.54,1,139.7,1,5200,1.5,2,0.08,-35,0.01,0.55,20,30,20,300,20,40,48,10,70,90,10,20,90,90,2,1,400,400,400,29.5,27.2}; + _declspec (dllexport) struct ErrorInf errorinf; + __declspec (dllexport) struct LogType LogType={};//WAVE_OBJECT,WAVE_OBJECT,WAVE_OBJECT,WAVE_OBJECT,WAVE_OBJECT,WAVE_OBJECT + __declspec( dllexport ) CMemRdWt MemRdWt; + _declspec (dllexport) int CBUIprogram(); +} + + +typedef struct ss_struct +{ + int GNO; + float GSDEP,GEDEP; + int GRESULT; +} GUJING; + +struct Fdpr { + float fdep; + float fspr; +// float flpr; + float fgpr; +}; + + +int getRange(float y,float S1,float S2,float S3) +{ + if (y >= 0 && y < S1) return 0; + if (y >= S1 && y < S2) return 1; + if (y >= S2 && y < S3) return 2; + if (y >= S3 && y <= 100) return 3; + return -1; +} + + +struct Process_Struct +{ + //------------------------------------޸------------------------------------- + //float ATT, RATE,ATTC,ZCC,SLG,THC,AMP,SPR_ALL,LPR_ALL, GPR_ALL,THCAV,THCMN,THCMX,ECM, CEM, THerr, THLR,THCSD; + float CTH,CT,IT,MT,STEV,ZM1,LSM,BW,CON1,CON2,CON3,RWD,RWL,FPS,FPE,RM1,RM2,RL,S1,S2,S3,L1,L2,L3,G1,CCMX,CCMN,NSR,FSR,RSR,CID,CD; + int Process(); +}; + +int CBUIprogram() +{ + //-------------------------------------޸---------------------------------------- + Process_Struct Process; + return Process.Process(); +} + + +int Process_Struct::Process() +{ + if(HD.Sdep >= HD.EndDep) + { + AfxMessageBox("ǰ\nֹͣ"); + return 0; + } + + //-------------------------------------޸---------------------------------------- + MemRdWt.Const(); + MemRdWt.In(); + MemRdWt.Out(); + //char name[100]; + //MemRdWt.GetInCurveName(0,name); + Slf_WAVE waveinf; + + //-----------------------------------------2 ȡ޸ģ----------------------------------------------- + #pragma region ȡ + //float NSR[36], FSR[36], RSR[72]; + + + GetPosValue(CTH,CON,1,1); + GetPosValue(CT,CON,2,1); + GetPosValue(IT,CON,3,1); + GetPosValue(MT,CON,4,1); + GetPosValue(STEV,CON,5,1); + GetPosValue(ZM1,CON,6,1); + GetPosValue(LSM,CON,7,1); + GetPosValue(BW,CON,8,1); + GetPosValue(CON1,CON,9,1); + GetPosValue(CON2,CON,10,1); + GetPosValue(CON3,CON,11,1); + GetPosValue(RWD,CON,12,1); + GetPosValue(RWL,CON,13,1); + GetPosValue(FPS,CON,14,1); + GetPosValue(FPE,CON,15,1); + GetPosValue(RM1,CON,16,1); + GetPosValue(RM2,CON,17,1); + GetPosValue(RL,CON,18,1); + GetPosValue(S1,CON,19,1); + GetPosValue(S2,CON,20,1); + GetPosValue(S3,CON,21,1); + GetPosValue(L1,CON,22,1); + GetPosValue(L2,CON,23,1); + GetPosValue(L3,CON,24,1); + GetPosValue(G1,CON,25,1); + GetPosValue(CCMX,CON,26,1); + GetPosValue(CCMN,CON,27,1); + GetPosValue(NSR,CON,28,1); + GetPosValue(FSR,CON,29,1); + GetPosValue(RSR,CON,30,1); + GetPosValue(CID,CON,31,1); + GetPosValue(CD,CON,32,1); + #pragma endregion + IT=IT/25.4; + float gd_Zc[100], gd_Att[100], ld_Zc[100], ld_Att[100], sd_Zc[100], sd_Att[100], gu_Zc[100], gu_Att[100], lu_Zc[100], lu_Att[100], su_Zc[100], su_Att[100]; + Tubanpara(MT, CTH, gd_Zc, gd_Att, ld_Zc, ld_Att, sd_Zc, sd_Att, gu_Zc, gu_Att, lu_Zc, lu_Att, su_Zc, su_Att); + + #pragma region F2D + float **F2D = new float*[36]; + for(int _ii = 0; _ii < 36; _ii++) + F2D[_ii] = new float[NN]; + float **N2D = new float*[36]; + for(int _ii = 0; _ii < 36; _ii++) + N2D[_ii] = new float[NN]; + float **R2D = new float*[72]; + for(int _ii = 0; _ii < 72; _ii++) + R2D[_ii] = new float[NN]; + #pragma endregion + #pragma region F_hx_abs + float **F_hx_abs = new float*[36]; + for(int _ii = 0; _ii < 36; _ii++) + F_hx_abs[_ii] = new float[NN]; + float **N_hx_abs = new float*[36]; + for(int _ii = 0; _ii < 36; _ii++) + N_hx_abs[_ii] = new float[NN]; + float **R_hx_abs = new float*[72]; + for(int _ii = 0; _ii < 72; _ii++) + R_hx_abs[_ii] = new float[NN*2]; + float **R_hx_group = new float*[72]; + for (int _ii = 0; _ii < 72; _ii++) + R_hx_group[_ii] = new float[NN * 2]; + //#pragma region RR2D/XX_abs/pha/p + float **RR2D = new float*[72]; + for(int _ii = 0; _ii < 72; _ii++) + RR2D[_ii] = new float[NN*2]; + float **R_XX_abs = new float*[72]; + for(int _ii = 0; _ii < 72; _ii++) + R_XX_abs[_ii] = new float[NN*2]; + float **F_lb = new float*[36]; + for (int _ii = 0; _ii < 36; _ii++) + F_lb[_ii] = new float[NN]; + #pragma endregion + + #pragma region ݳʼ + QStringList _nList; + _nList << "ATT" << "RATE" << "ATTC" << "ZCC" << "SLG" << "THC"<<"AMP"; + for(int _i = 0; _i < _nList.size(); _i++) + { + int index1 = MemRdWt.OpenWave(_nList[_i].toStdString().c_str()); + if(index1 > 0) + continue; + Slf_WAVE myWave; + strcpy(myWave.Name, _nList[_i].toStdString().c_str()); + strcpy(myWave.AliasName, _nList[_i].toStdString().c_str()); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + myWave.StartTime=0; + myWave.TimeLevel=5; + myWave.ArrayNum = 1;// + if(_nList[_i] == "ATT") + {myWave.TimeSamples = 36; + myWave.TimeLevel=10;} + else if(_nList[_i] == "SLGall") + myWave.TimeSamples = 1; + else + myWave.TimeSamples = 72; + strcpy(myWave.TimeUnit,"ns"); + index1 = MemRdWt.OpenWave((Slf_WAVE *)&myWave); + } + #pragma endregion + #pragma region ݳʼ + //MemRdWt.OpenCurve("SPR_all"); + int index1 = MemRdWt.OpenCurve("SPR_all"); + if(index1 < 0) + { + Slf_CURVE myWave; + strcpy(myWave.Name, "SPR_all"); + strcpy(myWave.AliasName, "SPR_all"); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + index1 = MemRdWt.OpenCurve((Slf_CURVE *)&myWave); + } + // + int index2 = MemRdWt.OpenCurve("LPR_all"); + if(index2 < 0) + { + Slf_CURVE myWave; + strcpy(myWave.Name, "LPR_all"); + strcpy(myWave.AliasName, "LPR_all"); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + index2 = MemRdWt.OpenCurve((Slf_CURVE *)&myWave); + } + // + int index3 = MemRdWt.OpenCurve("GPR_all"); + if(index3 < 0) + { + Slf_CURVE myWave; + strcpy(myWave.Name, "GPR_all"); + strcpy(myWave.AliasName, "GPR_all"); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + index3 = MemRdWt.OpenCurve((Slf_CURVE *)&myWave); + } + int index4 = MemRdWt.OpenCurve("THCAV"); + if(index4 < 0) + { + Slf_CURVE myWave; + strcpy(myWave.Name, "THCAV"); + strcpy(myWave.AliasName, "THCAV"); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + index4 = MemRdWt.OpenCurve((Slf_CURVE *)&myWave); + } + int index5 = MemRdWt.OpenCurve("THerr"); + if(index5 < 0) + { + Slf_CURVE myWave; + strcpy(myWave.Name, "THerr"); + strcpy(myWave.AliasName, "THerr"); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + index5 = MemRdWt.OpenCurve((Slf_CURVE *)&myWave); + } + int index6 = MemRdWt.OpenCurve("THCMN"); + if(index6 < 0) + { + Slf_CURVE myWave; + strcpy(myWave.Name, "THCMN"); + strcpy(myWave.AliasName, "THCMN"); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + index6 = MemRdWt.OpenCurve((Slf_CURVE *)&myWave); + } + int index7 = MemRdWt.OpenCurve("THCMX"); + if(index7 < 0) + { + Slf_CURVE myWave; + strcpy(myWave.Name, "THCMX"); + strcpy(myWave.AliasName, "THCMX"); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + index7 = MemRdWt.OpenCurve((Slf_CURVE *)&myWave); + } + int index8 = MemRdWt.OpenCurve("THLR"); + if(index8 < 0) + { + Slf_CURVE myWave; + strcpy(myWave.Name, "THLR"); + strcpy(myWave.AliasName, "THLR"); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + index8 = MemRdWt.OpenCurve((Slf_CURVE *)&myWave); + } + int index9 = MemRdWt.OpenCurve("ECM"); + if(index9 < 0) + { + Slf_CURVE myWave; + strcpy(myWave.Name, "ECM"); + strcpy(myWave.AliasName, "ECM"); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + index9 = MemRdWt.OpenCurve((Slf_CURVE *)&myWave); + } + int index10 = MemRdWt.OpenCurve("CEM"); + if(index10 < 0) + { + Slf_CURVE myWave; + strcpy(myWave.Name, "CEM"); + strcpy(myWave.AliasName, "CEM"); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + index10 = MemRdWt.OpenCurve((Slf_CURVE *)&myWave); + } + int index11 = MemRdWt.OpenCurve("THCSD"); + if(index11 < 0) + { + Slf_CURVE myWave; + strcpy(myWave.Name, "THCSD"); + strcpy(myWave.AliasName, "THCSD"); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4;//float + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit,"m"); + index11 = MemRdWt.OpenCurve((Slf_CURVE *)&myWave); + } + #pragma endregion + int SL=(HD.EndDep-HD.Sdep)/HD.Rlev+5; + float SPR_all; + float LPR_all; + float GPR_all; + float THCAV[1]; + float THerr,THCMX,THCMN,THLR,ECM,CEM,THCSD; + #pragma region indexȡ + int ATT_index = MemRdWt.OpenWave("ATT"); + int RATE_index = MemRdWt.OpenWave("RATE"); + int ATTC_index = MemRdWt.OpenWave("ATTC"); + int ZCC_index = MemRdWt.OpenWave("ZCC"); + int SLG_index = MemRdWt.OpenWave("SLG"); + int THC_index = MemRdWt.OpenWave("THC"); + //׹ڲ + int AMP_index = MemRdWt.OpenWave("AMP"); + // + int SPR_all_index = MemRdWt.OpenCurve("SPR_all"); + int LPR_all_index = MemRdWt.OpenCurve("LPR_all"); + int GPR_all_index = MemRdWt.OpenCurve("GPR_all"); + int THCAV_index = MemRdWt.OpenCurve("THCAV"); + int THerr_index = MemRdWt.OpenCurve("THerr"); + int THCMN_index = MemRdWt.OpenCurve("THCMN"); + int THCMX_index = MemRdWt.OpenCurve("THCMX"); + int THLR_index = MemRdWt.OpenCurve("THLR"); + int ECM_index = MemRdWt.OpenCurve("ECM"); + int CEM_index = MemRdWt.OpenCurve("CEM"); + int THCSD_index = MemRdWt.OpenCurve("THCSD"); + #pragma endregion + + #pragma region ȡinputݵindex + int FGN_index = MemRdWt.OpenWave("FWGN"); + int NGN_index = MemRdWt.OpenWave("NWGN"); + int RGN_index = MemRdWt.OpenWave("RWGN"); + int FDL_index = MemRdWt.OpenWave("FWST"); + int NDL_index = MemRdWt.OpenWave("NWST"); + int RDL_index = MemRdWt.OpenWave("RWST"); + + + + int FWAVEindex[36], NWAVEindex[36], RWAVEindex[72]; + for(int _i = 0; _i < 36; _i++) + { + QString num = QString::number(_i + 1); + num = (num.length() == 1)? "0" + num : num; + QString fwaveName = "FWAVE" + num; + QString nwaveName = "NWAVE" + num; + + FWAVEindex[_i] = MemRdWt.OpenWave(fwaveName.toStdString().c_str()); + NWAVEindex[_i] = MemRdWt.OpenWave(nwaveName.toStdString().c_str()); + + if(FWAVEindex[_i] < 0 || NWAVEindex[_i] < 0) + return 0; + } + for(int _i = 0; _i < 72; _i++) + { + QString num = QString::number(_i + 1); + num = (num.length() == 1)? "0" + num : num; + QString rwaveName = "RWAVE" + num; + + RWAVEindex[_i] = MemRdWt.OpenWave(rwaveName.toStdString().c_str()); + + if(RWAVEindex[_i] < 0) + return 0; + } + #pragma endregion + + + int itable1=MemRdWt.OpenOG_RESULT("̾");//򿪹̾񣬻ȡindexԿף + MemRdWt.SetTableRecordCount(itable1,0); //ԭеı + + int itable2=MemRdWt.OpenOG_RESULT(""); + MemRdWt.SetTableRecordCount(itable2,0); + + + int fiii=0; + int FLE=(HD.EndDep-HD.Stdep)/HD.Rlev+300; + float *FSPR=new float[FLE]; + float *FGPR=new float[FLE]; + float *FDEP=new float[FLE]; + /*float **FSLG = new float*[72]; + for (int _ii = 0; _ii < 72; _ii++) + FSLG[_ii] = new float[FLE];*/ + /*int **ADDR=new int*[72]; + for(int mm=0;mm<72;mm++) + ADDR[mm]=new int[FLE];*/ + + + + + + DepthProgress mmProgress; + mmProgress.CreatProgress(HD.Stdep, HD.EndDep, "..."); + //---------------------------------ѭ-------------------------------------------- + while(HD.Dep <= HD.EndDep) + { + //ÿζظȡӦԶβ + GetPosValue(CTH,CON,1,1); + GetPosValue(CT,CON,2,1); + GetPosValue(IT,CON,3,1); + GetPosValue(MT,CON,4,1); + GetPosValue(STEV,CON,5,1); + GetPosValue(ZM1,CON,6,1); + GetPosValue(LSM,CON,7,1); + GetPosValue(BW,CON,8,1); + GetPosValue(CON1,CON,9,1); + GetPosValue(CON2,CON,10,1); + GetPosValue(CON3,CON,11,1); + GetPosValue(RWD,CON,12,1); + GetPosValue(RWL,CON,13,1); + GetPosValue(FPS,CON,14,1); + GetPosValue(FPE,CON,15,1); + GetPosValue(RM1,CON,16,1); + GetPosValue(RM2,CON,17,1); + GetPosValue(RL,CON,18,1); + GetPosValue(S1,CON,19,1); + GetPosValue(S2,CON,20,1); + GetPosValue(S3,CON,21,1); + GetPosValue(L1,CON,22,1); + GetPosValue(L2,CON,23,1); + GetPosValue(L3,CON,24,1); + GetPosValue(G1,CON,25,1); + GetPosValue(CCMX,CON,26,1); + GetPosValue(CCMN,CON,27,1); + GetPosValue(NSR,CON,28,1); + GetPosValue(FSR,CON,29,1); + GetPosValue(RSR,CON,30,1); + GetPosValue(CID,CON,31,1); + GetPosValue(CD,CON,32,1); + IT=IT/25.4; + + QString _proOut = ""; + if(CTH < 5 || CTH > 15) + _proOut += "׹ܺCTH磨5~15mm\n"; + if(CT != 1 && CT != 2) + _proOut += "ˮCT磨1-ܶˮ࣬2-ˮࣩ\n"; + if(IT*25.4 < 100 || IT*25.4 > 200) + _proOut += "׹ܳߴIT磨100~200mm\n"; + if(MT != 1 && MT != 2) + _proOut += "ཬMT磨1-ˮ2-ͻ\n"; + if(STEV < 4000 || STEV > 7000) + _proOut += "׹STEV磨4000~7000m/s\n"; + if(ZM1 < 0.5 || ZM1 > 10) + _proOut += "ཬ迹ZM1磨0.5~10MRayls\n"; + if(LSM != 1 && LSM != 2) + _proOut += "ƽѡLSM磨1-ƽ2-ƽ\n"; + if(RWD <= 0) + _proOut += "񲨿ʱRWD磨0s\n"; + if(RWL <= 0) + _proOut += "ʱRWL磨0s\n"; + if(FPS <= 0) + _proOut += "ķѰʼFPS磨0\n"; + if(FPE <= 0) + _proOut += "ķѰֹFPE磨0\n"; + if(FPS >= FPE) + _proOut += "ķѰʼFPS/ķѰֹFPEϵFPS < FPE\n"; + if(RM1 <= 0) + _proOut += "ƵǰRM1磨0kHz\n"; + if(RM2 <= 0) + _proOut += "ƵRM2磨0kHz\n"; + if(RM1 >= RM2) + _proOut += "ƵǰRM1/ƵRM2ϵRM1 < RM2\n"; + if(RL <= 0) + _proOut += "ʱ򴰳RL磨0s\n"; + + if(S1 <= 0 || S1 >= 100) + _proOut += "ֵֹS1磨0~100%\n"; + if(S2 <= 0 || S2 >= 100) + _proOut += "нֵֹS2磨0~100%\n"; + if(S3 <= 0 || S3 >= 100) + _proOut += "ýֵֹS3磨0~100%\n"; + if(S1 >= S2 || S1 >= S3 || S2 >= S3) + _proOut += "S1/S2/S3ϵS1 < S2 < S3\n"; + + if(L1 <= 0 || L1 >= 100) + _proOut += "ҺýֵֹS1磨0~100%\n"; + if(L2 <= 0 || L2 >= 100) + _proOut += "ҺнֵֹS2磨0~100%\n"; + if(L3 <= 0 || L2 >= 100) + _proOut += "ҺֵֹS3磨0~100%\n"; + if(L1 >= L2 || L1 >= L3 || L2 >= L3) + _proOut += "ҺL1/L2/L3ϵL1 < L2 < L3\n"; + + if(G1 <= 0 || G1 >= 100) + _proOut += "ֵֹG1磨0~100%\n"; + + if(CCMX <= 0) + _proOut += "ܲ޽ֵֹCCMX磨0m\n"; + if(CCMN <= 0) + _proOut += "ܲ޽ֵֹCCMN磨0m\n"; + if(CCMN >= CCMX) + _proOut += "ܲCCMN/CCMXϵCCMN < CCMX\n"; + + if(CID <= 0) + _proOut += "CID磨0mm\n"; + if(CD <= 0) + _proOut += "ķCD磨0mm\n"; + + if(_proOut != ""){ + _proOut += "ֹͣ"; + AfxMessageBox(_proOut); + #pragma region ռͷ + for(int _ii = 0; _ii< 36; _ii++) + { + delete []N2D[_ii]; + }delete []N2D; + for(int _ii = 0; _ii < 36; _ii++) + { + delete []F2D[_ii]; + }delete []F2D; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []R2D[_ii]; + }delete []R2D; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []RR2D[_ii]; + }delete []RR2D; + // + for(int _ii = 0; _ii < 36; _ii++) + { + delete []N_hx_abs[_ii]; + }delete []N_hx_abs; + for(int _ii = 0; _ii < 36; _ii++) + { + delete []F_hx_abs[_ii]; + }delete []F_hx_abs; + // + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]R_hx_group[_ii]; + }delete[]R_hx_group; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []R_hx_abs[_ii]; + }delete []R_hx_abs; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []R_XX_abs[_ii]; + }delete []R_XX_abs; + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]F_lb[_ii]; + }delete[]F_lb; + #pragma endregion + return 0; + } + //------------------------------------------1 ȡݣ޸ģ-------------------------------------------------- + mmProgress.SetDepth(HD.Dep); + HD.Dep; + int a = 0; + float SPR[3]={1}; + float CmQ[2]={0}; + float FGN[36], NGN[36], RGN[72], FDL[36], NDL[36], RDL[72]; + float F2D0[36][300], N2D0[36][300], R2D0[72][300]; + float ATT[72],RATE[72],ATTC[72],ZCC[72],SLG[72],THC[72],AMP[72]; + + #pragma region ݻȡ + //GetINValue(FGN,1,36); + //GetINValue(NGN,3,36); + //GetINValue(RGN,5,72); + //GetINValue(FDL,2,36); + //GetINValue(NDL,4,36); + //GetINValue(RDL,6,72); + + + MemRdWt.ReadWaveToFloatBuf(FGN_index, HD.Dep, 1,FGN); + MemRdWt.ReadWaveToFloatBuf(NGN_index, HD.Dep, 1,NGN); + MemRdWt.ReadWaveToFloatBuf(RGN_index, HD.Dep, 1,RGN); + MemRdWt.ReadWaveToFloatBuf(FDL_index, HD.Dep, 1,FDL); + MemRdWt.ReadWaveToFloatBuf(NDL_index, HD.Dep, 1,NDL); + MemRdWt.ReadWaveToFloatBuf(RDL_index, HD.Dep, 1,RDL); + + if(FGN[0] <= -9999 || NGN[0] <= -9999 || RGN[0] <= -9999 || FDL[0] <= -9999 || NDL[0] <= -9999 || RDL[0] <= -9999) + { + #pragma region ռͷ + for(int _ii = 0; _ii< 36; _ii++) + { + delete []N2D[_ii]; + }delete []N2D; + for(int _ii = 0; _ii < 36; _ii++) + { + delete []F2D[_ii]; + }delete []F2D; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []R2D[_ii]; + }delete []R2D; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []RR2D[_ii]; + }delete []RR2D; + // + for(int _ii = 0; _ii < 36; _ii++) + { + delete []N_hx_abs[_ii]; + }delete []N_hx_abs; + for(int _ii = 0; _ii < 36; _ii++) + { + delete []F_hx_abs[_ii]; + }delete []F_hx_abs; + // + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]R_hx_group[_ii]; + }delete[]R_hx_group; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []R_hx_abs[_ii]; + }delete []R_hx_abs; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []R_XX_abs[_ii]; + }delete []R_XX_abs; + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]F_lb[_ii]; + }delete[]F_lb; + #pragma endregion + AfxMessageBox("ǰ龮û\nֹͣ"); + return 0; + } + + for(int _i = 0; _i < 36; _i++) + { + MemRdWt.ReadWaveToFloatBuf(FWAVEindex[_i], HD.Dep, 1, F2D0[_i]); + MemRdWt.ReadWaveToFloatBuf(NWAVEindex[_i], HD.Dep, 1, N2D0[_i]); + } + for(int _i = 0; _i < 72; _i++) + { + MemRdWt.ReadWaveToFloatBuf(RWAVEindex[_i], HD.Dep, 1, R2D0[_i]); + } + #pragma endregion + //ȥ + for (int i = 0; i < 36; i++) + { + for (int j = 0; j < 300; j++) + { + F2D[i][j] = F2D0[i][j]/FGN[i]; + N2D[i][j] = N2D0[i][j]/NGN[i]; + } + } + + float V=1500,RNS,RNE,D; + D=(IT*25.4/2-CTH-CID)*1e-3*2; + int rll=RL/RSR*1e3; + for (int i = 0; i < 72; i++) + { + for (int j = 0; j < 300; j++) + { + R2D[i][j] = R2D0[i][j]/RGN[i]; + RNS=floor((D/V)/(RSR*0.000000001))-RDL[i]/(RSR); + RNE=RNS+rll; + } + } + + //------------------------------------------3 򣨷ĵط-------------------------------------------------- + // + float Att0all[36],Att0all1[36],Rateall[72],Thick[72],Att_c[72],Zc_end[72], Zm_end[72]; + float Rf[72],N_hx_abs_max[36], F_hx_abs_max[36], R_hx_abs_max[72],R_hx_phah_min[72] ,S_welldata2D_max[72], S_welldata2D_min[72], N_maxindex[72], F_maxindex[72], S_maxindex[72], maxindex[72], minindex[72]; + //Զεʱ + hilbert(F2D, F_hx_abs, 36);//Զǰ12 + /*for (int i = 0; i < 36; i++) + { + for (int j = 0; j < NN; j++) + { + F_hx_abs[i][j] = F2D[i][j]; + } + }*/ + for (int i = 0; i < 36; i++) + { + maxindex[i]=1; + F_hx_abs_max[i] = F_hx_abs[i][0]; + } + maxInArray_self(F_hx_abs, F_hx_abs_max, maxindex,1, NN, 36, 1); + + int FPE1=FPE; + int FPS1=FPS; + float pf[36] = { 0 }, lf[36] = { 0 }; + float **pksf = new float*[36]; + for (int _ii = 0; _ii < 36; _ii++) + pksf[_ii] = new float[FPE1]; + float **locsf = new float*[36]; + for (int _ii = 0; _ii < 36; _ii++) + locsf[_ii] = new float[FPE1]; + + for (int i = 0; i<36; i++) + { + for (int m = 0; m < FPE1; m++) + { + pksf[i][m] = 0; + locsf[i][m] = 0; + } + } + findPeaks(F_hx_abs, pksf, locsf, FPS1, FPE1); + + for (int k = 0; k<36; k++) + { + for (int m = 0; mF_hx_abs_max[k]/3) + break; + } + else if (pksf[k][m] == 0) + break; + } + + } + float fcy[36] = { 0 }, fmy[36] = { 0 }; + for (int k = 0; k<36; k++) + { + for (int m = 0; mF_hx_abs_max[k] * 0.4) + break; + } + else if (pksf[k][m] == 0) + break; + } + } + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]pksf[_ii]; + }delete[]pksf; + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]locsf[_ii]; + }delete[]locsf; + + //׹ܾж + + float fbc = 15; + float fcc[36] = { 0 }; + float ffm[36] = { 0 }; + float F_lb_max[36] = { 0 }; + float CEC[18] = { 0 }; + for (int i = 0; i < 36; i++) + { + fcc[i] = fcy[i] + fbc; + for (int j = 0; j < NN; j++) + { + if (jF_lb_max[k] * 0.8) + break; + } + else if (pkce[k][m] == 0) + break; + } + } + + Ecc_co(lce, CEC, FDL, RSR,36); + CEM =CEC[0]; + for (int i = 1; i < 18; i++) + { + if (CEC[i] > CEM) + { + CEM = CEC[i]; + } + } + CEM= 100 - CEM; + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]pkce[_ii]; + }delete[]pkce; + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]loce[_ii]; + }delete[]loce; + //ʱ + hilbert(N2D,N_hx_abs,36);//ǰ512 + /*for (int i = 0; i < 36; i++) + { + for (int j = 0; j < NN; j++) + { + N_hx_abs[i][j] = N2D[i][j]; + } + }*/ + for (int i = 0; i < 36; i++) + { + maxindex[i]=1; + N_hx_abs_max[i] = N_hx_abs[i][0]; + } + maxInArray_self(N_hx_abs, N_hx_abs_max, maxindex,1, NN, 36, 1); + + float pn[36] = { 0 }, ln[36] = { 0 }; + float **pksn = new float*[36]; + for (int _ii = 0; _ii < 36; _ii++) + pksn[_ii] = new float[FPE1]; + float **locsn = new float*[36]; + for (int _ii = 0; _ii < 36; _ii++) + locsn[_ii] = new float[FPE1]; + for (int i = 0; i<36; i++) + { + for (int m = 0; m < FPE1; m++) + { + pksn[i][m] = 0; + locsn[i][m] = 0; + } + } + findPeaks(N_hx_abs, pksn, locsn, FPS1, FPE1); + for (int k = 0; k<36; k++) + { + for (int m = 0; mN_hx_abs_max[k]/3) + break; + } + else if (pksn[k][m] == 0) + break; + } + } + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]pksn[_ii]; + }delete[]pksn; + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]locsn[_ii]; + }delete[]locsn; + + //˥ + for (int j = 0; j < 36; j++) + { + Att0all[j] = 20 / 0.1*log10(pn[j] / pf[j]); + if(Att0all[j]<0) + {Att0all[j]=(Att0all[j-1]+Att0all[j-2])/2;} + } + /*for (int j = 0; j < 36; j++) + { + Att0all[j] = 20 / 0.1*log10(N_hx_abs_max[j] / F_hx_abs_max[j]); + }*/ + //׹ܺȼ + fft(R2D, RR2D,R_hx_group, R_XX_abs,72,RNS,RNE); //ѡ㲨ζ + /*for (int i = 0; i < 72; i++) + { + for (int j = 0; j < NN*2; j++) + { + R_XX_abs[i][j] = RR2D[i][j]; + R_hx_group[i][j]=RR2D[i][j]; + } + }*/ + float ref = 0.5*STEV / CTH;//Ƶ + float RN1 = round((ref - RM1)*6/25); + float RN2 = round((ref + RM2)*6/25); + int RN11=RN1; + for (int i = 0; i < 72; i++) + { + minindex[i]=RN1; + R_hx_phah_min[i] = R_hx_group[i][RN11]; + } + minInArray_self(R_hx_group, R_hx_phah_min, minindex, RN1,RN2, 72, 1); + + THerr=0; + Thc_co(THCAV, Rf, THC, minindex, RSR, STEV, NN*2); + THerr=sqrt((THCAV[0]-CTH)*(THCAV[0]-CTH))/CTH*100; + float THLR; + THLR=sqrt(((THCAV[0]-CTH)/CTH)*((THCAV[0]-CTH)/CTH))*100; + float THCMN= THC[0]; + for (int i = 1; i < 72; i++) + { + if (THC[i] THCMX) + { + THCMX = THC[i]; + } + } + THCSD=CTH; + //Чʼ + hilbert2(RR2D,R_hx_abs,72); + /*for (int i = 0; i < 72; i++) + { + for (int j = 0; j < NN; j++) + { + R_hx_abs[i][j] = R2D[i][j]; + } + }*/ + for (int i = 0; i < 72; i++) + { + maxindex[i]=1; + R_hx_abs_max[i] = R_hx_abs[i][0]; + } + maxInArray_self(R_hx_abs, R_hx_abs_max, maxindex,1, NN, 72, 1); + Rate_co(R_hx_abs, RATE, maxindex, R_hx_abs_max, RSR, RWD, RWL,NN); + float amp[72]; + for (int i = 0; i < 72; i++) + { + maxindex[i]=1; + amp[i] = R_hx_abs[i][0]; + } + maxInArray_self(R_hx_abs, amp, maxindex,50, NN, 72, 1); + float ampg[72]; + for (int i = 1; i < 72; i++) + { + ampg[i]=amp[i]/RGN[i]; + } + //ж + float ECC[36]; + Ecc_co(maxindex, ECC, RDL, RSR,72); + ECM= ECC[0]; + for (int i = 1; i < 36; i++) + { + if (ECC[i] > ECM) + { + ECM = ECC[i]; + } + } + + //Һ״̬ + float BW1 = BW * 100; + float ZM2=1.5; + Zc_Zm_comb(Att0all, ATT, RATE, CON2, CON1, CTH, IT, CD, BW1, CT, LSM, CON3,Zc_end, Zm_end, ZM1, ZM2); + Att_c_find2(Att_c, ATT, CTH, Zm_end, CON1); + SLG_plate(SLG, Zc_end, Att_c, CTH, CT, gd_Zc, gd_Att, ld_Zc, ld_Att, sd_Zc, sd_Att, gu_Zc, gu_Att, lu_Zc, lu_Att, su_Zc, su_Att); + + S_cal(SLG,SPR,CmQ,S1,S2,S3,L1,L2,L3,G1,CCMX,CCMN); + SPR_all=SPR[0]; + LPR_all=SPR[1]; + GPR_all=SPR[2]; + + + /*for(int j=0;j<72;j++) + { + FSLG[j][fiii]=SLG[j]; + }*/ + FDEP[fiii]=HD.Dep; + FSPR[fiii]=SPR_all; + FGPR[fiii]=GPR_all; + fiii++; + + + //-------------------------------------------4 (޸)------------------------------------------------- + //ά + if(ATT_index > 0) MemRdWt.WriteWave(ATT_index, HD.Dep, 1, &Att0all);//ֱӼõ + if(RATE_index > 0) MemRdWt.WriteWave(RATE_index, HD.Dep, 1, &RATE); + if(ATTC_index > 0) MemRdWt.WriteWave(ATTC_index, HD.Dep, 1, &Att_c);//׺˥ + if(ZCC_index > 0) MemRdWt.WriteWave(ZCC_index, HD.Dep, 1, &Zc_end);//׺迹 + if(SLG_index > 0) MemRdWt.WriteWave(SLG_index, HD.Dep, 1, &SLG); + if(THC_index > 0) MemRdWt.WriteWave(THC_index, HD.Dep, 1, &THC); + if(AMP_index > 0) MemRdWt.WriteWave(AMP_index, HD.Dep, 1, &); + //һά + if(THCAV_index > 0) MemRdWt.WriteCurve(THCAV_index,HD.Dep,1,&THCAV); + if(THerr_index > 0) MemRdWt.WriteCurve(THerr_index,HD.Dep,1,&THerr); + if(THCAV_index > 0) MemRdWt.WriteCurve(THCAV_index,HD.Dep,1,&THCAV); + if(THCMN_index > 0) MemRdWt.WriteCurve(THCMN_index,HD.Dep,1,&THCMN); + if(THCMX_index > 0) MemRdWt.WriteCurve(THCMX_index,HD.Dep,1,&THCMX); + if(THLR_index > 0) MemRdWt.WriteCurve(THLR_index,HD.Dep,1,&THLR); + if(CEM_index > 0) MemRdWt.WriteCurve(CEM_index,HD.Dep,1,&CEM); + if(ECM_index > 0) MemRdWt.WriteCurve(ECM_index,HD.Dep,1,&ECM); + if(THCSD_index > 0) MemRdWt.WriteCurve(THCSD_index,HD.Dep,1,&THCSD); + if(SPR_all_index > 0) MemRdWt.WriteCurve(SPR_all_index,HD.Dep,1,&SPR_all); + if(LPR_all_index > 0) MemRdWt.WriteCurve(LPR_all_index,HD.Dep,1,&LPR_all); + if(GPR_all_index > 0) MemRdWt.WriteCurve(GPR_all_index,HD.Dep,1,&GPR_all); + MemRdWt.In(); + + } + + Fdpr *fdpr=new Fdpr[fiii]; + for(int i=0;ifspr; + sumg += segments[segmentCount][j]->fgpr; + } + segmentAverages[segmentCount] = sum / segmentLengths[segmentCount]; + segmentGAverages[segmentCount] = sumg / segmentLengths[segmentCount]; + // ɵǰΣʼ¶ + segmentCount++; + segments[segmentCount] = new Fdpr*[dataSize]; + currentRange = newRange; + } + segments[segmentCount][segmentLengths[segmentCount]++] = &fdpr[i]; + } + // һεƽֵ + float sum = 0; + float sumg = 0; + for (int j = 0; j < segmentLengths[segmentCount]; ++j) { + sum += segments[segmentCount][j]->fspr; + sumg += segments[segmentCount][j]->fgpr; + } + segmentAverages[segmentCount] = sum / segmentLengths[segmentCount]; + segmentGAverages[segmentCount] = sumg / segmentLengths[segmentCount]; + segmentCount++; // ʵʵĶ + + // ֶνƽֵ + /*FILE *tb1; + tb1=fopen("E:\\seg.txt","w"); + for (int i = 0; i < segmentCount; i++) + { + fprintf(tb1,"%d\t",i+1); + fprintf(tb1,"%f\t",segmentAverages[i]); + fprintf(tb1,"%f\t",segments[i][0]->fdep); + fprintf(tb1,"%f\t",segments[i][segmentLengths[i]-1]->fdep); + fprintf(tb1,"\n"); + } + fclose(tb1);*/ + GUJING *CCNN1=new GUJING[segmentCount]; + for (int i = 0; i < segmentCount; i++) + { + CCNN1[i].GNO=i+1; + CCNN1[i].GSDEP=segments[i][0]->fdep; + if(i+1==segmentCount) + CCNN1[i].GEDEP=segments[i][segmentLengths[i]-1]->fdep; + else + CCNN1[i].GEDEP=segments[i+1][0]->fdep; + CCNN1[i].GRESULT=Grs(segmentAverages[i],segmentGAverages[i],S1,S2,S3,L1,L2,L3,G1); + } + /*FILE *tb11; + tb11=fopen("E:\\CN1.txt","w"); + for (int i = 0; i < segmentCount; i++) + { + fprintf(tb11,"%d\t",CCNN1[i].GNO); + fprintf(tb11,"%f\t",CCNN1[i].GSDEP); + fprintf(tb11,"%f\t",CCNN1[i].GEDEP); + fprintf(tb11,"%d\t",CCNN1[i].GRESULT); + fprintf(tb11,"\n"); + } + fclose(tb11);*/ + for (int i = 1; i < segmentCount-1; i++) + { + if(CCNN1[i].GEDEP-CCNN1[i].GSDEP<0.5&&CCNN1[i].GRESULT==1) + { + if(CCNN1[i-1].GRESULT==CCNN1[i+1].GRESULT) + CCNN1[i].GRESULT=CCNN1[i-1].GRESULT; + } + } + for (int i = 1; i < segmentCount-1; i++) + { + if(CCNN1[i].GEDEP-CCNN1[i].GSDEP<0.5) + { + if(CCNN1[i-1].GRESULT==CCNN1[i+1].GRESULT&&CCNN1[i-1].GRESULT==1) + CCNN1[i].GRESULT=1; + } + } + + + GUJING *CCNN2=new GUJING[segmentCount]; + int CN2=1; + CCNN2[0]=CCNN1[0]; + CCNN2[0].GNO=1; + for (int i = 0; i < segmentCount-1; i++) + { + if(CCNN1[i].GRESULT==CCNN1[i+1].GRESULT) + { + CCNN2[CN2-1].GEDEP=CCNN1[i+1].GEDEP; + } + else + { + CCNN2[CN2]=CCNN1[i+1]; + CCNN2[CN2].GNO=CN2+1; + CN2++; + } + } + /*FILE *tb1; + tb1=fopen("E:\\CN2.txt","w"); + for (int i = 0; i < CN2; i++) + { + fprintf(tb1,"%d\t",CCNN2[i].GNO); + fprintf(tb1,"%f\t",CCNN2[i].GSDEP); + fprintf(tb1,"%f\t",CCNN2[i].GEDEP); + fprintf(tb1,"%d\t",CCNN2[i].GRESULT); + fprintf(tb1,"\n"); + } + fclose(tb1);*/ + + for (int i = 1; i < CN2-1; i++) + { + if(CCNN2[i].GEDEP-CCNN2[i].GSDEP<1&&CCNN2[i].GRESULT==1) + { + if(CCNN2[i-1].GRESULT==CCNN2[i+1].GRESULT) + CCNN2[i].GRESULT=CCNN2[i-1].GRESULT; + } + } + for (int i = 1; i < CN2-1; i++) + { + if(CCNN2[i].GEDEP-CCNN2[i].GSDEP<1) + { + if(CCNN2[i-1].GRESULT==CCNN2[i+1].GRESULT&&CCNN2[i-1].GRESULT==1) + CCNN2[i].GRESULT=1; + } + } + GUJING *CCNN3=new GUJING[CN2]; + int CN3=1; + CCNN3[0]=CCNN2[0]; + CCNN3[0].GNO=1; + for (int i = 0; i < CN2-1; i++) + { + if(CCNN2[i].GRESULT==CCNN2[i+1].GRESULT) + { + CCNN3[CN3-1].GEDEP=CCNN2[i+1].GEDEP; + } + else + { + CCNN3[CN3]=CCNN2[i+1]; + CCNN3[CN3].GNO=CN3+1; + CN3++; + } + } + //float *CSLG=new float[FLE]; + for (int i = 0; i < CN3; i++) + { + float cspr=0; + float cgpr=0; + float cns=0; + for(int j = 0; j < FLE; j++) + { + if(FDEP[j]>=CCNN3[i].GSDEP&&FDEP[j]<=CCNN3[i].GEDEP) + { + cspr=cspr+FSPR[j]; + cgpr=cgpr+FGPR[j]; + cns++; + } + } + cspr=cspr/cns; + cgpr=cgpr/cns; + CCNN3[i].GRESULT=Grs(cspr,cgpr,S1,S2,S3,L1,L2,L3,G1); + } + for (int i = 1; i < CN3-1; i++) + { + if(CCNN3[i].GEDEP-CCNN3[i].GSDEP<1) + { + if(CCNN3[i-1].GRESULT==CCNN3[i+1].GRESULT) + CCNN3[i].GRESULT=CCNN3[i-1].GRESULT; + else if(CCNN3[i-1].GRESULTCCNN3[i+1].GRESULT) + CCNN3[i].GRESULT=CCNN3[i+1].GRESULT; + } + } + GUJING *CCNN4=new GUJING[CN3]; + int CN4=1; + CCNN4[0]=CCNN3[0]; + CCNN4[0].GNO=1; + for (int i = 0; i < CN3-1; i++) + { + if(CCNN3[i].GRESULT==CCNN3[i+1].GRESULT) + { + CCNN4[CN4-1].GEDEP=CCNN3[i+1].GEDEP; + } + else + { + CCNN4[CN4]=CCNN3[i+1]; + CCNN4[CN4].GNO=CN4+1; + CN4++; + } + } + for (int i = 0; i < CN4; i++) + { + float cspr=0; + float cgpr=0; + float cns=0; + for(int j = 0; j < FLE; j++) + { + if(FDEP[j]>=CCNN4[i].GSDEP&&FDEP[j]<=CCNN4[i].GEDEP) + { + cspr=cspr+FSPR[j]; + cgpr=cgpr+FGPR[j]; + cns++; + } + } + cspr=cspr/cns; + cgpr=cgpr/cns; + CCNN4[i].GRESULT=Grs(cspr,cgpr,S1,S2,S3,L1,L2,L3,G1); + } + GUJING *CCNN5=new GUJING[CN4]; + int CN5=1; + CCNN5[0]=CCNN4[0]; + CCNN5[0].GNO=1; + for (int i = 0; i < CN4-1; i++) + { + if(CCNN4[i].GRESULT==CCNN4[i+1].GRESULT) + { + CCNN5[CN5-1].GEDEP=CCNN4[i+1].GEDEP; + } + else + { + CCNN5[CN5]=CCNN4[i+1]; + CCNN5[CN5].GNO=CN5+1; + CN5++; + } + } + for (int i = 0; i < CN5; i++) + { + switch(CCNN5[i].GRESULT) + { + case 0: + CCNN5[i].GRESULT=7; + break; + case 1: + CCNN5[i].GRESULT=8; + break; + case 2: + CCNN5[i].GRESULT=9; + break; + case 3: + CCNN5[i].GRESULT=10; + break; + case 4: + CCNN5[i].GRESULT=6; + break; + case 5: + CCNN5[i].GRESULT=11; + break; + } + } + for (int i = 0; i < CN5; i++) + { + MemRdWt.WriteTable(itable1, i+1, &CCNN5[i]); + } + for (int i = 0; i < CN5; i++) + { + switch(CCNN5[i].GRESULT) + { + case 7: + CCNN5[i].GRESULT=12; + break; + case 8: + CCNN5[i].GRESULT=12; + break; + case 9: + CCNN5[i].GRESULT=13; + break; + case 10: + { + float cspr=0; + float cns=0; + for(int j = 0; j < FLE; j++) + { + if(FDEP[j]>=CCNN5[i].GSDEP&&FDEP[j]<=CCNN5[i].GEDEP) + { + cspr=cspr+FSPR[j]; + cns++; + } + } + cspr=cspr/cns; + if(cspr>100-S2) + CCNN5[i].GRESULT=15; + else + CCNN5[i].GRESULT=14; + break; + } + case 6: + CCNN5[i].GRESULT=15; + break; + case 11: + CCNN5[i].GRESULT=15; + break; + } + } + GUJING *CCNN6=new GUJING[CN5]; + int CN6=1; + CCNN6[0]=CCNN5[0]; + CCNN6[0].GNO=1; + for (int i = 0; i < CN5-1; i++) + { + if(CCNN5[i].GRESULT==CCNN5[i+1].GRESULT) + { + CCNN6[CN6-1].GEDEP=CCNN5[i+1].GEDEP; + } + else + { + CCNN6[CN6]=CCNN5[i+1]; + CCNN6[CN6].GNO=CN6+1; + CN6++; + } + } + for (int i = 0; i < CN6; i++) + { + MemRdWt.WriteTable(itable2, i+1, &CCNN6[i]); + } + // ͷŶ̬ڴ + delete[] CCNN1; + delete[] CCNN2; + delete[] CCNN3; + delete[] CCNN4; + delete[] CCNN5; + delete[] CCNN6; + delete[] fdpr; + for (int i = 0; i < segmentCount; ++i) { + delete[] segments[i]; // ͷÿεĶ̬ + } + delete[] segments; // ͷŴ洢ָ + delete[] segmentLengths; // ͷŶγ + delete[] segmentAverages; // ͷƽֵ + delete[] segmentGAverages; + delete[] FDEP; + delete[] FSPR; + delete[] FGPR; + + #pragma region ռͷ + for(int _ii = 0; _ii< 36; _ii++) + { + delete []N2D[_ii]; + }delete []N2D; + for(int _ii = 0; _ii < 36; _ii++) + { + delete []F2D[_ii]; + }delete []F2D; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []R2D[_ii]; + }delete []R2D; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []RR2D[_ii]; + }delete []RR2D; + // + for(int _ii = 0; _ii < 36; _ii++) + { + delete []N_hx_abs[_ii]; + }delete []N_hx_abs; + for(int _ii = 0; _ii < 36; _ii++) + { + delete []F_hx_abs[_ii]; + }delete []F_hx_abs; + // + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]R_hx_group[_ii]; + }delete[]R_hx_group; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []R_hx_abs[_ii]; + }delete []R_hx_abs; + for(int _ii = 0; _ii < 72; _ii++) + { + delete []R_XX_abs[_ii]; + }delete []R_XX_abs; + for (int _ii = 0; _ii < 36; _ii++) + { + delete[]F_lb[_ii]; + }delete[]F_lb; + #pragma endregion + + + /*N2D = nullptr; + F2D = nullptr; + R2D = nullptr; + RR2D = nullptr; + N_hx_abs = nullptr; + F_hx_abs = nullptr; + R_hx_group = nullptr; + R_hx_abs = nullptr; + R_XX_abs = nullptr; + F_lb = nullptr; */ + + cout << "The run time is: " << (float)clock() / CLOCKS_PER_SEC << "s" << endl; + return 1; +} diff --git a/app/fdsa4_test/Ecc_Co.h b/app/fdsa4_test/Ecc_Co.h new file mode 100644 index 0000000..af7de15 --- /dev/null +++ b/app/fdsa4_test/Ecc_Co.h @@ -0,0 +1,5 @@ +#ifndef __ECC_CO_H__ +#define __ECC_CO_H__ + +__declspec(dllexport) void Ecc_co(float maxindex[72],float ECC[36],float *WFDL,float RSR,float n); +#endif \ No newline at end of file diff --git a/app/fdsa4_test/FindPeak.h b/app/fdsa4_test/FindPeak.h new file mode 100644 index 0000000..b4516b4 --- /dev/null +++ b/app/fdsa4_test/FindPeak.h @@ -0,0 +1,5 @@ +#ifndef __FINDPEAK_H__ +#define __FINDPEAK_H__ + +__declspec(dllexport) void findPeaks(float **hx_abs, float **psk, float **locs, int strat, int end); +#endif \ No newline at end of file diff --git a/app/fdsa4_test/InArray_self.cpp b/app/fdsa4_test/InArray_self.cpp new file mode 100644 index 0000000..2bc61b2 --- /dev/null +++ b/app/fdsa4_test/InArray_self.cpp @@ -0,0 +1,32 @@ +#include +#include +#include"InArray_self.h" + +__declspec(dllexport) void maxInArray_self(float **hx_abs, float hx_abs_max[72], float maxindex[72],float strat, float limit, float size, int addValue) +{ + for (int i = 0; i < size; i++) + { + for (int j = strat; j < limit; j++) + { + if (hx_abs[i][j] > hx_abs_max[i]) + { + hx_abs_max[i] = hx_abs[i][j]; + maxindex[i] = j + addValue; + } + } + } +} +__declspec(dllexport) void minInArray_self(float **hx_abs, float hx_abs_min[72], float minindex[72],float strat, float limit, float size, int addValue) +{ + for (int i = 0; i < size; i++) + { + for (int j = strat; j < limit; j++) + { + if (hx_abs[i][j] < hx_abs_min[i]) + { + hx_abs_min[i] = hx_abs[i][j]; + minindex[i] = j + addValue; + } + } + } +} \ No newline at end of file diff --git a/app/fdsa4_test/InArray_self.h b/app/fdsa4_test/InArray_self.h new file mode 100644 index 0000000..b638063 --- /dev/null +++ b/app/fdsa4_test/InArray_self.h @@ -0,0 +1,6 @@ +#ifndef __INARRAY_SELF_H__ +#define __INARRAY_SELF_H__ + +__declspec(dllexport) void maxInArray_self(float **hx_abs, float hx_abs_max[72], float maxindex[72], float strat, float limit, float size, int addValue); +__declspec(dllexport) void minInArray_self(float **hx_abs, float hx_abs_min[72], float minindex[72], float strat, float limit, float size, int addValue); +#endif \ No newline at end of file diff --git a/app/fdsa4_test/Inputtuban.h b/app/fdsa4_test/Inputtuban.h new file mode 100644 index 0000000..437f7ca --- /dev/null +++ b/app/fdsa4_test/Inputtuban.h @@ -0,0 +1,9 @@ +#ifndef __INPUTTUBAN_H__ +#define __INPUTTUBAN_H__ + + + +__declspec(dllexport) void INputtuban(char strFile[], float fData1[], float fData2[]); +__declspec(dllexport) void Tubanpara(float Mode,float Thickness,float gd_Zc[20],float gd_Att[20],float ld_Zc[20],float ld_Att[20],float sd_Zc[20],float sd_Att[20],float gu_Zc[20],float gu_Att[20],float lu_Zc[20],float lu_Att[20],float su_Zc[20],float su_Att[20]); + +#endif \ No newline at end of file diff --git a/app/fdsa4_test/Rate_Co.h b/app/fdsa4_test/Rate_Co.h new file mode 100644 index 0000000..becde7f --- /dev/null +++ b/app/fdsa4_test/Rate_Co.h @@ -0,0 +1,5 @@ +#ifndef __RATE_CO_H__ +#define __RATE_CO_H__ + +__declspec(dllexport) void Rate_co(float **hx_abs, float RATE[36], float maxindex[36], float hx_abs_max[36], int RSR, float RWD, float RWL,float Nt); +#endif \ No newline at end of file diff --git a/app/fdsa4_test/SLG_plate.h b/app/fdsa4_test/SLG_plate.h new file mode 100644 index 0000000..52b82ee --- /dev/null +++ b/app/fdsa4_test/SLG_plate.h @@ -0,0 +1,11 @@ +#ifndef __SLG_PLATE_H__ +#define __SLG_PLATE_H__ + + + +__declspec(dllexport) void SLG_plate(float SLG[72], float Zc_end[72], float Att_c[72], float Thickness, float Mode, float gd_Zc[20], \ + float gd_Att[20], float ld_Zc[20], float ld_Att[20], float sd_Zc[20], float sd_Att[20], float gu_Zc[20], \ + float gu_Att[20], float lu_Zc[20], float lu_Att[20], float su_Zc[20], float su_Att[20]); + + +#endif \ No newline at end of file diff --git a/app/fdsa4_test/S_per.h b/app/fdsa4_test/S_per.h new file mode 100644 index 0000000..f911a9e --- /dev/null +++ b/app/fdsa4_test/S_per.h @@ -0,0 +1,6 @@ +#ifndef S_per_H +#define S_per_H + +__declspec(dllexport) void S_cal(float SLG[72],float SPR[3],float CmQ[2],float S1,float S2,float S3,float L1,float L2,float L3,float G1,float ccmx,float ccmn); + +#endif \ No newline at end of file diff --git a/app/fdsa4_test/Thcav_Co.h b/app/fdsa4_test/Thcav_Co.h new file mode 100644 index 0000000..88f6821 --- /dev/null +++ b/app/fdsa4_test/Thcav_Co.h @@ -0,0 +1,5 @@ +#ifndef __THCAV_CO_H__ +#define __THCAV_CO_H__ + +__declspec(dllexport) void Thc_co(float *THCAV,float Rf[72],float THC[72],float minindex[72],int RSR,float Stev,float size); +#endif \ No newline at end of file diff --git a/app/fdsa4_test/Zc_Zm_comb.h b/app/fdsa4_test/Zc_Zm_comb.h new file mode 100644 index 0000000..2c0b566 --- /dev/null +++ b/app/fdsa4_test/Zc_Zm_comb.h @@ -0,0 +1,8 @@ +#ifndef __ZC_ZM_COMB_H__ +#define __ZC_ZM_COMB_H__ + +__declspec(dllexport) void Zc_Zm_comb(float Att0[], float ATT[], float RATE[], float constant2, float constant1, float Thickness, float Inch, float CD, \ + float Bw, float Mode, float LSM, float c, float Zc_end[], float Zm_end[], float Zm2, float Zm1); + + +#endif \ No newline at end of file diff --git a/app/fdsa4_test/fdsa4_test.pro b/app/fdsa4_test/fdsa4_test.pro index 5e929bc..5cd5573 100644 --- a/app/fdsa4_test/fdsa4_test.pro +++ b/app/fdsa4_test/fdsa4_test.pro @@ -37,7 +37,19 @@ HeadS += ../include/*.h SOURCES += *.cpp HEADERS += \ # ./cloudalgorithmaccess.h \ - ./pythonhandler.h + ./pythonhandler.h \ + Att_c_find.h \ + Ecc_Co.h \ + FindPeak.h \ + Inputtuban.h \ + Rate_Co.h \ + SLG_plate.h \ + S_per.h \ + Thcav_Co.h \ + Zc_Zm_comb.h \ + fftw3.h \ + hilbert.h \ + maxInArray.h #CPATH = $$system(pwd) @@ -47,12 +59,20 @@ CONFIG(debug, debug|release){ LIBS += -L$$PWD/../../Bin -lslfiod LIBS += -L$$PWD/../../Bin -lBaseFund LIBS += -LD:/Python312/libs -lpython312 + LIBS += -L$$PWD/../../Bin -llibfftw3-3 + LIBS += -L$$PWD/../../Bin -llibfftw3f-3 + LIBS += -L$$PWD/../../Bin -llibfftw3l-3 + LIBS += -L$$PWD/../../Bin -l010902 # LIBS += -L$(QTDIR)/lib -lQtNetworkd4 # LIBS += -LD:/Qt4.7.1/lib -lQtNetworkd4 } else { LIBS += -L$$PWD/../../BinR -lslfio LIBS += -L$$PWD/../../BinR -lBaseFun LIBS += -LD:/Python312/libs -lpython312 + LIBS += -L$$PWD/../../Bin -llibfftw3-3 + LIBS += -L$$PWD/../../Bin -llibfftw3f-3 + LIBS += -L$$PWD/../../Bin -llibfftw3l-3 + LIBS += -L$$PWD/../../Bin -l010902 # LIBS += -LD:/Qt4.7.1/lib -lQtNetworkd4 # LIBS += -LD:/Qt4.7.1/lib -lQtNetworkd4 } diff --git a/app/fdsa4_test/fftw3.h b/app/fdsa4_test/fftw3.h new file mode 100644 index 0000000..39661d2 --- /dev/null +++ b/app/fdsa4_test/fftw3.h @@ -0,0 +1,415 @@ +/* + * Copyright (c) 2003, 2007-14 Matteo Frigo + * Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology + * + * The following statement of license applies *only* to this header file, + * and *not* to the other files distributed with FFTW or derived therefrom: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/***************************** NOTE TO USERS ********************************* + * + * THIS IS A HEADER FILE, NOT A MANUAL + * + * If you want to know how to use FFTW, please read the manual, + * online at http://www.fftw.org/doc/ and also included with FFTW. + * For a quick start, see the manual's tutorial section. + * + * (Reading header files to learn how to use a library is a habit + * stemming from code lacking a proper manual. Arguably, it's a + * *bad* habit in most cases, because header files can contain + * interfaces that are not part of the public, stable API.) + * + ****************************************************************************/ + +#ifndef FFTW3_H +#define FFTW3_H + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* If is included, use the C99 complex type. Otherwise + define a type bit-compatible with C99 complex */ +#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I) +# define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C +#else +# define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2] +#endif + +#define FFTW_CONCAT(prefix, name) prefix ## name +#define FFTW_MANGLE_DOUBLE(name) FFTW_CONCAT(fftw_, name) +#define FFTW_MANGLE_FLOAT(name) FFTW_CONCAT(fftwf_, name) +#define FFTW_MANGLE_LONG_DOUBLE(name) FFTW_CONCAT(fftwl_, name) +#define FFTW_MANGLE_QUAD(name) FFTW_CONCAT(fftwq_, name) + +/* IMPORTANT: for Windows compilers, you should add a line +*/ +#define FFTW_DLL +/* + here and in kernel/ifftw.h if you are compiling/using FFTW as a + DLL, in order to do the proper importing/exporting, or + alternatively compile with -DFFTW_DLL or the equivalent + command-line flag. This is not necessary under MinGW/Cygwin, where + libtool does the imports/exports automatically. */ +#if defined(FFTW_DLL) && (defined(_WIN32) || defined(__WIN32__)) + /* annoying Windows syntax for shared-library declarations */ +# if defined(COMPILING_FFTW) /* defined in api.h when compiling FFTW */ +# define FFTW_EXTERN extern __declspec(dllexport) +# else /* user is calling FFTW; import symbol */ +# define FFTW_EXTERN extern __declspec(dllimport) +# endif +#else +# define FFTW_EXTERN extern +#endif + +enum fftw_r2r_kind_do_not_use_me { + FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2, + FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6, + FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10 +}; + +struct fftw_iodim_do_not_use_me { + int n; /* dimension size */ + int is; /* input stride */ + int os; /* output stride */ +}; + +#include /* for ptrdiff_t */ +struct fftw_iodim64_do_not_use_me { + ptrdiff_t n; /* dimension size */ + ptrdiff_t is; /* input stride */ + ptrdiff_t os; /* output stride */ +}; + +typedef void (*fftw_write_char_func_do_not_use_me)(char c, void *); +typedef int (*fftw_read_char_func_do_not_use_me)(void *); + +/* + huge second-order macro that defines prototypes for all API + functions. We expand this macro for each supported precision + + X: name-mangling macro + R: real data type + C: complex data type +*/ + +#define FFTW_DEFINE_API(X, R, C) \ + \ +FFTW_DEFINE_COMPLEX(R, C); \ + \ +typedef struct X(plan_s) *X(plan); \ + \ +typedef struct fftw_iodim_do_not_use_me X(iodim); \ +typedef struct fftw_iodim64_do_not_use_me X(iodim64); \ + \ +typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind); \ + \ +typedef fftw_write_char_func_do_not_use_me X(write_char_func); \ +typedef fftw_read_char_func_do_not_use_me X(read_char_func); \ + \ +FFTW_EXTERN void X(execute)(const X(plan) p); \ + \ +FFTW_EXTERN X(plan) X(plan_dft)(int rank, const int *n, \ + C *in, C *out, int sign, unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_dft_1d)(int n, C *in, C *out, int sign, \ + unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_dft_2d)(int n0, int n1, \ + C *in, C *out, int sign, unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_dft_3d)(int n0, int n1, int n2, \ + C *in, C *out, int sign, unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_many_dft)(int rank, const int *n, \ + int howmany, \ + C *in, const int *inembed, \ + int istride, int idist, \ + C *out, const int *onembed, \ + int ostride, int odist, \ + int sign, unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_guru_dft)(int rank, const X(iodim) *dims, \ + int howmany_rank, \ + const X(iodim) *howmany_dims, \ + C *in, C *out, \ + int sign, unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_guru_split_dft)(int rank, const X(iodim) *dims, \ + int howmany_rank, \ + const X(iodim) *howmany_dims, \ + R *ri, R *ii, R *ro, R *io, \ + unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_guru64_dft)(int rank, \ + const X(iodim64) *dims, \ + int howmany_rank, \ + const X(iodim64) *howmany_dims, \ + C *in, C *out, \ + int sign, unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_guru64_split_dft)(int rank, \ + const X(iodim64) *dims, \ + int howmany_rank, \ + const X(iodim64) *howmany_dims, \ + R *ri, R *ii, R *ro, R *io, \ + unsigned flags); \ + \ +FFTW_EXTERN void X(execute_dft)(const X(plan) p, C *in, C *out); \ +FFTW_EXTERN void X(execute_split_dft)(const X(plan) p, R *ri, R *ii, \ + R *ro, R *io); \ + \ +FFTW_EXTERN X(plan) X(plan_many_dft_r2c)(int rank, const int *n, \ + int howmany, \ + R *in, const int *inembed, \ + int istride, int idist, \ + C *out, const int *onembed, \ + int ostride, int odist, \ + unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_dft_r2c)(int rank, const int *n, \ + R *in, C *out, unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_dft_r2c_1d)(int n,R *in,C *out,unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_dft_r2c_2d)(int n0, int n1, \ + R *in, C *out, unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_dft_r2c_3d)(int n0, int n1, \ + int n2, \ + R *in, C *out, unsigned flags); \ + \ + \ +FFTW_EXTERN X(plan) X(plan_many_dft_c2r)(int rank, const int *n, \ + int howmany, \ + C *in, const int *inembed, \ + int istride, int idist, \ + R *out, const int *onembed, \ + int ostride, int odist, \ + unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_dft_c2r)(int rank, const int *n, \ + C *in, R *out, unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_dft_c2r_1d)(int n,C *in,R *out,unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_dft_c2r_2d)(int n0, int n1, \ + C *in, R *out, unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_dft_c2r_3d)(int n0, int n1, \ + int n2, \ + C *in, R *out, unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_guru_dft_r2c)(int rank, const X(iodim) *dims, \ + int howmany_rank, \ + const X(iodim) *howmany_dims, \ + R *in, C *out, \ + unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_guru_dft_c2r)(int rank, const X(iodim) *dims, \ + int howmany_rank, \ + const X(iodim) *howmany_dims, \ + C *in, R *out, \ + unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_guru_split_dft_r2c)( \ + int rank, const X(iodim) *dims, \ + int howmany_rank, \ + const X(iodim) *howmany_dims, \ + R *in, R *ro, R *io, \ + unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_guru_split_dft_c2r)( \ + int rank, const X(iodim) *dims, \ + int howmany_rank, \ + const X(iodim) *howmany_dims, \ + R *ri, R *ii, R *out, \ + unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_guru64_dft_r2c)(int rank, \ + const X(iodim64) *dims, \ + int howmany_rank, \ + const X(iodim64) *howmany_dims, \ + R *in, C *out, \ + unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_guru64_dft_c2r)(int rank, \ + const X(iodim64) *dims, \ + int howmany_rank, \ + const X(iodim64) *howmany_dims, \ + C *in, R *out, \ + unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_guru64_split_dft_r2c)( \ + int rank, const X(iodim64) *dims, \ + int howmany_rank, \ + const X(iodim64) *howmany_dims, \ + R *in, R *ro, R *io, \ + unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_guru64_split_dft_c2r)( \ + int rank, const X(iodim64) *dims, \ + int howmany_rank, \ + const X(iodim64) *howmany_dims, \ + R *ri, R *ii, R *out, \ + unsigned flags); \ + \ +FFTW_EXTERN void X(execute_dft_r2c)(const X(plan) p, R *in, C *out); \ +FFTW_EXTERN void X(execute_dft_c2r)(const X(plan) p, C *in, R *out); \ + \ +FFTW_EXTERN void X(execute_split_dft_r2c)(const X(plan) p, \ + R *in, R *ro, R *io); \ +FFTW_EXTERN void X(execute_split_dft_c2r)(const X(plan) p, \ + R *ri, R *ii, R *out); \ + \ +FFTW_EXTERN X(plan) X(plan_many_r2r)(int rank, const int *n, \ + int howmany, \ + R *in, const int *inembed, \ + int istride, int idist, \ + R *out, const int *onembed, \ + int ostride, int odist, \ + const X(r2r_kind) *kind, unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_r2r)(int rank, const int *n, R *in, R *out, \ + const X(r2r_kind) *kind, unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_r2r_1d)(int n, R *in, R *out, \ + X(r2r_kind) kind, unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_r2r_2d)(int n0, int n1, R *in, R *out, \ + X(r2r_kind) kind0, X(r2r_kind) kind1, \ + unsigned flags); \ +FFTW_EXTERN X(plan) X(plan_r2r_3d)(int n0, int n1, int n2, \ + R *in, R *out, X(r2r_kind) kind0, \ + X(r2r_kind) kind1, X(r2r_kind) kind2, \ + unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_guru_r2r)(int rank, const X(iodim) *dims, \ + int howmany_rank, \ + const X(iodim) *howmany_dims, \ + R *in, R *out, \ + const X(r2r_kind) *kind, unsigned flags); \ + \ +FFTW_EXTERN X(plan) X(plan_guru64_r2r)(int rank, const X(iodim64) *dims, \ + int howmany_rank, \ + const X(iodim64) *howmany_dims, \ + R *in, R *out, \ + const X(r2r_kind) *kind, unsigned flags); \ + \ +FFTW_EXTERN void X(execute_r2r)(const X(plan) p, R *in, R *out); \ + \ +FFTW_EXTERN void X(destroy_plan)(X(plan) p); \ +FFTW_EXTERN void X(forget_wisdom)(void); \ +FFTW_EXTERN void X(cleanup)(void); \ + \ +FFTW_EXTERN void X(set_timelimit)(double t); \ + \ +FFTW_EXTERN void X(plan_with_nthreads)(int nthreads); \ +FFTW_EXTERN int X(init_threads)(void); \ +FFTW_EXTERN void X(cleanup_threads)(void); \ +FFTW_EXTERN void X(make_planner_thread_safe)(void); \ + \ +FFTW_EXTERN int X(export_wisdom_to_filename)(const char *filename); \ +FFTW_EXTERN void X(export_wisdom_to_file)(FILE *output_file); \ +FFTW_EXTERN char *X(export_wisdom_to_string)(void); \ +FFTW_EXTERN void X(export_wisdom)(X(write_char_func) write_char, \ + void *data); \ +FFTW_EXTERN int X(import_system_wisdom)(void); \ +FFTW_EXTERN int X(import_wisdom_from_filename)(const char *filename); \ +FFTW_EXTERN int X(import_wisdom_from_file)(FILE *input_file); \ +FFTW_EXTERN int X(import_wisdom_from_string)(const char *input_string); \ +FFTW_EXTERN int X(import_wisdom)(X(read_char_func) read_char, void *data); \ + \ +FFTW_EXTERN void X(fprint_plan)(const X(plan) p, FILE *output_file); \ +FFTW_EXTERN void X(print_plan)(const X(plan) p); \ +FFTW_EXTERN char *X(sprint_plan)(const X(plan) p); \ + \ +FFTW_EXTERN void *X(malloc)(size_t n); \ +FFTW_EXTERN R *X(alloc_real)(size_t n); \ +FFTW_EXTERN C *X(alloc_complex)(size_t n); \ +FFTW_EXTERN void X(free)(void *p); \ + \ +FFTW_EXTERN void X(flops)(const X(plan) p, \ + double *add, double *mul, double *fmas); \ +FFTW_EXTERN double X(estimate_cost)(const X(plan) p); \ +FFTW_EXTERN double X(cost)(const X(plan) p); \ + \ +FFTW_EXTERN int X(alignment_of)(R *p); \ +FFTW_EXTERN const char X(version)[]; \ +FFTW_EXTERN const char X(cc)[]; \ +FFTW_EXTERN const char X(codelet_optim)[]; + + +/* end of FFTW_DEFINE_API macro */ + +FFTW_DEFINE_API(FFTW_MANGLE_DOUBLE, double, fftw_complex) +FFTW_DEFINE_API(FFTW_MANGLE_FLOAT, float, fftwf_complex) +FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex) + +/* __float128 (quad precision) is a gcc extension on i386, x86_64, and ia64 + for gcc >= 4.6 (compiled in FFTW with --enable-quad-precision) */ +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) \ + && !(defined(__ICC) || defined(__INTEL_COMPILER) || defined(__CUDACC__) || defined(__PGI)) \ + && (defined(__i386__) || defined(__x86_64__) || defined(__ia64__)) +# if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I) +/* note: __float128 is a typedef, which is not supported with the _Complex + keyword in gcc, so instead we use this ugly __attribute__ version. + However, we can't simply pass the __attribute__ version to + FFTW_DEFINE_API because the __attribute__ confuses gcc in pointer + types. Hence redefining FFTW_DEFINE_COMPLEX. Ugh. */ +# undef FFTW_DEFINE_COMPLEX +# define FFTW_DEFINE_COMPLEX(R, C) typedef _Complex float __attribute__((mode(TC))) C +# endif +FFTW_DEFINE_API(FFTW_MANGLE_QUAD, __float128, fftwq_complex) +#endif + +#define FFTW_FORWARD (-1) +#define FFTW_BACKWARD (+1) + +#define FFTW_NO_TIMELIMIT (-1.0) + +/* documented flags */ +#define FFTW_MEASURE (0U) +#define FFTW_DESTROY_INPUT (1U << 0) +#define FFTW_UNALIGNED (1U << 1) +#define FFTW_CONSERVE_MEMORY (1U << 2) +#define FFTW_EXHAUSTIVE (1U << 3) /* NO_EXHAUSTIVE is default */ +#define FFTW_PRESERVE_INPUT (1U << 4) /* cancels FFTW_DESTROY_INPUT */ +#define FFTW_PATIENT (1U << 5) /* IMPATIENT is default */ +#define FFTW_ESTIMATE (1U << 6) +#define FFTW_WISDOM_ONLY (1U << 21) + +/* undocumented beyond-guru flags */ +#define FFTW_ESTIMATE_PATIENT (1U << 7) +#define FFTW_BELIEVE_PCOST (1U << 8) +#define FFTW_NO_DFT_R2HC (1U << 9) +#define FFTW_NO_NONTHREADED (1U << 10) +#define FFTW_NO_BUFFERING (1U << 11) +#define FFTW_NO_INDIRECT_OP (1U << 12) +#define FFTW_ALLOW_LARGE_GENERIC (1U << 13) /* NO_LARGE_GENERIC is default */ +#define FFTW_NO_RANK_SPLITS (1U << 14) +#define FFTW_NO_VRANK_SPLITS (1U << 15) +#define FFTW_NO_VRECURSE (1U << 16) +#define FFTW_NO_SIMD (1U << 17) +#define FFTW_NO_SLOW (1U << 18) +#define FFTW_NO_FIXED_RADIX_LARGE_N (1U << 19) +#define FFTW_ALLOW_PRUNING (1U << 20) + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* FFTW3_H */ diff --git a/app/fdsa4_test/findcc.cpp b/app/fdsa4_test/findcc.cpp new file mode 100644 index 0000000..72e147f --- /dev/null +++ b/app/fdsa4_test/findcc.cpp @@ -0,0 +1,29 @@ +#include"findcc.h" +#include +#include +using namespace std; + +__declspec(dllexport)int Grs(float sp,float gp,float s1,float s2,float s3,float l1,float l2,float l3,float g1) +{ + if(sp==100) + return 0; + else if(sp>=s3&&sp<100) + return 1; + else if(sp>=s2&&sp=s1&&spg1) + return 5; + else + return 4; + } +} + diff --git a/app/fdsa4_test/findcc.h b/app/fdsa4_test/findcc.h new file mode 100644 index 0000000..29275c6 --- /dev/null +++ b/app/fdsa4_test/findcc.h @@ -0,0 +1,6 @@ +#ifndef findcc_H +#define findcc_H + +_declspec(dllexport)int Grs(float sp,float gp,float s1,float s2,float s3,float l1,float l2,float l3,float g1); + +#endif \ No newline at end of file diff --git a/app/fdsa4_test/hilbert.h b/app/fdsa4_test/hilbert.h new file mode 100644 index 0000000..472c6ab --- /dev/null +++ b/app/fdsa4_test/hilbert.h @@ -0,0 +1,9 @@ +#ifndef __HILBERT_H__ +#define __HILBERT_H__ +#define NN 300 +#define NFFT 80 +__declspec(dllexport) void hilbert(float **welldata2D, float **hx_abs, int size); +__declspec(dllexport) void hilbert2(float **welldata2D, float **hx_abs, int size); +__declspec(dllexport) void fft(float **welldata2D, float **welldataR2D, float **hx_pha,float **XX_abs,int size,float strat,float end); + +#endif \ No newline at end of file diff --git a/app/fdsa4_test/maxInArray.h b/app/fdsa4_test/maxInArray.h new file mode 100644 index 0000000..9e948d1 --- /dev/null +++ b/app/fdsa4_test/maxInArray.h @@ -0,0 +1,9 @@ +#ifndef __MAXINARRAY_H__ +#define __MAXINARRAY_H__ +#define NN 300 + +__declspec(dllexport) float round(float r); +__declspec(dllexport) void maxInArray(float hx_abs[][NN], float hx_abs_max[72], float maxindex[72], float limit, float size); +__declspec(dllexport) void maxInArray2(float hx_abs[][NN], float hx_abs_max[72], float maxindex[72], float limit, float size); +__declspec(dllexport) void minInArray2(float hx_abs[][NN], float hx_abs_min[72], float minindex[72], float limit, float size); +#endif diff --git a/app/fdsa4_test/test0531.000 b/app/fdsa4_test/test0531.000 new file mode 100644 index 0000000..eb0fd3c --- /dev/null +++ b/app/fdsa4_test/test0531.000 @@ -0,0 +1,430 @@ +#include "memrdwt.h" +#include "math.h" +#include "basefun.h" +#include "DepthProgress.h" +#include +//#include"cloudalgorithmaccess.h" +#include +#include +#include +#include +#include +#include "pythonhandler.h" + +// #undef slots +// #if defined(_DEBUG) +// #define IS_DEBUG +// #undef _DEBUG//防止加载python312_d.lib 先取消掉_DEBUG +// #endif +// #include +// #include +// #if defined(IS_DEBUG) +// #define _DEBUG +// #endif +// #define slots +#include +/****************************************************数据定义**************************************************************** + ******************************begin****************************/ +extern "C"{ + _declspec (dllexport) struct INC_STRU INC={6, + "FWGN_W:波名1,raw;;\ + NWGN_W:波名2,raw;;\ + RWGN_W:波名3,raw;;\ + GR:伽马,API;;\ + NWGN_C:曲线名2,raw;;\ + RWGN_C:曲线名3,raw;;\ + " + };//输入曲线定义 6:输入6条数据, "数据英文:数据中文,数据单位;;" + _declspec (dllexport) struct INP_STRU INP; ///使用GetINValue(RGN_C, 6, 1);函数需要定义该变量 + + _declspec (dllexport) struct OUTC_STRU OUTC={2, + "ATT:波名1,raw;;\ + THCAV:曲线名1,raw;;\ + " + };//输出曲线定义 2:输出2条数据, "数据英文:数据中文,数据单位;;"(注:先写波形数据,再写曲线数据) + //_declspec (dllexport) struct OUTP_STRU OUTP; + + _declspec (dllexport) struct HD_STRU HD={0.0,9999.0,0.0,0.0,0.0,0.0,0.0,"test0531.INP","test0531.TLP"};//改成自己的工程名 + + __declspec (dllexport) struct CONC_STRU CONC={4, + "CTH:参数名1,mm;;;;10.5;\ + CT:参数名2,%;;;;1;\ + IT:参数名3,mm;;;;9.7;\ + MT:参数名4,%;;;;1;" + };//常量参数定义 4:4个参数, "数据英文:数据中文,单位;;;;参数默认值;" + _declspec (dllexport) struct CON_STRU CON={10.5, 1, 9.7, 1};//再次设置默认值(需要与前面相同) + + _declspec (dllexport) struct ErrorInf errorinf; + + //定义输出数据类型(注:需要与前面输出定义一一对应) + __declspec (dllexport) struct LogType LogType={WAVE_OBJECT, CURVE_OBJECT};//{WAVE_OBJECT, CURVE_OBJECT} + + __declspec( dllexport ) CMemRdWt MemRdWt; + _declspec (dllexport) int test0531();//改成自己的工程名 +} +/****************************************************end****************************************************************/ + + + +struct Process_Struct{ + int Process(); +}; + +//DLL入口函数 +int test0531()//改成自己的工程名 +{ + Process_Struct Process; + return Process.Process(); +} + +//固井结构体(注:此处为表格输出示例) +typedef struct ss_struct +{ + int GNO; + float GSDEP,GEDEP; + int GRESULT; +} GUJING; +//结论结构体 +typedef struct s2_struct +{ + int NO; + float SDEP,EDEP; + QString R; +} JIELUN; + +void callPython(float FGN_C, float NGN_C, float RGN_C, float* FGN_W, float* NGN_W, float* Att0all, int nlen) +{ + QVariantList args; +// args << 0.77; +// args << 2.93; +// args << 50; +// PythonHandler::getInstance()->executeScript("UCS_test_0330", "get_UCS_Horsrud_correlation_shale", args, NULL, nlen); +// return; + + QVariantList arg1; + QVariantList arg2; + // 填充列表 + for (int i = 0; i < nlen; ++i) { + arg1 << (double)FGN_W[i]; + arg2 << (double)NGN_W[i]; + } + args.append(QVariant::fromValue(arg1)); // 直接将 innerList1 作为元素添加 + args.append(QVariant::fromValue(arg2)); // 使用 << 操作符 + args << (double)FGN_C << (double)NGN_C << (double)RGN_C; + PythonHandler::getInstance()->executeScript("fdsa4_test", "process_arrays", args, Att0all, nlen); + + // static PyObject * pmodule = NULL; + // static PyObject * pmodule2 = NULL; + // if (!pmodule) // 防止重复加载报错cannot load module more than once per process + // { + // Py_Initialize(); + // if(!Py_IsInitialized()) + // { + // qDebug() << "init err"; + // } + // PyRun_SimpleString("import os"); + // PyRun_SimpleString("import sys"); + // // PyRun_SimpleString("sys.path.append('./app/fdsa4_test')");// 设置运行路径 + // PyRun_SimpleString("sys.path.append('D:/jiayl0909/logPlus/build/Bin/app/fdsa4_test')");// 设置运行路径 + // PyRun_SimpleString("sys.path.append(os.path.dirname(os.path.dirname(os.getcwd())))"); + // PyRun_SimpleString("print(os.getcwd())"); + // PyRun_SimpleString("print(os.path.dirname(os.path.dirname(os.getcwd())))"); + // PyRun_SimpleString("print(sys.path)"); + + // // pmodule2 = PyImport_ImportModule("math_algorithm"); + // pmodule = PyImport_ImportModule("math_algorithm"); + + // } + // if(PyErr_Occurred()){ + // PyObject*pType,*pValue,*pTraceback; + // PyErr_Fetch(&pType,&pValue,&pTraceback);PyErr_NormalizeException(&pType,&pValue,&pTraceback); + // PyObject* pstr=PyObject_Str(pValue); + // const char* pstrErrorMessage =PyUnicode_AsUTF8(pstr); + // printf("Error message:%s\n",pstrErrorMessage); + // } + + // if(!pmodule) + // { + // qDebug() << "can not open the file"; + // return; + // } + + // // return; + // PyObject* pFunc2 = PyObject_GetAttrString(pmodule, "process_arrays"); + + // // 创建两个Python列表(数组) + // PyObject* pArgs = PyTuple_New(5);//五个参数 + // PyObject* pList1 = PyList_New(0); + // PyObject* pList2 = PyList_New(0); + + // // 填充列表 + // for (int i = 0; i < nlen; ++i) { + // PyList_Append(pList1, PyFloat_FromDouble(FGN_W[i])); // 可以调用GetINValue(AC,1,1);添加曲线数据 + // PyList_Append(pList2, PyFloat_FromDouble(NGN_W[i])); + // } + + // // 将列表放入参数元组中 + // PyTuple_SetItem(pArgs, 0, pList1); + // PyTuple_SetItem(pArgs, 1, pList2); + // PyTuple_SetItem(pArgs, 2, PyFloat_FromDouble(FGN_C)); + // PyTuple_SetItem(pArgs, 3, PyFloat_FromDouble(NGN_C)); + // PyTuple_SetItem(pArgs, 4, PyFloat_FromDouble(RGN_C)); + + // // 调用函数 + // PyObject* pValue = PyObject_CallObject(pFunc2, pArgs); + // if (pValue != NULL) { + // // // 处理结果或打印结果(例如,转换为C++数据类型) + // // for (Py_ssize_t i = 0; i < PyList_Size(pValue); ++i) { + // // PyObject* item = PyList_GetItem(pValue, i); + // // printf("%ld ", PyLong_AsLong(item)); // 对于Python 3,使用 PyLong_AsLong + // // } + // // printf("\n"); + // // 处理返回的元组,这里有两个数组元素 + // PyObject* array1 = PyTuple_GetItem(pValue, 0); + // double dR = PyFloat_AsDouble(PyTuple_GetItem(pValue, 1)); // 获取double + + // // // 将numpy数组转换为C++数组(例如使用numpy的API) + // // PyArrayObject* arr1 = (PyArrayObject*)PyArray_FromAny(array1, NULL, 0, 0, NPY_ARRAY_CARRAY, NULL); + // PyArrayObject* arr1 = (PyArrayObject*)array1; + // double* data1 = (double*)PyArray_DATA(arr1); + + // int len = PyArray_DIM(arr1, 0); // 获取数组长度 + // if (len>nlen) + // len = nlen; + // for (int i = 0; i < len; i++) { + // Att0all[i] = data1[i]; + // } + // Py_DECREF(arr1); + // } else { + // PyErr_Print(); + // } + + // // 清理资源 + // Py_DECREF(pValue); + // Py_DECREF(pArgs); + + // // while(Py_REFCNT(pmodule)>0) + // // Py_DECREF(pmodule); + // // Py_Finalize(); +} + +//核心处理逻辑 +int Process_Struct::Process() +{ + if(HD.Sdep >= HD.EndDep) + { + // AfxMessageBox("当前处理井段深度有误!\n已停止计算"); + AfxMessageBox("The current depth of the processing interval is incorrect!\n Calculation has been stopped"); + return 0; + } + + /*******************************************************写数据前的准备操作******************************************************* + ******************************begin****************************/ + //(1)初始化参数、输入 + MemRdWt.Const(); + MemRdWt.In(); + + //(2)波形类型的输出数据初始化检查 + char outname[2][16]; + int OUTindex = 0, WaveIndex = 0; + MemRdWt.GetOutCurveName(OUTindex, outname[OUTindex]);//获取输出数据名称,参数1是序列值(从0开始)(注:波形/曲线均使用GetOutCurveName函数) + + int index1 = MemRdWt.OpenWave(outname[OUTindex]);//检查是否存在outname[OUTindex]波形 + if(index1 < 0) //返回索引小于0说明没有该波形,需要创建 + { + //创建方式: + Slf_WAVE myWave; + strcpy(myWave.Name, outname[OUTindex]); + strcpy(myWave.AliasName, outname[OUTindex]); + strcpy(myWave.DepthUnit, "m"); + myWave.CodeLen = 4; + myWave.RepCode = 4; + myWave.DefVal = 0; + myWave.StartDepth = HD.Sdep; + myWave.EndDepth = HD.Edep; + myWave.DepLevel = HD.Rlev; + strcpy(myWave.DepthUnit, "m"); + myWave.StartTime = 0; //起始记录时间 + myWave.TimeLevel = 5; //时间采样间隔 + myWave.ArrayNum = 1; //阵列数 + myWave.TimeSamples = 36; //时间采样总数 + strcpy(myWave.TimeUnit, "ns"); //时间单位 + + index1 = MemRdWt.OpenWave((Slf_WAVE *)&myWave); //创建波形(注:此时返回索引应>1,代表创建成功) + } + if(index1 < 0) + { + // AfxMessageBox("阵列数据创建失败!\n已停止计算"); + AfxMessageBox("Array data creation failed!\nCalculation stopped"); + return 0; + }else{ + WaveIndex = index1; + } + + //(3)曲线类型的输出数据初始化检查 + OUTindex = 1;//按extern "C"中定义的输出数据顺序设置 + MemRdWt.GetOutCurveName(OUTindex, outname[OUTindex]);//获取输出数据名称,参数1是序列值(从0开始) + index1 = MemRdWt.OpenCurve(outname[1]);//index1 = MemRdWt.OpenCurve("EEE");//检查数据是否存在//outname[OUTindex] + if(index1 < 0) //返回索引小于0说明没有这条曲线,需要创建 + { + //创建方式: + Slf_CURVE myCurve; //定义曲线对象 + strcpy(myCurve.Name, outname[1]); //设置名称 + strcpy(myCurve.AliasName, outname[1]); //设置别名 + strcpy(myCurve.Unit, "m"); //设置数据单位 + myCurve.CodeLen = 4; //设置字节长度(注:4float) + myCurve.RepCode = 4; //设置数据类型(注:4float) + myCurve.DefVal = 0; //设置默认值 + myCurve.StartDepth = HD.Sdep; //设置起始深度 + myCurve.EndDepth = HD.Edep; //设置结束深度 + myCurve.DepLevel = HD.Rlev; //设置采样间隔 + strcpy(myCurve.DepthUnit, "m"); //设置深度单位 + + index1 = MemRdWt.OpenCurve((Slf_CURVE *)&myCurve); //创建曲线(注:此时返回索引应>1,代表创建成功) + + } + if(index1 < 0) + { + // AfxMessageBox("波形数据创建失败!\n已停止计算"); + AfxMessageBox("Array data creation failed!\nCalculation stopped"); + return 0; + } + /*********************************************************end************************************************************/ + + + + //(4)平台进度条设置 + DepthProgress mmProgress; + mmProgress.CreatProgress(HD.Stdep, HD.EndDep, "程序处理中..."); + + //(5)深度循环 + while(HD.Dep <= HD.EndDep)//逐深度处理 + { + mmProgress.SetDepth(HD.Dep);//设置平台进度条 + + /********************************************************获取常量参数示例*************************************************** + ******************************begin****************************/ + + //GetPosValue函数的参数3为序列值,要和extern "C"的CONC内容对应上(从1开始) + float CTH, CT, IT, MT; + GetPosValue(CTH, CON, 1, 1); + GetPosValue(CT, CON, 2, 1); + GetPosValue(IT, CON, 3, 1); + GetPosValue(MT, CON, 4, 1); + /***************************************************************end*************************************************************/ + + + /********************************************************读数据示例*************************************************************** + *****************************begin****************************/ + + //(1)读wave数据 + char inname[3][36]; + int index[4] = {-1}; + //获取输入数据对应的波列名称,,参数1是序列值(从0开始) + MemRdWt.GetInCurveName(0, inname[0]); + MemRdWt.GetInCurveName(1, inname[1]); + MemRdWt.GetInCurveName(2, inname[2]); + //获取波列数据对应的index,再读数据 + index[0] = MemRdWt.OpenWave(inname[0]); + index[1] = MemRdWt.OpenWave(inname[1]); + index[2] = MemRdWt.OpenWave(inname[2]); + if(index[0] < 0 || index[1] < 0 || index[2] < 0){ + // AfxMessageBox("波列数据获取失败\n已停止计算"); + AfxMessageBox("Waveform data acquisition failed\nCalculation stopped"); + return 0; + } + float FGN_W[60], NGN_W[60], RGN_W[60]; //必须根据wave数据的大小声明! + int a = 0; + int b = 0; int c = 0; + c = MemRdWt.ReadWaveToFloatBuf(index[2], HD.Dep, 1, RGN_W); + b = MemRdWt.ReadWaveToFloatBuf(index[1], HD.Dep, 1, NGN_W); + a = MemRdWt.ReadWaveToFloatBuf(index[0], HD.Dep, 1, FGN_W);//读取wave数据,从HD.Dep深度开始,读1个深度位置的wave数据至FGN_W中 + + //(2)读曲线数据 + //GetINValue函数的参数2为序列值,要和extern "C"的INC内容的顺序对应上 + float FGN_C, NGN_C, RGN_C; + GetINValue(FGN_C, 4, 1); + GetINValue(NGN_C, 5, 1); + GetINValue(RGN_C, 6, 1); + /********************************************************end*************************************************************/ + + /*******************************************处理程序示例(注:改成自己的算法)****************************************** + *****************************begin****************************/ + float Att0all[36]; + float THCAV = 0.0; + bool bPython = true; + if (bPython) + { + callPython(FGN_C, NGN_C, RGN_C, FGN_W, NGN_W, Att0all, 36); + } + else + { + for(int i = 0; i < 36; i++) + Att0all[i] = FGN_W[i] + NGN_W[i]; + THCAV = FGN_C + NGN_C + RGN_C; + } + /********************************************************end********************************************************/ + + + /*******************************************************向平台写数据示例********************************************** + *****************************begin****************************/ + + //(1)写wave数据 + MemRdWt.WriteWave(WaveIndex, HD.Dep, 1, &Att0all); + + //(2)写curve数据 + int THCAV_index = MemRdWt.OpenCurve(outname[1]);//outname[1] + if(THCAV_index > 0) + MemRdWt.WriteCurve(THCAV_index, HD.Dep, 1, &THCAV); + /*******************************************************end**********************************************************/ + MemRdWt.In(); //继续深度循环 + } + + /*************************************************向平台写表格示例************************************************************* + *****************************begin****************************/ + + //(1)固井结论表格 + int itable1 = MemRdWt.OpenOG_RESULT("固井质量");//例如表格取名为“固井质量” + MemRdWt.SetTableRecordCount(itable1, 0); //清空原有表格数据 + + GUJING *CCNN2 = new GUJING[5]; + for(int i = 0; i < 5; i++) + { + CCNN2[i].GNO = i + 1; + CCNN2[i].GSDEP = 2000 + i * 10; + CCNN2[i].GEDEP = 2000 + (i + 1) * 10; + CCNN2[i].GRESULT = 1; + + int temp = MemRdWt.WriteTable(itable1, i + 1, &CCNN2[i]); + } + + //(2)其他表格 + struct Slf_RST{ + int Order; + float Depth; + float CorrDepth; + }; + struct Slf_RST m_Result; + itable1 = MemRdWt.OpenTable("ABCD"); + if (itable1 < 0) + { + itable1 = MemRdWt.Open_Set_Table("ABCD",0,3, + "NO,DEPTH,DDEP", + "4,4,4",//字段长度 + "1,4,4",//字段类型 + "0,0,0");//字段备注,1-枚举 + } + MemRdWt.SetTableRecordCount(itable1,3); //设置表格有3行数据 + for(int j = 0; j < 3; j++) + { + memset(&m_Result, 0, sizeof(Slf_RST)); + m_Result.Order = j + 1; + m_Result.Depth = 10; + m_Result.CorrDepth = 20 + j; + MemRdWt.WriteTable(itable1, j + 1, &m_Result); + + } + MemRdWt.CloseTable(itable1); + /******************************************************end*************************************************************/ + return 1; +}