同步修改

pull/3/head
陈增辉 2025-01-15 11:35:48 +08:00
parent 116a7f9bb2
commit f991dc3b99
42 changed files with 699 additions and 2946 deletions

View File

@ -14,8 +14,8 @@
#define __CUDANVCC___ // 定义CUDA函数
//#define __PRFDEBUG__
//#define __PRFDEBUG_PRFINF__
#define __PRFDEBUG__
#define __PRFDEBUG_PRFINF__
//#define __ECHOTIMEDEBUG__
#define __TBPIMAGEDEBUG__
@ -24,7 +24,7 @@
#include <complex>
#include <math.h>
#include <complex>
#include <time.h>
#define MATPLOTDRAWIMAGE
@ -161,5 +161,11 @@ inline void delPointer(void* p)
p = nullptr;
}
inline void PrintTime() {
time_t current_time;
time(&current_time);
printf("Current timestamp in seconds: %ld\n", (long)current_time);
}
#endif

View File

@ -0,0 +1,10 @@
#include "DEMLLA2XYZTool.h"
DEMLLA2XYZTool::DEMLLA2XYZTool(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
}
DEMLLA2XYZTool::~DEMLLA2XYZTool()
{}

View File

@ -0,0 +1,16 @@
#pragma once
#include <QDialog>
#include "ui_DEMLLA2XYZTool.h"
class DEMLLA2XYZTool : public QDialog
{
Q_OBJECT
public:
DEMLLA2XYZTool(QWidget *parent = nullptr);
~DEMLLA2XYZTool();
private:
Ui::DEMLLA2XYZToolClass ui;
};

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DEMLLA2XYZToolClass</class>
<widget class="QDialog" name="DEMLLA2XYZToolClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>246</height>
</rect>
</property>
<property name="windowTitle">
<string>DEMLLA2XYZTool</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>DEMWGS84</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>DEMXYZ</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_2"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="DEMWSG84SelectBtn">
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="DEMXYZSelectBtn">
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -10,6 +10,7 @@ class QComplex2AmpPhase : public QDialog
public:
QComplex2AmpPhase(QWidget *parent = nullptr);
~QComplex2AmpPhase();
public slots:
void accept();

View File

@ -12,6 +12,7 @@ class QImportGF3StripL1ADataset : public QDialog
public:
QImportGF3StripL1ADataset(QWidget *parent = nullptr);
~QImportGF3StripL1ADataset();
public slots:
void accept();
void reject();

View File

@ -15,6 +15,7 @@ private:
Ui::QOrthSlrRasterClass ui;
public slots:
void accept();
void reject();
void onpushButtonAddClicked(bool);

View File

