修改记录:

1. RTPC算法修改为RFPC
2. 删去Fs的读取,由带宽与成像范围计算得到频率点数
pull/3/head
陈增辉 2025-01-02 18:53:33 +08:00
parent 00017a32bd
commit 6615e35332
32 changed files with 1339 additions and 426 deletions

View File

@ -2,7 +2,7 @@
#ifndef BASECONSTVARIABLE_H #ifndef BASECONSTVARIABLE_H
#define BASECONSTVARIABLE_H #define BASECONSTVARIABLE_H
#define EIGEN_USE_MKL_ALL //#define EIGEN_USE_MKL_ALL
//#define EIGEN_NO_DEBUG //#define EIGEN_NO_DEBUG

View File

@ -312,6 +312,16 @@ void EchoL0Dataset::setLookSide(QString lookside)
this->LookSide = lookside; this->LookSide = lookside;
} }
double EchoL0Dataset::getBandwidth()
{
return this->bandwidth;
}
void EchoL0Dataset::setBandwidth(double Inbandwidth)
{
this->bandwidth = Inbandwidth;
}
SatelliteAntPos EchoL0Dataset::getSatelliteAntPos(long prf_id) SatelliteAntPos EchoL0Dataset::getSatelliteAntPos(long prf_id)
{ {
std::shared_ptr<double> antpos = this->getAntPos(); std::shared_ptr<double> antpos = this->getAntPos();
@ -347,6 +357,7 @@ void EchoL0Dataset::printInfo() {
std::cout << "Far Range: " << this->FarRange << std::endl; std::cout << "Far Range: " << this->FarRange << std::endl;
std::cout << "Center Frequency: " << this->centerFreq << std::endl; std::cout << "Center Frequency: " << this->centerFreq << std::endl;
std::cout << "Sampling Frequency: " << this->Fs << std::endl; std::cout << "Sampling Frequency: " << this->Fs << std::endl;
std::cout << "Band width: " << this->bandwidth << std::endl;
} }
// xmlÎļþ¶Áд // xmlÎļþ¶Áд
@ -366,6 +377,7 @@ void EchoL0Dataset::saveToXml() {
xmlWriter.writeStartElement("SimulationConfig"); xmlWriter.writeStartElement("SimulationConfig");
xmlWriter.writeTextElement("PluseCount", QString::number(this->PluseCount)); xmlWriter.writeTextElement("PluseCount", QString::number(this->PluseCount));
xmlWriter.writeTextElement("BandWidth", QString::number(this->bandwidth));
xmlWriter.writeTextElement("PlusePoints", QString::number(this->PlusePoints)); xmlWriter.writeTextElement("PlusePoints", QString::number(this->PlusePoints));
xmlWriter.writeTextElement("NearRange", QString::number(this->NearRange)); xmlWriter.writeTextElement("NearRange", QString::number(this->NearRange));
xmlWriter.writeTextElement("FarRange", QString::number(this->FarRange)); xmlWriter.writeTextElement("FarRange", QString::number(this->FarRange));
@ -408,7 +420,11 @@ ErrorCode EchoL0Dataset::loadFromXml() {
if (xmlReader.isStartElement()) { if (xmlReader.isStartElement()) {
QString elementName = xmlReader.name().toString(); QString elementName = xmlReader.name().toString();
if (elementName == "PluseCount") { if (elementName == "BandWidth") {
this->bandwidth = xmlReader.readElementText().toLong();
PluseCountflag = true;
}
else if (elementName == "PluseCount") {
this->PluseCount = xmlReader.readElementText().toLong(); this->PluseCount = xmlReader.readElementText().toLong();
PluseCountflag = true; PluseCountflag = true;
} }

View File

@ -153,6 +153,9 @@ public: //
QString getLookSide(); QString getLookSide();
void setLookSide(QString lookside); void setLookSide(QString lookside);
double getBandwidth();
void setBandwidth(double Inbandwidth);
SatelliteAntPos getSatelliteAntPos(long plusePRFID); SatelliteAntPos getSatelliteAntPos(long plusePRFID);
// 打印信息的成员函数 // 打印信息的成员函数
void printInfo() ; void printInfo() ;
@ -169,6 +172,8 @@ private: //
double CenterAngle; double CenterAngle;
QString LookSide; QString LookSide;
double bandwidth;
public: // 读写 XML 的函数 public: // 读写 XML 的函数
void saveToXml(); void saveToXml();
ErrorCode loadFromXml(); ErrorCode loadFromXml();

View File

@ -58,8 +58,8 @@ std::string errorCode2errInfo(ErrorCode e)
_CASE_STR(Error_GSL_ETOLX ); _CASE_STR(Error_GSL_ETOLX );
_CASE_STR(Error_GSL_ETOLG ); _CASE_STR(Error_GSL_ETOLG );
_CASE_STR(Error_GSL_EOF ); _CASE_STR(Error_GSL_EOF );
// RTPC // RFPC
_CASE_STR(RTPC_PARAMSISEMPTY); _CASE_STR(RFPC_PARAMSISEMPTY);
_CASE_STR(ECHO_L0DATA_NOTOPEN); _CASE_STR(ECHO_L0DATA_NOTOPEN);
_CASE_STR(ECHO_L0DATA_ROW_COL_NOEQUAL); _CASE_STR(ECHO_L0DATA_ROW_COL_NOEQUAL);
_CASE_STR(ECHO_L0DATA_PRFIDXOUTRANGE); _CASE_STR(ECHO_L0DATA_PRFIDXOUTRANGE);

View File

@ -68,8 +68,8 @@ enum ErrorCode {
Error_GSL_ETOLG = 131, /* cannot reach the specified tolerance in gradient */ Error_GSL_ETOLG = 131, /* cannot reach the specified tolerance in gradient */
Error_GSL_EOF = 132, /* end of file */ Error_GSL_EOF = 132, /* end of file */
// RTPC // RFPC
RTPC_PARAMSISEMPTY = 201, RFPC_PARAMSISEMPTY = 201,
// L0 数据 // L0 数据
ECHO_L0DATA_NOTOPEN = 202, ECHO_L0DATA_NOTOPEN = 202,
ECHO_L0DATA_ROW_COL_NOEQUAL = 203, // 行或者列数量错误 ECHO_L0DATA_ROW_COL_NOEQUAL = 203, // 行或者列数量错误

View File

@ -10,24 +10,30 @@
#include <cuComplex.h> #include <cuComplex.h>
#include "BaseConstVariable.h" #include "BaseConstVariable.h"
#include "GPURTPC.cuh" #include "GPURFPC.cuh"
#ifdef __CUDANVCC___ #ifdef __CUDANVCC___
__device__ float GPU_getSigma0dB(CUDASigmaParam param, float theta) {//线性值 __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); float sigma= param.p1 + param.p2 * exp(-param.p3 * theta) + param.p4 * cos(param.p5 * theta + param.p6);
return sigma; return sigma;
} }
__device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal(float RstX, float RstY, float RstZ, __device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal(
float RstX, float RstY, float RstZ,
float antXaxisX, float antXaxisY, float antXaxisZ, float antXaxisX, float antXaxisY, float antXaxisZ,
float antYaxisX, float antYaxisY, float antYaxisZ, float antYaxisX, float antYaxisY, float antYaxisZ,
float antZaxisX, float antZaxisY, float antZaxisZ, float antZaxisX, float antZaxisY, float antZaxisZ,
float antDirectX, float antDirectY, float antDirectZ float antDirectX, float antDirectY, float antDirectZ
) { ) {
CUDAVectorEllipsoidal result{ 0,0,-1 }; CUDAVectorEllipsoidal result{ 0,0,-1 };
// 求解天线增益
float Xst = -1 * RstX; // 卫星 --> 地面 float Xst = -1 * RstX; // 卫星 --> 地面
float Yst = -1 * RstY; float Yst = -1 * RstY;
float Zst = -1 * RstZ; float Zst = -1 * RstZ;
@ -40,18 +46,69 @@ __device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal(float RstX, float
float AntZaxisX = antZaxisX; float AntZaxisX = antZaxisX;
float AntZaxisY = antZaxisY; float AntZaxisY = antZaxisY;
float AntZaxisZ = antZaxisZ; 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 RstNorm = sqrtf(Xst * Xst + Yst * Yst + Zst * Zst);
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)); 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 // 计算theta 与 phi
float Norm = sqrtf(Xant * Xant + Yant * Yant + Zant * Zant); // 计算 pho float Norm = sqrtf(Xant * Xant + Yant * Yant + Zant * Zant); // 计算 pho
float ThetaAnt = acosf(Zant / Norm); // theta 与 Z轴的夹角 float ThetaAnt = acosf(Zant / Norm); // theta 与 Z轴的夹角
float YsinTheta = Yant / sinf(ThetaAnt); float PhiAnt = atanf(Yant / Xant); // -pi/2 ~pi/2
float PhiAnt = (YsinTheta / abs(YsinTheta)) * acosf(Xant / (Norm * sinf(ThetaAnt)));
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);
}
result.theta = ThetaAnt; result.theta = ThetaAnt;
result.phi = PhiAnt; result.phi = PhiAnt;
result.pho = Norm; result.Rho = Norm;
return result; return result;
} }
@ -328,8 +385,6 @@ __global__ void CUDA_InterpSigma(
long clsid = demcls[idx]; long clsid = demcls[idx];
float localangle = localanglearr[idx]; float localangle = localanglearr[idx];
CUDASigmaParam tempsigma = sigma0Paramslist[clsid]; CUDASigmaParam tempsigma = sigma0Paramslist[clsid];
//printf("cls:%d;localangle=%f;\n",clsid, localangle);
if (localangle < 0 || localangle >= LAMP_CUDA_PI/2) { if (localangle < 0 || localangle >= LAMP_CUDA_PI/2) {
sigmaAmp[idx] = 0; sigmaAmp[idx] = 0;
} }
@ -403,6 +458,165 @@ __global__ void CUDA_CombinationEchoAmpAndPhase(float* R,
} }
__global__ void CUDAKernel_RFPC_Caluation_R_Gain(
float antX, float antY, float antZ,
float* targetX, float* targetY, float* targetZ, long len,
float* demSlopeX, float* demSlopeY, float* demSlopeZ,
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* TransAntpattern,
float Transtarttheta, float Transstartphi, float Transdtheta, float Transdphi, int Transthetapoints, int Transphipoints,
float* ReceiveAntpattern,
float Receivestarttheta, float Receivestartphi, float Receivedtheta, float Receivedphi, int Receivethetapoints, int Receivephipoints,
float NearR, float FarR,
float* outR,
float* outLocalAngle,
float* AmpGain) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float RstX = antX - targetX[idx]; // 计算坐标矢量
float RstY = antY - targetY[idx];
float RstZ = antZ - targetZ[idx];
float slopeX = demSlopeX[idx];
float slopeY = demSlopeY[idx];
float slopeZ = demSlopeZ[idx];
float RstR= sqrtf(RstX* RstX + RstY* RstY + RstZ* RstZ); // 矢量距离
if (RstR<NearR || RstR>FarR) {
outLocalAngle[idx] = 0;
outR[idx] = 0;
AmpGain[idx] = 0;
}
else {
// 求解坡度
float slopR = sqrtf(slopeX * slopeX + slopeY * slopeY + slopeZ * slopeZ); //
float dotAB = RstX * slopeX + RstY * slopeY + RstZ * slopeZ;
outLocalAngle[idx] = acosf(dotAB / (RstR * slopR)); // 局地入射角
float 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) {
// 发射方向图
float temptheta = antVector.theta * r2d;
float tempphi = antVector.phi * r2d;
float TansantPatternGain =
GPU_BillerInterpAntPattern(
TransAntpattern,
Transtarttheta, Transstartphi, Transdtheta, Transdphi, Transthetapoints, Transphipoints,
temptheta, tempphi);
// 接收方向图
float antPatternGain = GPU_BillerInterpAntPattern(
ReceiveAntpattern,
Receivestarttheta, Receivestartphi, Receivedtheta, Receivedphi, Receivethetapoints, Receivephipoints,
temptheta, tempphi);
ampGain = TansantPatternGain * antPatternGain;
ampGain = ampGain / (powf(4 * LAMP_CUDA_PI, 2) * powf(RstR, 4)); // 反射强度
AmpGain[idx] = ampGain;
outR[idx] = RstR;
}
else {
outR[idx] = 0;
AmpGain[idx] = 0;
}
}
}
}
__global__ void CUDARFPCKernel_Target_Freq_EchoData(
float* InR,
float* InlocalAngle,
float* InampGain,
long* Indemcls,
long len,
float Pt, float freq,
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,
cuComplex* OutechoArr) {
long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) {
float sigma0 = 0;
{
long clsid = Indemcls[idx];
float localangle = InlocalAngle[idx];
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 {
float sigma = GPU_getSigma0dB(tempsigma, localangle);
sigma0 = powf(10.0, sigma / 10.0);// 后向散射系数
}
}
float amp = Pt * InampGain[idx] * sigma0;
float phi = 4 * PI * freq / LIGHTSPEED * InR[idx];
// 欧拉公式 exp(ix)=cos(x)+isin(x)
// echo=Aexp(ix)=A*cos(x)+i*A*sin(x)
cuComplex echotemp = make_cuComplex(amp * cosf(phi), amp * sinf(phi));
OutechoArr[idx] = echotemp;
}
}
__global__ void CUDACkernel_Complex_SUM_reduce_dynamicshared(cuComplex* d_x, cuComplex* d_y, long N)
{
const int tid = threadIdx.x; // 某个block内的线程标号 index
const int bid = blockIdx.x; // 某个block在网格grid内的标号 index
const int n = bid * blockDim.x + tid; // n 是某个线程的标号 index
__shared__ cuComplex s_y[128]; // 分配共享内存空间不同的block都有共享内存变量的副本
s_y[tid] = (n < N) ? d_x[n] : make_cuComplex(0.0,0.0); // 每个block的共享内存变量副本都用全局内存数组d_x来赋值最后一个多出来的用0
__syncthreads(); // 线程块内部直接同步
for (int offset = blockDim.x >> 1; offset > 0; offset >>= 1) // 折半
{
if (tid < offset) // 线程标号的index 不越界 折半
{
s_y[tid] = cuCaddf(s_y[tid], s_y[tid + offset]); // 某个block内的线程做折半规约
}
__syncthreads(); // 同步block内部的线程
}
if (tid == 0) // 某个block只做一次操作
{
d_y[bid] = s_y[0]; // 复制共享内存变量累加的结果到全局内存
}
}
/** 对外封装接口 *******************************************************************************************************/
extern "C" void SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ, extern "C" void SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ,
float antXaxisX, float antXaxisY, float antXaxisZ, float antXaxisX, float antXaxisY, float antXaxisZ,
@ -426,7 +640,7 @@ extern "C" void SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ,
#ifdef __CUDADEBUG__ #ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError(); cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) { if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err)); printf("CUDA_RFPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue.... // Possibly: exit(-1) if program cannot continue....
} }
#endif // __CUDADEBUG__ #endif // __CUDADEBUG__
@ -438,7 +652,7 @@ extern "C" void AntPatternInterpGain(float* anttheta, float* antphi, float* ga
float* antpattern, float starttheta, float startphi, float dtheta, float dphi, int thetapoints, int phipoints, long len) { float* antpattern, float starttheta, float startphi, float dtheta, float dphi, int thetapoints, int phipoints, long len) {
int blockSize = 256; // 每个块的线程数 int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小 int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
//printf("\nCUDA_RTPC_SiglePRF blockSize:%d ,numBlock:%d\n", blockSize, numBlocks); //printf("\nCUDA_RFPC_SiglePRF blockSize:%d ,numBlock:%d\n", blockSize, numBlocks);
CUDA_AntPatternInterpGain << <numBlocks, blockSize >> > ( anttheta,antphi, gain, CUDA_AntPatternInterpGain << <numBlocks, blockSize >> > ( anttheta,antphi, gain,
antpattern, antpattern,
@ -447,7 +661,7 @@ extern "C" void AntPatternInterpGain(float* anttheta, float* antphi, float* ga
#ifdef __CUDADEBUG__ #ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError(); cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) { if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err)); printf("CUDA_RFPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue.... // Possibly: exit(-1) if program cannot continue....
} }
#endif // __CUDADEBUG__ #endif // __CUDADEBUG__
@ -472,7 +686,7 @@ extern "C" void calculationEcho(float* sigma0, float* TransAnt, float* ReciveAnt
#ifdef __CUDADEBUG__ #ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError(); cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) { if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err)); printf("CUDA_RFPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue.... // Possibly: exit(-1) if program cannot continue....
} }
#endif // __CUDADEBUG__ #endif // __CUDADEBUG__
@ -490,7 +704,7 @@ extern "C" void CUDACalculationEchoAmp(float* sigma0, float* TransAnt, float* Re
#ifdef __CUDADEBUG__ #ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError(); cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) { if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err)); printf("CUDA_RFPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue.... // Possibly: exit(-1) if program cannot continue....
} }
#endif // __CUDADEBUG__ #endif // __CUDADEBUG__
@ -508,7 +722,7 @@ extern "C" void CUDACalculationEchoPhase(float* R, float lamda, float* phaseArr,
#ifdef __CUDADEBUG__ #ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError(); cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) { if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err)); printf("CUDA_RFPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue.... // Possibly: exit(-1) if program cannot continue....
} }
#endif // __CUDADEBUG__ #endif // __CUDADEBUG__
@ -533,7 +747,7 @@ extern "C" void CUDACombinationEchoAmpAndPhase(float* R,
#ifdef __CUDADEBUG__ #ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError(); cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) { if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err)); printf("CUDA_RFPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue.... // Possibly: exit(-1) if program cannot continue....
} }
#endif // __CUDADEBUG__ #endif // __CUDADEBUG__
@ -555,13 +769,128 @@ extern "C" void CUDAInterpSigma(
#ifdef __CUDADEBUG__ #ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError(); cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) { if (err != cudaSuccess) {
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err)); printf("CUDA_RFPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue.... // Possibly: exit(-1) if program cannot continue....
} }
#endif // __CUDADEBUG__ #endif // __CUDADEBUG__
cudaDeviceSynchronize(); cudaDeviceSynchronize();
} }
extern "C" void CUDARFPC_Caluation_R_Gain(float antX, float antY, float antZ,
float* targetX, float* targetY, float* targetZ, long TargetPixelNumber,
float* demSlopeX, float* demSlopeY, float* demSlopeZ,
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* TransAntpattern, float Transtarttheta, float Transstartphi, float Transdtheta, float Transdphi, int Transthetapoints, int Transphipoints,
float* ReceiveAntpattern, float Receivestarttheta, float Receivestartphi, float Receivedtheta, float Receivedphi, int Receivethetapoints, int Receivephipoints,
float NearR, float FarR,
float* outR,
float* outLocalAngle,
float* AmpGain)
{
int blockSize = 256; // 每个块的线程数
int numBlocks = (TargetPixelNumber + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDAKernel_RFPC_Caluation_R_Gain << <numBlocks, blockSize >> > (
antX, antY, antZ,
targetX,targetY, targetZ, TargetPixelNumber,
demSlopeX, demSlopeY, demSlopeZ,
antXaxisX, antXaxisY, antXaxisZ,
antYaxisX, antYaxisY, antYaxisZ,
antZaxisX, antZaxisY, antZaxisZ,
antDirectX, antDirectY, antDirectZ,
TransAntpattern,
Transtarttheta, Transstartphi, Transdtheta, Transdphi, Transthetapoints, Transphipoints,
ReceiveAntpattern,
Receivestarttheta, Receivestartphi, Receivedtheta, Receivedphi, Receivethetapoints, Receivephipoints,
NearR, FarR,
outR,
outLocalAngle,
AmpGain
);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDARFPC_Caluation_R_Gain CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDARFPC_Target_Freq_EchoData(float* InR,
float* InlocalAngle,
float* InampGain,
long* Indemcls,
long len,
float Pt, float freq,
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,
cuComplex* OutechoArr
)
{
int blockSize = 256; // 每个块的线程数
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
// 调用 CUDA 核函数
CUDARFPCKernel_Target_Freq_EchoData << <numBlocks, blockSize >> > (
InR,
InlocalAngle,
InampGain,
Indemcls,
len,
Pt, freq,
sigma0Paramslist, sigmaparamslistlen,
OutechoArr
);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDARFPC_Target_Freq_EchoData CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
}
extern "C" void CUDA_DemEchoSUM_NoMalloc(cuComplex* d_dem_echo,long N,
cuComplex* d_echosum_temp, int grid_size,
cuComplex* d_echo,long ehcoid
) {
long NUM_REPEATS = 100;
const int smem = sizeof(float) * BLOCK_SIZE;
for (long i = 0; i < grid_size; i++) { // 初始化
d_echosum_temp[i] = make_cuComplex(0,0);
}
CUDACkernel_Complex_SUM_reduce_dynamicshared << <grid_size, BLOCK_SIZE, smem >> > (d_dem_echo, d_echosum_temp,N); //归约求和
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDALinearInterp1 CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
cudaDeviceSynchronize();
for (int n = 0; n < grid_size; ++n)
{
d_echo[ehcoid] =cuCaddf(d_echo[ehcoid],d_echosum_temp[n]);
}
}
#endif #endif

View File

@ -1,5 +1,5 @@
#ifndef _GPURTPC_H_ #ifndef _GPURFPC_H_
#define _GPURTPC_H_ #define _GPURFPC_H_
#include "BaseConstVariable.h" #include "BaseConstVariable.h"
#include "GPUTool.cuh" #include "GPUTool.cuh"
@ -63,6 +63,50 @@ extern "C" void CUDAInterpSigma(
long* demcls, float* sigmaAmp, float* localanglearr, long len, long* demcls, float* sigmaAmp, float* localanglearr, long len,
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen); CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen);
// 计算坐标的 距离、增益
extern "C" void CUDARFPC_Caluation_R_Gain(
float antX,float antY,float antZ, // 天线的坐标
float* targetX,float* targetY, float* targetZ, long TargetPixelNumber, // 地面坐标
float* demSlopeX, float* demSlopeY, float* demSlopeZ, // 地表坡度矢量
float antXaxisX, float antXaxisY, float antXaxisZ, // 天线坐标系的X轴
float antYaxisX, float antYaxisY, float antYaxisZ,// 天线坐标系的Y轴
float antZaxisX, float antZaxisY, float antZaxisZ,// 天线坐标系的Z轴
float antDirectX, float antDirectY, float antDirectZ,// 天线的指向
float* TransAntpattern, float Transtarttheta, float Transstartphi, float Transdtheta, float Transdphi, int Transthetapoints, int Transphipoints, // 发射天线方向图
float* ReceiveAntpattern, float Receivestarttheta, float Receivestartphi, float Receivedtheta, float Receivedphi, int Receivethetapoints, int Receivephipoints,//接收天线方向图
float NearR,float FarR, // 距离范围
float* outR, // 输出距离
float* outLocalAngle, // 输出局地坐标系
float* AmpGain // 输出增益
);
// 创建回波
extern "C" void CUDARFPC_Target_Freq_EchoData(
float* InR,
float* InlocalAngle,
float* InampGain,
long* Indemcls, long TargetPixelNumber,
float Pt, float freq,
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,// 插值图
cuComplex* OutechoArr
);
extern "C" void CUDA_DemEchoSUM_NoMalloc(cuComplex* d_dem_echo, long N,
cuComplex* d_echosum_temp, int grid_size,
cuComplex* d_echo, long ehcoid
);
#endif #endif

View File

@ -76,8 +76,8 @@ extern "C" void CUDATBPImage(float* antPx, float* antPy, float* antPz,
{ {
int blockSize = 256; // 每个块的线程数 int blockSize = 256; // 每个块的线程数
int numBlocks = (rowcount * colcount + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小 int numBlocks = (rowcount * colcount + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
//printf("\nCUDA_RTPC_SiglePRF blockSize:%d ,numBlock:%d\n",blockSize,numBlocks); //printf("\nCUDA_RFPC_SiglePRF blockSize:%d ,numBlock:%d\n",blockSize,numBlocks);
// 调用 CUDA 核函数 CUDA_RTPC_Kernel // 调用 CUDA 核函数 CUDA_RFPC_Kernel
CUDA_TBPImage << <numBlocks, blockSize >> > ( CUDA_TBPImage << <numBlocks, blockSize >> > (
antPx, antPy, antPz, antPx, antPy, antPz,

View File

@ -8,12 +8,13 @@
#include <cuda_runtime.h> #include <cuda_runtime.h>
#include <cublas_v2.h> #include <cublas_v2.h>
#include <cuComplex.h> #include <cuComplex.h>
#include <chrono>
#include "BaseConstVariable.h" #include "BaseConstVariable.h"
#include "GPUTool.cuh" #include "GPUTool.cuh"
#ifdef __CUDANVCC___ #ifdef __CUDANVCC___
#define BLOCK_DIM 1024
#define REDUCE_SCALE 4
// 定义参数 // 定义参数
__device__ cuComplex cuCexpf(cuComplex x) __device__ cuComplex cuCexpf(cuComplex x)
@ -43,6 +44,49 @@ __device__ float GPU_CosAngle_VectorA_VectorB(CUDAVector A, CUDAVector B) {
} }
__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
const int n = bid * blockDim.x + tid; // n 是某个线程的标号 index
__shared__ float s_y[128]; // 分配共享内存空间不同的block都有共享内存变量的副本
s_y[tid] = (n < N) ? d_x[n] : 0.0; // 每个block的共享内存变量副本都用全局内存数组d_x来赋值最后一个多出来的用0
__syncthreads(); // 线程块内部直接同步
for (int offset = blockDim.x >> 1; offset > 0; offset >>= 1) // 折半
{
if (tid < offset) // 线程标号的index 不越界 折半
{
s_y[tid] += s_y[tid + offset]; // 某个block内的线程做折半规约
}
__syncthreads(); // 同步block内部的线程
}
if (tid == 0) // 某个block只做一次操作
{
d_y[bid] = s_y[0]; // 复制共享内存变量累加的结果到全局内存
}
}
__global__ void CUDA_DistanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long len) { __global__ void CUDA_DistanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long len) {
long idx = blockIdx.x * blockDim.x + threadIdx.x; long idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < len) { if (idx < len) {
@ -113,6 +157,22 @@ __global__ void CUDA_GridPoint_Linear_Interp1(float* v, float* q, float* qv, lon
} }
} }
} }
//错误提示 //错误提示
extern "C" void checkCudaError(cudaError_t err, const char* msg) { extern "C" void checkCudaError(cudaError_t err, const char* msg) {
@ -314,3 +374,39 @@ extern "C" void CUDAGridPointLinearInterp1(float* v, float* q, float* qv, long
#endif #endif
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* h_y = (float*)mallocCUDAHost(ymem);
CUDACkernel_SUM_reduce_dynamicshared << <grid_size, BLOCK_SIZE, smem >> > (d_x, d_y,N);
#ifdef __CUDADEBUG__
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess) {
printf("CUDALinearInterp1 CUDA Error: %s\n", cudaGetErrorString(err));
// Possibly: exit(-1) if program cannot continue....
}
#endif // __CUDADEBUG__
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

@ -13,6 +13,7 @@
#define LAMP_CUDA_PI 3.141592653589793238462643383279 #define LAMP_CUDA_PI 3.141592653589793238462643383279
#define BLOCK_SIZE 256
// 默认显存分布 // 默认显存分布
@ -32,7 +33,7 @@ extern "C" struct CUDAVector {
extern "C" struct CUDAVectorEllipsoidal { extern "C" struct CUDAVectorEllipsoidal {
float theta; float theta;
float phi; float phi;
float pho; float Rho;
}; };
// 定义设备函数 // 定义设备函数

View File

@ -0,0 +1,446 @@
#include "LAMPScatterS1B.h"
#include <flann/flann.hpp>
#include <QDebug>
LAMPScatterS1BRCSDataNode::LAMPScatterS1BRCSDataNode(QString PolarName, double AzAngle, double IncAngle, std::shared_ptr<double> freqs, std::shared_ptr<double> InRCSPoints, long freqnumber)
{
this->PolarName = PolarName;
this->FreqPointNumber = freqnumber;
this->FreqPoints = freqs;
this->RCSPoints = InRCSPoints;
this->AzAngle = AzAngle;
this->IncAngle = IncAngle;
}
LAMPScatterS1BRCSDataNode::~LAMPScatterS1BRCSDataNode()
{
}
long LAMPScatterS1BRCSDataNode::getFreqPointNumber()
{
return this->FreqPointNumber;
}
std::shared_ptr<double> LAMPScatterS1BRCSDataNode::getFreqPoints()
{
return this->FreqPoints;
}
std::shared_ptr<double> LAMPScatterS1BRCSDataNode::getRCSPoints()
{
return this->RCSPoints;
}
QString LAMPScatterS1BRCSDataNode::getPolarName()
{
return this->PolarName;
}
double LAMPScatterS1BRCSDataNode::getAzAngle()
{
return this->AzAngle;
}
double LAMPScatterS1BRCSDataNode::getIncAngle()
{
return this->IncAngle;
}
LAMPScatterS1BPolarKdTree::LAMPScatterS1BPolarKdTree(std::vector<std::shared_ptr<LAMPScatterS1BRCSDataNode>> inDatalist)
{
this->KdtreeFlannDatasetPtr = nullptr;
this->kdtreeIndexPtr = nullptr;
this->datalist = std::vector<std::shared_ptr< LAMPScatterS1BRCSDataNode >>(inDatalist.size());
for (long i = 0; i < inDatalist.size(); i++) {
this->datalist[i] = inDatalist[i];
}
this->dataset= std::vector<std::vector<double>>(this->datalist.size(), std::vector<double>(2));
for (size_t i = 0; i < this->datalist.size(); ++i) {
dataset[i][0] = static_cast<double>(this->datalist[i]->getAzAngle());
dataset[i][1] = static_cast<double>(this->datalist[i]->getIncAngle());
}
// 构建KDtree
this->KdtreeFlannDatasetPtr = std::make_shared < flann::Matrix<double>>(&(this->dataset)[0][0], this->dataset.size(), this->dataset[0].size());
this->kdtreeIndexPtr = std::make_shared<flann::Index<flann::L2<double>>>(*(this->KdtreeFlannDatasetPtr.get()), flann::KDTreeSingleIndexParams(1));
this->kdtreeIndexPtr->buildIndex();
}
LAMPScatterS1BPolarKdTree::~LAMPScatterS1BPolarKdTree()
{
this->datalist.clear();
std::vector<std::shared_ptr< LAMPScatterS1BRCSDataNode >>().swap(this->datalist);
}
QVector<std::shared_ptr< LAMPScatterS1BRCSDataNode >> LAMPScatterS1BPolarKdTree::search(double sAzAngle, double sIncAngle, long sPointNumber)
{
// 查询点
std::vector<double> queryPoint = { sAzAngle, sIncAngle };
flann::Matrix<double> query(&queryPoint[0], 1, queryPoint.size());
// 存储结果索引和距离
std::vector<int> indices(sPointNumber);
std::vector<double> dists(sPointNumber);
// 确保 indices 和 dists 是 flann::Matrix 类型
flann::Matrix<int> flannIndices(&indices[0], sPointNumber, 1);
flann::Matrix<double> flannDists(&dists[0], sPointNumber, 1);
// 执行最近邻搜索
int result = this->kdtreeIndexPtr->knnSearch(query, flannIndices, flannDists, sPointNumber, flann::FLANN_CHECKS_AUTOTUNED);
if (result > 0) {
QVector<std::shared_ptr< LAMPScatterS1BRCSDataNode >> searchResults(sPointNumber);
for(long i=0;i< sPointNumber;i++){
searchResults[i] = datalist[indices[0]];
}
return searchResults;
}
else {
return QVector<std::shared_ptr< LAMPScatterS1BRCSDataNode >>(0);
}
}
int LAMPScatterS1BDataset::OpenFile(QString s1bfilepath)
{
int ncid;
if (nc_open(s1bfilepath.toLocal8Bit().constData(), NC_NOWRITE, &ncid)) {
qCritical() << "Failed to open NetCDF file";
return 1;
}
int FreqVarid ;
int PolVarid ;
int AzVarid ;
int IncVarid ;
int RCSVarid ;
if (nc_inq_varid(ncid, "Freq", &FreqVarid)
|| nc_inq_varid(ncid, "Pol", &PolVarid)
|| nc_inq_varid(ncid, "Az", &AzVarid)
|| nc_inq_varid(ncid, "Inc", &IncVarid)
|| nc_inq_varid(ncid, "RCS", &RCSVarid)
) {
qDebug() << "Failed to get variable ";
qDebug() << "Freq:\t" << FreqVarid << "\tPol:\t" << PolVarid << "\tAz:\t" << AzVarid << "\tInc:\t" << IncVarid << "\RCS:\t" << RCSVarid;
nc_close(ncid);
return 1;
}
qDebug() << "[VarID]\t Freq:\t" << FreqVarid << "\tPol:\t" << PolVarid << "\tAz:\t" << AzVarid << "\tInc:\t" << IncVarid << "\RCS:\t" << RCSVarid;
// 检查变量维度
int Freqndims ;
int Polndims ;
int Azndims ;
int Incndims ;
int RCSndims ;
if ( nc_inq_varndims(ncid, FreqVarid , &Freqndims)
|| nc_inq_varndims(ncid, PolVarid , &Polndims )
|| nc_inq_varndims(ncid, AzVarid , &Azndims )
|| nc_inq_varndims(ncid, IncVarid , &Incndims )
|| nc_inq_varndims(ncid, RCSVarid , &RCSndims )
) {
qDebug() << "Failed to get number of dimensions for variable";
qDebug() << "[Dimensions]\t Freq:\t" << Freqndims
<< "\tPol:\t"<< Polndims
<< "\tAz:\t" << Azndims
<< "\tInc:\t"<< Incndims
<< "\RCS:\t" << RCSndims ;
nc_close(ncid);
return 1;
}
qDebug() << "[Dimensions]\t Freq:\t" << Freqndims
<< "\tPol:\t" << Polndims
<< "\tAz:\t" << Azndims
<< "\tInc:\t" << Incndims
<< "\RCS:\t" << RCSndims;
// 获取 点数据数量
std::vector<int> Freqdimids (Freqndims );
std::vector<int> Poldimids (Polndims );
std::vector<int> Azdimids (Azndims );
std::vector<int> Incdimids (Incndims );
std::vector<int> RCSdimids (RCSndims );
if ( nc_inq_vardimid(ncid, FreqVarid , Freqdimids.data())
|| nc_inq_vardimid(ncid, PolVarid , Poldimids .data())
|| nc_inq_vardimid(ncid, AzVarid , Azdimids .data())
|| nc_inq_vardimid(ncid, IncVarid , Incdimids .data())
|| nc_inq_vardimid(ncid, RCSVarid , RCSdimids .data())
) {
qDebug() << "Failed to get dimension IDs for variable";
qDebug() << "[Dimensions IDs]\t Freq:\t" << Freqdimids.size()
<< "\tPol:\t"<< Poldimids .size()
<< "\tAz:\t" << Azdimids .size()
<< "\tInc:\t"<< Incdimids .size()
<< "\RCS:\t" << RCSdimids .size() ;
nc_close(ncid);
return 1;
}
qDebug() << "[Dimensions IDs]\t Freq:\t" << Freqdimids.size()
<< "\tPol:\t" << Poldimids.size()
<< "\tAz:\t" << Azdimids.size()
<< "\tInc:\t" << Incdimids.size()
<< "\RCS:\t" << RCSdimids.size();
std::vector<int> Freqdimsize(Freqndims);
std::vector<int> Poldimsizes(Polndims);
std::vector<int> Azdimsize (Azndims);
std::vector<int> Incdimsize (Incndims);
std::vector<int> RCSdimsize (RCSndims);
for (long i = 0; i < Freqdimids.size(); i++) {
size_t datalen_temp;
if (nc_inq_dimlen(ncid, Freqdimids[i], &datalen_temp)) {
qDebug() << "Failed to get Freqdimsize for variable";
}
else {
Freqdimsize[i] = datalen_temp;
}
}
for (long i = 0; i < Poldimids.size(); i++) {
size_t datalen_temp;
if (nc_inq_dimlen(ncid, Poldimids[i], &datalen_temp)) {
qDebug() << "Failed to get Poldimids for variable";
}
else {
Poldimsizes[i] = datalen_temp;
}
}
for (long i = 0; i < Azdimids.size(); i++) {
size_t datalen_temp;
if (nc_inq_dimlen(ncid, Azdimids[i], &datalen_temp)) {
qDebug() << "Failed to get Azdimids for variable";
}
else {
Azdimsize[i] = datalen_temp;
}
}
for (long i = 0; i < Incdimids.size(); i++) {
size_t datalen_temp;
if (nc_inq_dimlen(ncid, Incdimids[i], &datalen_temp)) {
qDebug() << "Failed to get Incdimids for variable";
}
else {
Incdimsize[i] = datalen_temp;
}
}
for (long i = 0; i < RCSdimids.size(); i++) {
size_t datalen_temp;
if (nc_inq_dimlen(ncid, RCSdimids[i], &datalen_temp)) {
qDebug() << "Failed to get RCSdimids for variable";
}
else {
RCSdimsize[i] = datalen_temp;
}
}
long Freq_datalen =1;
long Pol_datalen =1;
long Az_datalen =1;
long Inc_datalen =1;
long RCS_datalen =1;
for (long i = 0; i < Freqdimsize.size(); i++) {
Freq_datalen = Freq_datalen * Freqdimsize[i];
}
for (long i = 0; i < Poldimsizes.size(); i++) {
Pol_datalen = Pol_datalen * Poldimsizes[i];
}
for (long i = 0; i < Azdimsize.size(); i++) {
Az_datalen = Az_datalen * Azdimsize[i];
}
for (long i = 0; i < Incdimsize.size(); i++) {
Inc_datalen = Inc_datalen * Incdimsize[i];
}
for (long i = 0; i < RCSdimsize.size(); i++) {
RCS_datalen = RCS_datalen * RCSdimsize[i];
}
qDebug() << "[Data Size]\t Freq:\t" << Freq_datalen
<< "\tPol:\t" << Pol_datalen
<< "\tAz:\t" << Az_datalen
<< "\tInc:\t" << Inc_datalen
<< "\RCS:\t" << RCS_datalen;
// 读取数据
std::vector<float> pol_data (Pol_datalen);
std::vector<float> inc_data (Inc_datalen);
std::vector<float> az_data (Az_datalen );
std::vector<float> freq_data (Freq_datalen);
std::vector<double> rcs_data (RCS_datalen);
if ( nc_get_var_float(ncid, FreqVarid, freq_data.data())
//|| nc_get_var_float(ncid, PolVarid, pol_data.data())
//|| nc_get_var_float(ncid, AzVarid, az_data.data())
//|| nc_get_var_float(ncid, IncVarid, inc_data.data())
//|| nc_get_var_double(ncid, RCSVarid, rcs_data.data())
) {
qDebug() << "reading Data for variable";
qDebug() << "[Data size ]\t Freq:\t" << pol_data .size()
<< "\tPol:\t" << inc_data .size()
<< "\tAz:\t" << az_data .size()
<< "\tInc:\t" << freq_data .size()
<< "\RCS:\t" << rcs_data .size();
nc_close(ncid);
return 1;
}
qDebug() << "[Data size ]\t Freq:\t" << pol_data.size()
<< "\tPol:\t" << inc_data.size()
<< "\tAz:\t" << az_data.size()
<< "\tInc:\t" << freq_data.size()
<< "\RCS:\t" << rcs_data.size();
// 读取Pol的属性
QMap<QString, QString> polnamedict = ReadPolAttribution(ncid, PolVarid);
if (polnamedict.count()==0) {
qDebug() << "Failed to get attribution Number for variable Pol ";
nc_close(ncid);
return 1;
}
nc_close(ncid);
// 创建节点
for (long PolId = 0; PolId < Pol_datalen; PolId++) { // Polar
QString polkey = QString("label_Pol_%1").arg(PolId+1);
QString polname = polnamedict[polkey];
std::vector<std::shared_ptr< LAMPScatterS1BRCSDataNode >> nodes(0);
for (long Azid = 0; Azid < Az_datalen; Azid++) { // Az
for (long Incid = 0; Incid < Inc_datalen; Incid++) { // Inc
std::shared_ptr<double> freqs(new double[Freq_datalen], LAMPScatterS1BdelArrPtr);
std::shared_ptr<double> RCSData(new double[Freq_datalen], LAMPScatterS1BdelArrPtr);
double Azvalue = az_data[Azid];
double Incvalue = inc_data[Azid];
for (long freqID = 0; freqID < Freq_datalen; freqID++) { // Freq
freqs.get()[freqID] = freq_data[freqID];
RCSData.get()[freqID] = rcs_data[PolId * Az_datalen * Inc_datalen * Freq_datalen +
Azid * Inc_datalen * Freq_datalen +
Incid * Freq_datalen +
freqID
];
}
std::shared_ptr<LAMPScatterS1BRCSDataNode> node(new LAMPScatterS1BRCSDataNode(polname, Azvalue, Incvalue, freqs, RCSData, Freq_datalen));
nodes.push_back(node);
}
}
std::shared_ptr< LAMPScatterS1BPolarKdTree> treetemp(new LAMPScatterS1BPolarKdTree(nodes));
polarRCSTree.insert(polname, treetemp); // KDTree
}
this->FreqPointNumber= Freq_datalen;
this->polNumber= Pol_datalen;
this->AzNumber = Az_datalen;
this->IncNumber = Inc_datalen;
std::vector<float>().swap(pol_data);
std::vector<float>().swap(inc_data);
std::vector<float>().swap(az_data);
std::vector<float>().swap(freq_data);
std::vector<double>().swap(rcs_data);
std::vector<int>().swap(Freqdimids);
std::vector<int>().swap(Poldimids);
std::vector<int>().swap(Azdimids);
std::vector<int>().swap(Incdimids);
std::vector<int>().swap(RCSdimids);
std::vector<int>().swap(Freqdimsize);
std::vector<int>().swap(Poldimsizes);
std::vector<int>().swap(Azdimsize);
std::vector<int>().swap(Incdimsize);
std::vector<int>().swap(RCSdimsize);
return 0;
}
std::complex<double> LAMPScatterS1BDataset::getRCSData(QString polarName, double AzAngle, double IncAngle, double FreqId)
{
return std::complex<double>();
}
QMap<QString, QString> LAMPScatterS1BDataset::ReadPolAttribution(int ncid, int pol_varid)
{
int num_atts;
if (nc_inq_varnatts(ncid, pol_varid, &num_atts)) {
return QMap<QString, QString>();
}
if (num_atts == 0) {
return QMap<QString, QString>();
}
else {
QMap<QString, QString> result;
qDebug() << "Attributes for Pol:" ;
for (int i = 0; i < num_atts; ++i) {
char att_name[NC_MAX_NAME + 1];
if (nc_inq_attname(ncid, pol_varid, i, att_name)) {
qDebug() << "Error getting attribute name";
}
// 获取属性类型和长度
nc_type xtype;
size_t len;
if (nc_inq_att(ncid, pol_varid, att_name, &xtype, &len)) {
qDebug() << "Error getting attribute type and length";
}
// 根据属性类型读取属性值
switch (xtype) {
case NC_CHAR: {
std::vector<char> att_value(len + 1); // +1 for null terminator
if (nc_get_att_text(ncid, pol_varid, att_name, att_value.data())) {
qDebug() << "Error reading text attribute";
}
qDebug() << "Attribute Name: " << att_name << ", Type: NC_CHAR, Value: " << att_value.data();
result.insert(QString(att_name), QString(att_value.data()));
break;
}
default:
std::cout << "Attribute Name: " << att_name << ", Type: Unknown" << std::endl;
break;
}
}
return result;
}
}

View File

@ -0,0 +1,90 @@
#pragma once
#ifndef _LAMPSCATTERS1B_H_
#define _LAMPSCATTERS1B_H_
#include <stdlib.h>
#include <QString>
#include <netcdf.h>
#include <complex>
#include <memory>
#include <Qset>
#include <QMap>
#include <flann/flann.hpp>
#include <memory>
#include <vector>
inline void LAMPScatterS1BdelArrPtr(void* p)
{
delete[] p;
p = nullptr;
}
class LAMPScatterS1BRCSDataNode {
public:
LAMPScatterS1BRCSDataNode(QString PolarName, double AzAngle, double IncAngle,std::shared_ptr<double> freqs, std::shared_ptr<double> RCSPoints,long freqnumber);
~LAMPScatterS1BRCSDataNode();
public:
long getFreqPointNumber();
std::shared_ptr<double> getFreqPoints();
std::shared_ptr<double> getRCSPoints();
QString getPolarName();
double getAzAngle();
double getIncAngle();
private:
double AzAngle;
double IncAngle;
long FreqPointNumber;
std::shared_ptr<double> FreqPoints;
std::shared_ptr<double> RCSPoints;
QString PolarName;
};
class LAMPScatterS1BPolarKdTree {// 这里使用 kdTree作为 检索索引,不需要考虑调整的
public:
LAMPScatterS1BPolarKdTree(std::vector<std::shared_ptr< LAMPScatterS1BRCSDataNode >> inDatalist);
~LAMPScatterS1BPolarKdTree();
public:
QVector<std::shared_ptr< LAMPScatterS1BRCSDataNode >> search(double sAzAngle, double sIncAngle,long sPointNumber);
private: //kdtree
std::vector<std::vector<double>> dataset;
std::shared_ptr < flann::Matrix<double>> KdtreeFlannDatasetPtr;
std::shared_ptr < flann::Index<flann::L2<double>>> kdtreeIndexPtr;
private:
std::vector<std::shared_ptr< LAMPScatterS1BRCSDataNode >> datalist; //所有节点
};
class LAMPScatterS1BDataset
{
public:
int OpenFile(QString s1bfilepath);
public:
std::complex<double> getRCSData(QString polarName, double AzAngle, double IncAngle, double FreqId);
private:
long FreqPointNumber;
long polNumber;
long AzNumber;
long IncNumber;
QMap<QString,std::shared_ptr<LAMPScatterS1BPolarKdTree>> polarRCSTree;
private:
QMap<QString,QString> ReadPolAttribution(int ncid, int polvarid);
};
#endif

10
QSimulationRFPCGUI.cpp Normal file
View File

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

16
QSimulationRFPCGUI.h Normal file
View File

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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>QSimulationRTPCGUIClass</class> <class>QSimulationRFPCGUIClass</class>
<widget class="QDialog" name="QSimulationRTPCGUIClass"> <widget class="QDialog" name="QSimulationRFPCGUIClass">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>RTPC回波仿真</string> <string>RFPC回波仿真</string>
</property> </property>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>

View File

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

View File

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

View File

@ -78,14 +78,14 @@
<string>orthinterpRaster</string> <string>orthinterpRaster</string>
</property> </property>
</action> </action>
<action name="actionSARRTPC"> <action name="actionSARRFPC">
<property name="text"> <property name="text">
<string>SARRTPC</string> <string>SARRFPC</string>
</property> </property>
</action> </action>
<action name="actionSimuSARRTPC"> <action name="actionSimuSARRFPC">
<property name="text"> <property name="text">
<string>SimuSARRTPC</string> <string>SimuSARRFPC</string>
</property> </property>
</action> </action>
<action name="actionSimuBPImage"> <action name="actionSimuBPImage">

View File

@ -68,7 +68,7 @@
<IncludePath>.\SimulationSAR;.\GF3ProcessToolbox;.\BaseTool;$(IncludePath)</IncludePath> <IncludePath>.\SimulationSAR;.\GF3ProcessToolbox;.\BaseTool;$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>.\GPUTool;.\SimulationSAR;.\GF3ProcessToolbox;.\BaseTool;$(oneMKLIncludeDir);$(IncludePath)</IncludePath> <IncludePath>.\LAMPScatterTool;.\GPUTool;.\SimulationSAR;.\GF3ProcessToolbox;.\BaseTool;$(oneMKLIncludeDir);$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
@ -128,17 +128,18 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="GF3ProcessToolbox\QOrthSlrRaster.cpp" /> <ClCompile Include="GF3ProcessToolbox\QOrthSlrRaster.cpp" />
<ClCompile Include="QSimulationRTPCGUI.cpp" /> <ClCompile Include="LAMPScatterTool\LAMPScatterS1B.cpp" />
<ClCompile Include="QSimulationRFPCGUI.cpp" />
<ClCompile Include="RegisterToolbox.cpp"> <ClCompile Include="RegisterToolbox.cpp">
<DynamicSource Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">input</DynamicSource> <DynamicSource Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">input</DynamicSource>
<QtMocFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).moc</QtMocFileName> <QtMocFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).moc</QtMocFileName>
<DynamicSource Condition="'$(Configuration)|$(Platform)'=='Release|x64'">input</DynamicSource> <DynamicSource Condition="'$(Configuration)|$(Platform)'=='Release|x64'">input</DynamicSource>
<QtMocFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).moc</QtMocFileName> <QtMocFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).moc</QtMocFileName>
</ClCompile> </ClCompile>
<ClCompile Include="SimulationSAR\QImageSARRTPC.cpp" /> <ClCompile Include="SimulationSAR\QImageSARRFPC.cpp" />
<ClCompile Include="SimulationSAR\QSimulationBPImage.cpp" /> <ClCompile Include="SimulationSAR\QSimulationBPImage.cpp" />
<ClCompile Include="SimulationSAR\QToolAbstract.cpp" /> <ClCompile Include="SimulationSAR\QToolAbstract.cpp" />
<ClCompile Include="SimulationSAR\RTPCProcessCls.cpp" /> <ClCompile Include="SimulationSAR\RFPCProcessCls.cpp" />
<ClCompile Include="SimulationSAR\SARSatelliteSimulationAbstractCls.cpp" /> <ClCompile Include="SimulationSAR\SARSatelliteSimulationAbstractCls.cpp" />
<ClCompile Include="SimulationSAR\SARSimulationTaskSetting.cpp" /> <ClCompile Include="SimulationSAR\SARSimulationTaskSetting.cpp" />
<ClCompile Include="SimulationSAR\SatelliteOribtModel.cpp" /> <ClCompile Include="SimulationSAR\SatelliteOribtModel.cpp" />
@ -154,7 +155,7 @@
<QtUic Include="Imageshow\ImageShowDialogClass.ui" /> <QtUic Include="Imageshow\ImageShowDialogClass.ui" />
<QtUic Include="Imageshow\qcustomplot.ui" /> <QtUic Include="Imageshow\qcustomplot.ui" />
<QtUic Include="QMergeRasterProcessDialog.ui" /> <QtUic Include="QMergeRasterProcessDialog.ui" />
<QtUic Include="QSimulationRTPCGUI.ui" /> <QtUic Include="QSimulationRFPCGUI.ui" />
<QtUic Include="RasterProcessTool.ui" /> <QtUic Include="RasterProcessTool.ui" />
<QtMoc Include="RasterProcessTool.h" /> <QtMoc Include="RasterProcessTool.h" />
<ClCompile Include="GF3ProcessToolbox\GF3CalibrationAndGeocodingClass.cpp" /> <ClCompile Include="GF3ProcessToolbox\GF3CalibrationAndGeocodingClass.cpp" />
@ -171,11 +172,11 @@
<ClCompile Include="QMergeRasterProcessDialog.cpp" /> <ClCompile Include="QMergeRasterProcessDialog.cpp" />
<ClCompile Include="RasterProcessTool.cpp" /> <ClCompile Include="RasterProcessTool.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
<QtUic Include="SimulationSAR\QImageSARRTPC.ui" /> <QtUic Include="SimulationSAR\QImageSARRFPC.ui" />
<QtUic Include="SimulationSAR\QSimulationBPImage.ui" /> <QtUic Include="SimulationSAR\QSimulationBPImage.ui" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtMoc Include="SimulationSAR\QImageSARRTPC.h" /> <QtMoc Include="SimulationSAR\QImageSARRFPC.h" />
<QtMoc Include="SimulationSAR\QToolAbstract.h" /> <QtMoc Include="SimulationSAR\QToolAbstract.h" />
<QtMoc Include="RegisterToolbox.h" /> <QtMoc Include="RegisterToolbox.h" />
<QtMoc Include="SimulationSAR\QSimulationBPImage.h" /> <QtMoc Include="SimulationSAR\QSimulationBPImage.h" />
@ -190,13 +191,14 @@
<ClInclude Include="BaseTool\RasterToolBase.h" /> <ClInclude Include="BaseTool\RasterToolBase.h" />
<ClInclude Include="BaseTool\SARSimulationImageL1.h" /> <ClInclude Include="BaseTool\SARSimulationImageL1.h" />
<ClInclude Include="BaseTool\stdafx.h" /> <ClInclude Include="BaseTool\stdafx.h" />
<ClInclude Include="GPUTool\GPURTPC.cuh" /> <ClInclude Include="GPUTool\GPURFPC.cuh" />
<ClInclude Include="GPUTool\GPUTBPImage.cuh" /> <ClInclude Include="GPUTool\GPUTBPImage.cuh" />
<ClInclude Include="GPUTool\GPUTool.cuh" /> <ClInclude Include="GPUTool\GPUTool.cuh" />
<ClInclude Include="LAMPScatterTool\LAMPScatterS1B.h" />
<ClInclude Include="SimulationSAR\TBPImageAlgCls.h" /> <ClInclude Include="SimulationSAR\TBPImageAlgCls.h" />
<QtMoc Include="QSimulationRTPCGUI.h" /> <QtMoc Include="QSimulationRFPCGUI.h" />
<QtMoc Include="GF3ProcessToolbox\QOrthSlrRaster.h" /> <QtMoc Include="GF3ProcessToolbox\QOrthSlrRaster.h" />
<ClInclude Include="SimulationSAR\RTPCProcessCls.h" /> <ClInclude Include="SimulationSAR\RFPCProcessCls.h" />
<ClInclude Include="SimulationSAR\SARSatelliteSimulationAbstractCls.h" /> <ClInclude Include="SimulationSAR\SARSatelliteSimulationAbstractCls.h" />
<ClInclude Include="SimulationSAR\SARSimulationTaskSetting.h" /> <ClInclude Include="SimulationSAR\SARSimulationTaskSetting.h" />
<ClInclude Include="SimulationSAR\SatelliteOribtModel.h" /> <ClInclude Include="SimulationSAR\SatelliteOribtModel.h" />
@ -218,7 +220,7 @@
<None Include="cpp.hint" /> <None Include="cpp.hint" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CudaCompile Include="GPUTool\GPURTPC.cu"> <CudaCompile Include="GPUTool\GPURFPC.cu">
<GenerateRelocatableDeviceCode Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateRelocatableDeviceCode> <GenerateRelocatableDeviceCode Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateRelocatableDeviceCode>
</CudaCompile> </CudaCompile>
<CudaCompile Include="GPUTool\GPUTBPImage.cu"> <CudaCompile Include="GPUTool\GPUTBPImage.cu">

View File

@ -36,6 +36,9 @@
<Filter Include="GPUTool"> <Filter Include="GPUTool">
<UniqueIdentifier>{c39dcd9f-dfd6-4d94-8912-7a3f5f719385}</UniqueIdentifier> <UniqueIdentifier>{c39dcd9f-dfd6-4d94-8912-7a3f5f719385}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="LAMPScatter">
<UniqueIdentifier>{cc849de4-c841-40e3-96bc-54ebe034fa4a}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtRcc Include="RasterProcessTool.qrc"> <QtRcc Include="RasterProcessTool.qrc">
@ -94,7 +97,7 @@
<ClCompile Include="GF3ProcessToolbox\QRDOrthProcessClass.cpp"> <ClCompile Include="GF3ProcessToolbox\QRDOrthProcessClass.cpp">
<Filter>GF3ProcessToolbox</Filter> <Filter>GF3ProcessToolbox</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SimulationSAR\RTPCProcessCls.cpp"> <ClCompile Include="SimulationSAR\RFPCProcessCls.cpp">
<Filter>SimulationSAR</Filter> <Filter>SimulationSAR</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SimulationSAR\SARSatelliteSimulationAbstractCls.cpp"> <ClCompile Include="SimulationSAR\SARSatelliteSimulationAbstractCls.cpp">
@ -109,7 +112,7 @@
<ClCompile Include="SimulationSAR\SigmaDatabase.cpp"> <ClCompile Include="SimulationSAR\SigmaDatabase.cpp">
<Filter>SimulationSAR</Filter> <Filter>SimulationSAR</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="QSimulationRTPCGUI.cpp"> <ClCompile Include="QSimulationRFPCGUI.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="GF3ProcessToolbox\QOrthSlrRaster.cpp"> <ClCompile Include="GF3ProcessToolbox\QOrthSlrRaster.cpp">
@ -124,7 +127,7 @@
<ClCompile Include="RegisterToolbox.cpp"> <ClCompile Include="RegisterToolbox.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SimulationSAR\QImageSARRTPC.cpp"> <ClCompile Include="SimulationSAR\QImageSARRFPC.cpp">
<Filter>SimulationSAR</Filter> <Filter>SimulationSAR</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SimulationSAR\QSimulationBPImage.cpp"> <ClCompile Include="SimulationSAR\QSimulationBPImage.cpp">
@ -160,6 +163,9 @@
<ClCompile Include="BaseTool\stdafx.cpp"> <ClCompile Include="BaseTool\stdafx.cpp">
<Filter>BaseTool</Filter> <Filter>BaseTool</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="LAMPScatterTool\LAMPScatterS1B.cpp">
<Filter>LAMPScatter</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="GF3ProcessToolbox\GF3CalibrationAndGeocodingClass.h"> <ClInclude Include="GF3ProcessToolbox\GF3CalibrationAndGeocodingClass.h">
@ -180,7 +186,7 @@
<ClInclude Include="GF3ProcessToolbox\WGS84_J2000.h"> <ClInclude Include="GF3ProcessToolbox\WGS84_J2000.h">
<Filter>GF3ProcessToolbox</Filter> <Filter>GF3ProcessToolbox</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="SimulationSAR\RTPCProcessCls.h"> <ClInclude Include="SimulationSAR\RFPCProcessCls.h">
<Filter>SimulationSAR</Filter> <Filter>SimulationSAR</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="SimulationSAR\SARSatelliteSimulationAbstractCls.h"> <ClInclude Include="SimulationSAR\SARSatelliteSimulationAbstractCls.h">
@ -231,12 +237,15 @@
<ClInclude Include="GPUTool\GPUTool.cuh"> <ClInclude Include="GPUTool\GPUTool.cuh">
<Filter>GPUTool</Filter> <Filter>GPUTool</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="GPUTool\GPURTPC.cuh"> <ClInclude Include="GPUTool\GPURFPC.cuh">
<Filter>GPUTool</Filter> <Filter>GPUTool</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="GPUTool\GPUTBPImage.cuh"> <ClInclude Include="GPUTool\GPUTBPImage.cuh">
<Filter>GPUTool</Filter> <Filter>GPUTool</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="LAMPScatterTool\LAMPScatterS1B.h">
<Filter>LAMPScatter</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtMoc Include="QMergeRasterProcessDialog.h"> <QtMoc Include="QMergeRasterProcessDialog.h">
@ -257,7 +266,7 @@
<QtMoc Include="GF3ProcessToolbox\QRDOrthProcessClass.h"> <QtMoc Include="GF3ProcessToolbox\QRDOrthProcessClass.h">
<Filter>GF3ProcessToolbox</Filter> <Filter>GF3ProcessToolbox</Filter>
</QtMoc> </QtMoc>
<QtMoc Include="QSimulationRTPCGUI.h"> <QtMoc Include="QSimulationRFPCGUI.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</QtMoc> </QtMoc>
<QtMoc Include="GF3ProcessToolbox\QOrthSlrRaster.h"> <QtMoc Include="GF3ProcessToolbox\QOrthSlrRaster.h">
@ -272,7 +281,7 @@
<QtMoc Include="RegisterToolbox.h"> <QtMoc Include="RegisterToolbox.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</QtMoc> </QtMoc>
<QtMoc Include="SimulationSAR\QImageSARRTPC.h"> <QtMoc Include="SimulationSAR\QImageSARRFPC.h">
<Filter>SimulationSAR</Filter> <Filter>SimulationSAR</Filter>
</QtMoc> </QtMoc>
<QtMoc Include="SimulationSAR\QSimulationBPImage.h"> <QtMoc Include="SimulationSAR\QSimulationBPImage.h">
@ -298,13 +307,13 @@
<QtUic Include="GF3ProcessToolbox\QRDOrthProcessClass.ui"> <QtUic Include="GF3ProcessToolbox\QRDOrthProcessClass.ui">
<Filter>GF3ProcessToolbox</Filter> <Filter>GF3ProcessToolbox</Filter>
</QtUic> </QtUic>
<QtUic Include="QSimulationRTPCGUI.ui"> <QtUic Include="QSimulationRFPCGUI.ui">
<Filter>Form Files</Filter> <Filter>Form Files</Filter>
</QtUic> </QtUic>
<QtUic Include="GF3ProcessToolbox\QOrthSlrRaster.ui"> <QtUic Include="GF3ProcessToolbox\QOrthSlrRaster.ui">
<Filter>GF3ProcessToolbox</Filter> <Filter>GF3ProcessToolbox</Filter>
</QtUic> </QtUic>
<QtUic Include="SimulationSAR\QImageSARRTPC.ui"> <QtUic Include="SimulationSAR\QImageSARRFPC.ui">
<Filter>SimulationSAR</Filter> <Filter>SimulationSAR</Filter>
</QtUic> </QtUic>
<QtUic Include="SimulationSAR\QSimulationBPImage.ui"> <QtUic Include="SimulationSAR\QSimulationBPImage.ui">
@ -315,7 +324,7 @@
</QtUic> </QtUic>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CudaCompile Include="GPUTool\GPURTPC.cu"> <CudaCompile Include="GPUTool\GPURFPC.cu">
<Filter>GPUTool</Filter> <Filter>GPUTool</Filter>
</CudaCompile> </CudaCompile>
<CudaCompile Include="GPUTool\GPUTBPImage.cu"> <CudaCompile Include="GPUTool\GPUTBPImage.cu">

View File

@ -5,7 +5,7 @@
#include "QComplex2AmpPhase.h" #include "QComplex2AmpPhase.h"
#include "QRDOrthProcessClass.h" #include "QRDOrthProcessClass.h"
#include "QOrthSlrRaster.h" #include "QOrthSlrRaster.h"
#include "QImageSARRTPC.h" #include "QImageSARRFPC.h"
#include "QSimulationBPImage.h" #include "QSimulationBPImage.h"
GF3ImportDataToolButton::GF3ImportDataToolButton(QWidget* parent) :QToolAbstract(parent) GF3ImportDataToolButton::GF3ImportDataToolButton(QWidget* parent) :QToolAbstract(parent)
@ -94,21 +94,21 @@ void MergeRasterProcessToolButton::excute()
dialog->show(); dialog->show();
} }
SARSimlulationRTPCToolButton::SARSimlulationRTPCToolButton(QWidget* parent) :QToolAbstract(parent) SARSimlulationRFPCToolButton::SARSimlulationRFPCToolButton(QWidget* parent) :QToolAbstract(parent)
{ {
this->toolPath = QVector<QString>(0); this->toolPath = QVector<QString>(0);
this->toolPath.push_back(u8"·ÂÕæ¹¤¾ß¿â"); this->toolPath.push_back(u8"·ÂÕæ¹¤¾ß¿â");
this->toolname = QString(u8"RTPC"); this->toolname = QString(u8"RFPC");
} }
SARSimlulationRTPCToolButton::~SARSimlulationRTPCToolButton() SARSimlulationRFPCToolButton::~SARSimlulationRFPCToolButton()
{ {
} }
void SARSimlulationRTPCToolButton::excute() void SARSimlulationRFPCToolButton::excute()
{ {
QImageSARRTPC* dialog = new QImageSARRTPC(); QImageSARRFPC* dialog = new QImageSARRFPC();
dialog->show(); dialog->show();
} }
@ -136,7 +136,7 @@ void RegisterPreToolBox(RasterProcessTool* mainWindows)
QRDOrthProcessClassToolButton* items3 = new QRDOrthProcessClassToolButton(nullptr); QRDOrthProcessClassToolButton* items3 = new QRDOrthProcessClassToolButton(nullptr);
QOrthSlrRasterToolButton* items4 = new QOrthSlrRasterToolButton(nullptr); QOrthSlrRasterToolButton* items4 = new QOrthSlrRasterToolButton(nullptr);
MergeRasterProcessToolButton* items5 = new MergeRasterProcessToolButton(nullptr); MergeRasterProcessToolButton* items5 = new MergeRasterProcessToolButton(nullptr);
SARSimlulationRTPCToolButton* items6 = new SARSimlulationRTPCToolButton(nullptr); SARSimlulationRFPCToolButton* items6 = new SARSimlulationRFPCToolButton(nullptr);
SARSimulationTBPImageToolButton* items7 = new SARSimulationTBPImageToolButton(nullptr); SARSimulationTBPImageToolButton* items7 = new SARSimulationTBPImageToolButton(nullptr);
emit mainWindows->addBoxToolItemSIGNAL(items1); emit mainWindows->addBoxToolItemSIGNAL(items1);

