算法模版生成的乱码编译
This commit is contained in:
parent
2c6ff9b050
commit
9ef6542bbe
78
app/example_plugin/ActionDialog.cpp
Normal file
78
app/example_plugin/ActionDialog.cpp
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
#include "ActionDialog.h"
|
||||
#include <QLabel>
|
||||
#include <QDoubleValidator>
|
||||
#include <QMessageBox>
|
||||
|
||||
#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<QAction *> 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弹窗");
|
||||
}
|
||||
|
||||
45
app/example_plugin/ActionDialog.h
Normal file
45
app/example_plugin/ActionDialog.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef ACTION_DIALOG
|
||||
#define ACTION_DIALOG
|
||||
#include <QDialog>
|
||||
#include <QWidget>
|
||||
#include "ui_ActionDialog.h"
|
||||
|
||||
#pragma once
|
||||
#include <QAction>
|
||||
|
||||
class CActionDialog:public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
void paintEvent( QPaintEvent * event );
|
||||
public:
|
||||
CActionDialog(QWidget* parent);
|
||||
~CActionDialog();
|
||||
void init();
|
||||
|
||||
// 初始化按钮,显示在平台右侧ToolBar
|
||||
void initActions();
|
||||
|
||||
// 平台获取该模块中自定义的QAction
|
||||
QList<QAction*> getListAction();
|
||||
|
||||
public:
|
||||
float m_StartDep = 0.0f;
|
||||
float m_EndDep = 0.0f;
|
||||
int mNARMS = 0;
|
||||
private:
|
||||
Ui_ActionDialog *uiDlg;
|
||||
|
||||
QList<QAction*> m_listAction;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
public slots:
|
||||
// QAction的槽函数处理
|
||||
void onAction1Func();
|
||||
void onAction2Func();
|
||||
void onAction3Func();
|
||||
|
||||
};
|
||||
#endif
|
||||
19
app/example_plugin/ActionDialog.ui
Normal file
19
app/example_plugin/ActionDialog.ui
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ActionDialog</class>
|
||||
<widget class="QDialog" name="ActionDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>425</width>
|
||||
<height>304</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -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<QAction*> actions = PLGDialog->getListAction();
|
||||
if(ActDialog == nullptr)
|
||||
InitActDialog(pF);
|
||||
QList<QAction*> actions = ActDialog->getListAction();
|
||||
int ncnt = actions.size();
|
||||
*count = ncnt;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,4 +51,5 @@ CONFIG(debug, debug|release){
|
|||
}
|
||||
|
||||
FORMS += \
|
||||
ActionDialog.ui \
|
||||
PluginDialog.ui
|
||||
|
|
|
|||
9
app/fdsa4_test/Att_c_find.h
Normal file
9
app/fdsa4_test/Att_c_find.h
Normal file
|
|
@ -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
|
||||
1606
app/fdsa4_test/CBUIprogram.cpp
Normal file
1606
app/fdsa4_test/CBUIprogram.cpp
Normal file
File diff suppressed because it is too large
Load Diff
5
app/fdsa4_test/Ecc_Co.h
Normal file
5
app/fdsa4_test/Ecc_Co.h
Normal file
|
|
@ -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
|
||||
5
app/fdsa4_test/FindPeak.h
Normal file
5
app/fdsa4_test/FindPeak.h
Normal file
|
|
@ -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
|
||||
32
app/fdsa4_test/InArray_self.cpp
Normal file
32
app/fdsa4_test/InArray_self.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
6
app/fdsa4_test/InArray_self.h
Normal file
6
app/fdsa4_test/InArray_self.h
Normal file
|
|
@ -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
|
||||
9
app/fdsa4_test/Inputtuban.h
Normal file
9
app/fdsa4_test/Inputtuban.h
Normal file
|
|
@ -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
|
||||
5
app/fdsa4_test/Rate_Co.h
Normal file
5
app/fdsa4_test/Rate_Co.h
Normal file
|
|
@ -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
|
||||
11
app/fdsa4_test/SLG_plate.h
Normal file
11
app/fdsa4_test/SLG_plate.h
Normal file
|
|
@ -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
|
||||
6
app/fdsa4_test/S_per.h
Normal file
6
app/fdsa4_test/S_per.h
Normal file
|
|
@ -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
|
||||
5
app/fdsa4_test/Thcav_Co.h
Normal file
5
app/fdsa4_test/Thcav_Co.h
Normal file
|
|
@ -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
|
||||
8
app/fdsa4_test/Zc_Zm_comb.h
Normal file
8
app/fdsa4_test/Zc_Zm_comb.h
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
415
app/fdsa4_test/fftw3.h
Normal file
415
app/fdsa4_test/fftw3.h
Normal file
|
|
@ -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 <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* If <complex.h> 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 <stddef.h> /* 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 */
|
||||
29
app/fdsa4_test/findcc.cpp
Normal file
29
app/fdsa4_test/findcc.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include"findcc.h"
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
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<s3)
|
||||
{
|
||||
if(100-sp<l2)
|
||||
return 2;
|
||||
else
|
||||
return 3;
|
||||
}
|
||||
else if(sp>=s1&&sp<s2)
|
||||
return 3;
|
||||
else if(sp<s1)
|
||||
{
|
||||
if(gp>g1)
|
||||
return 5;
|
||||
else
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
6
app/fdsa4_test/findcc.h
Normal file
6
app/fdsa4_test/findcc.h
Normal file
|
|
@ -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
|
||||
9
app/fdsa4_test/hilbert.h
Normal file
9
app/fdsa4_test/hilbert.h
Normal file
|
|
@ -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
|
||||
9
app/fdsa4_test/maxInArray.h
Normal file
9
app/fdsa4_test/maxInArray.h
Normal file
|
|
@ -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
|
||||
430
app/fdsa4_test/test0531.000
Normal file
430
app/fdsa4_test/test0531.000
Normal file
|
|
@ -0,0 +1,430 @@
|
|||
#include "memrdwt.h"
|
||||
#include "math.h"
|
||||
#include "basefun.h"
|
||||
#include "DepthProgress.h"
|
||||
#include <qvector.h>
|
||||
//#include"cloudalgorithmaccess.h"
|
||||
#include <QTextCodec>
|
||||
#include <QCoreApplication>
|
||||
#include <QtNetwork/QNetworkProxyFactory>
|
||||
#include <QLibrary>
|
||||
#include <QtNetwork/QTcpSocket>
|
||||
#include "pythonhandler.h"
|
||||
|
||||
// #undef slots
|
||||
// #if defined(_DEBUG)
|
||||
// #define IS_DEBUG
|
||||
// #undef _DEBUG//防止加载python312_d.lib 先取消掉_DEBUG
|
||||
// #endif
|
||||
// #include <Python.h>
|
||||
// #include <numpy/arrayobject.h>
|
||||
// #if defined(IS_DEBUG)
|
||||
// #define _DEBUG
|
||||
// #endif
|
||||
// #define slots
|
||||
#include <QDebug>
|
||||
/****************************************************数据定义****************************************************************
|
||||
******************************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;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user