@ -3,7 +3,7 @@
#include <QDialog>
#include "ui_QRDOrthProcessClass.h"
class QRDOrthProcessClass : public QDialog
class QRDOrthProcessClass : public QDialog
{
Q_OBJECT

View File

@ -1,568 +0,0 @@
#include <iostream>
#include <memory>
#include <cmath>
#include <complex>
#include <device_launch_parameters.h>
#include <cuda_runtime.h>
#include <cublas_v2.h>
#include <cuComplex.h>
#include "BaseConstVariable.h"
#include "GPURTPC.cuh"
#ifdef __CUDANVCC___
__device__ float GPU_getSigma0dB(CUDASigmaParam param, float theta) {//线性值
float sigma= param.p1 + param.p2 * exp(-param.p3 * theta) + param.p4 * cos(param.p5 * theta + param.p6);
return sigma;
}
__device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal(float RstX, float RstY, float RstZ,
float antXaxisX, float antXaxisY, float antXaxisZ,
float antYaxisX, float antYaxisY, float antYaxisZ,
float antZaxisX, float antZaxisY, float antZaxisZ,
float antDirectX, float antDirectY, float antDirectZ
) {
CUDAVectorEllipsoidal result{ 0,0,-1 };
float Xst = -1 * RstX; // 卫星 --> 地面
float Yst = -1 * RstY;
float Zst = -1 * RstZ;
float AntXaxisX = antXaxisX;
float AntXaxisY = antXaxisY;
float AntXaxisZ = antXaxisZ;
float AntYaxisX = antYaxisX;
float AntYaxisY = antYaxisY;
float AntYaxisZ = antYaxisZ;
float AntZaxisX = antZaxisX;
float AntZaxisY = antZaxisY;
float AntZaxisZ = antZaxisZ;
// 天线指向在天线坐标系下的值
float Xant = (Xst * (AntYaxisY * AntZaxisZ - AntYaxisZ * AntZaxisY) + Xst * (AntXaxisZ * AntZaxisY - AntXaxisY * AntZaxisZ) + Xst * (AntXaxisY * AntYaxisZ - AntXaxisZ * AntYaxisY)) / (AntXaxisX * (AntYaxisY * AntZaxisZ - AntZaxisY * AntYaxisZ) - AntYaxisX * (AntXaxisY * AntZaxisZ - AntXaxisZ * AntZaxisY) + AntZaxisX * (AntXaxisY * AntYaxisZ - AntXaxisZ * AntYaxisY));
float Yant = (Yst * (AntYaxisZ * AntZaxisX - AntYaxisX * AntZaxisZ) + Yst * (AntXaxisX * AntZaxisZ - AntXaxisZ * AntZaxisX) + Yst * (AntYaxisX * AntXaxisZ - AntXaxisX * AntYaxisZ)) / (AntXaxisX * (AntYaxisY * AntZaxisZ - AntZaxisY * AntYaxisZ) - AntYaxisX * (AntXaxisY * AntZaxisZ - AntXaxisZ * AntZaxisY) + AntZaxisX * (AntXaxisY * AntYaxisZ - AntXaxisZ * AntYaxisY));
float Zant = (Zst * (AntYaxisX * AntZaxisY - AntYaxisY * AntZaxisX) + Zst * (AntXaxisY * AntZaxisX - AntXaxisX * AntZaxisY) + Zst * (AntXaxisX * AntYaxisY - AntYaxisX * AntXaxisY)) / (AntXaxisX * (AntYaxisY * AntZaxisZ - AntZaxisY * AntYaxisZ) - AntYaxisX * (AntXaxisY * AntZaxisZ - AntXaxisZ * AntZaxisY) + AntZaxisX * (AntXaxisY * AntYaxisZ - AntXaxisZ * AntYaxisY));
// 计算theta 与 phi
float Norm = sqrtf(Xant * Xant + Yant * Yant + Zant * Zant); // 计算 pho
float ThetaAnt = acosf(Zant / Norm); // theta 与 Z轴的夹角
float YsinTheta = Yant / sinf(ThetaAnt);
float PhiAnt = (YsinTheta / abs(YsinTheta)) * acosf(Xant / (Norm * sinf(ThetaAnt)));
result.theta = ThetaAnt;
result.phi = PhiAnt;
result.pho = Norm;
return result;
}
__device__ float GPU_BillerInterpAntPattern(float* antpattern,
float starttheta, float startphi, float dtheta, float dphi,
long thetapoints, long phipoints,
float searththeta, float searchphi) {
float stheta = searththeta;
float sphi = searchphi;
if (stheta > 90) {
return 0;
}
else {}
float pthetaid = (stheta - starttheta) / dtheta;//
float pphiid = (sphi - startphi) / dphi;
long lasttheta = floorf(pthetaid);
long nextTheta = lasttheta + 1;
long lastphi = floorf(pphiid);
long nextPhi = lastphi + 1;
if (lasttheta < 0 || nextTheta < 0 || lastphi < 0 || nextPhi < 0 ||
lasttheta >= thetapoints || nextTheta >= thetapoints || lastphi >= phipoints || nextPhi >= phipoints)
{
return 0;
}
else {
float x = stheta;
float y = sphi;
float x1 = lasttheta * dtheta + starttheta;
float x2 = nextTheta * dtheta + starttheta;
float y1 = lastphi * dphi + startphi;
float y2 = nextPhi * dphi + startphi;
float z11 = antpattern[lasttheta * phipoints + lastphi];
float z12 = antpattern[lasttheta * phipoints + nextPhi];
float z21 = antpattern[nextTheta * phipoints + lastphi];
float z22 = antpattern[nextTheta * phipoints + nextPhi];
//z11 = powf(10, z11 / 10); // dB-> 线性
//z12 = powf(10, z12 / 10);
//z21 = powf(10, z21 / 10);
//z22 = powf(10, z22 / 10);
float GainValue = (z11 * (x2 - x) * (y2 - y)
+ z21 * (x - x1) * (y2 - y)
+ z12 * (x2 - x) * (y - y1)
+ z22 * (x - x1) * (y - y1));
GainValue = GainValue / ((x2 - x1) * (y2 - y1));
return GainValue;
}
}
__device__ cuComplex GPU_calculationEcho(float sigma0, float TransAnt, float ReciveAnt,
float localangle, float R, float slopeangle, float Pt, float lamda) {
float amp = Pt * TransAnt * ReciveAnt;
amp = amp * sigma0;
amp = amp / (powf(4 * LAMP_CUDA_PI, 2) * powf(R, 4)); // 反射强度
float phi = (-4 * LAMP_CUDA_PI / lamda) * R;
cuComplex echophi = make_cuComplex(0, phi);
cuComplex echophiexp = cuCexpf(echophi);
cuComplex echo=make_cuComplex(echophiexp.x * amp, echophiexp.y * amp);
return echo;
}
__global__ void CUDA_SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ,
float antXaxisX, float antXaxisY, float antXaxisZ,
float antYaxisX, float antYaxisY, float antYaxisZ,
float antZaxisX, float antZaxisY, float antZaxisZ,
float antDirectX, float antDirectY, float antDirectZ,
float* thetaAnt, float* phiAnt
, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float Xst = -1 * RstX[idx]; // 卫星 --> 地面
float Yst = -1 * RstY[idx];
float Zst = -1 * RstZ[idx];
float AntXaxisX = antXaxisX;
float AntXaxisY = antXaxisY;
float AntXaxisZ = antXaxisZ;
float AntYaxisX = antYaxisX;
float AntYaxisY = antYaxisY;
float AntYaxisZ = antYaxisZ;
float AntZaxisX = antZaxisX;
float AntZaxisY = antZaxisY;
float AntZaxisZ = antZaxisZ;
// 归一化
float RstNorm = sqrtf(Xst * Xst + Yst * Yst + Zst * Zst);
float AntXaxisNorm = sqrtf(AntXaxisX * AntXaxisX + AntXaxisY * AntXaxisY + AntXaxisZ * AntXaxisZ);
float AntYaxisNorm = sqrtf(AntYaxisX * AntYaxisX + AntYaxisY * AntYaxisY + AntYaxisZ * AntYaxisZ);
float AntZaxisNorm = sqrtf(AntZaxisX * AntZaxisX + AntZaxisY * AntZaxisY + AntZaxisZ * AntZaxisZ);
float Rx = Xst / RstNorm;
float Ry = Yst / RstNorm;
float Rz = Zst / RstNorm;
float Xx = AntXaxisX / AntXaxisNorm;
float Xy = AntXaxisY / AntXaxisNorm;
float Xz = AntXaxisZ / AntXaxisNorm;
float Yx = AntYaxisX / AntYaxisNorm;
float Yy = AntYaxisY / AntYaxisNorm;
float Yz = AntYaxisZ / AntYaxisNorm;
float Zx = AntZaxisX / AntZaxisNorm;
float Zy = AntZaxisY / AntZaxisNorm;
float Zz = AntZaxisZ / AntZaxisNorm;
float Xant = (Rx * Yy * Zz - Rx * Yz * Zy - Ry * Yx * Zz + Ry * Yz * Zx + Rz * Yx * Zy - Rz * Yy * Zx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
float Yant = -(Rx * Xy * Zz - Rx * Xz * Zy - Ry * Xx * Zz + Ry * Xz * Zx + Rz * Xx * Zy - Rz * Xy * Zx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
float Zant = (Rx * Xy * Yz - Rx * Xz * Yy - Ry * Xx * Yz + Ry * Xz * Yx + Rz * Xx * Yy - Rz * Xy * Yx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
// 计算theta 与 phi
float Norm = sqrtf(Xant * Xant + Yant * Yant + Zant * Zant); // 计算 pho
float ThetaAnt = acosf(Zant / Norm); // theta 与 Z轴的夹角
float PhiAnt = atanf(Yant / Xant); // -pi/2 ~pi/2
if (abs(Yant) < PRECISIONTOLERANCE) { // X轴上
PhiAnt = 0;
}
else if (abs(Xant) < PRECISIONTOLERANCE) { // Y轴上原点
if (Yant > 0) {
PhiAnt = PI / 2;
}
else {
PhiAnt = -PI / 2;
}
}
else if (Xant < 0) {
if (Yant > 0) {
PhiAnt = PI + PhiAnt;
}
else {
PhiAnt = -PI+PhiAnt ;
}
}
else { // Xant>0 X 正轴
}
if (isnan(PhiAnt)) {
printf("V=[%f,%f,%f];norm=%f;thetaAnt=%f;phiAnt=%f;\n", Xant, Yant, Zant,Norm, ThetaAnt, PhiAnt);
}
//if (abs(ThetaAnt - 0) < PRECISIONTOLERANCE) {
// PhiAnt = 0;
//}
//else {}
thetaAnt[idx] = ThetaAnt*r2d;
phiAnt[idx] = PhiAnt*r2d;
//printf("Rst=[%f,%f,%f];AntXaxis = [%f, %f, %f];AntYaxis=[%f,%f,%f];AntZaxis=[%f,%f,%f];phiAnt=%f;thetaAnt=%f;\n", Xst, Yst, Zst
// , AntXaxisX, AntXaxisY, AntXaxisZ
// , AntYaxisX, AntYaxisY, AntYaxisZ
// , AntZaxisX, AntZaxisY, AntZaxisZ
// , phiAnt[idx]
// , thetaAnt[idx]
//);
}
}
__global__ void CUDA_BillerInterpAntPattern(float* antpattern,
float starttheta, float startphi, float dtheta, float dphi,
long thetapoints, long phipoints,
float* searththeta, float* searchphi, float* searchantpattern,
long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float stheta = searththeta[idx];
float sphi = searchphi[idx];
float pthetaid = (stheta - starttheta) / dtheta;//
float pphiid = (sphi - startphi) / dphi;
long lasttheta = floorf(pthetaid);
long nextTheta = lasttheta + 1;
long lastphi = floorf(pphiid);
long nextPhi = lastphi + 1;
if (lasttheta < 0 || nextTheta < 0 || lastphi < 0 || nextPhi < 0 ||
lasttheta >= thetapoints || nextTheta >= thetapoints || lastphi >= phipoints || nextPhi >= phipoints)
{
searchantpattern[idx] = 0;
}
else {
float x = stheta;
float y = sphi;
float x1 = lasttheta * dtheta + starttheta;
float x2 = nextTheta * dtheta + starttheta;
float y1 = lastphi * dphi + startphi;
float y2 = nextPhi * dphi + startphi;
float z11 = antpattern[lasttheta * phipoints + lastphi];
float z12 = antpattern[lasttheta * phipoints + nextPhi];
float z21 = antpattern[nextTheta * phipoints + lastphi];
float z22 = antpattern[nextTheta * phipoints + nextPhi];
z11 = powf(10, z11 / 10);
z12 = powf(10, z12 / 10);
z21 = powf(10, z21 / 10);
z22 = powf(10, z22 / 10);
float GainValue = (z11 * (x2 - x) * (y2 - y)
+ z21 * (x - x1) * (y2 - y)
+ z12 * (x2 - x) * (y - y1)
+ z22 * (x - x1) * (y - y1));
GainValue = GainValue / ((x2 - x1) * (y2 - y1));
searchantpattern[idx] = GainValue;
}
}
}
__global__ void CUDA_calculationEcho(float* sigma0, float* TransAnt, float* ReciveAnt,
float* localangle, float* R, float* slopeangle,
float nearRange, float Fs, float Pt, float lamda, long FreqIDmax,
cuComplex* echoArr, long* FreqID,
long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float r = R[idx];
float amp = Pt * TransAnt[idx] * ReciveAnt[idx];
amp = amp * sigma0[idx];
amp = amp / (powf(4 * LAMP_CUDA_PI, 2) * powf(r, 4)); // 反射强度
// 处理相位
float phi = (-4 * LAMP_CUDA_PI / lamda) * r;
cuComplex echophi = make_cuComplex(0, phi);
cuComplex echophiexp = cuCexpf(echophi);
float timeR = 2 * (r - nearRange) / LIGHTSPEED * Fs;
long timeID = floorf(timeR);
//if (timeID < 0 || timeID >= FreqIDmax) {
// timeID = 0;
// amp = 0;
//}
cuComplex echo = make_cuComplex(echophiexp.x , echophiexp.y);
echoArr[idx] = echo;
FreqID[idx] = timeID;
}
}
__global__ void CUDA_AntPatternInterpGain(float* anttheta, float* antphi, float* gain,
float* antpattern, float starttheta, float startphi, float dtheta, float dphi, int thetapoints, int phipoints, long len) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float temptheta = anttheta[idx];
float tempphi = antphi[idx];
float antPatternGain = GPU_BillerInterpAntPattern(antpattern,
starttheta, startphi, dtheta, dphi, thetapoints, phipoints,
temptheta, tempphi) ;
gain[idx] = antPatternGain;
}
}
__global__ void CUDA_InterpSigma(
long* demcls, float* sigmaAmp, float* localanglearr, long len,
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
long clsid = demcls[idx];
float localangle = localanglearr[idx];
CUDASigmaParam tempsigma = sigma0Paramslist[clsid];
//printf("cls:%d;localangle=%f;\n",clsid, localangle);
if (localangle < 0 || localangle >= LAMP_CUDA_PI/2) {
sigmaAmp[idx] = 0;
}
else {}
if (abs(tempsigma.p1)< PRECISIONTOLERANCE&&
abs(tempsigma.p2) < PRECISIONTOLERANCE &&
abs(tempsigma.p3) < PRECISIONTOLERANCE &&
abs(tempsigma.p4) < PRECISIONTOLERANCE&&
abs(tempsigma.p5) < PRECISIONTOLERANCE&&
abs(tempsigma.p6) < PRECISIONTOLERANCE
) {
sigmaAmp[idx] = 0;
}
else {
float sigma = GPU_getSigma0dB(tempsigma, localangle);
sigma = powf(10.0, sigma / 10.0);// 后向散射系数
//printf("cls:%d;localangle=%f;sigma0=%f;\n", clsid, localangle, sigma);
sigmaAmp[idx] = sigma;
}
}
}
__global__ void CUDA_CalculationEchoAmp(float* sigma0, float* TransAnt, float* ReciveAnt, float* R,
float Pt,
float* ampArr, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float r = R[idx];
float amptemp = Pt * TransAnt[idx] * ReciveAnt[idx] * sigma0[idx];
amptemp = amptemp / (powf(4 * LAMP_CUDA_PI, 2) * powf(r, 4)); // 反射强度
ampArr[idx] = amptemp;
}
}
__global__ void CUDA_CalculationEchoPhase(float* R, float lamda, float* phaseArr, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float r = R[idx];
// 处理相位
float phi = (-4 * LAMP_CUDA_PI / lamda) * r;
phaseArr[idx] = phi;
}
}
__global__ void CUDA_CombinationEchoAmpAndPhase(float* R,
float* echoAmp,float* echoPhase,
float nearRange, float Fs, long plusepoints,
cuComplex* echo, long* FreqID, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float r = R[idx];
float phase = echoPhase[idx];
float amp = echoAmp[idx];
cuComplex echophi = make_cuComplex(0, phase);
cuComplex echophiexp = cuCexpf(echophi);
float timeR = 2 * (r - nearRange) / LIGHTSPEED * Fs;
long timeID = floorf(timeR);
if (timeID < 0 || timeID >= plusepoints) {
timeID = 0;
amp = 0;
}
cuComplex echotemp = make_cuComplex(echophiexp.x*amp, echophiexp.y*amp);
echo[idx] = echotemp;
FreqID[idx] = timeID;
}
}
extern "C" void SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ,
float antXaxisX, float antXaxisY, float antXaxisZ,
float antYaxisX, float antYaxisY, float antYaxisZ,
float antZaxisX, float antZaxisY, float antZaxisZ,
float antDirectX, float antDirectY, float antDirectZ,
float* thetaAnt, float* phiAnt
, long len) {
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_SatelliteAntDirectNormal << <numBlocks, blockSize >> > (RstX, RstY, RstZ,
antXaxisX, antXaxisY, antXaxisZ,
antYaxisX, antYaxisY, antYaxisZ,
antZaxisX, antZaxisY, antZaxisZ,
antDirectX, antDirectY, antDirectZ,
thetaAnt, phiAnt
, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void AntPatternInterpGain(float* anttheta, float* antphi, float* gain,
float* antpattern, float starttheta, float startphi, float dtheta, float dphi, int thetapoints, int phipoints, long len) {
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
//printf("\nCUDA_RTPC_SiglePRF blockSize:%d ,numBlock:%d\n", blockSize, numBlocks);
CUDA_AntPatternInterpGain << <numBlocks, blockSize >> > ( anttheta,antphi, gain,
antpattern,
starttheta, startphi, dtheta, dphi, thetapoints, phipoints,
len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void calculationEcho(float* sigma0, float* TransAnt, float* ReciveAnt,
float* localangle, float* R, float* slopeangle,
float nearRange, float Fs, float pt, float lamda, long FreqIDmax,
cuComplex* echoAmp, long* FreqID,
long len)
{
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_calculationEcho << <numBlocks, blockSize >> > (sigma0, TransAnt, ReciveAnt,
localangle, R, slopeangle,
nearRange, Fs, pt, lamda, FreqIDmax,
echoAmp, FreqID,
len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDACalculationEchoAmp(float* sigma0, float* TransAnt, float* ReciveAnt, float* R, float Pt, float* ampArr, long len)
{
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_CalculationEchoAmp << <numBlocks, blockSize >> > (
sigma0, TransAnt, ReciveAnt, R, Pt, ampArr, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDACalculationEchoPhase(float* R, float lamda, float* phaseArr, long len)
{
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_CalculationEchoPhase << <numBlocks, blockSize >> > (
R, lamda, phaseArr, len);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDACombinationEchoAmpAndPhase(float* R,
float* echoAmp, float* echoPhase,
float nearRange, float Fs, long plusepoints, cuComplex* echo, long* FreqID, long len)
{
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_CombinationEchoAmpAndPhase << <numBlocks, blockSize >> > (
R,
echoAmp, echoPhase,
nearRange, Fs, plusepoints, echo, FreqID, len
);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDAInterpSigma(
long* demcls,float* sigmaAmp, float* localanglearr,long len,
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen) {// 地表覆盖类型-sigma插值对应函数-ulaby
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_InterpSigma << <numBlocks, blockSize >> > (
demcls, sigmaAmp, localanglearr, len,
sigma0Paramslist, sigmaparamslistlen
);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
#endif

View File

@ -1,69 +0,0 @@
#ifndef _GPURTPC_H_
#define _GPURTPC_H_
#include "BaseConstVariable.h"
#include "GPUTool.cuh"
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include <cublas_v2.h>
#include <cuComplex.h>
extern "C" struct CUDASigmaParam {
float p1;
float p2;
float p3;
float p4;
float p5;
float p6;
};
extern "C" void SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ,
float antXaxisX, float antXaxisY, float antXaxisZ,
float antYaxisX, float antYaxisY, float antYaxisZ,
float antZaxisX, float antZaxisY, float antZaxisZ,
float antDirectX, float antDirectY, float antDirectZ,
float* thetaAnt, float* phiAnt, long len);
extern "C" void AntPatternInterpGain(float* anttheta, float* antphi, float* gain,
float* antpattern,
float starttheta, float startphi, float dtheta, float dphi, int thetapoints, int phipoints,
long len);
extern "C" void calculationEcho(float* sigma0, float* TransAnt, float* ReciveAnt,
float* localangle, float* R, float* slopeangle,
float nearRange, float Fs, float pt, float lamda, long FreqIDmax,
cuComplex* echoAmp, long* FreqID,
long len);
extern "C" void CUDACalculationEchoAmp(
float* sigma0,
float* TransAnt, float* ReciveAnt,
float* R,
float Pt,
float* ampArr,
long len
);
extern "C" void CUDACalculationEchoPhase(
float* R, float lamda,
float* phaseArr,
long len
);
extern "C" void CUDACombinationEchoAmpAndPhase(float* R, float* echoAmp, float* echoPhase,
float nearRange, float Fs,long plusepoints,
cuComplex* echo,long* FreqID,
long len
);
extern "C" void CUDAInterpSigma(
long* demcls, float* sigmaAmp, float* localanglearr, long len,
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen);
#endif

View File

@ -1,252 +0,0 @@
#include "QImageSARRTPC.h"
#include <QFileDialog>
#include <QMessageBox>
#include "RTPCProcessCls.h"
#include <boost/thread.hpp>
#include <thread>
QImageSARRTPC::QImageSARRTPC(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
QObject::connect(ui.pushButtonRP, SIGNAL(clicked()), this, SLOT(onpushButtonRPClieck()));
QObject::connect(ui.pushButtonTP, SIGNAL(clicked()), this, SLOT(onpushButtonTPClieck()));
QObject::connect(ui.pushButtonEcho, SIGNAL(clicked()), this, SLOT(onpushButtonEchoClieck()));
QObject::connect(ui.pushButtongpxml, SIGNAL(clicked()), this, SLOT(onpushButtongpxmlClieck()));
QObject::connect(ui.pushButtonTaskxml, SIGNAL(clicked()), this, SLOT(onpushButtonTaskxmlClieck()));
QObject::connect(ui.pushButtondem, SIGNAL(clicked()), this, SLOT(onpushButtondemClieck()));
QObject::connect(ui.pushButtonlandcover, SIGNAL(clicked()), this, SLOT(onpushButtonlandcoverClieck()));
QObject::connect(ui.pushButtonHHSigma0, SIGNAL(clicked()), this, SLOT(onpushButtonHHSigma0Clieck()));
QObject::connect(ui.pushButtonHVSigma0, SIGNAL(clicked()), this, SLOT(onpushButtonHVSigma0Clieck()));
QObject::connect(ui.pushButtonVHSigma0, SIGNAL(clicked()), this, SLOT(onpushButtonVHSigma0Clieck()));
QObject::connect(ui.pushButtonVVSigma0, SIGNAL(clicked()), this, SLOT(onpushButtonVVSigma0Clieck()));
QObject::connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(onBtnaccept()));
QObject::connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(onBtnReject()));
}
QImageSARRTPC::~QImageSARRTPC()
{}
void QImageSARRTPC::onpushButtonRPClieck()
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"接收方向图", // 对话框标题
"", // 初始目录,可以设置为路径
u8"csv Files (*.csv);;All Files (*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui.receivePatternFilePathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QImageSARRTPC::onpushButtonTPClieck()
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"发射方向图", // 对话框标题
"", // 初始目录,可以设置为路径
u8"csv Files (*.csv);;All Files (*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui.transformPatternFilePathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QImageSARRTPC::onpushButtonEchoClieck()
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getExistingDirectory(this, u8"选择回波存放路径", "");
if (!fileName.isEmpty()) {
this->ui.outEchoPathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件夹", u8"没有选择任何文件夹");
}
}
void QImageSARRTPC::onpushButtongpxmlClieck()
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"GPS xml", // 对话框标题
"", // 初始目录,可以设置为路径
u8"xml Files (*.xml);;All Files (*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui.gpsXmlPathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QImageSARRTPC::onpushButtonTaskxmlClieck()
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"任务xml", // 对话框标题
"", // 初始目录,可以设置为路径
u8"xml Files (*.xml);;All Files (*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui.taskXmlPathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QImageSARRTPC::onpushButtondemClieck()
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"dem文件", // 对话框标题
"", // 初始目录,可以设置为路径
u8"Image Files (*.tif);;All Files (*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui.demTiffPathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QImageSARRTPC::onpushButtonlandcoverClieck()
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"地表覆盖数据", // 对话框标题
"", // 初始目录,可以设置为路径
u8"Image Files (*.tif);;All Files (*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui.landCoverPathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QImageSARRTPC::onpushButtonHHSigma0Clieck()
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"HH后向散射系数", // 对话框标题
"", // 初始目录,可以设置为路径
u8"Image Files (*.tif);;All Files (*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui.hhSigmaPathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QImageSARRTPC::onpushButtonHVSigma0Clieck()
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"HV后向散射系数", // 对话框标题
"", // 初始目录,可以设置为路径
u8"Image Files (*.tif);;All Files (*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui.hvSigmaPathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QImageSARRTPC::onpushButtonVHSigma0Clieck()
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"VH后向散射系数", // 对话框标题
"", // 初始目录,可以设置为路径
u8"Image Files (*.tif);;All Files (*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui.vhSigmaPathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QImageSARRTPC::onpushButtonVVSigma0Clieck()
{
// 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this,
u8"VV后向散射系数", // 对话框标题
"", // 初始目录,可以设置为路径
u8"Image Files (*.tif);;All Files (*)"); // 文件类型过滤器
if (!fileName.isEmpty()) {
this->ui.vvSigmaPathEdit->setText(fileName);
}
else {
QMessageBox::information(this, u8"没有选择文件", u8"没有选择任何文件");
}
}
void QImageSARRTPC::onBtnaccept()
{
QString GPSXmlPath = ui.gpsXmlPathEdit->text().trimmed();// u8"D:/Programme/vs2022/RasterMergeTest/TestData/GF3_Simulation_GPSNode.xml";
QString TaskXmlPath = ui.taskXmlPathEdit->text().trimmed();//u8"D:/Programme/vs2022/RasterMergeTest/TestData/GF3_Simulation_Setting.xml";
QString demTiffPath = ui.demTiffPathEdit->text().trimmed();//u8"D:/Programme/vs2022/RasterMergeTest/TestData/115E39N_COP30_clip.tif";
QString landConverPath = ui.landCoverPathEdit->text().trimmed();// u8"D:/Programme/vs2022/RasterMergeTest/TestData/landcover_aligned.tiff";
QString HHSigmaPath = ui.hhSigmaPathEdit->text().trimmed();// u8"D:/Programme/vs2022/RasterMergeTest/TestData/PALSAR-2/N45E116_23_MOS_F02DAR/N45E116_2023_sl_HH_F02DAR.tif";
QString HVSigmaPath = ui.hvSigmaPathEdit->text().trimmed();// u8"D:/Programme/vs2022/RasterMergeTest/TestData/PALSAR-2/N45E116_23_MOS_F02DAR/N45E116_2023_sl_HV_F02DAR.tif";
QString VHSigmaPath = ui.vhSigmaPathEdit->text().trimmed();// HVSigmaPath;
QString VVSigmaPath = ui.vvSigmaPathEdit->text().trimmed();//HHSigmaPath;
QString OutEchoPath = ui.outEchoPathEdit->text().trimmed();// u8"D:/Programme/vs2022/RasterMergeTest/TestData/outData/";
QString simulationtaskName = ui.simulationTaskNameEdit->text().trimmed();// u8"GF3_Simulation";
// 天线方向图
QString TransAntPatternFilePath = ui.transformPatternFilePathEdit->text().trimmed();// "D:/Programme/vs2022/RasterMergeTest/TestData/ant/ant_model_setting_Horn_conical1_FarField-theta.csv"; //
QString ReceiveAntPatternFilePath = ui.receivePatternFilePathEdit->text().trimmed();//"D:/Programme/vs2022/RasterMergeTest/TestData/ant/ant_model_setting_Horn_conical1_FarField-phi.csv";
// 打印参数
// 打印解析的参数
std::cout << "GPS XML Path: " << GPSXmlPath.toStdString() << "\n"
<< "Task XML Path: " << TaskXmlPath.toStdString() << "\n"
<< "DEM TIFF Path: " << demTiffPath.toStdString() << "\n"
<< "Land Cover Path: " << landConverPath.toStdString() << "\n"
<< "HH Sigma Path: " << HHSigmaPath.toStdString() << "\n"
<< "HV Sigma Path: " << HVSigmaPath.toStdString() << "\n"
<< "VH Sigma Path: " << VHSigmaPath.toStdString() << "\n"
<< "VV Sigma Path: " << VVSigmaPath.toStdString() << "\n"
<< "Trans AntPattern Path: " << TransAntPatternFilePath.toStdString() << "\n"
<< "Reception AntPattern Path: " << ReceiveAntPatternFilePath.toStdString() << "\n"
<< "Output Path: " << OutEchoPath.toStdString() << "\n"
<< "Simulation Task Name: " << simulationtaskName.toStdString() << "\n";
long cpucore_num = std::thread::hardware_concurrency();
RTPCProcessMain(cpucore_num, TransAntPatternFilePath, ReceiveAntPatternFilePath, simulationtaskName, OutEchoPath, GPSXmlPath, TaskXmlPath, demTiffPath, landConverPath, HHSigmaPath, HVSigmaPath, VHSigmaPath, VVSigmaPath);
}
void QImageSARRTPC::onBtnReject()
{
this->close();
}

View File

@ -1,34 +0,0 @@
#pragma once
#include <QMainWindow>
#include "ui_QImageSARRTPC.h"
class QImageSARRTPC : public QDialog
{
Q_OBJECT
public:
QImageSARRTPC(QWidget *parent = nullptr);
~QImageSARRTPC();
public slots:
void onpushButtonRPClieck();
void onpushButtonTPClieck();
void onpushButtonEchoClieck();
void onpushButtongpxmlClieck();
void onpushButtonTaskxmlClieck();
void onpushButtondemClieck();
void onpushButtonlandcoverClieck();
void onpushButtonHHSigma0Clieck();
void onpushButtonHVSigma0Clieck();
void onpushButtonVHSigma0Clieck();
void onpushButtonVVSigma0Clieck();
void onBtnaccept();
void onBtnReject();
private:
Ui::QImageSARRTPCClass ui;
};

View File

@ -1,502 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QImageSARRTPCClass</class>
<widget class="QDialog" name="QImageSARRTPCClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>873</width>
<height>499</height>
</rect>
</property>
<property name="windowTitle">
<string>RTPC回波仿真</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>853</width>
<height>450</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="9" column="0">
<widget class="QLabel" name="label_9">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>参考HH极化后向散射系数:</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_11">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>参考VH极化后向散射系数</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>仿真任务名称:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="receivePatternFilePathEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/Programme/vs2022/RasterMergeTest/simulationData/ant/ant_model_setting_Horn_conical1_FarField-receive.csv</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="landCoverPathEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/Programme/vs2022/RasterMergeTest/simulationData/landcover_aligned2.dat</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="outEchoPathEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/Programme/vs2022/RasterMergeTest/LAMPCAE_SCANE/</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="taskXmlPathEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/Programme/vs2022/RasterMergeTest/simulationData/GF3_Simulation_Setting.xml</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>接收方向图:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="transformPatternFilePathEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/Programme/vs2022/RasterMergeTest/simulationData/ant/ant_model_setting_Horn_conical1_FarField-trans.csv</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLineEdit" name="vhSigmaPathEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/Programme/vs2022/RasterMergeTest/TestData/PALSAR-2/N45E116_23_MOS_F02DAR/N45E116_2023_sl_HV_F02DAR.tif</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_1">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>发射方向图:</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QLineEdit" name="vvSigmaPathEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/Programme/vs2022/RasterMergeTest/TestData/PALSAR-2/N45E116_23_MOS_F02DAR/N45E116_2023_sl_HH_F02DAR.tif</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="demTiffPathEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/Programme/vs2022/RasterMergeTest/simulationData/115E39N_COP30_clip.tif</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>输出回波地址:</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="hhSigmaPathEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/Programme/vs2022/RasterMergeTest/TestData/PALSAR-2/N45E116_23_MOS_F02DAR/N45E116_2023_sl_HH_F02DAR.tif</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_8">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>地表覆盖文件地址:</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_12">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>参考VV极化后向散射系数</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_10">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>参考HV极化后向散射系数</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="gpsXmlPathEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/Programme/vs2022/RasterMergeTest/simulationData/GF3_Simulation_GPSNode.xml</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLineEdit" name="hvSigmaPathEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>D:/Programme/vs2022/RasterMergeTest/TestData/PALSAR-2/N45E116_23_MOS_F02DAR/N45E116_2023_sl_HV_F02DAR.tif</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>参考DEM 地址:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>GPS xml 地址:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="simulationTaskNameEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>GF3_Simulation</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_6">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>任务 xml 地址:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonRP">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonTP">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonEcho">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="pushButtongpxml">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="pushButtonTaskxml">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QPushButton" name="pushButtondem">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QPushButton" name="pushButtonlandcover">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="9" column="2">
<widget class="QPushButton" name="pushButtonHHSigma0">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="10" column="2">
<widget class="QPushButton" name="pushButtonHVSigma0">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="11" column="2">
<widget class="QPushButton" name="pushButtonVHSigma0">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="12" column="2">
<widget class="QPushButton" name="pushButtonVVSigma0">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

File diff suppressed because it is too large Load Diff

View File

@ -1,86 +0,0 @@
#pragma once
/*****************************************************************//**
* \file RTPCProcessCls.h
* \brief Range Time domain Pulse Coherent
*
*
* cumming ,
* Mark A.Richards,
*
* InSAR
* SAR仿
*
* SAR仿
*
*
*
*
* \author
* \date October 2024
*********************************************************************/
#include "BaseConstVariable.h"
#include "SARSatelliteSimulationAbstractCls.h"
#include "SARSimulationTaskSetting.h"
#include "SatelliteOribtModel.h"
#include "EchoDataFormat.h"
#include "SigmaDatabase.h"
class RTPCProcessCls
{
public:
RTPCProcessCls();
~RTPCProcessCls();
public:
void setTaskSetting(std::shared_ptr < AbstractSARSatelliteModel> TaskSetting);
void setEchoSimulationDataSetting(std::shared_ptr < EchoL0Dataset> EchoSimulationData);
void setTaskFileName(QString EchoFileName);
void setDEMTiffPath(QString DEMTiffPath);
void setLandCoverPath(QString LandCoverPath);
void setHHSigmaPath(QString HHSigmaPath);
void setHVSigmaPath(QString HVSigmaPath);
void setVHSigmaPath(QString VHSigmaPath);
void setVVSigmaPath(QString VVSigmaPath);
void setOutEchoPath(QString OutEchoPath);
private:
std::shared_ptr <AbstractSARSatelliteModel> TaskSetting; // 仿真任务设置
std::shared_ptr <EchoL0Dataset> EchoSimulationData; // GPS数据
std::shared_ptr<SigmaDatabase> SigmaDatabasePtr;
long PluseCount; // 脉冲数量
long PlusePoint; // 脉冲点数
QString DEMTiffPath; // DEM Tiff 文件路径
QString LandCoverPath;
QString HHSigmaPath;
QString HVSigmaPath;
QString VHSigmaPath;
QString VVSigmaPath;
QString OutEchoPath; // 输出回波路径
QString TaskFileName;
QString tmpfolderPath;
QString OutEchoMaskPath;
public:
ErrorCode Process(long num_thread); // 处理
private: // 处理流程
ErrorCode InitParams();// 1. 初始化参数
ErrorCode DEMPreprocess(); // 2. 裁剪DEM范围
ErrorCode InitEchoMaskArray();
//ErrorCode RTPCMainProcess(long num_thread);
ErrorCode RTPCMainProcess_GPU();
std::shared_ptr<SatelliteOribtNode[]> getSatelliteOribtNodes(double prf_time, double dt, bool antflag, long double imageStarttime);
private:
QString demxyzPath;
QString demmaskPath;
QString demsloperPath;
};
void RTPCProcessMain(long num_thread,QString TansformPatternFilePath,QString ReceivePatternFilePath,QString simulationtaskName, QString OutEchoPath, QString GPSXmlPath,QString TaskXmlPath,QString demTiffPath, QString LandCoverPath, QString HHSigmaPath, QString HVSigmaPath, QString VHSigmaPath, QString VVSigmaPath);

View File

@ -1,5 +1,5 @@
#include <time.h>
#include <iostream>
#include <memory>
#include <cmath>
@ -11,6 +11,7 @@
#include "BaseConstVariable.h"
#include "GPURFPC.cuh"
#ifdef __CUDANVCC___
@ -529,6 +530,125 @@ __global__ void CUDAKernel_RFPC_Caluation_R_Gain(
}
}
__global__ void CUDAKernel_RFPC_Computer_R_Gain(
double antX, double antY, double antZ, // 天线的坐标
double* targetX, double* targetY, double* targetZ, long len, // 地面坐标
long* demCls,
double* demSlopeX, double* demSlopeY, double* demSlopeZ, // 地表坡度矢量
double antXaxisX, double antXaxisY, double antXaxisZ, // 天线坐标系的X轴
double antYaxisX, double antYaxisY, double antYaxisZ,// 天线坐标系的Y轴
double antZaxisX, double antZaxisY, double antZaxisZ,// 天线坐标系的Z轴
double antDirectX, double antDirectY, double antDirectZ,// 天线的指向
double Pt,// 发射能量
double refPhaseRange,
double* TransAntpattern, double Transtarttheta, double Transstartphi, double Transdtheta, double Transdphi, int Transthetapoints, int Transphipoints, // 发射天线方向图
double* ReceiveAntpattern, double Receivestarttheta, double Receivestartphi, double Receivedtheta, double Receivedphi, int Receivethetapoints, int Receivephipoints,//接收天线方向图
double NearR, double FarR, // 距离范围
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,// 插值图
double* outR, // 输出距离
double* outAmp
) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
double tx = targetX[idx];
double ty = targetY[idx];
double tz = targetZ[idx];
double RstX = antX - tx; // 计算坐标矢量
double RstY = antY - ty;
double RstZ = antZ - tz;
double slopeX = demSlopeX[idx];
double slopeY = demSlopeY[idx];
double slopeZ = demSlopeZ[idx];
double RstR2 = RstX * RstX + RstY * RstY + RstZ * RstZ;
double RstR = sqrt(RstR2); // 矢量距离
//printf("antX=%f;antY=%f;antZ=%f;targetX=%f;targetY=%f;targetZ=%f;RstR=%.6f;diffR=%.6f;\n",antX,antY,antZ,targetX,targetY,targetZ,RstR, RstR - 9.010858499003178e+05);
if (RstR<NearR || RstR>FarR) {
}
else {
// 求解坡度
double slopR = sqrtf(slopeX * slopeX + slopeY * slopeY + slopeZ * slopeZ); //
double dotAB = RstX * slopeX + RstY * slopeY + RstZ * slopeZ;
double localangle = acosf(dotAB / (RstR * slopR)); // 局地入射角
double ampGain = 0;
// 求解天线方向图指向
CUDAVectorEllipsoidal antVector = GPU_SatelliteAntDirectNormal(
RstX, RstY, RstZ,
antXaxisX, antXaxisY, antXaxisZ,
antYaxisX, antYaxisY, antYaxisZ,
antZaxisX, antZaxisY, antZaxisZ,
antDirectX, antDirectY, antDirectZ
);
if (antVector.Rho > 0) {
// 发射方向图
double temptheta = antVector.theta * r2d;
double tempphi = antVector.phi * r2d;
double TansantPatternGain =
GPU_BillerInterpAntPattern(
TransAntpattern,
Transtarttheta, Transstartphi, Transdtheta, Transdphi, Transthetapoints, Transphipoints,
temptheta, tempphi);
// 接收方向图
double antPatternGain = GPU_BillerInterpAntPattern(
ReceiveAntpattern,
Receivestarttheta, Receivestartphi, Receivedtheta, Receivedphi, Receivethetapoints, Receivephipoints,
temptheta, tempphi);
// 计算
double sigma0 = 0;
{
long clsid = demCls[idx];
//printf("clsid=%d\n", clsid);
CUDASigmaParam tempsigma = sigma0Paramslist[clsid];
if (localangle < 0 || localangle >= LAMP_CUDA_PI / 2) {
sigma0 = 0;
}
else {}
if (abs(tempsigma.p1) < PRECISIONTOLERANCE &&
abs(tempsigma.p2) < PRECISIONTOLERANCE &&
abs(tempsigma.p3) < PRECISIONTOLERANCE &&
abs(tempsigma.p4) < PRECISIONTOLERANCE &&
abs(tempsigma.p5) < PRECISIONTOLERANCE &&
abs(tempsigma.p6) < PRECISIONTOLERANCE
) {
sigma0 = 0;
}
else {
double sigma = GPU_getSigma0dB(tempsigma, localangle);
sigma0 = powf(10.0, sigma / 10.0);// 后向散射系数
}
}
ampGain = TansantPatternGain * antPatternGain;
ampGain = ampGain / (powf(4 * LAMP_CUDA_PI, 2) * powf(RstR, 4)); // 反射强度
outAmp[idx] = ampGain * Pt * sigma0;
outR[idx] = RstR - refPhaseRange;
}
else {
}
}
}
}
__global__ void CUDAKernel_PRF_FreqEcho(double* temp_R,double factorj,double* temp_real,double* temp_imag,long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
double phi = factorj * temp_R[idx];
temp_real[idx] = cos(phi);
temp_imag[idx] = sin(phi);
}
}
__global__ void CUDAKernel_PRF_CalFreqEcho(
double* Rarr, double* ampArr, long pixelcount,
double* factorj, long freqnum,
@ -559,52 +679,49 @@ __global__ void CUDAKernel_PRF_GeneratorEcho(double* Rarr, double* ampArr, long
double nearR, double farR, double* echo_real, double* echo_imag, long prfid) //11
{
//// 假定共享内存大小为49152 byte
//// 假定每个Block 线程数大小为 256
__shared__ double s_R[GPU_SHARE_MEMORY]; // 距离 256*12 * 8= 49.2kb
//// 假定每个Block 线程数大小为 32
__shared__ double s_R[GPU_SHARE_MEMORY]; // 距离 32*12 * 8= 49.2kb
__shared__ double s_Amp[GPU_SHARE_MEMORY]; // 振幅 3072 * 8= 49.2kb 49.2*2 = 98.4 < 100 KB
const int bid = blockIdx.x; // 获取 grid网格编号ID
const int tid = threadIdx.x;// 获取 单个 block 中的线程ID
const int startPIX = bid * GPU_SHARE_MEMORY;
const int startPIX = bid * GPU_SHARE_STEP;
int curthreadidx = 0;
for (long i = 0; i < GPU_SHARE_STEP; i++) {
curthreadidx = tid * GPU_SHARE_STEP + i;
s_R[curthreadidx] = (startPIX + curthreadidx) < pixelcount ? Rarr[startPIX + curthreadidx] : 0.0;
s_Amp[curthreadidx] = (startPIX + curthreadidx) < pixelcount ? ampArr[startPIX + curthreadidx] : 0.0;
curthreadidx = i * blockDim.x + tid; // 计算分块
s_R[curthreadidx] = (startPIX + i) < pixelcount ? Rarr[startPIX + i] : 0.0;
s_Amp[curthreadidx] = (startPIX + i) < pixelcount ? ampArr[startPIX + i] : 0.0;
}
__syncthreads(); // 确定所有待处理数据都已经进入程序中
//__syncthreads(); // 确定所有待处理数据都已经进入程序中
long freqnumblock = (freqnum + 32 - 1) / 32; //16
if (startPIX < pixelcount) { // 存在可能处理的计算
double temp_real = 0;
double temp_imag = 0;
double factorjTemp = 0;
double temp_phi = 0;
double temp_amp = 0;
long dataid = 0;
curthreadidx = 0;
for (long i = 0; i < freqnumblock; i++) {
curthreadidx = tid * freqnumblock + i; // 获取当前频率
if (curthreadidx < freqnum) { // 存在频率
factorjTemp = factorj[curthreadidx];
for (long j = 0; j < GPU_SHARE_STEP; j++) {
dataid = j * blockDim.x + tid; // 数据编辑
temp_phi = s_R[dataid] * factorjTemp;
temp_amp = s_Amp[dataid];
long freqnumblock = freqnum / 256 + 1; //16
//if (startPIX < pixelcount) { // 存在可能处理的计算
// double temp_real = 0;
// double temp_imag = 0;
// double factorjTemp = 0;
// double temp_phi = 0;
// double temp_amp = 0;
// curthreadidx = 0;
// for (long i = 0; i < freqnumblock; i++) {
// curthreadidx = tid * freqnumblock + i; // 获取当前频率
// if (curthreadidx < freqnum) { // 存在频率
// factorjTemp = factorj[curthreadidx];
// for (long j = 0; j < GPU_SHARE_MEMORY; j++) {
// temp_phi = s_R[j] * factorjTemp;
// temp_amp = s_Amp[j];
// temp_real = temp_real + temp_amp * cos(temp_phi);
// temp_imag = temp_imag + temp_amp * sin(temp_phi);
// }
// //atomicAdd(&echo_real[prfid * freqnum + curthreadidx], temp_real); // 更新实部
// //atomicAdd(&echo_imag[prfid * freqnum + curthreadidx], temp_imag); // 更新虚部
// }
// }
//}
temp_real = temp_real + temp_amp * cos(temp_phi);
temp_imag = temp_imag + temp_amp * sin(temp_phi);
}
atomicAdd(&echo_real[prfid * freqnum + curthreadidx], temp_real); // 更新实部
atomicAdd(&echo_imag[prfid * freqnum + curthreadidx], temp_imag); // 更新虚部
}
}
}
}
@ -612,7 +729,6 @@ __global__ void CUDAKernel_PRF_GeneratorEcho(double* Rarr, double* ampArr, long
/** 对外封装接口 *******************************************************************************************************/
extern "C" void SatelliteAntDirectNormal(double* RstX, double* RstY, double* RstZ,
@ -822,20 +938,74 @@ extern "C" void CUDA_PRF_GeneratorEcho(cublasHandle_t handle,double* Rarr, doub
//cublasDestroy(handle);
}
void CUDA_RFPC_MainProgramm()
{
// 创建 cuBLAS 句柄
cublasHandle_t handle;
cublasStatus_t status = cublasCreate(&handle);
extern "C" void CUDA_RFPC_MainBlock(
double* antX, double* antY, double* antZ, // 天线的坐标
double* antXaxisX, double* antXaxisY, double* antXaxisZ, // 天线坐标系的X轴
double* antYaxisX, double* antYaxisY, double* antYaxisZ,// 天线坐标系的Y轴
double* antZaxisX, double* antZaxisY, double* antZaxisZ,// 天线坐标系的Z轴
double* antDirectX, double* antDirectY, double* antDirectZ,// 天线的指向
long PRFCount, // 脉冲数
double* freqpoints,double* factorj ,long freqnum,// 频率数
double* targetX, double* targetY, double* targetZ, long TargetPixelNumber, // 地面坐标
long* demCls, // 地表类别
double* demSlopeX, double* demSlopeY, double* demSlopeZ, // 地表坡度矢量
double Pt,// 发射能量
double refPhaseRange,
double* TransAntpattern, double Transtarttheta, double Transstartphi, double Transdtheta, double Transdphi, int Transthetapoints, int Transphipoints, // 发射天线方向图
double* ReceiveAntpattern, double Receivestarttheta, double Receivestartphi, double Receivedtheta, double Receivedphi, int Receivethetapoints, int Receivephipoints,//接收天线方向图
double NearR, double FarR, // 距离范围
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,// 插值图
double* out_echoReal, double* out_echoImag,// 输出回波
double* temp_R, double* temp_amp
//, double* temp_phi, double* temp_real, double* temp_imag// 临时变量
) {
long blocknum = 0;
long pixelcount=TargetPixelNumber;
for(long pid=0;pid<PRFCount;pid++){
int blockSize = 256; // 每个块的线程数
int numBlocks = (TargetPixelNumber + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
CUDAKernel_RFPC_Computer_R_Gain<<<numBlocks , blockSize >>>(
antX[pid], antY[pid], antZ[pid],
targetX, targetY, targetZ, TargetPixelNumber,
demCls,
demSlopeX, demSlopeY, demSlopeZ,
antXaxisX[pid], antXaxisY[pid], antXaxisZ[pid],
antYaxisX[pid], antYaxisY[pid], antYaxisZ[pid],
antZaxisX[pid], antZaxisY[pid], antZaxisZ[pid],
antDirectX[pid], antDirectY[pid], antDirectZ[pid],
Pt,// 增益后发射能量
refPhaseRange,
TransAntpattern,
Transtarttheta, Transstartphi, Transdtheta, Transdphi, Transthetapoints, Transphipoints,
ReceiveAntpattern,
Receivestarttheta, Receivestartphi, Receivedtheta, Receivedphi, Receivethetapoints, Receivephipoints,
NearR, FarR,
sigma0Paramslist, sigmaparamslistlen,
//factorj, freqnum,
temp_R, // 输出距离
temp_amp
//out_echoReal, out_echoImag, pid // 输出振幅
);
cudaDeviceSynchronize();
blocknum = pixelcount / GPU_SHARE_MEMORY + 1;
blockSize = 32; // 每个块的线程数
numBlocks = (pixelcount + GPU_SHARE_MEMORY - 1) / GPU_SHARE_MEMORY; // 网格数量
CUDAKernel_PRF_GeneratorEcho << <numBlocks, blockSize >> > (temp_R, temp_amp, blocknum, pixelcount,
factorj, freqnum,
NearR, FarR,
out_echoReal, out_echoImag, pid);
cudaDeviceSynchronize();
}
cublasDestroy(handle);
}
#endif

View File

@ -145,7 +145,27 @@ extern "C" void CUDA_PRF_GeneratorEcho(cublasHandle_t handle,double* Rarr, doub
double* echo_real, double* echo_imag, long prfid);
extern "C" void CUDA_RFPC_MainBlock(
double* antX, double* antY, double* antZ, // 天线的坐标
double* antXaxisX, double* antXaxisY, double* antXaxisZ, // 天线坐标系的X轴
double* antYaxisX, double* antYaxisY, double* antYaxisZ,// 天线坐标系的Y轴
double* antZaxisX, double* antZaxisY, double* antZaxisZ,// 天线坐标系的Z轴
double* antDirectX, double* antDirectY, double* antDirectZ,// 天线的指向
long PRFCount, // 脉冲数
double* freqpoints, double* factorj ,long freqnunm,// 频率数
double* targetX, double* targetY, double* targetZ, long TargetPixelNumber, // 地面坐标
long* demCls, // 地表类别
double* demSlopeX, double* demSlopeY, double* demSlopeZ, // 地表坡度矢量
double Pt,// 发射能量
double refPhaseRange,
double* TransAntpattern, double Transtarttheta, double Transstartphi, double Transdtheta, double Transdphi, int Transthetapoints, int Transphipoints, // 发射天线方向图
double* ReceiveAntpattern, double Receivestarttheta, double Receivestartphi, double Receivedtheta, double Receivedphi, int Receivethetapoints, int Receivephipoints,//接收天线方向图
double NearR, double FarR, // 距离范围
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,// 插值图
double* out_echoReal,double* out_echoImag,// 输出回波
double* temp_R,double* temp_amp
//,double* temp_phi ,double* temp_real, double* tmep_imag// 临时变量
);
#endif

View File

@ -54,7 +54,7 @@ __global__ void CUDAKernel_MemsetBlock(cuComplex* data, cuComplex init0, long le
__global__ void CUDACkernel_SUM_reduce_dynamicshared(float* d_x, float* d_y,long N)
__global__ void CUDACkernel_SUM_reduce_dynamicshared(float* d_x, float* d_y, long N)
{
const int tid = threadIdx.x; // 某个block内的线程标号 index
const int bid = blockIdx.x; // 某个block在网格grid内的标号 index
@ -162,8 +162,20 @@ __global__ void CUDA_GridPoint_Linear_Interp1(float* v, float* q, float* qv, lon
}
}
}
extern __global__ void CUDA_D_sin(double* y, double* X, int n) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < n) {
y[idx] = sin(X[idx]);
}
}
extern __global__ void CUDA_D_cos(double* y, double* X, int n) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < n) {
y[idx] = cos(X[idx]);
}
}
extern "C" void CUDA_MemsetBlock(cuComplex* data, cuComplex init0, long len) {
int blockSize = 256; // 每个块的线程数
@ -251,7 +263,7 @@ extern "C" void FreeCUDADevice(void* ptr) {
// GPU 内存数据转移
extern "C" void HostToDevice(void* hostptr, void* deviceptr, long memsize) {
cudaMemcpy(deviceptr, hostptr, memsize, cudaMemcpyHostToDevice);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
@ -275,6 +287,20 @@ extern "C" void DeviceToHost(void* hostptr, void* deviceptr, long memsize) {
cudaDeviceSynchronize();
}
void DeviceToDevice(void* s_deviceptr, void* t_deviceptr, long memsize)
{
cudaMemcpy(t_deviceptr, s_deviceptr, memsize, cudaMemcpyDeviceToDevice);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("DeviceToHost CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
// 基础运算函数
extern "C" void CUDAdistanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long len) {
// 设置 CUDA 核函数的网格和块的尺寸
@ -365,7 +391,7 @@ extern "C" void CUDAGridPointLinearInterp1(float* v, float* q, float* qv, long
int blockSize = 256; // 每个块的线程数
int numBlocks = (qlen + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDA_GridPoint_Linear_Interp1 << <numBlocks, blockSize >> > ( v, q,qv, xlen, qlen);
CUDA_GridPoint_Linear_Interp1 << <numBlocks, blockSize >> > (v, q, qv, xlen, qlen);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
@ -378,6 +404,43 @@ extern "C" void CUDAGridPointLinearInterp1(float* v, float* q, float* qv, long
}
extern "C" void CUDADSin(double* y, double* X, int n)
{
// 计算 sin(temp) 并存储在 d_temp 中
int blockSize = 256;
int numBlocks = (n + blockSize - 1) / blockSize;
CUDA_D_sin << <numBlocks, blockSize >> > (y, X, n);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("sin CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDADCos(double* y, double* X, int n)
{
// 计算 sin(temp) 并存储在 d_temp 中
int blockSize = 256;
int numBlocks = (n + blockSize - 1) / blockSize;
CUDA_D_cos << <numBlocks, blockSize >> > (y, X, n);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("sin CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
#endif
@ -386,13 +449,13 @@ extern "C" void CUDAGridPointLinearInterp1(float* v, float* q, float* qv, long
extern "C" float CUDA_SUM(float* d_x, long N)
{
long NUM_REPEATS = 100;
int grid_size = (N + BLOCK_SIZE - 1) / BLOCK_SIZE;
const int ymem = sizeof(float) * grid_size;
const int smem = sizeof(float) * BLOCK_SIZE;
float* d_y=(float*)mallocCUDADevice(ymem);
float* d_y = (float*)mallocCUDADevice(ymem);
float* h_y = (float*)mallocCUDAHost(ymem);
CUDACkernel_SUM_reduce_dynamicshared << <grid_size, BLOCK_SIZE, smem >> > (d_x, d_y,N);
CUDACkernel_SUM_reduce_dynamicshared << <grid_size, BLOCK_SIZE, smem >> > (d_x, d_y, N);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
@ -403,17 +466,17 @@ extern "C" float CUDA_SUM(float* d_x, long N)
cudaDeviceSynchronize();
DeviceToHost(h_y, d_y, ymem);
float result = 0.0;
for (int n = 0; n < grid_size; ++n)
{
result += h_y[n];
}
FreeCUDAHost(h_y);
FreeCUDADevice(d_y);
return result;
}

View File

@ -15,9 +15,10 @@
#define BLOCK_SIZE 256
#define GPU_SHARE_MEMORY 2816
#define GPU_SHARE_STEP 11
// 默认显存分布
#define GPU_SHARE_MEMORY 2816
#define GPU_SHARE_STEP 88
enum LAMPGPUDATETYPE {
@ -59,7 +60,8 @@ extern __global__ void CUDA_make_VectorA_B(float sX, float sY, float sZ, float*
extern __global__ void CUDA_Norm_Vector(float* Vx, float* Vy, float* Vz, float* R, long len);
extern __global__ void CUDA_cosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len);
extern __global__ void CUDA_GridPoint_Linear_Interp1(float* v, float* q, float* qv, long xlen, long qlen);
extern __global__ void CUDA_D_sin(double* y, double* X, int n);
extern __global__ void CUDA_D_cos(double* y, double* X, int n);
// 误差处理函数
@ -72,6 +74,7 @@ extern "C" void* mallocCUDADevice( long memsize); // GPU
extern "C" void FreeCUDADevice(void* ptr);
extern "C" void HostToDevice(void* hostptr, void* deviceptr, long memsize);//GPU 内存数据转移 设备 -> GPU
extern "C" void DeviceToHost(void* hostptr, void* deviceptr, long memsize);//GPU 内存数据转移 GPU -> 设备
extern "C" void DeviceToDevice(void* s_deviceptr, void* t_deviceptr, long memsize);//GPU 内存数据转移 GPU -> 设备
extern "C" void CUDA_MemsetBlock(cuComplex* data, cuComplex init0, long len);
// 矢量基础运算函数
@ -84,7 +87,7 @@ extern "C" void CUDAcosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, f
// 常见插值算法
extern "C" void CUDAGridPointLinearInterp1(float* v, float* q, float* qv,long xlen, long qlen);
extern "C" void CUDADSin(double* y, double* X, int n);
extern "C" void CUDADCos(double* y, double* X, int n);
#endif
#endif

View File

@ -68,7 +68,7 @@
<IncludePath>.\SimulationSAR;.\GF3ProcessToolbox;.\BaseTool;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>.\LAMPScatterTool;.\GPUTool;.\SimulationSAR;.\GF3ProcessToolbox;.\BaseTool;$(oneMKLIncludeDir);$(IncludePath)</IncludePath>
<IncludePath>.\LAMPScatterTool;.\GPUTool;.\SimulationSAR;.\BaseToolbox;.\BaseTool;$(oneMKLIncludeDir);$(IncludePath)</IncludePath>
<ReferencePath>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\lib\x64;$(ReferencePath)</ReferencePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -120,6 +120,17 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="BaseToolbox\DEMLLA2XYZTool.cpp" />
<ClCompile Include="BaseToolbox\GF3CalibrationAndGeocodingClass.cpp" />
<ClCompile Include="BaseToolbox\GF3PSTNClass.cpp" />
<ClCompile Include="BaseToolbox\QComplex2AmpPhase.cpp" />
<ClCompile Include="BaseToolbox\QImportGF3StripL1ADataset.cpp" />
<ClCompile Include="BaseToolbox\QOrthSlrRaster.cpp" />
<ClCompile Include="BaseToolbox\QRDOrthProcessClass.cpp" />
<ClCompile Include="BaseToolbox\SatelliteGF3xmlParser.cpp" />
<ClCompile Include="BaseToolbox\SateOrbit.cpp" />
<ClCompile Include="BaseToolbox\simptsn.cpp" />
<ClCompile Include="BaseToolbox\WGS84_J2000.cpp" />
<ClCompile Include="BaseTool\BaseTool.cpp" />
<ClCompile Include="BaseTool\EchoDataFormat.cpp" />
<ClCompile Include="BaseTool\FileOperator.cpp" />
@ -133,7 +144,6 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="GF3ProcessToolbox\QOrthSlrRaster.cpp" />
<ClCompile Include="LAMPScatterTool\LAMPScatterS1B.cpp" />
<ClCompile Include="QSimulationRFPCGUI.cpp" />
<ClCompile Include="RegisterToolbox.cpp">
@ -153,26 +163,18 @@
<ClCompile Include="SimulationSAR\TBPImageAlgCls.cpp" />
<QtRcc Include="Imageshow\qcustomplot.qrc" />
<QtRcc Include="RasterProcessTool.qrc" />
<QtUic Include="BaseToolbox\DEMLLA2XYZTool.ui" />
<QtUic Include="BaseToolbox\QComplex2AmpPhase.ui" />
<QtUic Include="BaseToolbox\QImportGF3StripL1ADataset.ui" />
<QtUic Include="BaseToolbox\QOrthSlrRaster.ui" />
<QtUic Include="BaseToolbox\QRDOrthProcessClass.ui" />
<QtUic Include="BaseTool\QToolProcessBarDialog.ui" />
<QtUic Include="GF3ProcessToolbox\QComplex2AmpPhase.ui" />
<QtUic Include="GF3ProcessToolbox\QImportGF3StripL1ADataset.ui" />
<QtUic Include="GF3ProcessToolbox\QOrthSlrRaster.ui" />
<QtUic Include="GF3ProcessToolbox\QRDOrthProcessClass.ui" />
<QtUic Include="Imageshow\ImageShowDialogClass.ui" />
<QtUic Include="Imageshow\qcustomplot.ui" />
<QtUic Include="QMergeRasterProcessDialog.ui" />
<QtUic Include="QSimulationRFPCGUI.ui" />
<QtUic Include="RasterProcessTool.ui" />
<QtMoc Include="RasterProcessTool.h" />
<ClCompile Include="GF3ProcessToolbox\GF3CalibrationAndGeocodingClass.cpp" />
<ClCompile Include="GF3ProcessToolbox\GF3PSTNClass.cpp" />
<ClCompile Include="GF3ProcessToolbox\QComplex2AmpPhase.cpp" />
<ClCompile Include="GF3ProcessToolbox\QImportGF3StripL1ADataset.cpp" />
<ClCompile Include="GF3ProcessToolbox\QRDOrthProcessClass.cpp" />
<ClCompile Include="GF3ProcessToolbox\SatelliteGF3xmlParser.cpp" />
<ClCompile Include="GF3ProcessToolbox\SateOrbit.cpp" />
<ClCompile Include="GF3ProcessToolbox\simptsn.cpp" />
<ClCompile Include="GF3ProcessToolbox\WGS84_J2000.cpp" />
<ClCompile Include="Imageshow\ImageShowDialogClass.cpp" />
<ClCompile Include="Imageshow\qcustomplot.cpp" />
<ClCompile Include="QMergeRasterProcessDialog.cpp" />
@ -186,6 +188,17 @@
<QtMoc Include="SimulationSAR\QToolAbstract.h" />
<QtMoc Include="RegisterToolbox.h" />
<QtMoc Include="SimulationSAR\QSimulationBPImage.h" />
<QtMoc Include="BaseToolbox\DEMLLA2XYZTool.h" />
<ClInclude Include="BaseToolbox\GF3CalibrationAndGeocodingClass.h" />
<ClInclude Include="BaseToolbox\GF3PSTNClass.h" />
<QtMoc Include="BaseToolbox\QComplex2AmpPhase.h" />
<QtMoc Include="BaseToolbox\QImportGF3StripL1ADataset.h" />
<QtMoc Include="BaseToolbox\QOrthSlrRaster.h" />
<QtMoc Include="BaseToolbox\QRDOrthProcessClass.h" />
<ClInclude Include="BaseToolbox\SatelliteGF3xmlParser.h" />
<ClInclude Include="BaseToolbox\SateOrbit.h" />
<ClInclude Include="BaseToolbox\simptsn.h" />
<ClInclude Include="BaseToolbox\WGS84_J2000.h" />
<ClInclude Include="BaseTool\BaseConstVariable.h" />
<ClInclude Include="BaseTool\BaseTool.h" />
<ClInclude Include="BaseTool\EchoDataFormat.h" />
@ -203,21 +216,11 @@
<ClInclude Include="LAMPScatterTool\LAMPScatterS1B.h" />
<ClInclude Include="SimulationSAR\TBPImageAlgCls.h" />
<QtMoc Include="QSimulationRFPCGUI.h" />
<QtMoc Include="GF3ProcessToolbox\QOrthSlrRaster.h" />
<ClInclude Include="SimulationSAR\RFPCProcessCls.h" />
<ClInclude Include="SimulationSAR\SARSatelliteSimulationAbstractCls.h" />
<ClInclude Include="SimulationSAR\SARSimulationTaskSetting.h" />
<ClInclude Include="SimulationSAR\SatelliteOribtModel.h" />
<ClInclude Include="SimulationSAR\SigmaDatabase.h" />
<ClInclude Include="GF3ProcessToolbox\GF3CalibrationAndGeocodingClass.h" />
<ClInclude Include="GF3ProcessToolbox\GF3PSTNClass.h" />
<QtMoc Include="GF3ProcessToolbox\QImportGF3StripL1ADataset.h" />
<QtMoc Include="GF3ProcessToolbox\QComplex2AmpPhase.h" />
<QtMoc Include="GF3ProcessToolbox\QRDOrthProcessClass.h" />
<ClInclude Include="GF3ProcessToolbox\SatelliteGF3xmlParser.h" />
<ClInclude Include="GF3ProcessToolbox\SateOrbit.h" />
<ClInclude Include="GF3ProcessToolbox\simptsn.h" />
<ClInclude Include="GF3ProcessToolbox\WGS84_J2000.h" />
<QtMoc Include="Imageshow\qcustomplot.h" />
<QtMoc Include="Imageshow\ImageShowDialogClass.h" />
<QtMoc Include="QMergeRasterProcessDialog.h" />

View File

@ -27,9 +27,6 @@
<Filter Include="SimulationSAR">
<UniqueIdentifier>{c019ab22-835f-44bd-8689-f5550c9c690d}</UniqueIdentifier>
</Filter>
<Filter Include="GF3ProcessToolbox">
<UniqueIdentifier>{c49d5cbf-5e46-46f8-880c-1f1f9d6e32e9}</UniqueIdentifier>
</Filter>
<Filter Include="BaseTool">
<UniqueIdentifier>{101c627b-537e-4c7f-862c-380d3f7f226f}</UniqueIdentifier>
</Filter>
@ -39,6 +36,9 @@
<Filter Include="LAMPScatter">
<UniqueIdentifier>{cc849de4-c841-40e3-96bc-54ebe034fa4a}</UniqueIdentifier>
</Filter>
<Filter Include="BaseToolbox">
<UniqueIdentifier>{c49d5cbf-5e46-46f8-880c-1f1f9d6e32e9}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<QtRcc Include="RasterProcessTool.qrc">
@ -70,33 +70,6 @@
<ClCompile Include="Imageshow\qcustomplot.cpp">
<Filter>Imageshow</Filter>
</ClCompile>
<ClCompile Include="GF3ProcessToolbox\GF3CalibrationAndGeocodingClass.cpp">
<Filter>GF3ProcessToolbox</Filter>
</ClCompile>
<ClCompile Include="GF3ProcessToolbox\GF3PSTNClass.cpp">
<Filter>GF3ProcessToolbox</Filter>
</ClCompile>
<ClCompile Include="GF3ProcessToolbox\SatelliteGF3xmlParser.cpp">
<Filter>GF3ProcessToolbox</Filter>
</ClCompile>
<ClCompile Include="GF3ProcessToolbox\SateOrbit.cpp">
<Filter>GF3ProcessToolbox</Filter>
</ClCompile>
<ClCompile Include="GF3ProcessToolbox\simptsn.cpp">
<Filter>GF3ProcessToolbox</Filter>
</ClCompile>
<ClCompile Include="GF3ProcessToolbox\WGS84_J2000.cpp">
<Filter>GF3ProcessToolbox</Filter>
</ClCompile>
<ClCompile Include="GF3ProcessToolbox\QImportGF3StripL1ADataset.cpp">
<Filter>GF3ProcessToolbox</Filter>
</ClCompile>
<ClCompile Include="GF3ProcessToolbox\QComplex2AmpPhase.cpp">
<Filter>GF3ProcessToolbox</Filter>
</ClCompile>
<ClCompile Include="GF3ProcessToolbox\QRDOrthProcessClass.cpp">
<Filter>GF3ProcessToolbox</Filter>
</ClCompile>
<ClCompile Include="SimulationSAR\RFPCProcessCls.cpp">
<Filter>SimulationSAR</Filter>
</ClCompile>
@ -115,9 +88,6 @@
<ClCompile Include="QSimulationRFPCGUI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GF3ProcessToolbox\QOrthSlrRaster.cpp">
<Filter>GF3ProcessToolbox</Filter>
</ClCompile>
<ClCompile Include="SimulationSAR\TBPImageAlgCls.cpp">
<Filter>SimulationSAR</Filter>
</ClCompile>
@ -166,26 +136,41 @@
<ClCompile Include="LAMPScatterTool\LAMPScatterS1B.cpp">
<Filter>LAMPScatter</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\DEMLLA2XYZTool.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\GF3CalibrationAndGeocodingClass.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\GF3PSTNClass.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\QComplex2AmpPhase.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\QImportGF3StripL1ADataset.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\QOrthSlrRaster.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\QRDOrthProcessClass.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\SatelliteGF3xmlParser.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\SateOrbit.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\simptsn.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\WGS84_J2000.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GF3ProcessToolbox\GF3CalibrationAndGeocodingClass.h">
<Filter>GF3ProcessToolbox</Filter>
</ClInclude>
<ClInclude Include="GF3ProcessToolbox\GF3PSTNClass.h">
<Filter>GF3ProcessToolbox</Filter>
</ClInclude>
<ClInclude Include="GF3ProcessToolbox\SatelliteGF3xmlParser.h">
<Filter>GF3ProcessToolbox</Filter>
</ClInclude>
<ClInclude Include="GF3ProcessToolbox\SateOrbit.h">
<Filter>GF3ProcessToolbox</Filter>
</ClInclude>
<ClInclude Include="GF3ProcessToolbox\simptsn.h">
<Filter>GF3ProcessToolbox</Filter>
</ClInclude>
<ClInclude Include="GF3ProcessToolbox\WGS84_J2000.h">
<Filter>GF3ProcessToolbox</Filter>
</ClInclude>
<ClInclude Include="SimulationSAR\RFPCProcessCls.h">
<Filter>SimulationSAR</Filter>
</ClInclude>
@ -246,6 +231,24 @@
<ClInclude Include="LAMPScatterTool\LAMPScatterS1B.h">
<Filter>LAMPScatter</Filter>
</ClInclude>
<ClInclude Include="BaseToolbox\GF3CalibrationAndGeocodingClass.h">
<Filter>BaseToolbox</Filter>
</ClInclude>
<ClInclude Include="BaseToolbox\GF3PSTNClass.h">
<Filter>BaseToolbox</Filter>
</ClInclude>
<ClInclude Include="BaseToolbox\SatelliteGF3xmlParser.h">
<Filter>BaseToolbox</Filter>
</ClInclude>
<ClInclude Include="BaseToolbox\SateOrbit.h">
<Filter>BaseToolbox</Filter>
</ClInclude>
<ClInclude Include="BaseToolbox\simptsn.h">
<Filter>BaseToolbox</Filter>
</ClInclude>
<ClInclude Include="BaseToolbox\WGS84_J2000.h">
<Filter>BaseToolbox</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<QtMoc Include="QMergeRasterProcessDialog.h">
@ -257,21 +260,9 @@
<QtMoc Include="Imageshow\qcustomplot.h">
<Filter>Imageshow</Filter>
</QtMoc>
<QtMoc Include="GF3ProcessToolbox\QImportGF3StripL1ADataset.h">
<Filter>GF3ProcessToolbox</Filter>
</QtMoc>
<QtMoc Include="GF3ProcessToolbox\QComplex2AmpPhase.h">
<Filter>GF3ProcessToolbox</Filter>
</QtMoc>
<QtMoc Include="GF3ProcessToolbox\QRDOrthProcessClass.h">
<Filter>GF3ProcessToolbox</Filter>
</QtMoc>
<QtMoc Include="QSimulationRFPCGUI.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="GF3ProcessToolbox\QOrthSlrRaster.h">
<Filter>GF3ProcessToolbox</Filter>
</QtMoc>
<QtMoc Include="BaseTool\QToolProcessBarDialog.h">
<Filter>Header Files</Filter>
</QtMoc>
@ -287,6 +278,21 @@
<QtMoc Include="SimulationSAR\QSimulationBPImage.h">
<Filter>SimulationSAR</Filter>
</QtMoc>
<QtMoc Include="BaseToolbox\DEMLLA2XYZTool.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="BaseToolbox\QRDOrthProcessClass.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
<QtMoc Include="BaseToolbox\QComplex2AmpPhase.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
<QtMoc Include="BaseToolbox\QImportGF3StripL1ADataset.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
<QtMoc Include="BaseToolbox\QOrthSlrRaster.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<QtUic Include="QMergeRasterProcessDialog.ui">
@ -298,21 +304,9 @@
<QtUic Include="Imageshow\qcustomplot.ui">
<Filter>Imageshow</Filter>
</QtUic>
<QtUic Include="GF3ProcessToolbox\QImportGF3StripL1ADataset.ui">
<Filter>GF3ProcessToolbox</Filter>
</QtUic>
<QtUic Include="GF3ProcessToolbox\QComplex2AmpPhase.ui">
<Filter>GF3ProcessToolbox</Filter>
</QtUic>
<QtUic Include="GF3ProcessToolbox\QRDOrthProcessClass.ui">
<Filter>GF3ProcessToolbox</Filter>
</QtUic>
<QtUic Include="QSimulationRFPCGUI.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="GF3ProcessToolbox\QOrthSlrRaster.ui">
<Filter>GF3ProcessToolbox</Filter>
</QtUic>
<QtUic Include="SimulationSAR\QImageSARRFPC.ui">
<Filter>SimulationSAR</Filter>
</QtUic>
@ -322,6 +316,21 @@
<QtUic Include="BaseTool\QToolProcessBarDialog.ui">
<Filter>BaseTool</Filter>
</QtUic>
<QtUic Include="BaseToolbox\DEMLLA2XYZTool.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="BaseToolbox\QComplex2AmpPhase.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
<QtUic Include="BaseToolbox\QImportGF3StripL1ADataset.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
<QtUic Include="BaseToolbox\QOrthSlrRaster.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
<QtUic Include="BaseToolbox\QRDOrthProcessClass.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<CudaCompile Include="GPUTool\GPURFPC.cu">

View File

@ -410,7 +410,7 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU()
// 每块 250MB*16 = 4GB
blokline = Memory1MB * 500 / 8 / demCol;
blokline = Memory1MB / 8 / demCol * 500;
blokline = blokline < 1 ? 1 : blokline;
bool bloklineflag = false;
@ -574,51 +574,41 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU()
// 提前声明参数变量
double* h_R = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
double* d_R = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
double* h_amp = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
double* d_amp = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
//double* h_phi = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
//double* d_phi = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
//double* h_real = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
//double* d_real = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
//double* h_imag = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
//double* d_imag = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
double* h_one = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
double* d_one = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
for (long ii = 0; ii < blokline * tempDemCols; ii++) {
h_one[ii] = 1;
}
HostToDevice(h_one, d_one, sizeof(double) * blokline * tempDemCols);
double* h_temp = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
double* d_temp = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
// 地面回波
cuComplex* h_echo = (cuComplex*)mallocCUDAHost(sizeof(cuComplex) * blokline * tempDemCols);
cuComplex* d_echo = (cuComplex*)mallocCUDADevice(sizeof(cuComplex) * blokline * tempDemCols); //19
long echoblockline = Memory1GB / 8 / 2 / PlusePoint * 1;
// 每一行的脉冲
long echoblockline = Memory1GB / 8 / 2 / PlusePoint * 2;
double* h_PRFEcho_real = (double*)mallocCUDAHost(sizeof(double) * echoblockline * PlusePoint);
double* h_PRFEcho_imag = (double*)mallocCUDAHost(sizeof(double) * echoblockline * PlusePoint);
double* d_PRFEcho_real = (double*)mallocCUDADevice(sizeof(double) * echoblockline * PlusePoint);
double* d_PRFEcho_imag = (double*)mallocCUDADevice(sizeof(double) * echoblockline * PlusePoint);
double* h_factorj = (double*)mallocCUDAHost(sizeof(double) * freqlist.size());
double* d_factorj = (double*)mallocCUDADevice(sizeof(double) * freqlist.size());
double* h_freqlist = (double*)mallocCUDAHost(sizeof(double) * freqlist.size());
for (long ii = 0; ii < freqlist.size(); ii++) {
h_factorj[ii] = -4*PI*freqlist[ii]/LIGHTSPEED;
h_factorj[ii] = -4 * PI * freqlist[ii] / LIGHTSPEED;
h_freqlist[ii] = freqlist[ii];
}
HostToDevice(h_factorj, d_factorj, sizeof(double) * freqlist.size());
double* d_factorj = (double*)mallocCUDADevice(sizeof(double) * freqlist.size());
double* d_freqlist = (double*)mallocCUDADevice(sizeof(double) * freqlist.size());
HostToDevice(h_factorj, d_factorj, (sizeof(double) * freqlist.size()));
HostToDevice(h_freqlist, d_freqlist, (sizeof(double) * freqlist.size()));
testOutAmpArr("freqlist.bin", h_freqlist, freqlist.size(), 1);
testOutAmpArr("factorj.bin", h_factorj, freqlist.size(), 1);
// 地表覆盖类型
Eigen::MatrixXd landcover = Eigen::MatrixXd::Zero(blokline, tempDemCols);// 地面覆盖类型
long* h_demcls = (long*)mallocCUDAHost(sizeof(long) * blokline * tempDemCols);
long* d_demcls = (long*)mallocCUDADevice(sizeof(long) * blokline * tempDemCols);
cublasHandle_t handle;
cublasStatus_t status = cublasCreate(&handle);
for (startline = 0; startline < demRow; startline = startline + blokline) {
long newblokline = blokline;
if ((startline + blokline) >= demRow) {
@ -628,20 +618,18 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU()
dem_x = demxyz.getData(startline, 0, newblokline, blockwidth, 1); // 地面坐标
dem_y = demxyz.getData(startline, 0, newblokline, blockwidth, 2);
dem_z = demxyz.getData(startline, 0, newblokline, blockwidth, 3);
demsloper_x = demsloperxyz.getData(startline, 0, newblokline,blockwidth, 1);
demsloper_y = demsloperxyz.getData(startline, 0, newblokline,blockwidth, 2);
demsloper_z = demsloperxyz.getData(startline, 0, newblokline,blockwidth, 3);
demsloper_x = demsloperxyz.getData(startline, 0, newblokline, blockwidth, 1);
demsloper_y = demsloperxyz.getData(startline, 0, newblokline, blockwidth, 2);
demsloper_z = demsloperxyz.getData(startline, 0, newblokline, blockwidth, 3);
landcover = demlandcls.getData(startline, 0, newblokline, blockwidth, 1);
long calpluseFreqBufferLen = Memory1GB / 8 / 2 / PlusePoint * 2;
if (calpluseFreqBufferLen < 1000) {
qDebug() << "frequency point has morn than 50000";
QMessageBox::warning(nullptr,u8"frequency point has morn than 50000",u8"frequency point has morn than 50000");
QMessageBox::warning(nullptr, u8"frequency point has morn than 50000", u8"frequency point has morn than 50000");
}
cuComplex* pluseFreqPointBuffer = (cuComplex*)mallocCUDADevice(sizeof(cuComplex)*calpluseFreqBufferLen*PlusePoint);
if (bloklineflag) {
FreeCUDAHost(h_dem_x); FreeCUDADevice(d_dem_x);
@ -650,12 +638,12 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU()
FreeCUDAHost(h_demsloper_x); FreeCUDADevice(d_demsloper_x);
FreeCUDAHost(h_demsloper_y); FreeCUDADevice(d_demsloper_y);
FreeCUDAHost(h_demsloper_z); FreeCUDADevice(d_demsloper_z); //6
FreeCUDAHost(h_demcls); FreeCUDADevice(d_demcls);
FreeCUDAHost(h_R); FreeCUDADevice(d_R);
FreeCUDAHost(h_amp); FreeCUDADevice(d_amp);
FreeCUDAHost(h_echo); FreeCUDADevice(d_echo);//19
FreeCUDAHost(h_demcls); FreeCUDADevice(d_demcls);
FreeCUDAHost(h_one); FreeCUDADevice(d_one);
FreeCUDAHost(h_temp); FreeCUDADevice(d_temp);
//FreeCUDAHost(h_phi); FreeCUDADevice(d_phi);
//FreeCUDAHost(h_real); FreeCUDADevice(d_real);
//FreeCUDAHost(h_imag); FreeCUDADevice(d_imag);
h_dem_x = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_dem_y = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
@ -663,27 +651,30 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU()
h_demsloper_x = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_demsloper_y = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_demsloper_z = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_R = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_amp = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_echo = (cuComplex*)mallocCUDAHost(sizeof(cuComplex) * newblokline * tempDemCols);
h_demcls = (long*)mallocCUDAHost(sizeof(long) * newblokline * tempDemCols);
d_dem_x = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
d_dem_y = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
d_dem_z = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
d_demsloper_x = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
d_demsloper_y = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
d_demsloper_z = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);//6
d_amp = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
d_echo = (cuComplex*)mallocCUDADevice(sizeof(cuComplex) * newblokline * tempDemCols);
d_demcls = (long*)mallocCUDADevice(sizeof(long) * newblokline * tempDemCols);
// 临时变量
h_R = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
d_R = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
h_amp = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
d_amp = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
//h_phi = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
//d_phi = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
//h_real = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
//d_real = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
//h_imag = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
//d_imag = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
h_one = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
d_one = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
h_temp = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
d_temp = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
}
//# pragma omp parallel for
@ -692,26 +683,24 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU()
#ifdef __PRFDEBUG__
h_dem_x[i * blockwidth + j] = -2028380.6250000; double(dem_x(i, j));
h_dem_y[i * blockwidth + j] = 4139373.250000; double(dem_y(i, j));
h_dem_z[i * blockwidth + j] = 4393382.500000;double(dem_z(i, j));
h_demsloper_x[i * blockwidth + j] = 4393382.500000;double(demsloper_x(i, j));
h_demsloper_y[i * blockwidth + j] = 446.923950;double(demsloper_y(i, j));
h_demsloper_z[i * blockwidth + j] = -219.002213;double(demsloper_z(i, j));
h_demcls[i * blockwidth + j] = clamap[80] ;// clamap[long(landcover(i, j))];
h_dem_z[i * blockwidth + j] = 4393382.500000; double(dem_z(i, j));
h_demsloper_x[i * blockwidth + j] = 4393382.500000; double(demsloper_x(i, j));
h_demsloper_y[i * blockwidth + j] = 446.923950; double(demsloper_y(i, j));
h_demsloper_z[i * blockwidth + j] = -219.002213; double(demsloper_z(i, j));
h_demcls[i * blockwidth + j] = clamap[80];// clamap[long(landcover(i, j))];
#else
h_dem_x[i * blockwidth + j] = double(dem_x(i, j));
h_dem_y[i * blockwidth + j] = double(dem_y(i, j));
h_dem_y[i * blockwidth + j] = double(dem_y(i, j));
h_dem_z[i * blockwidth + j] = double(dem_z(i, j));
h_demsloper_x[i * blockwidth + j] = double(demsloper_x(i, j));
h_demsloper_y[i * blockwidth + j] = double(demsloper_y(i, j));
h_demsloper_z[i * blockwidth + j] = double(demsloper_z(i, j));
h_demcls[i * blockwidth + j] = clamap[long(landcover(i, j))];
h_demsloper_x[i * blockwidth + j] = double(demsloper_x(i, j));
h_demsloper_y[i * blockwidth + j] = double(demsloper_y(i, j));
h_demsloper_z[i * blockwidth + j] = double(demsloper_z(i, j));
h_demcls[i * blockwidth + j] = clamap[long(landcover(i, j))];
#endif
h_one[i * blockwidth + j] = 1;
}
}
HostToDevice(h_one, d_one, sizeof(double) * newblokline * tempDemCols);
HostToDevice((void*)h_dem_x, (void*)d_dem_x, sizeof(double) * newblokline * tempDemCols); // 复制 机器 -> GPU
HostToDevice((void*)h_dem_y, (void*)d_dem_y, sizeof(double) * newblokline * tempDemCols);
HostToDevice((void*)h_dem_z, (void*)d_dem_z, sizeof(double) * newblokline * tempDemCols);
@ -724,7 +713,7 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU()
#ifdef __PRFDEBUG__ && __PRFDEBUG_PRFINF__
printf("tatgetPs=[%f,%f,%f]\n", h_dem_x[0], h_dem_y[0], h_dem_z[0]);
std::shared_ptr<double> h_temp_R(new double[PluseCount],delArrPtr);
std::shared_ptr<double> h_temp_R(new double[PluseCount], delArrPtr);
#endif // __PRFDEBUG__
@ -733,109 +722,123 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU()
long pixelcount = newblokline * tempDemCols;
long startprfid = 0;
for (startprfid = 0; startprfid < pluseCount; startprfid = startprfid + echoblockline) {
std::cout << "[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz").toStdString() << "] dem:\t" << startline << "\t-\t" << startline + newblokline << "\t:\t pluse :\t" << startprfid << " / " << pluseCount << std::endl;
long templine = startprfid + echoblockline < PluseCount ? echoblockline : PluseCount - startprfid;
std::shared_ptr<std::complex<double>> echotemp = this->EchoSimulationData->getEchoArr(startprfid, templine);
for (long tempprfid = 0; tempprfid < templine; tempprfid++) {
for (long freqid = 0; freqid < PlusePoint; freqid++) {
h_PRFEcho_real[tempprfid * PlusePoint + freqid] = echotemp.get()[tempprfid * PlusePoint + freqid].real();
h_PRFEcho_imag[tempprfid * PlusePoint + freqid] = echotemp.get()[tempprfid * PlusePoint + freqid].imag();
h_PRFEcho_real[tempprfid * PlusePoint + freqid] = 0;// echotemp.get()[tempprfid * PlusePoint + freqid].real();
h_PRFEcho_imag[tempprfid * PlusePoint + freqid] = 0;// echotemp.get()[tempprfid * PlusePoint + freqid].imag();
}
}
HostToDevice(h_PRFEcho_real, d_PRFEcho_real, sizeof(double) * echoblockline * PlusePoint);
HostToDevice(h_PRFEcho_imag, d_PRFEcho_imag, sizeof(double) * echoblockline * PlusePoint);
double* antpx = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antpy = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antpz = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antvx = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antvy = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antvz = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antdirectx = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antdirecty = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antdirectz = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antXaxisX = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antXaxisY = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antXaxisZ = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antYaxisX = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antYaxisY = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antYaxisZ = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antZaxisX = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antZaxisY = (double*)mallocCUDAHost(sizeof(double) * templine);
double* antZaxisZ = (double*)mallocCUDAHost(sizeof(double) * templine);
for (long tempprfid = 0; tempprfid < templine; tempprfid++) {
{// 计算
long prfid = tempprfid + startprfid;
//std::cout << "\r[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz").toStdString() << "]\t" << prfid<<"\t start R\t\t\t\n";
// 天线位置
double antpx = sateOirbtNodes[prfid].Px;
double antpy = sateOirbtNodes[prfid].Py;
double antpz = sateOirbtNodes[prfid].Pz;
double antvx = sateOirbtNodes[prfid].Vx;
double antvy = sateOirbtNodes[prfid].Vy;
double antvz = sateOirbtNodes[prfid].Vz; //6
double antdirectx = sateOirbtNodes[prfid].AntDirecX;
double antdirecty = sateOirbtNodes[prfid].AntDirecY;
double antdirectz = sateOirbtNodes[prfid].AntDirecZ; // 9 天线指向
double antXaxisX = sateOirbtNodes[prfid].AntXaxisX;
double antXaxisY = sateOirbtNodes[prfid].AntXaxisY;
double antXaxisZ = sateOirbtNodes[prfid].AntXaxisZ;//12 天线坐标系
double antYaxisX = sateOirbtNodes[prfid].AntYaxisX;
double antYaxisY = sateOirbtNodes[prfid].AntYaxisY;
double antYaxisZ = sateOirbtNodes[prfid].AntYaxisZ;//15
double antZaxisX = sateOirbtNodes[prfid].AntZaxisX;
double antZaxisY = sateOirbtNodes[prfid].AntZaxisY;
double antZaxisZ = sateOirbtNodes[prfid].AntZaxisZ;//18
// 计算距离、局地入射角、增益
CUDARFPC_Caluation_R_Gain(
antpx, antpy, antpz, // 天线的坐标
d_dem_x, d_dem_y, d_dem_z, pixelcount, // 地面坐标
d_demcls,
d_demsloper_x, d_demsloper_y, d_demsloper_z, // 地表坡度矢量
antXaxisX, antXaxisY, antXaxisZ, // 天线坐标系的X轴
antYaxisX, antYaxisY, antYaxisZ,// 天线坐标系的Y轴
antZaxisX, antZaxisY, antZaxisZ,// 天线坐标系的Z轴
antdirectx, antdirecty, antdirectz,// 天线的指向
Pt,// 增益后发射能量
refphaseRange,
d_TantPattern, TstartTheta, TstartPhi, Tdtheta, Tdphi, Tthetanum, Tphinum, // 发射天线方向图
d_RantPattern, RstartTheta, RstartPhi, Rdtheta, Rdphi, Rthetanum, Rphinum,//接收天线方向图
NearRange, FarRange,
d_clsSigmaParam, clamapid,
d_factorj, PlusePoint,
d_R, // 输出距离
//d_amp
d_PRFEcho_real, d_PRFEcho_imag,tempprfid // 输出振幅
);
//std::cout << "\r[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz").toStdString() << "]\t" << prfid << "\t cal R\t\t\t\n";
//for (long fid = 0; fid < freqnum; fid++) {
// CUDA_PRF_GeneratorEcho(handle,d_R, d_amp, pixelcount,
// d_factorj, PlusePoint,
// NearRange, FarRange,
// d_PRFEcho_real, d_PRFEcho_imag, tempprfid);
//}
//std::cout << "\r[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz").toStdString() << "]\t" << prfid << "\t end Echo\t\t\t\n";
if (prfid % 100 == 0) {
std::cout << "[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz").toStdString() << "] dem:\t" << startline << "\t-\t" << startline + newblokline << "\t:\t pluse :\t" << prfid << " / " << pluseCount << std::endl;
}
#ifdef __PRFDEBUG__ && __PRFDEBUG_PRFINF__
DeviceToHost(h_R, d_R, sizeof(double)* newblokline* tempDemCols);
h_temp_R.get()[prfid] = h_R[0];
#endif
}
long prfid = tempprfid + startprfid;
antpx[tempprfid] = sateOirbtNodes[prfid].Px;
antpy[tempprfid] = sateOirbtNodes[prfid].Py;
antpz[tempprfid] = sateOirbtNodes[prfid].Pz;
antvx[tempprfid] = sateOirbtNodes[prfid].Vx;
antvy[tempprfid] = sateOirbtNodes[prfid].Vy;
antvz[tempprfid] = sateOirbtNodes[prfid].Vz; //6
antdirectx[tempprfid] = sateOirbtNodes[prfid].AntDirecX;
antdirecty[tempprfid] = sateOirbtNodes[prfid].AntDirecY;
antdirectz[tempprfid] = sateOirbtNodes[prfid].AntDirecZ; // 9 天线指向
antXaxisX[tempprfid] = sateOirbtNodes[prfid].AntXaxisX;
antXaxisY[tempprfid] = sateOirbtNodes[prfid].AntXaxisY;
antXaxisZ[tempprfid] = sateOirbtNodes[prfid].AntXaxisZ;//12 天线坐标系
antYaxisX[tempprfid] = sateOirbtNodes[prfid].AntYaxisX;
antYaxisY[tempprfid] = sateOirbtNodes[prfid].AntYaxisY;
antYaxisZ[tempprfid] = sateOirbtNodes[prfid].AntYaxisZ;//15
antZaxisX[tempprfid] = sateOirbtNodes[prfid].AntZaxisX;
antZaxisY[tempprfid] = sateOirbtNodes[prfid].AntZaxisY;
antZaxisZ[tempprfid] = sateOirbtNodes[prfid].AntZaxisZ;//18
}
CUDA_RFPC_MainBlock(
antpx, antpy, antpz, // 天线的坐标
antXaxisX, antXaxisY, antXaxisZ, // 天线坐标系的X轴
antYaxisX, antYaxisY, antYaxisZ,// 天线坐标系的Y轴
antZaxisX, antZaxisY, antZaxisZ,// 天线坐标系的Z轴
antdirectx, antdirecty, antdirectz,// 天线的指向
templine, // 脉冲数
//h_freqlist, h_factorj, PlusePoint,// 频率数
d_freqlist, d_factorj, PlusePoint,// 频率数
d_dem_x, d_dem_y, d_dem_z, pixelcount, // 地面坐标
d_demcls,
d_demsloper_x, d_demsloper_y, d_demsloper_z, // 地表坡度矢量
Pt,// 增益后发射能量
refphaseRange,
d_TantPattern, TstartTheta, TstartPhi, Tdtheta, Tdphi, Tthetanum, Tphinum, // 发射天线方向图
d_RantPattern, RstartTheta, RstartPhi, Rdtheta, Rdphi, Rthetanum, Rphinum,//接收天线方向图
NearRange, FarRange,
d_clsSigmaParam, clamapid,
d_PRFEcho_real, d_PRFEcho_imag,// 输出回波
d_R, d_amp
//, d_phi, d_real, d_imag// 临时变量
);
FreeCUDAHost(antpx); // 回收局部数据
FreeCUDAHost(antpy);
FreeCUDAHost(antpz);
FreeCUDAHost(antvx);
FreeCUDAHost(antvy);
FreeCUDAHost(antvz);
FreeCUDAHost(antdirectx);
FreeCUDAHost(antdirecty);
FreeCUDAHost(antdirectz);
FreeCUDAHost(antXaxisX);
FreeCUDAHost(antXaxisY);
FreeCUDAHost(antXaxisZ);
FreeCUDAHost(antYaxisX);
FreeCUDAHost(antYaxisY);
FreeCUDAHost(antYaxisZ);
FreeCUDAHost(antZaxisX);
FreeCUDAHost(antZaxisY);
FreeCUDAHost(antZaxisZ);
DeviceToHost(h_PRFEcho_real, d_PRFEcho_real, sizeof(double) * echoblockline * PlusePoint);
DeviceToHost(h_PRFEcho_imag, d_PRFEcho_imag, sizeof(double) * echoblockline * PlusePoint);
for (long tempprfid = 0; tempprfid < templine; tempprfid++) {
for (long freqid = 0; freqid < PlusePoint; freqid++) {
echotemp.get()[tempprfid * PlusePoint + freqid].real(h_PRFEcho_real[tempprfid * PlusePoint + freqid]);
echotemp.get()[tempprfid * PlusePoint + freqid].imag(h_PRFEcho_imag[tempprfid * PlusePoint + freqid]);
echotemp.get()[tempprfid * PlusePoint + freqid].real(
echotemp.get()[tempprfid * PlusePoint + freqid].real()+h_PRFEcho_real[tempprfid * PlusePoint + freqid]);
echotemp.get()[tempprfid * PlusePoint + freqid].imag(
echotemp.get()[tempprfid * PlusePoint + freqid].imag() + h_PRFEcho_imag[tempprfid * PlusePoint + freqid]);
}
}
this->EchoSimulationData->saveEchoArr(echotemp, startprfid, templine);
}
#ifdef __PRFDEBUG__ && __PRFDEBUG_PRFINF__
testOutAmpArr("test_out_D_R.bin", h_temp_R.get(), pluseCount, 1);
#endif
#ifdef __PRFDEBUG__
break;
#endif // __PRFDEBUG__
}
}
std::cout << std::endl;
// 释放资源
cublasDestroy(handle);
// 地面数据释放
FreeCUDAHost(h_dem_x); FreeCUDADevice(d_dem_x);
FreeCUDAHost(h_dem_y); FreeCUDADevice(d_dem_y);
@ -849,11 +852,13 @@ ErrorCode RFPCProcessCls::RFPCMainProcess_GPU()
FreeCUDAHost(h_amp); FreeCUDADevice(d_amp);
FreeCUDAHost(h_demcls); FreeCUDADevice(d_demcls);
FreeCUDAHost(h_factorj); FreeCUDADevice(d_factorj);
FreeCUDAHost(h_factorj); FreeCUDADevice(d_factorj);
FreeCUDAHost(h_freqlist); FreeCUDADevice(d_freqlist);
FreeCUDAHost(h_PRFEcho_real); FreeCUDADevice(d_PRFEcho_real);
FreeCUDAHost(h_PRFEcho_imag); FreeCUDADevice(d_PRFEcho_imag);
FreeCUDAHost(h_one); FreeCUDADevice(d_one);
FreeCUDAHost(h_temp); FreeCUDADevice(d_temp);
//FreeCUDAHost(h_phi); FreeCUDADevice(d_phi);
//FreeCUDAHost(h_real); FreeCUDADevice(d_real);
//FreeCUDAHost(h_imag); FreeCUDADevice(d_imag);
#endif