View File

@ -55,11 +55,11 @@ public slots:
}; };
class SARSimlulationRTPCToolButton : public QToolAbstract { class SARSimlulationRFPCToolButton : public QToolAbstract {
Q_OBJECT Q_OBJECT
public: public:
SARSimlulationRTPCToolButton( QWidget* parent = nullptr); SARSimlulationRFPCToolButton( QWidget* parent = nullptr);
~SARSimlulationRTPCToolButton(); ~SARSimlulationRFPCToolButton();
public slots: public slots:
virtual void excute() override; virtual void excute() override;

View File

@ -1,11 +1,11 @@
#include "QImageSARRTPC.h" #include "QImageSARRFPC.h"
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include "RTPCProcessCls.h" #include "RFPCProcessCls.h"
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <thread> #include <thread>
QImageSARRTPC::QImageSARRTPC(QWidget *parent) QImageSARRFPC::QImageSARRFPC(QWidget *parent)
: QDialog(parent) : QDialog(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
@ -30,10 +30,10 @@ QImageSARRTPC::QImageSARRTPC(QWidget *parent)
} }
QImageSARRTPC::~QImageSARRTPC() QImageSARRFPC::~QImageSARRFPC()
{} {}
void QImageSARRTPC::onpushButtonRPClieck() void QImageSARRFPC::onpushButtonRPClieck()
{ {
// 调用文件选择对话框并选择一个 .tif 文件 // 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this, QString fileName = QFileDialog::getSaveFileName(this,
@ -49,7 +49,7 @@ void QImageSARRTPC::onpushButtonRPClieck()
} }
} }
void QImageSARRTPC::onpushButtonTPClieck() void QImageSARRFPC::onpushButtonTPClieck()
{ {
// 调用文件选择对话框并选择一个 .tif 文件 // 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this, QString fileName = QFileDialog::getSaveFileName(this,
@ -65,7 +65,7 @@ void QImageSARRTPC::onpushButtonTPClieck()
} }
} }
void QImageSARRTPC::onpushButtonEchoClieck() void QImageSARRFPC::onpushButtonEchoClieck()
{ {
// 调用文件选择对话框并选择一个 .tif 文件 // 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getExistingDirectory(this, u8"选择回波存放路径", ""); QString fileName = QFileDialog::getExistingDirectory(this, u8"选择回波存放路径", "");
@ -79,7 +79,7 @@ void QImageSARRTPC::onpushButtonEchoClieck()
} }
void QImageSARRTPC::onpushButtongpxmlClieck() void QImageSARRFPC::onpushButtongpxmlClieck()
{ {
// 调用文件选择对话框并选择一个 .tif 文件 // 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this, QString fileName = QFileDialog::getSaveFileName(this,
@ -95,7 +95,7 @@ void QImageSARRTPC::onpushButtongpxmlClieck()
} }
} }
void QImageSARRTPC::onpushButtonTaskxmlClieck() void QImageSARRFPC::onpushButtonTaskxmlClieck()
{ {
// 调用文件选择对话框并选择一个 .tif 文件 // 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this, QString fileName = QFileDialog::getSaveFileName(this,
@ -111,7 +111,7 @@ void QImageSARRTPC::onpushButtonTaskxmlClieck()
} }
} }
void QImageSARRTPC::onpushButtondemClieck() void QImageSARRFPC::onpushButtondemClieck()
{ {
// 调用文件选择对话框并选择一个 .tif 文件 // 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this, QString fileName = QFileDialog::getSaveFileName(this,
@ -127,7 +127,7 @@ void QImageSARRTPC::onpushButtondemClieck()
} }
} }
void QImageSARRTPC::onpushButtonlandcoverClieck() void QImageSARRFPC::onpushButtonlandcoverClieck()
{ {
// 调用文件选择对话框并选择一个 .tif 文件 // 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this, QString fileName = QFileDialog::getSaveFileName(this,
@ -143,7 +143,7 @@ void QImageSARRTPC::onpushButtonlandcoverClieck()
} }
} }
void QImageSARRTPC::onpushButtonHHSigma0Clieck() void QImageSARRFPC::onpushButtonHHSigma0Clieck()
{ {
// 调用文件选择对话框并选择一个 .tif 文件 // 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this, QString fileName = QFileDialog::getSaveFileName(this,
@ -159,7 +159,7 @@ void QImageSARRTPC::onpushButtonHHSigma0Clieck()
} }
} }
void QImageSARRTPC::onpushButtonHVSigma0Clieck() void QImageSARRFPC::onpushButtonHVSigma0Clieck()
{ {
// 调用文件选择对话框并选择一个 .tif 文件 // 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this, QString fileName = QFileDialog::getSaveFileName(this,
@ -175,7 +175,7 @@ void QImageSARRTPC::onpushButtonHVSigma0Clieck()
} }
} }
void QImageSARRTPC::onpushButtonVHSigma0Clieck() void QImageSARRFPC::onpushButtonVHSigma0Clieck()
{ {
// 调用文件选择对话框并选择一个 .tif 文件 // 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this, QString fileName = QFileDialog::getSaveFileName(this,
@ -191,7 +191,7 @@ void QImageSARRTPC::onpushButtonVHSigma0Clieck()
} }
} }
void QImageSARRTPC::onpushButtonVVSigma0Clieck() void QImageSARRFPC::onpushButtonVVSigma0Clieck()
{ {
// 调用文件选择对话框并选择一个 .tif 文件 // 调用文件选择对话框并选择一个 .tif 文件
QString fileName = QFileDialog::getSaveFileName(this, QString fileName = QFileDialog::getSaveFileName(this,
@ -207,7 +207,7 @@ void QImageSARRTPC::onpushButtonVVSigma0Clieck()
} }
} }
void QImageSARRTPC::onBtnaccept() void QImageSARRFPC::onBtnaccept()
{ {
@ -242,11 +242,11 @@ void QImageSARRTPC::onBtnaccept()
long cpucore_num = std::thread::hardware_concurrency(); long cpucore_num = std::thread::hardware_concurrency();
RTPCProcessMain(cpucore_num, TransAntPatternFilePath, ReceiveAntPatternFilePath, simulationtaskName, OutEchoPath, GPSXmlPath, TaskXmlPath, demTiffPath, landConverPath, HHSigmaPath, HVSigmaPath, VHSigmaPath, VVSigmaPath); RFPCProcessMain(cpucore_num, TransAntPatternFilePath, ReceiveAntPatternFilePath, simulationtaskName, OutEchoPath, GPSXmlPath, TaskXmlPath, demTiffPath, landConverPath, HHSigmaPath, HVSigmaPath, VHSigmaPath, VVSigmaPath);
} }
void QImageSARRTPC::onBtnReject() void QImageSARRFPC::onBtnReject()
{ {
this->close(); this->close();
} }

View File

@ -1,15 +1,15 @@
#pragma once #pragma once
#include <QMainWindow> #include <QMainWindow>
#include "ui_QImageSARRTPC.h" #include "ui_QImageSARRFPC.h"
class QImageSARRTPC : public QDialog class QImageSARRFPC : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
QImageSARRTPC(QWidget *parent = nullptr); QImageSARRFPC(QWidget *parent = nullptr);
~QImageSARRTPC(); ~QImageSARRFPC();
public slots: public slots:
@ -30,5 +30,5 @@ public slots:
void onBtnReject(); void onBtnReject();
private: private:
Ui::QImageSARRTPCClass ui; Ui::QImageSARRFPCClass ui;
}; };

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>QImageSARRTPCClass</class> <class>QImageSARRFPCClass</class>
<widget class="QDialog" name="QImageSARRTPCClass"> <widget class="QDialog" name="QImageSARRFPCClass">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>RTPC回波仿真</string> <string>RFPC回波仿真</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>

View File

@ -1,6 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "RTPCProcessCls.h" #include "RFPCProcessCls.h"
#include "BaseConstVariable.h" #include "BaseConstVariable.h"
#include "SARSatelliteSimulationAbstractCls.h" #include "SARSatelliteSimulationAbstractCls.h"
#include "SARSimulationTaskSetting.h" #include "SARSimulationTaskSetting.h"
@ -21,7 +21,7 @@
#ifdef __CUDANVCC___ #ifdef __CUDANVCC___
#include "GPUTool.cuh" #include "GPUTool.cuh"
#include "GPURTPC.cuh" #include "GPURFPC.cuh"
#endif // __CUDANVCC___ #endif // __CUDANVCC___
#include <Imageshow/ImageShowDialogClass.h> #include <Imageshow/ImageShowDialogClass.h>
@ -31,7 +31,7 @@
RTPCProcessCls::RTPCProcessCls() RFPCProcessCls::RFPCProcessCls()
{ {
this->PluseCount = 0; this->PluseCount = 0;
this->PlusePoint = 0; this->PlusePoint = 0;
@ -57,67 +57,67 @@ RTPCProcessCls::RTPCProcessCls()
} }
RTPCProcessCls::~RTPCProcessCls() RFPCProcessCls::~RFPCProcessCls()
{ {
} }
void RTPCProcessCls::setTaskSetting(std::shared_ptr < AbstractSARSatelliteModel> TaskSetting) void RFPCProcessCls::setTaskSetting(std::shared_ptr < AbstractSARSatelliteModel> TaskSetting)
{ {
this->TaskSetting = std::shared_ptr < AbstractSARSatelliteModel>(TaskSetting); this->TaskSetting = std::shared_ptr < AbstractSARSatelliteModel>(TaskSetting);
qDebug() << "RTPCProcessCls::setTaskSetting"; qDebug() << "RFPCProcessCls::setTaskSetting";
} }
void RTPCProcessCls::setEchoSimulationDataSetting(std::shared_ptr<EchoL0Dataset> EchoSimulationData) void RFPCProcessCls::setEchoSimulationDataSetting(std::shared_ptr<EchoL0Dataset> EchoSimulationData)
{ {
this->EchoSimulationData = std::shared_ptr<EchoL0Dataset>(EchoSimulationData); this->EchoSimulationData = std::shared_ptr<EchoL0Dataset>(EchoSimulationData);
qDebug() << "RTPCProcessCls::setEchoSimulationDataSetting"; qDebug() << "RFPCProcessCls::setEchoSimulationDataSetting";
} }
void RTPCProcessCls::setTaskFileName(QString EchoFileName) void RFPCProcessCls::setTaskFileName(QString EchoFileName)
{ {
this->TaskFileName = EchoFileName; this->TaskFileName = EchoFileName;
} }
void RTPCProcessCls::setDEMTiffPath(QString DEMTiffPath) void RFPCProcessCls::setDEMTiffPath(QString DEMTiffPath)
{ {
this->DEMTiffPath = DEMTiffPath; this->DEMTiffPath = DEMTiffPath;
} }
void RTPCProcessCls::setLandCoverPath(QString LandCoverPath) void RFPCProcessCls::setLandCoverPath(QString LandCoverPath)
{ {
this->LandCoverPath = LandCoverPath; this->LandCoverPath = LandCoverPath;
} }
void RTPCProcessCls::setHHSigmaPath(QString HHSigmaPath) void RFPCProcessCls::setHHSigmaPath(QString HHSigmaPath)
{ {
this->HHSigmaPath = HHSigmaPath; this->HHSigmaPath = HHSigmaPath;
} }
void RTPCProcessCls::setHVSigmaPath(QString HVSigmaPath) void RFPCProcessCls::setHVSigmaPath(QString HVSigmaPath)
{ {
this->HVSigmaPath = HVSigmaPath; this->HVSigmaPath = HVSigmaPath;
} }
void RTPCProcessCls::setVHSigmaPath(QString VHSigmaPath) void RFPCProcessCls::setVHSigmaPath(QString VHSigmaPath)
{ {
this->VHSigmaPath = VHSigmaPath; this->VHSigmaPath = VHSigmaPath;
} }
void RTPCProcessCls::setVVSigmaPath(QString VVSigmaPath) void RFPCProcessCls::setVVSigmaPath(QString VVSigmaPath)
{ {
this->VVSigmaPath = VVSigmaPath; this->VVSigmaPath = VVSigmaPath;
} }
void RTPCProcessCls::setOutEchoPath(QString OutEchoPath) void RFPCProcessCls::setOutEchoPath(QString OutEchoPath)
{ {
this->OutEchoPath = OutEchoPath; this->OutEchoPath = OutEchoPath;
} }
ErrorCode RTPCProcessCls::Process(long num_thread) ErrorCode RFPCProcessCls::Process(long num_thread)
{ {
// RTPC 算法 // RFPC 算法
qDebug() << u8"params init ...."; qDebug() << u8"params init ....";
ErrorCode stateCode = this->InitParams(); ErrorCode stateCode = this->InitParams();
if (stateCode != ErrorCode::SUCCESS) { if (stateCode != ErrorCode::SUCCESS) {
@ -130,7 +130,7 @@ ErrorCode RTPCProcessCls::Process(long num_thread)
return stateCode; return stateCode;
} }
else {} else {}
qDebug() << "RTPCMainProcess"; qDebug() << "RFPCMainProcess";
stateCode = this->InitEchoMaskArray(); stateCode = this->InitEchoMaskArray();
if (stateCode != ErrorCode::SUCCESS) { if (stateCode != ErrorCode::SUCCESS) {
@ -139,8 +139,10 @@ ErrorCode RTPCProcessCls::Process(long num_thread)
else {} else {}
qDebug() << "InitEchoMaskArray"; qDebug() << "InitEchoMaskArray";
//stateCode = this->RTPCMainProcess(num_thread); //stateCode = this->RFPCMainProcess(num_thread);
stateCode = this->RTPCMainProcess_GPU( ); // 初始化回波
this->EchoSimulationData->initEchoArr(std::complex<float>(0, 0));
stateCode = this->RFPCMainProcess_GPU( );
if (stateCode != ErrorCode::SUCCESS) { if (stateCode != ErrorCode::SUCCESS) {
return stateCode; return stateCode;
@ -151,13 +153,13 @@ ErrorCode RTPCProcessCls::Process(long num_thread)
return ErrorCode::SUCCESS; return ErrorCode::SUCCESS;
} }
ErrorCode RTPCProcessCls::InitParams() ErrorCode RFPCProcessCls::InitParams()
{ {
if (nullptr == this->TaskSetting || this->DEMTiffPath.isEmpty() || if (nullptr == this->TaskSetting || this->DEMTiffPath.isEmpty() ||
this->LandCoverPath.isEmpty() || this->HHSigmaPath.isEmpty() || this->LandCoverPath.isEmpty() || this->HHSigmaPath.isEmpty() ||
this->HVSigmaPath.isEmpty() || this->VHSigmaPath.isEmpty() || this->HVSigmaPath.isEmpty() || this->VHSigmaPath.isEmpty() ||
this->VVSigmaPath.isEmpty()) { this->VVSigmaPath.isEmpty()) {
return ErrorCode::RTPC_PARAMSISEMPTY; return ErrorCode::RFPC_PARAMSISEMPTY;
} }
else { else {
@ -180,6 +182,7 @@ ErrorCode RTPCProcessCls::InitParams()
this->EchoSimulationData->setNearRange(this->TaskSetting->getNearRange()); this->EchoSimulationData->setNearRange(this->TaskSetting->getNearRange());
this->EchoSimulationData->setFarRange(this->TaskSetting->getFarRange()); this->EchoSimulationData->setFarRange(this->TaskSetting->getFarRange());
this->EchoSimulationData->setFs(this->TaskSetting->getFs()); this->EchoSimulationData->setFs(this->TaskSetting->getFs());
this->EchoSimulationData->setBandwidth(this->TaskSetting->getBandWidth());
this->EchoSimulationData->setCenterAngle(this->TaskSetting->getCenterLookAngle()); this->EchoSimulationData->setCenterAngle(this->TaskSetting->getCenterLookAngle());
this->EchoSimulationData->setLookSide(this->TaskSetting->getIsRightLook() ? "R" : "L"); this->EchoSimulationData->setLookSide(this->TaskSetting->getIsRightLook() ? "R" : "L");
this->EchoSimulationData->OpenOrNew(OutEchoPath, TaskFileName, PluseCount, PlusePoint); this->EchoSimulationData->OpenOrNew(OutEchoPath, TaskFileName, PluseCount, PlusePoint);
@ -192,7 +195,7 @@ ErrorCode RTPCProcessCls::InitParams()
return ErrorCode::SUCCESS; return ErrorCode::SUCCESS;
} }
ErrorCode RTPCProcessCls::DEMPreprocess() ErrorCode RFPCProcessCls::DEMPreprocess()
{ {
this->demxyzPath = QDir(tmpfolderPath).filePath("demxyz.bin"); this->demxyzPath = QDir(tmpfolderPath).filePath("demxyz.bin");
@ -307,7 +310,7 @@ ErrorCode RTPCProcessCls::DEMPreprocess()
return ErrorCode::SUCCESS; return ErrorCode::SUCCESS;
} }
ErrorCode RTPCProcessCls::InitEchoMaskArray() ErrorCode RFPCProcessCls::InitEchoMaskArray()
{ {
QString name = this->EchoSimulationData->getSimulationTaskName(); QString name = this->EchoSimulationData->getSimulationTaskName();
this->OutEchoMaskPath = JoinPath(this->OutEchoPath, name + "_echomask.bin"); this->OutEchoMaskPath = JoinPath(this->OutEchoPath, name + "_echomask.bin");
@ -336,11 +339,9 @@ ErrorCode RTPCProcessCls::InitEchoMaskArray()
} }
ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( ) ErrorCode RFPCProcessCls::RFPCMainProcess_GPU( )
{ {
double widthSpace = LIGHTSPEED / 2 / this->TaskSetting->getFs(); double widthSpace = LIGHTSPEED / 2 / this->TaskSetting->getFs();
double prf_time = 0; double prf_time = 0;
double dt = 1 / this->TaskSetting->getPRF();// 获取每次脉冲的时间间隔 double dt = 1 / this->TaskSetting->getPRF();// 获取每次脉冲的时间间隔
bool antflag = true; // 计算天线方向图 bool antflag = true; // 计算天线方向图
@ -348,6 +349,12 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
Point3 GERpoint{ 0,0,0 }; Point3 GERpoint{ 0,0,0 };
double R = 0; double R = 0;
double dem_row = 0, dem_col = 0, dem_alt = 0; double dem_row = 0, dem_col = 0, dem_alt = 0;
QVector<double> freqlist = this->TaskSetting->getFreqList();
float* freqpoints=(float*)mallocCUDAHost(sizeof(float)*freqlist.size());
for (long ii = 0; ii < freqlist.size(); ii++) {
freqpoints[ii] = freqlist[ii];
}
long double imageStarttime = 0; long double imageStarttime = 0;
imageStarttime = this->TaskSetting->getSARImageStartTime(); imageStarttime = this->TaskSetting->getSARImageStartTime();
@ -373,11 +380,7 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
std::shared_ptr<AbstractRadiationPattern> TransformPattern = this->TaskSetting->getTransformRadiationPattern(); // 发射天线方向图 std::shared_ptr<AbstractRadiationPattern> TransformPattern = this->TaskSetting->getTransformRadiationPattern(); // 发射天线方向图
std::shared_ptr<AbstractRadiationPattern> ReceivePattern = this->TaskSetting->getReceiveRadiationPattern(); // 接收天线方向图 std::shared_ptr<AbstractRadiationPattern> ReceivePattern = this->TaskSetting->getReceiveRadiationPattern(); // 接收天线方向图
long PlusePoint = this->EchoSimulationData->getPlusePoints(); long PlusePoint = this->EchoSimulationData->getPlusePoints();
// 初始化回波
this->EchoSimulationData->initEchoArr(std::complex<float>(0, 0));
POLARTYPEENUM polartype = this->TaskSetting->getPolarType(); POLARTYPEENUM polartype = this->TaskSetting->getPolarType();
gdalImage echoMaskImg(this->OutEchoMaskPath); gdalImage echoMaskImg(this->OutEchoMaskPath);
@ -385,7 +388,7 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
QMessageBox::information(this, u8"程序提示", u8"请确定安装了CUDA库"); QMessageBox::information(this, u8"程序提示", u8"请确定安装了CUDA库");
#else #else
// RTPC CUDA版本 // RFPC CUDA版本
if (pluseCount * 4 * 18 > Memory1MB * 100) { if (pluseCount * 4 * 18 > Memory1MB * 100) {
long max = Memory1MB * 100 / 4 / 20 / PluseCount; long max = Memory1MB * 100 / 4 / 20 / PluseCount;
QMessageBox::warning(nullptr, u8"仿真场景太大了", u8"当前频点数下,脉冲数量最多为:" + QString::number(max)); QMessageBox::warning(nullptr, u8"仿真场景太大了", u8"当前频点数下,脉冲数量最多为:" + QString::number(max));
@ -431,7 +434,6 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
} }
} }
testOutAntPatternTrans("TransPattern.bin", h_TantPattern, TstartTheta, Tdtheta, TstartPhi, Tdphi, Tthetanum, Tphinum); testOutAntPatternTrans("TransPattern.bin", h_TantPattern, TstartTheta, Tdtheta, TstartPhi, Tdphi, Tthetanum, Tphinum);
for (long i = 0; i < Tthetanum; i++) { for (long i = 0; i < Tthetanum; i++) {
for (long j = 0; j < Tphinum; j++) { for (long j = 0; j < Tphinum; j++) {
@ -578,21 +580,6 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
d_demsloper_z=(float* )mallocCUDADevice( sizeof(float) * blokline * tempDemCols); d_demsloper_z=(float* )mallocCUDADevice( sizeof(float) * blokline * tempDemCols);
d_demsloper_angle= (float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols); d_demsloper_angle= (float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols);
float* h_dem_theta; // 天线方向图
float* h_dem_phi;
float* d_dem_theta;
float* d_dem_phi;
h_dem_theta=(float* )mallocCUDAHost( sizeof(float) * blokline * tempDemCols);
h_dem_phi= (float*)mallocCUDAHost(sizeof(float) * blokline * tempDemCols);
d_dem_theta= (float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols);// 9
d_dem_phi= (float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols);
HostToDevice((void*)h_dem_theta, (void*)d_dem_theta, sizeof(float) * blokline * tempDemCols);
HostToDevice((void*)h_dem_phi, (void*)d_dem_phi, sizeof(float) * blokline * tempDemCols);
// 提前声明参数变量 // 提前声明参数变量
float* h_R;// 辐射方向 float* h_R;// 辐射方向
float* h_localangle;//入射角 float* h_localangle;//入射角
@ -605,37 +592,9 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
d_R= (float*)mallocCUDADevice(sizeof(float) * blokline * tempDemCols); d_R= (float*)mallocCUDADevice(sizeof(float) * blokline * tempDemCols);
d_localangle= (float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols); d_localangle= (float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols);
float* h_RstX;
float* h_RstY;
float* h_RstZ;
float* d_RstX; float* h_gain = (float*)mallocCUDAHost( sizeof(float)* blokline* tempDemCols);
float* d_RstY; float* d_gain = (float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols);
float* d_RstZ;
h_RstX=(float*)mallocCUDAHost( sizeof(float) * blokline * tempDemCols);
h_RstY=(float*)mallocCUDAHost( sizeof(float) * blokline * tempDemCols);
h_RstZ=(float*)mallocCUDAHost( sizeof(float) * blokline * tempDemCols); // 14
d_RstX=(float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols);
d_RstY=(float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols);
d_RstZ=(float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols);
float* h_sigma0;
float* h_TransAnt;
float* h_ReciveAnt;
float* d_sigma0;
float* d_TransAnt;
float* d_ReciveAnt;
h_sigma0= (float*)mallocCUDAHost( sizeof(float)* blokline* tempDemCols);
h_TransAnt = (float*)mallocCUDAHost(sizeof(float) * blokline * tempDemCols);
h_ReciveAnt = (float*)mallocCUDAHost(sizeof(float) * blokline * tempDemCols); // 17
d_sigma0= (float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols);
d_TransAnt= (float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols);
d_ReciveAnt= (float*)mallocCUDADevice( sizeof(float) * blokline * tempDemCols);
// 回波 // 回波
cuComplex* h_echo; cuComplex* h_echo;
@ -643,30 +602,11 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
h_echo=(cuComplex*)mallocCUDAHost(sizeof(cuComplex) * blokline * tempDemCols); h_echo=(cuComplex*)mallocCUDAHost(sizeof(cuComplex) * blokline * tempDemCols);
d_echo=(cuComplex*)mallocCUDADevice( sizeof(cuComplex) * blokline * tempDemCols); //19 d_echo=(cuComplex*)mallocCUDADevice( sizeof(cuComplex) * blokline * tempDemCols); //19
long* h_FreqID;
long* d_FreqID;
h_FreqID=(long*)mallocCUDAHost( sizeof(long) * blokline * tempDemCols);
d_FreqID=(long*)mallocCUDADevice( sizeof(long) * blokline * tempDemCols); //21
// 地表覆盖类型 // 地表覆盖类型
Eigen::MatrixXd landcover = Eigen::MatrixXd::Zero(blokline, tempDemCols);// 地面覆盖类型 Eigen::MatrixXd landcover = Eigen::MatrixXd::Zero(blokline, tempDemCols);// 地面覆盖类型
long* h_demcls = (long*)mallocCUDAHost(sizeof(long) * blokline * tempDemCols); long* h_demcls = (long*)mallocCUDAHost(sizeof(long) * blokline * tempDemCols);
long* d_demcls = (long*)mallocCUDADevice(sizeof(long) * blokline * tempDemCols); long* d_demcls = (long*)mallocCUDADevice(sizeof(long) * blokline * tempDemCols);
float* h_amp=(float*)mallocCUDAHost(sizeof(float) * blokline * tempDemCols);
float* d_amp=(float*)mallocCUDADevice(sizeof(float) * blokline * tempDemCols);
float* h_echoAmp = (float*)mallocCUDAHost(sizeof(float) * blokline * tempDemCols);
float* d_echoAmp = (float*)mallocCUDADevice(sizeof(float) * blokline * tempDemCols);
float* h_echoPhase = (float*)mallocCUDAHost(sizeof(float) * blokline * tempDemCols);
float* d_echoPhase = (float*)mallocCUDADevice(sizeof(float) * blokline * tempDemCols);
//float* h_R = (float*)mallocCUDAHost(sizeof(float) * blokline * tempDemCols);
//float* d_R = (float*)mallocCUDADevice(sizeof(float) * blokline * tempDemCols);
for (startline = 0; startline < demRow; startline = startline + blokline) { for (startline = 0; startline < demRow; startline = startline + blokline) {
long newblokline = blokline; long newblokline = blokline;
if ((startline + blokline) >= demRow) { if ((startline + blokline) >= demRow) {
@ -691,23 +631,11 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
FreeCUDAHost(h_demsloper_y); FreeCUDADevice(d_demsloper_y); FreeCUDAHost(h_demsloper_y); FreeCUDADevice(d_demsloper_y);
FreeCUDAHost(h_demsloper_z); FreeCUDADevice(d_demsloper_z); //6 FreeCUDAHost(h_demsloper_z); FreeCUDADevice(d_demsloper_z); //6
FreeCUDAHost(h_demsloper_angle); FreeCUDADevice(d_demsloper_angle);//7 FreeCUDAHost(h_demsloper_angle); FreeCUDADevice(d_demsloper_angle);//7
FreeCUDAHost(h_dem_theta); FreeCUDADevice(d_dem_theta);
FreeCUDAHost(h_dem_phi); FreeCUDADevice(d_dem_phi); //9
FreeCUDAHost(h_R); FreeCUDADevice(d_R); FreeCUDAHost(h_R); FreeCUDADevice(d_R);
FreeCUDAHost(h_localangle); FreeCUDADevice(d_localangle); //11 FreeCUDAHost(h_localangle); FreeCUDADevice(d_localangle); //11
FreeCUDAHost(h_RstX); FreeCUDADevice(d_RstX); FreeCUDAHost(h_gain); FreeCUDADevice(d_gain);
FreeCUDAHost(h_RstY); FreeCUDADevice(d_RstY);
FreeCUDAHost(h_RstZ); FreeCUDADevice(d_RstZ); //14
FreeCUDAHost(h_sigma0); FreeCUDADevice(d_sigma0);
FreeCUDAHost(h_TransAnt); FreeCUDADevice(d_TransAnt);
FreeCUDAHost(h_ReciveAnt); FreeCUDADevice(d_ReciveAnt); //17
FreeCUDAHost(h_echo); FreeCUDADevice(d_echo);//19 FreeCUDAHost(h_echo); FreeCUDADevice(d_echo);//19
FreeCUDAHost(h_FreqID); FreeCUDADevice(d_FreqID);//20
FreeCUDAHost(h_demcls); FreeCUDADevice(d_demcls); FreeCUDAHost(h_demcls); FreeCUDADevice(d_demcls);
FreeCUDAHost(h_amp); FreeCUDADevice(d_amp);
FreeCUDAHost(h_echoAmp); FreeCUDADevice(d_echoAmp);
FreeCUDAHost(h_echoPhase); FreeCUDADevice(d_echoPhase);
h_dem_x = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols); h_dem_x = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_dem_y = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols); h_dem_y = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
@ -716,25 +644,12 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
h_demsloper_y = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols); h_demsloper_y = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_demsloper_z = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols); h_demsloper_z = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_demsloper_angle = (float*)mallocCUDAHost(sizeof(float) * blokline * tempDemCols); h_demsloper_angle = (float*)mallocCUDAHost(sizeof(float) * blokline * tempDemCols);
h_dem_theta = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_dem_phi = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_R = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols); h_R = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_localangle = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols); h_localangle = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_RstX = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols); h_gain = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_RstY = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_RstZ = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_sigma0 = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_TransAnt = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_ReciveAnt = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_echo = (cuComplex*)mallocCUDAHost(sizeof(cuComplex) * newblokline * tempDemCols); h_echo = (cuComplex*)mallocCUDAHost(sizeof(cuComplex) * newblokline * tempDemCols);
h_FreqID = (long*)mallocCUDAHost(sizeof(long) * newblokline * tempDemCols);
h_demcls = (long*)mallocCUDAHost(sizeof(long) * newblokline * tempDemCols); h_demcls = (long*)mallocCUDAHost(sizeof(long) * newblokline * tempDemCols);
h_amp = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_R = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols); h_R = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_echoAmp = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
h_echoPhase = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
d_dem_x=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols); d_dem_x=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_dem_y=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols); d_dem_y=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
@ -743,23 +658,12 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
d_demsloper_y=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols); d_demsloper_y=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_demsloper_z=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);//6 d_demsloper_z=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);//6
d_demsloper_angle=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);//7 d_demsloper_angle=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);//7
d_dem_theta=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_dem_phi=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);// 9
d_R=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols); d_R=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_localangle=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols); d_localangle=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_RstX=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols); d_gain =(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_RstY=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_RstZ=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_sigma0=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_TransAnt=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_ReciveAnt=(float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_echo=(cuComplex*)mallocCUDADevice(sizeof(cuComplex) * newblokline * tempDemCols); d_echo=(cuComplex*)mallocCUDADevice(sizeof(cuComplex) * newblokline * tempDemCols);
d_FreqID=(long*)mallocCUDADevice(sizeof(long) * newblokline * tempDemCols);
d_demcls = (long*)mallocCUDADevice(sizeof(long) * newblokline * tempDemCols); d_demcls = (long*)mallocCUDADevice(sizeof(long) * newblokline * tempDemCols);
d_amp = (float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_R = (float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols); d_R = (float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_echoAmp = (float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
d_echoPhase = (float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
} }
//# pragma omp parallel for //# pragma omp parallel for
for (long i = 0; i < newblokline; i++) { for (long i = 0; i < newblokline; i++) {
@ -772,9 +676,6 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
h_demsloper_z[i * demxyz.width + j] = float(demsloper_z(i, j)); h_demsloper_z[i * demxyz.width + j] = float(demsloper_z(i, j));
h_demsloper_angle[i * demxyz.width + j] = float(sloperAngle(i, j)); h_demsloper_angle[i * demxyz.width + j] = float(sloperAngle(i, j));
h_demcls[i * demxyz.width + j] = clamap[long(landcover(i, j))]; h_demcls[i * demxyz.width + j] = clamap[long(landcover(i, j))];
h_amp[i * demxyz.width + j] = 0.0f;
h_echoAmp[i * demxyz.width + j] = 0.0f;
h_echoPhase[i * demxyz.width + j] = 0.0f;
} }
} }
@ -785,12 +686,7 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
HostToDevice((void*)h_demsloper_y, (void*)d_demsloper_y, sizeof(float) * newblokline * tempDemCols); HostToDevice((void*)h_demsloper_y, (void*)d_demsloper_y, sizeof(float) * newblokline * tempDemCols);
HostToDevice((void*)h_demsloper_z, (void*)d_demsloper_z, sizeof(float) * newblokline * tempDemCols); HostToDevice((void*)h_demsloper_z, (void*)d_demsloper_z, sizeof(float) * newblokline * tempDemCols);
HostToDevice((void*)h_demsloper_angle, (void*)d_demsloper_angle, sizeof(float) * newblokline * tempDemCols); HostToDevice((void*)h_demsloper_angle, (void*)d_demsloper_angle, sizeof(float) * newblokline * tempDemCols);
HostToDevice((void*)h_dem_theta, (void*)d_dem_theta, sizeof(float) * newblokline * tempDemCols);
HostToDevice((void*)h_dem_phi, (void*)d_dem_phi, sizeof(float) * newblokline* tempDemCols);
HostToDevice((void*)h_demcls, (void*)d_demcls, sizeof(long) * newblokline* tempDemCols); HostToDevice((void*)h_demcls, (void*)d_demcls, sizeof(long) * newblokline* tempDemCols);
HostToDevice((void*)h_amp, (void*)d_amp, sizeof(float) * newblokline* tempDemCols);
HostToDevice((void*)h_echoAmp, (void*)d_echoAmp, sizeof(float) * newblokline* tempDemCols);
HostToDevice((void*)h_echoPhase, (void*)d_echoPhase, sizeof(float) * newblokline* tempDemCols);
@ -805,13 +701,27 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
long pixelcount = newblokline * tempDemCols; long pixelcount = newblokline * tempDemCols;
long echoblockline = Memory1MB * 2000 / 8 / 2 / PlusePoint; long echoblockline = Memory1MB / 8 / 2 / PlusePoint*2;
long startprfid = 0; long startprfid = 0;
int grid_size = (pixelcount + BLOCK_SIZE - 1) / BLOCK_SIZE;
cuComplex* d_echosum_temp = (cuComplex*)mallocCUDADevice(sizeof(cuComplex) * grid_size);
for (startprfid = 0; startprfid < pluseCount; startprfid = startprfid + echoblockline) { for (startprfid = 0; startprfid < pluseCount; startprfid = startprfid + echoblockline) {
long templine = startprfid + echoblockline < PluseCount ? echoblockline : PluseCount - startprfid; long templine = startprfid + echoblockline < PluseCount ? echoblockline : PluseCount - startprfid;
std::shared_ptr<std::complex<float>> echotemp = this->EchoSimulationData->getEchoArr(startprfid, templine);
Eigen::MatrixXd echoMasktemp = echoMaskImg.getData(startprfid,0, templine,echoMaskImg.width,1); Eigen::MatrixXd echoMasktemp = echoMaskImg.getData(startprfid,0, templine,echoMaskImg.width,1);
// 创建内存
cuComplex* h_echoData_tempblock = (cuComplex*)mallocCUDAHost(sizeof(cuComplex) * templine * PlusePoint);
cuComplex* d_echoData_tempblock = (cuComplex*)mallocCUDADevice(sizeof(cuComplex) * templine * PlusePoint);
for (long tempprfid = 0; tempprfid < templine; tempprfid++) {
for (long j = 0; j < PlusePoint; j++) {
h_echoData_tempblock[tempprfid * PlusePoint + j] = make_cuComplex(0, 0);
}
}
HostToDevice(h_echoData_tempblock, d_echoData_tempblock, sizeof(cuComplex) * templine * PlusePoint); // 回波复制
for (long tempprfid = 0; tempprfid < templine; tempprfid++) { for (long tempprfid = 0; tempprfid < templine; tempprfid++) {
{// 计算 {// 计算
long prfid = tempprfid + startprfid; long prfid = tempprfid + startprfid;
@ -837,99 +747,43 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
#ifdef __PRFDEBUG__ #ifdef __PRFDEBUG__
std::cout << "ant Position=[" << antpx << "," << antpy << "," << antpz << "]" << std::endl; std::cout << "ant Position=[" << antpx << "," << antpy << "," << antpz << "]" << std::endl;
#endif // __PRFDEBUG__ #endif // __PRFDEBUG__
// 计算距离、局地入射角、增益
CUDARFPC_Caluation_R_Gain(
antpx, antpy, antpz, // 天线的坐标
d_dem_x, d_dem_y, d_dem_z, pixelcount, // 地面坐标
d_demsloper_x, d_demsloper_y, d_demsloper_z, // 地表坡度矢量
CUDAmake_VectorA_B(antpx, antpy, antpz, d_dem_x, d_dem_y, d_dem_z, d_RstX, d_RstY, d_RstZ, pixelcount); // Rst = Rs - Rt; 地面-> 指向 antXaxisX, antXaxisY, antXaxisZ, // 天线坐标系的X轴
CUDANorm_Vector(d_RstX, d_RstY, d_RstZ, d_R, pixelcount); // R antYaxisX, antYaxisY, antYaxisZ,// 天线坐标系的Y轴
CUDAcosAngle_VA_AB(d_RstX, d_RstY, d_RstZ, d_demsloper_x, d_demsloper_y, d_demsloper_z, d_localangle, pixelcount); // 局部入射角 (线性) antZaxisX, antZaxisY, antZaxisZ,// 天线坐标系的Z轴
SatelliteAntDirectNormal(d_RstX, d_RstY, d_RstZ, antdirectx, antdirecty, antdirectz,// 天线的指向
antXaxisX, antXaxisY, antXaxisZ,
antYaxisX, antYaxisY, antYaxisZ,
antZaxisX, antZaxisY, antZaxisZ,
antdirectx, antdirecty, antdirectz,
d_dem_theta, d_dem_phi, pixelcount);// 计算角度
#ifdef __PRFDEBUG__ d_TantPattern, TstartTheta, TstartPhi, Tdtheta, Tdphi, Tthetanum, Tphinum, // 发射天线方向图
d_RantPattern, RstartTheta, RstartPhi, Rdtheta, Rdphi, Rthetanum, Rphinum,//接收天线方向图
NearRange, FarRange,
d_R, // 输出距离
d_localangle, // 输出局地入射角
d_gain // 输出增益
);
// 计算某个具体回波
CUDA_Norm_Vector(d_RstX, d_RstY, d_RstZ, d_R, pixelcount); for (long freqid = 0; freqid < freqlist.size(); freqid++) {
float freqpoint = freqlist[freqid];
CUDARFPC_Target_Freq_EchoData(d_R,
DeviceToHost(h_RstX, d_RstX, sizeof(float)* pixelcount); d_localangle,
DeviceToHost(h_RstY, d_RstY, sizeof(float)* pixelcount); d_gain,
DeviceToHost(h_RstZ, d_RstZ, sizeof(float)* pixelcount); d_demcls,
DeviceToHost(h_R, d_R, sizeof(float)* pixelcount); pixelcount,
Pt, freqpoint,
testOutAmpArr(QString("h_RstX_%1.bin").arg(prfid), h_RstX, newblokline, tempDemCols); d_clsSigmaParam, clamapid,
testOutAmpArr(QString("h_RstY_%1.bin").arg(prfid), h_RstY, newblokline, tempDemCols); d_echo);
testOutAmpArr(QString("h_RstZ_%1.bin").arg(prfid), h_RstZ, newblokline, tempDemCols); // 数据求和
testOutAmpArr(QString("h_R_%1.bin").arg(prfid), h_R, newblokline, tempDemCols); long tempechoid = tempprfid * PlusePoint + freqid;
CUDA_DemEchoSUM_NoMalloc(d_echo, pixelcount,
#endif // __PRFDEBUG__ d_echosum_temp, grid_size,
AntPatternInterpGain(d_dem_theta, d_dem_phi, d_TransAnt, d_TantPattern, TstartTheta, TstartPhi, Tdtheta, Tdphi, Tthetanum, Tphinum, pixelcount); d_echoData_tempblock, tempechoid
AntPatternInterpGain(d_dem_theta, d_dem_phi, d_ReciveAnt, d_RantPattern, RstartTheta, RstartPhi, Rdtheta, Rdphi, Rthetanum, Rphinum, pixelcount); );
#ifdef __PRFDEBUG__
DeviceToHost(h_dem_theta, d_dem_theta, sizeof(float)* pixelcount); // 从GPU -> 主机
DeviceToHost(h_dem_phi, d_dem_phi, sizeof(float)* pixelcount);
DeviceToHost(h_localangle, d_localangle, sizeof(float)* pixelcount);
testOutAmpArr(QString("h_localangle_%1.bin").arg(prfid), h_localangle, newblokline, tempDemCols);
DeviceToHost(h_TransAnt, d_TransAnt, sizeof(float)* pixelcount);
DeviceToHost(h_ReciveAnt, d_ReciveAnt, sizeof(float)* pixelcount);
testOutAmpArr(QString("ant_theta_%1.bin").arg(prfid), h_dem_theta, newblokline, tempDemCols);
testOutAmpArr(QString("ant_phi_%1.bin").arg(prfid), h_dem_phi, newblokline, tempDemCols);
testOutAmpArr(QString("antPattern_Trans_%1.bin").arg(prfid), h_TransAnt, newblokline, tempDemCols);
testOutAmpArr(QString("antPattern_Receive_%1.bin").arg(prfid), h_ReciveAnt, newblokline, tempDemCols);
#endif // __PRFDEBUG__
// 插值后向散射系数
CUDAInterpSigma(d_demcls, d_amp, d_localangle, pixelcount, d_clsSigmaParam, clamapid);
// 计算强度
CUDACalculationEchoAmp(d_amp, d_TransAnt, d_ReciveAnt, d_R, Pt, d_echoAmp, pixelcount);
// 计算相位
CUDACalculationEchoPhase(d_R,lamda, d_echoPhase, pixelcount);
// 计算回波
CUDACombinationEchoAmpAndPhase(d_R, d_echoAmp, d_echoPhase,NearRange,Fs,PlusePoint,d_echo,d_FreqID,pixelcount);
#ifdef __PRFDEBUG__
DeviceToHost(h_amp, d_amp, sizeof(float) * pixelcount);
DeviceToHost(h_echoAmp, d_echoAmp, sizeof(float) * pixelcount);
DeviceToHost(h_echoPhase, d_echoPhase, sizeof(float) * pixelcount);
testOutAmpArr(QString("amp_%1.bin").arg(prfid), h_amp, newblokline, tempDemCols);
testOutAmpArr(QString("echoAmp_%1.bin").arg(prfid), h_echoAmp, newblokline, tempDemCols);
testOutAmpArr(QString("echoPhase_%1.bin").arg(prfid), h_echoPhase, newblokline, tempDemCols);
#endif // __PRFDEBUG__
DeviceToHost(h_echo, d_echo, sizeof(cuComplex) * pixelcount);
DeviceToHost(h_FreqID, d_FreqID, sizeof(long) * pixelcount);
//DeviceToHost(h_amp, d_amp, sizeof(float) * pixelcount);
#ifdef __PRFDEBUG__
float* h_echoAmp_real = (float*)mallocCUDAHost(sizeof(float) * pixelcount);
float* h_echoAmp_imag = (float*)mallocCUDAHost(sizeof(float) * pixelcount);
float* h_echoAmp_abs = (float*)mallocCUDAHost(sizeof(float) * pixelcount);
for (long freqi = 0; freqi < pixelcount; freqi++) {
h_echoAmp_real[freqi] = h_echoAmp[freqi].x;
h_echoAmp_imag[freqi] = h_echoAmp[freqi].y;
h_echoAmp_abs[freqi] =20*std::log10(std::abs(std::complex<double>(h_echoAmp_real[freqi], h_echoAmp_imag[freqi])));
} }
testOutAmpArr(QString("h_echoAmp_real_%1.bin").arg(prfid), h_echoAmp_real, newblokline, tempDemCols);
testOutAmpArr(QString("h_echoAmp_imag_%1.bin").arg(prfid), h_echoAmp_imag, newblokline, tempDemCols);
testOutAmpArr(QString("h_echoAmp_absdB_%1.bin").arg(prfid), h_echoAmp_abs, newblokline, tempDemCols);
testOutClsArr(QString("h_FreqID_%1.bin").arg(prfid), h_FreqID, newblokline, tempDemCols);
FreeCUDAHost(h_echoAmp_real);
FreeCUDAHost(h_echoAmp_imag);
#endif // __PRFDEBUG__
for (long freqi = 0; freqi < pixelcount; freqi++) {
long pluseid = h_FreqID[freqi];
echotemp.get()[tempprfid * PlusePoint + pluseid] =
echotemp.get()[tempprfid * PlusePoint + pluseid]
+ std::complex<float>(h_echo[freqi].x, h_echo[freqi].y);
echoMasktemp(tempprfid, pluseid)=echoMasktemp(tempprfid, pluseid) + 1;
}
if (prfid % 1000 == 0) { if (prfid % 1000 == 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; 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;
} }
@ -944,11 +798,26 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
} }
} }
DeviceToHost(h_echoData_tempblock, d_echoData_tempblock, sizeof(cuComplex) * templine * PlusePoint); // 回波复制
std::shared_ptr<std::complex<float>> echotemp = this->EchoSimulationData->getEchoArr(startprfid, templine);
for (long tempprfid = 0; tempprfid < templine; tempprfid++) {
for (long j = 0; j < PlusePoint; j++) {
echotemp.get()[tempprfid * PlusePoint + j] = echotemp.get()[tempprfid * PlusePoint + j]
+ std::complex<float>(h_echoData_tempblock[tempprfid * PlusePoint + j].x,
h_echoData_tempblock[tempprfid * PlusePoint + j].y);
}
}
echoMaskImg.saveImage(echoMasktemp, startprfid, 0, 1); echoMaskImg.saveImage(echoMasktemp, startprfid, 0, 1);
this->EchoSimulationData->saveEchoArr(echotemp, startprfid, templine); this->EchoSimulationData->saveEchoArr(echotemp, startprfid, templine);
} }
FreeCUDADevice(d_echosum_temp);
} }
std::cout << std::endl; std::cout << std::endl;
@ -964,24 +833,12 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
FreeCUDAHost(h_demsloper_angle); FreeCUDADevice(d_demsloper_angle); //7 FreeCUDAHost(h_demsloper_angle); FreeCUDADevice(d_demsloper_angle); //7
// 临时变量释放 // 临时变量释放
FreeCUDAHost(h_dem_theta); FreeCUDADevice(d_dem_theta);
FreeCUDAHost(h_dem_phi); FreeCUDADevice(d_dem_phi);// 9
FreeCUDAHost(h_R); FreeCUDADevice(d_R); FreeCUDAHost(h_R); FreeCUDADevice(d_R);
FreeCUDAHost(h_localangle); FreeCUDADevice(d_localangle); //11 FreeCUDAHost(h_localangle); FreeCUDADevice(d_localangle); //11
FreeCUDAHost(h_gain); FreeCUDADevice(d_gain);
FreeCUDAHost(h_RstX); FreeCUDADevice(d_RstX);
FreeCUDAHost(h_RstY); FreeCUDADevice(d_RstY);
FreeCUDAHost(h_RstZ); FreeCUDADevice(d_RstZ); //14
FreeCUDAHost(h_sigma0); FreeCUDADevice(d_sigma0);
FreeCUDAHost(h_TransAnt); FreeCUDADevice(d_TransAnt);
FreeCUDAHost(h_ReciveAnt); FreeCUDADevice(d_ReciveAnt); //17
FreeCUDAHost(h_echoAmp); FreeCUDADevice(d_echoAmp);//19
FreeCUDAHost(h_FreqID); FreeCUDADevice(d_FreqID);//20
FreeCUDAHost(h_demcls); FreeCUDADevice(d_demcls); FreeCUDAHost(h_demcls); FreeCUDADevice(d_demcls);
FreeCUDAHost(h_amp); FreeCUDADevice(d_amp);
FreeCUDAHost(freqpoints);
#endif #endif
@ -989,7 +846,7 @@ ErrorCode RTPCProcessCls::RTPCMainProcess_GPU( )
return ErrorCode::SUCCESS; return ErrorCode::SUCCESS;
} }
std::shared_ptr<SatelliteOribtNode[]> RTPCProcessCls::getSatelliteOribtNodes(double prf_time, double dt, bool antflag, long double imageStarttime) std::shared_ptr<SatelliteOribtNode[]> RFPCProcessCls::getSatelliteOribtNodes(double prf_time, double dt, bool antflag, long double imageStarttime)
{ {
@ -1049,7 +906,7 @@ std::shared_ptr<SatelliteOribtNode[]> RTPCProcessCls::getSatelliteOribtNodes(dou
} }
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) void RFPCProcessMain(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)
{ {
std::shared_ptr < AbstractSARSatelliteModel> task = ReadSimulationSettingsXML(TaskXmlPath); std::shared_ptr < AbstractSARSatelliteModel> task = ReadSimulationSettingsXML(TaskXmlPath);
@ -1106,19 +963,19 @@ void RTPCProcessMain(long num_thread, QString TansformPatternFilePath, QString R
task->setSatelliteOribtModel(SatelliteOribtModel); task->setSatelliteOribtModel(SatelliteOribtModel);
} }
qDebug() << "-------------- RTPC init ---------------------------------------"; qDebug() << "-------------- RFPC init ---------------------------------------";
RTPCProcessCls rtpc; RFPCProcessCls RFPC;
rtpc.setTaskSetting(task); //qDebug() << "setTaskSetting"; RFPC.setTaskSetting(task); //qDebug() << "setTaskSetting";
rtpc.setTaskFileName(simulationtaskName); //qDebug() << "setTaskFileName"; RFPC.setTaskFileName(simulationtaskName); //qDebug() << "setTaskFileName";
rtpc.setDEMTiffPath(demTiffPath); //qDebug() << "setDEMTiffPath"; RFPC.setDEMTiffPath(demTiffPath); //qDebug() << "setDEMTiffPath";
rtpc.setLandCoverPath(LandCoverPath); //qDebug() << "setLandCoverPath"; RFPC.setLandCoverPath(LandCoverPath); //qDebug() << "setLandCoverPath";
rtpc.setHHSigmaPath(HHSigmaPath); //qDebug() << "setHHSigmaPath"; RFPC.setHHSigmaPath(HHSigmaPath); //qDebug() << "setHHSigmaPath";
rtpc.setHVSigmaPath(HVSigmaPath); //qDebug() << "setHVSigmaPath"; RFPC.setHVSigmaPath(HVSigmaPath); //qDebug() << "setHVSigmaPath";
rtpc.setVHSigmaPath(VHSigmaPath); //qDebug() << "setVHSigmaPath"; RFPC.setVHSigmaPath(VHSigmaPath); //qDebug() << "setVHSigmaPath";
rtpc.setVVSigmaPath(VVSigmaPath); //qDebug() << "setVVSigmaPath"; RFPC.setVVSigmaPath(VVSigmaPath); //qDebug() << "setVVSigmaPath";
rtpc.setOutEchoPath(OutEchoPath); //qDebug() << "setOutEchoPath"; RFPC.setOutEchoPath(OutEchoPath); //qDebug() << "setOutEchoPath";
qDebug() << "-------------- RTPC start---------------------------------------"; qDebug() << "-------------- RFPC start---------------------------------------";
rtpc.Process(num_thread); // 处理程序 RFPC.Process(num_thread); // 处理程序
qDebug() << "-------------- RTPC end---------------------------------------"; qDebug() << "-------------- RFPC end---------------------------------------";
} }

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
/*****************************************************************//** /*****************************************************************//**
* \file RTPCProcessCls.h * \file RFPCProcessCls.h
* \brief Range Time domain Pulse Coherent * \brief Range Time domain Pulse Coherent
* *
* *
@ -28,11 +28,11 @@
#include "EchoDataFormat.h" #include "EchoDataFormat.h"
#include "SigmaDatabase.h" #include "SigmaDatabase.h"
class RTPCProcessCls class RFPCProcessCls
{ {
public: public:
RTPCProcessCls(); RFPCProcessCls();
~RTPCProcessCls(); ~RFPCProcessCls();
public: public:
void setTaskSetting(std::shared_ptr < AbstractSARSatelliteModel> TaskSetting); void setTaskSetting(std::shared_ptr < AbstractSARSatelliteModel> TaskSetting);
void setEchoSimulationDataSetting(std::shared_ptr < EchoL0Dataset> EchoSimulationData); void setEchoSimulationDataSetting(std::shared_ptr < EchoL0Dataset> EchoSimulationData);
@ -48,7 +48,7 @@ public:
private: private:
std::shared_ptr <AbstractSARSatelliteModel> TaskSetting; // 仿真任务设置 std::shared_ptr <AbstractSARSatelliteModel> TaskSetting; // 仿真任务设置
std::shared_ptr <EchoL0Dataset> EchoSimulationData; // GPSÊý¾Ý std::shared_ptr <EchoL0Dataset> EchoSimulationData; // »Ø²¨ÉèÖÃ
std::shared_ptr<SigmaDatabase> SigmaDatabasePtr; std::shared_ptr<SigmaDatabase> SigmaDatabasePtr;
long PluseCount; // 脉冲数量 long PluseCount; // 脉冲数量
long PlusePoint; // 脉冲点数 long PlusePoint; // 脉冲点数
@ -58,11 +58,9 @@ private:
QString HVSigmaPath; QString HVSigmaPath;
QString VHSigmaPath; QString VHSigmaPath;
QString VVSigmaPath; QString VVSigmaPath;
QString OutEchoPath; // 输出回波路径 QString OutEchoPath; // 输出回波路径
QString TaskFileName; QString TaskFileName;
QString tmpfolderPath; QString tmpfolderPath;
QString OutEchoMaskPath; QString OutEchoMaskPath;
public: public:
@ -71,8 +69,8 @@ private: //
ErrorCode InitParams();// 1. 初始化参数 ErrorCode InitParams();// 1. 初始化参数
ErrorCode DEMPreprocess(); // 2. 裁剪DEM范围 ErrorCode DEMPreprocess(); // 2. 裁剪DEM范围
ErrorCode InitEchoMaskArray(); ErrorCode InitEchoMaskArray();
//ErrorCode RTPCMainProcess(long num_thread); //ErrorCode RFPCMainProcess(long num_thread);
ErrorCode RTPCMainProcess_GPU(); ErrorCode RFPCMainProcess_GPU();
std::shared_ptr<SatelliteOribtNode[]> getSatelliteOribtNodes(double prf_time, double dt, bool antflag, long double imageStarttime); std::shared_ptr<SatelliteOribtNode[]> getSatelliteOribtNodes(double prf_time, double dt, bool antflag, long double imageStarttime);
@ -82,5 +80,5 @@ private:
QString demsloperPath; 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); void RFPCProcessMain(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

@ -199,6 +199,30 @@ double AbstractSARSatelliteModel::getBandWidth()
return 0.0; return 0.0;
} }
QVector<double> AbstractSARSatelliteModel::getFreqList()
{
double bandwidth = this->getBandWidth(); // 频率范围
double centerFreq = this->getCenterFreq(); // 中心频率
double nearR = this->getNearRange();
double farR = this->getFarRange();
// 计算分辨率
double Resolution = LIGHTSPEED / 2.0 / bandwidth; // 计算分辨率
double freqpoints = (farR - nearR) / Resolution + 1;
double minFreq = centerFreq - bandwidth / 2.0;// 最小频率
double maxFreq = minFreq + bandwidth;
double deltaFreq = bandwidth / (freqpoints - 1);
QVector<double> freqlist(freqpoints);
for (long i = 0; i < freqpoints; i++) {
freqlist[i] = minFreq + i * deltaFreq;
}
return freqlist;
}
POLARTYPEENUM AbstractSARSatelliteModel::getPolarType() POLARTYPEENUM AbstractSARSatelliteModel::getPolarType()
{ {
return POLARTYPEENUM(); return POLARTYPEENUM();
@ -219,13 +243,18 @@ double AbstractSARSatelliteModel::getPRF()
double AbstractSARSatelliteModel::getFs() double AbstractSARSatelliteModel::getFs()
{ {
return 0; double NearRange = this->getNearRange();
} double FarRange = this->getFarRange();
void AbstractSARSatelliteModel::setFs(double Fs) QVector<double> freqpoints = this->getFreqList();
{ long freqNum = freqpoints.size();
}
double timeRange = 2 * (FarRange - NearRange) / LIGHTSPEED;
double fs = freqNum / timeRange;
return fs;
}
double AbstractSARSatelliteModel::getCenterLookAngle() double AbstractSARSatelliteModel::getCenterLookAngle()
{ {
return 0.0; return 0.0;

View File

@ -259,6 +259,9 @@ public: //
virtual void setBandWidth(double bandwidth); // 带宽范围 virtual void setBandWidth(double bandwidth); // 带宽范围
virtual double getBandWidth(); virtual double getBandWidth();
virtual QVector<double> getFreqList(); // 获取频点列表
virtual POLARTYPEENUM getPolarType();// 极化类型 virtual POLARTYPEENUM getPolarType();// 极化类型
virtual void setPolarType(POLARTYPEENUM type); virtual void setPolarType(POLARTYPEENUM type);
public: // 设置PRF、FS public: // 设置PRF、FS
@ -266,7 +269,7 @@ public: //
virtual double getPRF(); virtual double getPRF();
virtual double getFs(); // 距离向采样频率 virtual double getFs(); // 距离向采样频率
virtual void setFs(double Fs);
virtual double getCenterLookAngle() ; virtual double getCenterLookAngle() ;
virtual void setCenterLookAngle(double angle) ; virtual void setCenterLookAngle(double angle) ;

View File

@ -143,16 +143,6 @@ double SARSimulationTaskSetting::getPRF()
return this->PRF; return this->PRF;
} }
double SARSimulationTaskSetting::getFs()
{
return this->Fs;
}
void SARSimulationTaskSetting::setFs(double Fs)
{
this->Fs = Fs;
}
void SARSimulationTaskSetting::setTransformRadiationPattern(std::shared_ptr<AbstractRadiationPattern> radiationPanttern) void SARSimulationTaskSetting::setTransformRadiationPattern(std::shared_ptr<AbstractRadiationPattern> radiationPanttern)
{ {
this->TransformRadiationPattern = radiationPanttern; this->TransformRadiationPattern = radiationPanttern;
@ -231,12 +221,14 @@ std::shared_ptr<AbstractSARSatelliteModel> ReadSimulationSettingsXML(QString xml
QDomElement bandWidth = taskSensor.firstChildElement("bandWidth"); QDomElement bandWidth = taskSensor.firstChildElement("bandWidth");
QDomElement centerLookAngle = taskSensor.firstChildElement("centerLookAngle"); QDomElement centerLookAngle = taskSensor.firstChildElement("centerLookAngle");
QDomElement prf = taskSensor.firstChildElement("prf"); QDomElement prf = taskSensor.firstChildElement("prf");
QDomElement fs = taskSensor.firstChildElement("fs"); //QDomElement fs = taskSensor.firstChildElement("fs");
QDomElement polar = taskSensor.firstChildElement("polar"); QDomElement polar = taskSensor.firstChildElement("polar");
QDomElement nearRange = taskSensor.firstChildElement("nearRange"); QDomElement nearRange = taskSensor.firstChildElement("nearRange");
QDomElement farRange = taskSensor.firstChildElement("farRange"); QDomElement farRange = taskSensor.firstChildElement("farRange");
QDomElement lookDirection = taskSensor.firstChildElement("lookDirection"); QDomElement lookDirection = taskSensor.firstChildElement("lookDirection");
if (imagingMode.isNull() || radarCenterFrequency.isNull() || bandWidth.isNull() || centerLookAngle.isNull() || prf.isNull() || fs.isNull() || polar.isNull() || nearRange.isNull() || farRange.isNull() ) if (imagingMode.isNull() || radarCenterFrequency.isNull() || bandWidth.isNull()
|| centerLookAngle.isNull() || prf.isNull() || polar.isNull()
|| nearRange.isNull() || farRange.isNull() )
{ {
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::XMLNOTFOUNDElEMENT)); qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::XMLNOTFOUNDElEMENT));
return nullptr; return nullptr;
@ -295,7 +287,7 @@ std::shared_ptr<AbstractSARSatelliteModel> ReadSimulationSettingsXML(QString xml
taskSetting->setBandWidth(bandWidth.text().toDouble()); taskSetting->setBandWidth(bandWidth.text().toDouble());
taskSetting->setCenterFreq(radarCenterFrequency.text().toDouble()); // ÖÐÐÄÆµÂÊ taskSetting->setCenterFreq(radarCenterFrequency.text().toDouble()); // ÖÐÐÄÆµÂÊ
taskSetting->setPRF(prf.text().toDouble()); // PRF taskSetting->setPRF(prf.text().toDouble()); // PRF
taskSetting->setFs(fs.text().toDouble()); //Fs //taskSetting->setFs(fs.text().toDouble()); //Fs
taskSetting->setNearRange(nearRange.text().toDouble()); // NearRange taskSetting->setNearRange(nearRange.text().toDouble()); // NearRange
taskSetting->setFarRange(farRange.text().toDouble()); // FarRange taskSetting->setFarRange(farRange.text().toDouble()); // FarRange
taskSetting->setIsRightLook(isR); taskSetting->setIsRightLook(isR);

View File

@ -78,13 +78,9 @@ private:
public: // 设置PRF、FS public: // 设置PRF、FS
virtual void setPRF(double prf) override; // 方位向采样频率 virtual void setPRF(double prf) override; // 方位向采样频率
virtual double getPRF() override; virtual double getPRF() override;
virtual double getFs() override; // ¾àÀëÏò²ÉÑùƵÂÊ
virtual void setFs(double Fs) override;
private: private:
double PRF; double PRF;
double Fs;
public:// 天线方向图 public:// 天线方向图

View File

@ -608,8 +608,8 @@ ErrorCode TBPImageAlgCls::ProcessCPU(long num_thread)
long startLine = 0; long startLine = 0;
long processValue = 0; long processValue = 0;
long processNumber = 0; long processNumber = 0;
QProgressDialog progressDialog(u8"RTPC回波生成中", u8"终止", 0, rowCount); QProgressDialog progressDialog(u8"RFPC回波生成中", u8"终止", 0, rowCount);
progressDialog.setWindowTitle(u8"RTPC回波生成中"); progressDialog.setWindowTitle(u8"RFPC回波生成中");
progressDialog.setWindowModality(Qt::WindowModal); progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setAutoClose(true); progressDialog.setAutoClose(true);
progressDialog.setValue(0); progressDialog.setValue(0);