RasterProcessTool/SimulationSAR/RFPCProcessCls.cpp

868 lines
34 KiB
C++
Raw Normal View History

#include "stdafx.h"
#include "RFPCProcessCls.h"
#include "BaseConstVariable.h"
#include "SARSatelliteSimulationAbstractCls.h"
#include "SARSimulationTaskSetting.h"
#include "SatelliteOribtModel.h"
#include <QDebug>
#include "ImageOperatorBase.h"
#include "GeoOperator.h"
#include "EchoDataFormat.h"
#include <QDir>
#include <QDatetime>
#include <omp.h>
2024-11-25 17:51:20 +00:00
#include <QProgressDialog>
#include <QMessageBox>
#ifdef DEBUGSHOWDIALOG
#include "ImageShowDialogClass.h"
#endif
#ifdef __CUDANVCC___
#include "GPUTool.cuh"
#include "GPURFPC.cuh"
2025-01-14 01:25:23 +00:00
#include <cuda_runtime.h>
#include <cublas_v2.h>
#endif // __CUDANVCC___
#include <Imageshow/ImageShowDialogClass.h>
RFPCProcessCls::RFPCProcessCls()
{
this->PluseCount = 0;
this->PlusePoint = 0;
this->TaskSetting = nullptr;
this->EchoSimulationData = nullptr;
2025-01-15 12:47:38 +00:00
this->LandCoverPath = "";
this->OutEchoPath = "";
2025-01-15 12:47:38 +00:00
this->LandCoverPath.clear();
this->OutEchoPath.clear();
this->SigmaDatabasePtr = std::shared_ptr<SigmaDatabase>(new SigmaDatabase);
}
RFPCProcessCls::~RFPCProcessCls()
{
}
void RFPCProcessCls::setTaskSetting(std::shared_ptr < AbstractSARSatelliteModel> TaskSetting)
{
this->TaskSetting = std::shared_ptr < AbstractSARSatelliteModel>(TaskSetting);
qDebug() << "RFPCProcessCls::setTaskSetting";
}
void RFPCProcessCls::setEchoSimulationDataSetting(std::shared_ptr<EchoL0Dataset> EchoSimulationData)
{
this->EchoSimulationData = std::shared_ptr<EchoL0Dataset>(EchoSimulationData);
qDebug() << "RFPCProcessCls::setEchoSimulationDataSetting";
}
void RFPCProcessCls::setTaskFileName(QString EchoFileName)
{
this->TaskFileName = EchoFileName;
}
void RFPCProcessCls::setDEMTiffPath(QString DEMTiffPath)
{
2025-01-15 12:47:38 +00:00
this->demxyzPath = DEMTiffPath;
}
2025-01-15 12:47:38 +00:00
void RFPCProcessCls::setSloperPath(QString InSloperPath)
{
2025-01-15 12:47:38 +00:00
this->demsloperPath = InSloperPath;
}
2025-01-15 12:47:38 +00:00
void RFPCProcessCls::setLandCoverPath(QString LandCoverPath)
{
2025-01-15 12:47:38 +00:00
this->LandCoverPath = LandCoverPath;
}
void RFPCProcessCls::setOutEchoPath(QString OutEchoPath)
{
this->OutEchoPath = OutEchoPath;
}
ErrorCode RFPCProcessCls::Process(long num_thread)
{
// RFPC <20>
qDebug() << u8"params init ....";
ErrorCode stateCode = this->InitParams();
if (stateCode != ErrorCode::SUCCESS) {
return stateCode;
}
else {}
2025-01-15 12:47:38 +00:00
qDebug() << "RFPCMainProcess";
stateCode = this->InitEchoMaskArray();
if (stateCode != ErrorCode::SUCCESS) {
return stateCode;
}
else {}
qDebug() << "InitEchoMaskArray";
//stateCode = this->RFPCMainProcess(num_thread);
// <20><>ʼ<EFBFBD><CABC><EFBFBD>ز<EFBFBD>
this->EchoSimulationData->initEchoArr(std::complex<double>(0, 0));
2025-01-06 04:03:14 +00:00
stateCode = this->RFPCMainProcess_GPU();
if (stateCode != ErrorCode::SUCCESS) {
return stateCode;
}
else {}
return ErrorCode::SUCCESS;
}
ErrorCode RFPCProcessCls::InitParams()
{
2025-01-15 12:47:38 +00:00
if (nullptr == this->TaskSetting || this->demxyzPath.isEmpty() ||
this->LandCoverPath.isEmpty() || this->demsloperPath.isEmpty()) {
return ErrorCode::RFPC_PARAMSISEMPTY;
}
else {
}
// <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
this->OutEchoPath = QDir(this->OutEchoPath).absolutePath();
// <20>ز<EFBFBD><D8B2><EFBFBD>С
double imgStart_end = this->TaskSetting->getSARImageEndTime() - this->TaskSetting->getSARImageStartTime();
this->PluseCount = ceil(imgStart_end * this->TaskSetting->getPRF());
double rangeTimeSample = (this->TaskSetting->getFarRange() - this->TaskSetting->getNearRange()) * 2.0 / LIGHTSPEED;
this->PlusePoint = ceil(rangeTimeSample * this->TaskSetting->getFs());
// <20><>ʼ<EFBFBD><CABC><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
qDebug() << "--------------Echo Data Setting ---------------------------------------";
this->EchoSimulationData = std::shared_ptr<EchoL0Dataset>(new EchoL0Dataset);
this->EchoSimulationData->setCenterFreq(this->TaskSetting->getCenterFreq());
this->EchoSimulationData->setNearRange(this->TaskSetting->getNearRange());
this->EchoSimulationData->setFarRange(this->TaskSetting->getFarRange());
this->EchoSimulationData->setFs(this->TaskSetting->getFs());
this->EchoSimulationData->setBandwidth(this->TaskSetting->getBandWidth());
this->EchoSimulationData->setCenterAngle(this->TaskSetting->getCenterLookAngle());
this->EchoSimulationData->setLookSide(this->TaskSetting->getIsRightLook() ? "R" : "L");
this->EchoSimulationData->OpenOrNew(OutEchoPath, TaskFileName, PluseCount, PlusePoint);
QString tmpfolderPath = QDir(OutEchoPath).filePath("tmp");
if (QDir(tmpfolderPath).exists() == false) {
QDir(OutEchoPath).mkpath(tmpfolderPath);
}
this->tmpfolderPath = tmpfolderPath;
return ErrorCode::SUCCESS;
}
2025-01-15 12:47:38 +00:00
ErrorCode RFPCProcessCls::InitEchoMaskArray()
{
QString name = this->EchoSimulationData->getSimulationTaskName();
this->OutEchoMaskPath = JoinPath(this->OutEchoPath, name + "_echomask.bin");
Eigen::MatrixXd gt(2, 3);
gt(0, 0) = 0;
gt(0, 1) = 1;
gt(0, 2) = 0;
gt(1, 0) = 0;
gt(1, 1) = 0;
gt(1, 2) = 1;
gdalImage echomaskImg = CreategdalImage(this->OutEchoMaskPath,
this->EchoSimulationData->getPluseCount(),
this->EchoSimulationData->getPlusePoints(),
1,
gt, "",
false, true, true);
long cols = this->EchoSimulationData->getPlusePoints();
long rows = this->EchoSimulationData->getPluseCount();
long blocksize = Memory1GB / 8 / this->EchoSimulationData->getPlusePoints() * 4;
for (long startid = 0; startid < rows; startid = startid + blocksize) {
Eigen::MatrixXd data = echomaskImg.getData(startid, 0, blocksize, cols, 1);
data = data.array() * 0;
echomaskImg.saveImage(data, startid, 0, 1);
}
return ErrorCode::SUCCESS;
}
2025-01-15 03:57:07 +00:00
std::shared_ptr<SatelliteOribtNode[]> RFPCProcessCls::getSatelliteOribtNodes(double prf_time, double dt, bool antflag, long double imageStarttime)
{
std::shared_ptr<SatelliteOribtNode[]> sateOirbtNodes(new SatelliteOribtNode[this->PluseCount], delArrPtr);
{ // <20><>̬<EFBFBD><CCAC><EFBFBD>㲻ͬ
qDebug() << "Ant position finished started !!!";
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬
std::shared_ptr<double> antpos = this->EchoSimulationData->getAntPos();
double dAt = 1e-6;
double prf_time_dt = 0;
Landpoint InP{ 0,0,0 }, outP{ 0,0,0 };
for (long prf_id = 0; prf_id < this->PluseCount; prf_id++) {
prf_time = dt * prf_id;
prf_time_dt = prf_time + dAt;
SatelliteOribtNode sateOirbtNode;
SatelliteOribtNode sateOirbtNode_dAt;
this->TaskSetting->getSatelliteOribtNode(prf_time, sateOirbtNode, antflag);
this->TaskSetting->getSatelliteOribtNode(prf_time_dt, sateOirbtNode_dAt, antflag);
sateOirbtNode.AVx = (sateOirbtNode_dAt.Vx - sateOirbtNode.Vx) / dAt; // <20><><EFBFBD>ٶ<EFBFBD>
sateOirbtNode.AVy = (sateOirbtNode_dAt.Vy - sateOirbtNode.Vy) / dAt;
sateOirbtNode.AVz = (sateOirbtNode_dAt.Vz - sateOirbtNode.Vz) / dAt;
InP.lon = sateOirbtNode.Px;
InP.lat = sateOirbtNode.Py;
InP.ati = sateOirbtNode.Pz;
outP = XYZ2LLA(InP);
antpos.get()[prf_id * 19 + 0] = prf_time + imageStarttime;
antpos.get()[prf_id * 19 + 1] = sateOirbtNode.Px;
antpos.get()[prf_id * 19 + 2] = sateOirbtNode.Py;
antpos.get()[prf_id * 19 + 3] = sateOirbtNode.Pz;
antpos.get()[prf_id * 19 + 4] = sateOirbtNode.Vx;
antpos.get()[prf_id * 19 + 5] = sateOirbtNode.Vy;
antpos.get()[prf_id * 19 + 6] = sateOirbtNode.Vz;
antpos.get()[prf_id * 19 + 7] = sateOirbtNode.AntDirecX;
antpos.get()[prf_id * 19 + 8] = sateOirbtNode.AntDirecY;
antpos.get()[prf_id * 19 + 9] = sateOirbtNode.AntDirecZ;
antpos.get()[prf_id * 19 + 10] = sateOirbtNode.AVx;
antpos.get()[prf_id * 19 + 11] = sateOirbtNode.AVy;
antpos.get()[prf_id * 19 + 12] = sateOirbtNode.AVz;
antpos.get()[prf_id * 19 + 13] = sateOirbtNode.zeroDopplerDirectX;
antpos.get()[prf_id * 19 + 14] = sateOirbtNode.zeroDopplerDirectY;
antpos.get()[prf_id * 19 + 15] = sateOirbtNode.zeroDopplerDirectZ;
antpos.get()[prf_id * 19 + 16] = outP.lon;
antpos.get()[prf_id * 19 + 17] = outP.lat;
antpos.get()[prf_id * 19 + 18] = outP.ati;
sateOirbtNodes[prf_id] = sateOirbtNode;
}
this->EchoSimulationData->saveAntPos(antpos);
antpos.reset();
qDebug() << "Ant position finished sucessfully !!!";
}
return sateOirbtNodes;
}
2025-01-15 13:50:46 +00:00
void RFPCProcessMain(long num_thread,
QString TansformPatternFilePath, QString ReceivePatternFilePath,
QString simulationtaskName, QString OutEchoPath,
QString GPSXmlPath, QString TaskXmlPath,QString demTiffPath, QString sloperPath, QString LandCoverPath)
2025-01-15 03:57:07 +00:00
{
std::shared_ptr < AbstractSARSatelliteModel> task = ReadSimulationSettingsXML(TaskXmlPath);
if (nullptr == task)
{
return;
}
else {
// <20><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
qDebug() << "--------------Task Seting ---------------------------------------";
qDebug() << "SARImageStartTime: " << task->getSARImageStartTime();
qDebug() << "SARImageEndTime: " << task->getSARImageEndTime();
qDebug() << "BandWidth: " << task->getBandWidth();
qDebug() << "CenterFreq: " << task->getCenterFreq();
qDebug() << "PRF: " << task->getPRF();
qDebug() << "Lamda: " << task->getCenterLamda();
qDebug() << "Fs: " << task->getFs();
qDebug() << "POLAR: " << task->getPolarType();
qDebug() << "NearRange: " << task->getNearRange();
qDebug() << "FarRange: " << task->getFarRange();
qDebug() << (task->getFarRange() - task->getNearRange()) * 2 / LIGHTSPEED * task->getFs();
qDebug() << "\n\n";
}
// 1.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
std::vector<RadiationPatternGainPoint> TansformPatternGainpoints = ReadGainFile(TansformPatternFilePath);
std::shared_ptr<AbstractRadiationPattern> TansformPatternGainPtr = CreateAbstractRadiationPattern(TansformPatternGainpoints);
std::vector<RadiationPatternGainPoint> ReceivePatternGainpoints = ReadGainFile(ReceivePatternFilePath);
std::shared_ptr<AbstractRadiationPattern> ReceivePatternGainPtr = CreateAbstractRadiationPattern(ReceivePatternGainpoints);
task->setTransformRadiationPattern(TansformPatternGainPtr);
task->setReceiveRadiationPattern(ReceivePatternGainPtr);
//2. <20><>ȡGPS<50>ڵ<EFBFBD>
std::vector<SatelliteOribtNode> nodes;
ErrorCode stateCode = ReadSateGPSPointsXML(GPSXmlPath, nodes);
if (stateCode != ErrorCode::SUCCESS)
{
qWarning() << QString::fromStdString(errorCode2errInfo(stateCode));
return;
}
else {}
std::shared_ptr<AbstractSatelliteOribtModel> SatelliteOribtModel = CreataPolyfitSatelliteOribtModel(nodes, task->getSARImageStartTime(), 3); // <20>Գ<EFBFBD><D4B3><EFBFBD><EFBFBD><EFBFBD>ʼʱ<CABC><CAB1><EFBFBD><EFBFBD>Ϊ ʱ<><CAB1><EFBFBD>ο<EFBFBD><CEBF><EFBFBD><EFBFBD><EFBFBD>
SatelliteOribtModel->setbeamAngle(task->getCenterLookAngle(), task->getIsRightLook()); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
if (nullptr == SatelliteOribtModel)
{
return;
}
else {
task->setSatelliteOribtModel(SatelliteOribtModel);
}
qDebug() << "-------------- RFPC init ---------------------------------------";
RFPCProcessCls RFPC;
RFPC.setTaskSetting(task); //qDebug() << "setTaskSetting";
RFPC.setTaskFileName(simulationtaskName); //qDebug() << "setTaskFileName";
RFPC.setDEMTiffPath(demTiffPath); //qDebug() << "setDEMTiffPath";
2025-01-16 02:12:08 +00:00
RFPC.setSloperPath(sloperPath); //qDebug() << "setDEMTiffPath";
2025-01-15 03:57:07 +00:00
RFPC.setLandCoverPath(LandCoverPath); //qDebug() << "setLandCoverPath";
RFPC.setOutEchoPath(OutEchoPath); //qDebug() << "setOutEchoPath";
qDebug() << "-------------- RFPC start---------------------------------------";
RFPC.Process(num_thread); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
qDebug() << "-------------- RFPC end---------------------------------------";
}
2025-01-06 04:03:14 +00:00
ErrorCode RFPCProcessCls::RFPCMainProcess_GPU()
{
double widthSpace = LIGHTSPEED / 2 / this->TaskSetting->getFs();
double prf_time = 0;
double dt = 1 / this->TaskSetting->getPRF();// <20><>ȡÿ<C8A1><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool antflag = true; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
Landpoint LandP{ 0,0,0 };
Point3 GERpoint{ 0,0,0 };
double R = 0;
double dem_row = 0, dem_col = 0, dem_alt = 0;
QVector<double> freqlist = this->TaskSetting->getFreqList();
2025-01-14 01:25:23 +00:00
long freqnum = freqlist.count();
std::shared_ptr<double> freqPtr(new double[freqnum], delArrPtr);
for (long ii = 0; ii < freqlist.count(); ii++) {
freqPtr.get()[ii] = freqlist[ii];
}
testOutAmpArr("freqlist.bin", (double*)(freqPtr.get()), freqnum, 1);
2025-01-15 10:48:43 +00:00
float f0 = float(freqlist[0] / 1e9);
float dfreq = float((freqlist[1] - freqlist[0]) / 1e9);
long double imageStarttime = 0;
imageStarttime = this->TaskSetting->getSARImageStartTime();
//std::vector<SatelliteOribtNode> sateOirbtNodes(this->PluseCount);
std::shared_ptr<SatelliteOribtNode[]> sateOirbtNodes = this->getSatelliteOribtNodes(prf_time, dt, antflag, imageStarttime); // <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
long echoIdx = 0;
2025-01-14 01:25:23 +00:00
double NearRange = this->EchoSimulationData->getNearRange(); // <20><>б<EFBFBD><D0B1>
double FarRange = this->EchoSimulationData->getFarRange();
double TimgNearRange = 2 * NearRange / LIGHTSPEED;
double TimgFarRange = 2 * FarRange / LIGHTSPEED;
double dx = (FarRange - NearRange) / (PlusePoint - 1);
double Fs = this->TaskSetting->getFs(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double Pt = this->TaskSetting->getPt() * this->TaskSetting->getGri();// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ 1v
//double GainAntLen = -3;// -3dB Ϊ<><CEAA><EFBFBD>߰뾶
long pluseCount = this->PluseCount;
2025-01-14 01:25:23 +00:00
double lamda = this->TaskSetting->getCenterLamda(); // <20><><EFBFBD><EFBFBD>
2025-01-06 11:56:45 +00:00
double refphaseRange = this->TaskSetting->getRefphaseRange(); // <20>ο<EFBFBD><CEBF><EFBFBD>λб<CEBB><D0B1>
// <20><><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
std::shared_ptr<AbstractRadiationPattern> TransformPattern = this->TaskSetting->getTransformRadiationPattern(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
std::shared_ptr<AbstractRadiationPattern> ReceivePattern = this->TaskSetting->getReceiveRadiationPattern(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
long PlusePoint = this->EchoSimulationData->getPlusePoints();
POLARTYPEENUM polartype = this->TaskSetting->getPolarType();
gdalImage echoMaskImg(this->OutEchoMaskPath);
2025-01-15 13:50:46 +00:00
long echoblockline = Memory1GB / 8 / 2 / PlusePoint * 2;
#ifndef __CUDANVCC___
QMessageBox::information(this, u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ", u8"<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD>CUDA<EFBFBD><EFBFBD>");
#else
2025-01-15 13:50:46 +00:00
double* antpx,*antpy,*antpz,
*antvx,*antvy,*antvz,
*antdirectx,*antdirecty,*antdirectz
,*antXaxisX,*antXaxisY,*antXaxisZ,
*antYaxisX,*antYaxisY,*antYaxisZ,
*antZaxisX,*antZaxisY,*antZaxisZ;
{
antpx = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antpy = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antpz = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antvx = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antvy = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antvz = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antdirectx = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antdirecty = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antdirectz = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antXaxisX = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antXaxisY = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antXaxisZ = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antYaxisX = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antYaxisY = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antYaxisZ = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antZaxisX = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antZaxisY = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
antZaxisZ = (double*)mallocCUDAHost(sizeof(double) * pluseCount);
for (long tempprfid = 0; tempprfid < pluseCount; tempprfid++) {
long prfid = tempprfid;
antpx[tempprfid] = sateOirbtNodes[prfid].Px;
antpy[tempprfid] = sateOirbtNodes[prfid].Py;
antpz[tempprfid] = sateOirbtNodes[prfid].Pz;
antvx[tempprfid] = sateOirbtNodes[prfid].Vx;
antvy[tempprfid] = sateOirbtNodes[prfid].Vy;
antvz[tempprfid] = sateOirbtNodes[prfid].Vz; //6
antdirectx[tempprfid] = sateOirbtNodes[prfid].AntDirecX;
antdirecty[tempprfid] = sateOirbtNodes[prfid].AntDirecY;
antdirectz[tempprfid] = sateOirbtNodes[prfid].AntDirecZ; // 9 <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
antXaxisX[tempprfid] = sateOirbtNodes[prfid].AntXaxisX;
antXaxisY[tempprfid] = sateOirbtNodes[prfid].AntXaxisY;
antXaxisZ[tempprfid] = sateOirbtNodes[prfid].AntXaxisZ;//12 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ
antYaxisX[tempprfid] = sateOirbtNodes[prfid].AntYaxisX;
antYaxisY[tempprfid] = sateOirbtNodes[prfid].AntYaxisY;
antYaxisZ[tempprfid] = sateOirbtNodes[prfid].AntYaxisZ;//15
antZaxisX[tempprfid] = sateOirbtNodes[prfid].AntZaxisX;
antZaxisY[tempprfid] = sateOirbtNodes[prfid].AntZaxisY;
antZaxisZ[tempprfid] = sateOirbtNodes[prfid].AntZaxisZ;//18
}
}
// RFPC CUDA<44>
if (pluseCount * 4 * 18 > Memory1MB * 100) {
long max = Memory1MB * 100 / 4 / 20 / PluseCount;
QMessageBox::warning(nullptr, u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̫<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", u8"<EFBFBD><EFBFBD>ǰƵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>" + QString::number(max));
}
gdalImage demxyz(this->demxyzPath);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gdalImage demlandcls(this->LandCoverPath);// <20>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gdalImage demsloperxyz(this->demsloperPath);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>
long demRow = demxyz.height;
long demCol = demxyz.width;
long blokline = 100;
// ÿ<><C3BF> 250MB*16 = 4GB
2025-01-15 03:35:48 +00:00
blokline = Memory1MB / 8 / demCol * 500;
blokline = blokline < 1 ? 1 : blokline;
bool bloklineflag = false;
2025-01-15 12:47:38 +00:00
PatternImageDesc TantPatternDesc = {};
double* h_TantPattern=nullptr;
double* d_TantPattern=nullptr;
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
double Tminphi = TransformPattern->getMinPhi();
double Tmaxphi = TransformPattern->getMaxPhi();
double Tmintheta = TransformPattern->getMinTheta();
double Tmaxtheta = TransformPattern->getMaxTheta();
2025-01-15 12:47:38 +00:00
long Tphinum = TransformPattern->getPhis().size();
long Tthetanum = TransformPattern->getThetas().size();
2025-01-15 12:47:38 +00:00
double TstartTheta = Tmintheta;
double TstartPhi = Tminphi;
2025-01-15 12:47:38 +00:00
double Tdtheta = (Tmaxtheta - Tmintheta) / (Tthetanum - 1);
double Tdphi = (Tmaxphi - Tminphi) / (Tphinum - 1);
2025-01-16 02:12:08 +00:00
h_TantPattern = (double*)mallocCUDAHost(sizeof(double) * Tthetanum * Tphinum);
d_TantPattern = (double*)mallocCUDADevice(sizeof(double) * Tthetanum * Tphinum);
2025-01-15 12:47:38 +00:00
for (long i = 0; i < Tthetanum; i++) {
for (long j = Tphinum - 1; j >= 0; j--) {
//h_TantPattern[i * Tphinum + j] = TransformPattern->getGainLearThetaPhi(TstartTheta + i * Tdtheta, TstartPhi + j * Tdphi);
h_TantPattern[i * Tphinum + j] = TransformPattern->getGain(TstartTheta + i * Tdtheta, TstartPhi + j * Tdphi);
}
}
2025-01-15 12:47:38 +00:00
testOutAntPatternTrans("TransPattern.bin", h_TantPattern, TstartTheta, Tdtheta, TstartPhi, Tdphi, Tthetanum, Tphinum);
for (long i = 0; i < Tthetanum; i++) {
for (long j = 0; j < Tphinum; j++) {
h_TantPattern[i * Tphinum + j] = powf(10.0, h_TantPattern[i * Tphinum + j] / 10);
}
}
2025-01-15 12:47:38 +00:00
HostToDevice(h_TantPattern, d_TantPattern, sizeof(double) * Tthetanum * Tphinum);
TantPatternDesc.startTheta = TstartTheta;
TantPatternDesc.startPhi = TstartPhi;
TantPatternDesc.dtheta = Tdtheta;
TantPatternDesc.dphi = Tdphi;
TantPatternDesc.phinum = Tphinum;
TantPatternDesc.thetanum = Tthetanum;
}
2025-01-15 13:50:46 +00:00
2025-01-15 12:47:38 +00:00
PatternImageDesc RantPatternDesc = {};
double* h_RantPattern = nullptr;
double* d_RantPattern = nullptr;
2025-01-15 13:50:46 +00:00
2025-01-15 12:47:38 +00:00
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
double Rminphi = ReceivePattern->getMinPhi();
double Rmaxphi = ReceivePattern->getMaxPhi();
double Rmintheta = ReceivePattern->getMinTheta();
double Rmaxtheta = ReceivePattern->getMaxTheta();
2025-01-15 12:47:38 +00:00
long Rphinum = ReceivePattern->getPhis().size();
long Rthetanum = ReceivePattern->getThetas().size();
2025-01-15 12:47:38 +00:00
double RstartTheta = Rmintheta;
double RstartPhi = Rminphi;
2025-01-15 12:47:38 +00:00
double Rdtheta = (Rmaxtheta - Rmintheta) / (Rthetanum - 1);
double Rdphi = (Rmaxphi - Rminphi) / (Rphinum - 1);
2025-01-16 02:12:08 +00:00
h_RantPattern = (double*)mallocCUDAHost(sizeof(double) * Rthetanum * Rphinum);
d_RantPattern = (double*)mallocCUDADevice(sizeof(double) * Rthetanum * Rphinum);
2025-01-15 12:47:38 +00:00
for (long i = 0; i < Rthetanum; i++) {
for (long j = 0; j < Rphinum; j++) {
//h_RantPattern[i * Rphinum + j] = ReceivePattern->getGainLearThetaPhi(RstartTheta + i * Rdtheta, RstartPhi + j * Rdphi);
h_RantPattern[i * Rphinum + j] = ReceivePattern->getGain(RstartTheta + i * Rdtheta, RstartPhi + j * Rdphi);
}
}
2025-01-15 12:47:38 +00:00
testOutAntPatternTrans("ReceivePattern.bin", h_RantPattern, Rmintheta, Rdtheta, RstartPhi, Rdphi, Rthetanum, Rphinum);
for (long i = 0; i < Rthetanum; i++) {
for (long j = 0; j < Rphinum; j++) {
h_RantPattern[i * Rphinum + j] = powf(10.0, h_RantPattern[i * Rphinum + j] / 10);
}
}
2025-01-15 12:47:38 +00:00
HostToDevice(h_RantPattern, d_RantPattern, sizeof(double) * Rthetanum * Rphinum);
RantPatternDesc.startTheta = RstartTheta;
RantPatternDesc.startPhi = RstartPhi;
RantPatternDesc.dtheta = Rdtheta;
RantPatternDesc.dphi = Rdphi;
RantPatternDesc.phinum = Rphinum;
RantPatternDesc.thetanum = Rthetanum;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>
QMap<long, long> clamap;
long clamapid = 0;
long startline = 0;
2025-01-15 13:50:46 +00:00
{
for (startline = 0; startline < demRow; startline = startline + blokline) {
Eigen::MatrixXd clsland = demlandcls.getData(startline, 0, blokline, demlandcls.width, 1);
long clsrows = clsland.rows();
long clscols = clsland.cols();
long clsid = 0;
for (long ii = 0; ii < clsrows; ii++) {
for (long jj = 0; jj < clscols; jj++) {
clsid = clsland(ii, jj);
if (clamap.contains(clsid)) {}
else {
clamap.insert(clsid, clamapid);
clamapid = clamapid + 1;
}
}
}
}
2025-01-15 13:50:46 +00:00
std::cout << "class id recoding" << std::endl;
for (long id : clamap.keys()) {
std::cout << id << " -> " << clamap[id] << std::endl;
}
}
CUDASigmaParam* h_clsSigmaParam = (CUDASigmaParam*)mallocCUDAHost(sizeof(CUDASigmaParam) * clamapid);
CUDASigmaParam* d_clsSigmaParam = (CUDASigmaParam*)mallocCUDADevice(sizeof(CUDASigmaParam) * clamapid);
2025-01-02 17:05:04 +00:00
{
std::map<long, SigmaParam> tempSigmaParam = this->SigmaDatabasePtr->getsigmaParams(polartype);
for (long id : clamap.keys()) {
SigmaParam tempp = tempSigmaParam[id];
h_clsSigmaParam[clamap[id]].p1 = tempp.p1;
h_clsSigmaParam[clamap[id]].p2 = tempp.p2;
h_clsSigmaParam[clamap[id]].p3 = tempp.p3;
h_clsSigmaParam[clamap[id]].p4 = tempp.p4;
h_clsSigmaParam[clamap[id]].p5 = tempp.p5;
h_clsSigmaParam[clamap[id]].p6 = tempp.p6;
}
// <20><>ӡ<EFBFBD><D3A1>־
std::cout << "sigma params:" << std::endl;
2025-01-06 04:03:14 +00:00
std::cout << "classid:\tp1\tp2\tp3\tp4\tp5\tp6" << std::endl;
for (long ii = 0; ii < clamapid; ii++) {
std::cout << ii << ":\t" << h_clsSigmaParam[ii].p1;
std::cout << "\t" << h_clsSigmaParam[ii].p2;
std::cout << "\t" << h_clsSigmaParam[ii].p3;
std::cout << "\t" << h_clsSigmaParam[ii].p4;
std::cout << "\t" << h_clsSigmaParam[ii].p5;
2025-01-06 04:03:14 +00:00
std::cout << "\t" << h_clsSigmaParam[ii].p6 << std::endl;
}
std::cout << "";
}
HostToDevice(h_clsSigmaParam, d_clsSigmaParam, sizeof(CUDASigmaParam) * clamapid);
2025-01-06 04:03:14 +00:00
long blockwidth = demxyz.width;
#ifdef __PRFDEBUG__
blokline = 1;
blockwidth = 1;
#endif
// <20><><EFBFBD><EFBFBD> XYZ
2025-01-06 04:03:14 +00:00
Eigen::MatrixXd dem_x = demxyz.getData(0, 0, blokline, blockwidth, 1); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
long tempDemRows = dem_x.rows();
long tempDemCols = dem_x.cols();
Eigen::MatrixXd dem_y = Eigen::MatrixXd::Zero(tempDemRows, tempDemCols);
Eigen::MatrixXd dem_z = Eigen::MatrixXd::Zero(tempDemRows, tempDemCols);
Eigen::MatrixXd demsloper_x = Eigen::MatrixXd::Zero(tempDemRows, tempDemCols);
Eigen::MatrixXd demsloper_y = Eigen::MatrixXd::Zero(tempDemRows, tempDemCols);
Eigen::MatrixXd demsloper_z = Eigen::MatrixXd::Zero(tempDemRows, tempDemCols);
2025-01-06 04:03:14 +00:00
2025-01-14 01:25:23 +00:00
double* h_dem_x = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
double* h_dem_y = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
double* h_dem_z = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
double* h_demsloper_x = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
double* h_demsloper_y = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
double* h_demsloper_z = (double*)mallocCUDAHost(sizeof(double) * blokline * tempDemCols);
2025-01-06 04:03:14 +00:00
2025-01-14 01:25:23 +00:00
double* d_dem_x = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols); // 7
double* d_dem_y = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
double* d_dem_z = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
double* d_demsloper_x = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
double* d_demsloper_y = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
double* d_demsloper_z = (double*)mallocCUDADevice(sizeof(double) * blokline * tempDemCols);
// <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2025-01-15 03:57:07 +00:00
float* h_R = (float*)mallocCUDAHost(sizeof(float) * blokline * tempDemCols);
float* d_R = (float*)mallocCUDADevice(sizeof(float) * blokline * tempDemCols);
float* h_amp = (float*)mallocCUDAHost(sizeof(float) * blokline * tempDemCols);
float* d_amp = (float*)mallocCUDADevice(sizeof(float) * blokline * tempDemCols);
2025-01-15 03:35:48 +00:00
2025-01-15 13:50:46 +00:00
2025-01-16 02:12:08 +00:00
float* h_PRFEcho_real = (float*)mallocCUDAHost(sizeof(float) * echoblockline * PlusePoint);
float* h_PRFEcho_imag = (float*)mallocCUDAHost(sizeof(float) * echoblockline * PlusePoint);
float* d_PRFEcho_real = (float*)mallocCUDADevice(sizeof(float) * echoblockline * PlusePoint);
float* d_PRFEcho_imag = (float*)mallocCUDADevice(sizeof(float) * echoblockline * PlusePoint);
2025-01-02 17:05:04 +00:00
2025-01-15 03:35:48 +00:00
2025-01-14 01:25:23 +00:00
double* h_factorj = (double*)mallocCUDAHost(sizeof(double) * freqlist.size());
2025-01-15 03:35:48 +00:00
double* h_freqlist = (double*)mallocCUDAHost(sizeof(double) * freqlist.size());
2025-01-02 17:05:04 +00:00
for (long ii = 0; ii < freqlist.size(); ii++) {
2025-01-15 03:35:48 +00:00
h_factorj[ii] = -4 * PI * freqlist[ii] / LIGHTSPEED;
h_freqlist[ii] = freqlist[ii];
2025-01-02 17:05:04 +00:00
}
2025-01-15 03:35:48 +00:00
testOutAmpArr("freqlist.bin", h_freqlist, freqlist.size(), 1);
2025-01-06 11:56:45 +00:00
testOutAmpArr("factorj.bin", h_factorj, freqlist.size(), 1);
// <20>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Eigen::MatrixXd landcover = Eigen::MatrixXd::Zero(blokline, tempDemCols);// <20><><EFBFBD><EFBFBD><E6B8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
long* h_demcls = (long*)mallocCUDAHost(sizeof(long) * blokline * tempDemCols);
long* d_demcls = (long*)mallocCUDADevice(sizeof(long) * blokline * tempDemCols);
for (startline = 0; startline < demRow; startline = startline + blokline) {
long newblokline = blokline;
if ((startline + blokline) >= demRow) {
newblokline = demRow - startline;
bloklineflag = true;
}
2025-01-06 04:03:14 +00:00
dem_x = demxyz.getData(startline, 0, newblokline, blockwidth, 1); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
dem_y = demxyz.getData(startline, 0, newblokline, blockwidth, 2);
dem_z = demxyz.getData(startline, 0, newblokline, blockwidth, 3);
2025-01-15 03:35:48 +00:00
demsloper_x = demsloperxyz.getData(startline, 0, newblokline, blockwidth, 1);
demsloper_y = demsloperxyz.getData(startline, 0, newblokline, blockwidth, 2);
demsloper_z = demsloperxyz.getData(startline, 0, newblokline, blockwidth, 3);
2025-01-06 04:03:14 +00:00
landcover = demlandcls.getData(startline, 0, newblokline, blockwidth, 1);
long calpluseFreqBufferLen = Memory1GB / 8 / 2 / PlusePoint * 2;
if (calpluseFreqBufferLen < 1000) {
qDebug() << "frequency point has morn than 50000";
2025-01-15 03:35:48 +00:00
QMessageBox::warning(nullptr, u8"frequency point has morn than 50000", u8"frequency point has morn than 50000");
}
if (bloklineflag) {
FreeCUDAHost(h_dem_x); FreeCUDADevice(d_dem_x);
FreeCUDAHost(h_dem_y); FreeCUDADevice(d_dem_y);
FreeCUDAHost(h_dem_z); FreeCUDADevice(d_dem_z);
FreeCUDAHost(h_demsloper_x); FreeCUDADevice(d_demsloper_x);
FreeCUDAHost(h_demsloper_y); FreeCUDADevice(d_demsloper_y);
FreeCUDAHost(h_demsloper_z); FreeCUDADevice(d_demsloper_z); //6
2025-01-15 03:35:48 +00:00
FreeCUDAHost(h_demcls); FreeCUDADevice(d_demcls);
FreeCUDAHost(h_R); FreeCUDADevice(d_R);
2025-01-02 16:15:08 +00:00
FreeCUDAHost(h_amp); FreeCUDADevice(d_amp);
2025-01-15 03:35:48 +00:00
//FreeCUDAHost(h_phi); FreeCUDADevice(d_phi);
//FreeCUDAHost(h_real); FreeCUDADevice(d_real);
//FreeCUDAHost(h_imag); FreeCUDADevice(d_imag);
2025-01-14 01:25:23 +00:00
h_dem_x = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_dem_y = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_dem_z = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_demsloper_x = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_demsloper_y = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_demsloper_z = (double*)mallocCUDAHost(sizeof(double) * newblokline * tempDemCols);
h_demcls = (long*)mallocCUDAHost(sizeof(long) * newblokline * tempDemCols);
2025-01-15 03:35:48 +00:00
2025-01-14 01:25:23 +00:00
d_dem_x = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
d_dem_y = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
d_dem_z = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
d_demsloper_x = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
d_demsloper_y = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);
d_demsloper_z = (double*)mallocCUDADevice(sizeof(double) * newblokline * tempDemCols);//6
d_demcls = (long*)mallocCUDADevice(sizeof(long) * newblokline * tempDemCols);
2025-01-14 01:25:23 +00:00
2025-01-15 03:35:48 +00:00
// <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
2025-01-15 03:57:07 +00:00
h_R = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
d_R = (float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
h_amp = (float*)mallocCUDAHost(sizeof(float) * newblokline * tempDemCols);
d_amp = (float*)mallocCUDADevice(sizeof(float) * newblokline * tempDemCols);
2025-01-14 01:25:23 +00:00
}
2025-01-06 04:03:14 +00:00
//# pragma omp parallel for
for (long i = 0; i < newblokline; i++) {
2025-01-06 04:03:14 +00:00
for (long j = 0; j < blockwidth; j++) {
#ifdef __PRFDEBUG__
2025-01-14 01:25:23 +00:00
h_dem_x[i * blockwidth + j] = -2028380.6250000; double(dem_x(i, j));
h_dem_y[i * blockwidth + j] = 4139373.250000; double(dem_y(i, j));
2025-01-15 03:35:48 +00:00
h_dem_z[i * blockwidth + j] = 4393382.500000; double(dem_z(i, j));
h_demsloper_x[i * blockwidth + j] = 4393382.500000; double(demsloper_x(i, j));
h_demsloper_y[i * blockwidth + j] = 446.923950; double(demsloper_y(i, j));
h_demsloper_z[i * blockwidth + j] = -219.002213; double(demsloper_z(i, j));
h_demcls[i * blockwidth + j] = clamap[80];// clamap[long(landcover(i, j))];
2025-01-06 04:03:14 +00:00
#else
2025-01-14 01:25:23 +00:00
h_dem_x[i * blockwidth + j] = double(dem_x(i, j));
2025-01-15 03:35:48 +00:00
h_dem_y[i * blockwidth + j] = double(dem_y(i, j));
2025-01-14 01:25:23 +00:00
h_dem_z[i * blockwidth + j] = double(dem_z(i, j));
2025-01-15 03:35:48 +00:00
h_demsloper_x[i * blockwidth + j] = double(demsloper_x(i, j));
h_demsloper_y[i * blockwidth + j] = double(demsloper_y(i, j));
h_demsloper_z[i * blockwidth + j] = double(demsloper_z(i, j));
h_demcls[i * blockwidth + j] = clamap[long(landcover(i, j))];
2025-01-14 01:25:23 +00:00
#endif
2025-01-15 03:35:48 +00:00
}
}
2025-01-14 01:25:23 +00:00
HostToDevice((void*)h_dem_x, (void*)d_dem_x, sizeof(double) * newblokline * tempDemCols); // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> -> GPU
HostToDevice((void*)h_dem_y, (void*)d_dem_y, sizeof(double) * newblokline * tempDemCols);
HostToDevice((void*)h_dem_z, (void*)d_dem_z, sizeof(double) * newblokline * tempDemCols);
HostToDevice((void*)h_demsloper_x, (void*)d_demsloper_x, sizeof(double) * newblokline * tempDemCols);
HostToDevice((void*)h_demsloper_y, (void*)d_demsloper_y, sizeof(double) * newblokline * tempDemCols);
HostToDevice((void*)h_demsloper_z, (void*)d_demsloper_z, sizeof(double) * newblokline * tempDemCols);
2025-01-06 04:03:14 +00:00
HostToDevice((void*)h_demcls, (void*)d_demcls, sizeof(long) * newblokline * tempDemCols);
2025-01-06 04:03:14 +00:00
#ifdef __PRFDEBUG__ && __PRFDEBUG_PRFINF__
printf("tatgetPs=[%f,%f,%f]\n", h_dem_x[0], h_dem_y[0], h_dem_z[0]);
2025-01-15 03:35:48 +00:00
std::shared_ptr<double> h_temp_R(new double[PluseCount], delArrPtr);
2024-12-23 02:49:55 +00:00
#endif // __PRFDEBUG__
long pixelcount = newblokline * tempDemCols;
long startprfid = 0;
for (startprfid = 0; startprfid < pluseCount; startprfid = startprfid + echoblockline) {
2025-01-15 03:35:48 +00:00
std::cout << "[" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz").toStdString() << "] dem:\t" << startline << "\t-\t" << startline + newblokline << "\t:\t pluse :\t" << startprfid << " / " << pluseCount << std::endl;
long templine = startprfid + echoblockline < PluseCount ? echoblockline : PluseCount - startprfid;
std::shared_ptr<std::complex<double>> echotemp = this->EchoSimulationData->getEchoArr(startprfid, templine);
2025-01-02 17:05:04 +00:00
for (long tempprfid = 0; tempprfid < templine; tempprfid++) {
for (long freqid = 0; freqid < PlusePoint; freqid++) {
2025-01-15 03:35:48 +00:00
h_PRFEcho_real[tempprfid * PlusePoint + freqid] = 0;// echotemp.get()[tempprfid * PlusePoint + freqid].real();
h_PRFEcho_imag[tempprfid * PlusePoint + freqid] = 0;// echotemp.get()[tempprfid * PlusePoint + freqid].imag();
2025-01-02 17:05:04 +00:00
}
}
2025-01-16 02:12:08 +00:00
HostToDevice(h_PRFEcho_real, d_PRFEcho_real, sizeof(float) * echoblockline * PlusePoint);
HostToDevice(h_PRFEcho_imag, d_PRFEcho_imag, sizeof(float) * echoblockline * PlusePoint);
2025-01-15 03:35:48 +00:00
CUDA_RFPC_MainBlock(
antpx, antpy, antpz, // <20><><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
antXaxisX, antXaxisY, antXaxisZ, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>X<EFBFBD><58>
antYaxisX, antYaxisY, antYaxisZ,// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>Y<EFBFBD><59>
antZaxisX, antZaxisY, antZaxisZ,// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>Z<EFBFBD><5A>
antdirectx, antdirecty, antdirectz,// <20><><EFBFBD>ߵ<EFBFBD>ָ<EFBFBD><D6B8>
2025-01-15 13:50:46 +00:00
startprfid,templine, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2025-01-15 03:35:48 +00:00
//h_freqlist, h_factorj, PlusePoint,// Ƶ<><C6B5><EFBFBD><EFBFBD>
2025-01-15 10:48:43 +00:00
f0, dfreq, PlusePoint,// Ƶ<><C6B5><EFBFBD><EFBFBD>
2025-01-15 03:35:48 +00:00
d_dem_x, d_dem_y, d_dem_z, pixelcount, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
d_demcls,
d_demsloper_x, d_demsloper_y, d_demsloper_z, // <20>ر<EFBFBD><D8B1><EFBFBD>ʸ<EFBFBD><CAB8>
Pt,// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
refphaseRange,
2025-01-16 02:12:08 +00:00
d_TantPattern,
TantPatternDesc.startTheta, TantPatternDesc.startPhi, TantPatternDesc.dtheta,TantPatternDesc.dphi,TantPatternDesc.thetanum,TantPatternDesc.phinum,
d_RantPattern,
RantPatternDesc.startTheta, RantPatternDesc.startPhi, RantPatternDesc.dtheta, RantPatternDesc.dphi, RantPatternDesc.thetanum, RantPatternDesc.phinum,
2025-01-15 03:35:48 +00:00
NearRange, FarRange,
d_clsSigmaParam, clamapid,
d_PRFEcho_real, d_PRFEcho_imag,// <20><><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>
d_R, d_amp
//, d_phi, d_real, d_imag// <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
);
2025-01-16 02:12:08 +00:00
DeviceToHost(h_PRFEcho_real, d_PRFEcho_real, sizeof(float) * echoblockline * PlusePoint);
DeviceToHost(h_PRFEcho_imag, d_PRFEcho_imag, sizeof(float) * echoblockline * PlusePoint);
2025-01-02 17:05:04 +00:00
for (long tempprfid = 0; tempprfid < templine; tempprfid++) {
for (long freqid = 0; freqid < PlusePoint; freqid++) {
2025-01-15 03:35:48 +00:00
echotemp.get()[tempprfid * PlusePoint + freqid].real(
2025-01-15 03:57:07 +00:00
echotemp.get()[tempprfid * PlusePoint + freqid].real() + h_PRFEcho_real[tempprfid * PlusePoint + freqid]);
2025-01-15 03:35:48 +00:00
echotemp.get()[tempprfid * PlusePoint + freqid].imag(
echotemp.get()[tempprfid * PlusePoint + freqid].imag() + h_PRFEcho_imag[tempprfid * PlusePoint + freqid]);
2025-01-02 17:05:04 +00:00
}
}
this->EchoSimulationData->saveEchoArr(echotemp, startprfid, templine);
}
2025-01-14 01:25:23 +00:00
2025-01-15 03:35:48 +00:00
#ifdef __PRFDEBUG__ && __PRFDEBUG_PRFINF__
2025-01-06 04:03:14 +00:00
break;
#endif // __PRFDEBUG__
2025-01-15 03:35:48 +00:00
}
std::cout << std::endl;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>
FreeCUDAHost(h_dem_x); FreeCUDADevice(d_dem_x);
FreeCUDAHost(h_dem_y); FreeCUDADevice(d_dem_y);
FreeCUDAHost(h_dem_z); FreeCUDADevice(d_dem_z);
FreeCUDAHost(h_demsloper_x); FreeCUDADevice(d_demsloper_x);
FreeCUDAHost(h_demsloper_y); FreeCUDADevice(d_demsloper_y);
FreeCUDAHost(h_demsloper_z); FreeCUDADevice(d_demsloper_z); //6
// <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>
FreeCUDAHost(h_R); FreeCUDADevice(d_R);
2025-01-02 16:15:08 +00:00
FreeCUDAHost(h_amp); FreeCUDADevice(d_amp);
FreeCUDAHost(h_demcls); FreeCUDADevice(d_demcls);
2025-01-16 02:12:08 +00:00
FreeCUDAHost(h_factorj); //FreeCUDADevice(d_factorj);
FreeCUDAHost(h_freqlist); //FreeCUDADevice(d_freqlist);
2025-01-06 11:56:45 +00:00
FreeCUDAHost(h_PRFEcho_real); FreeCUDADevice(d_PRFEcho_real);
FreeCUDAHost(h_PRFEcho_imag); FreeCUDADevice(d_PRFEcho_imag);
2025-01-15 03:35:48 +00:00
//FreeCUDAHost(h_phi); FreeCUDADevice(d_phi);
//FreeCUDAHost(h_real); FreeCUDADevice(d_real);
//FreeCUDAHost(h_imag); FreeCUDADevice(d_imag);
2025-01-15 13:50:46 +00:00
FreeCUDAHost(antpx); // <20><><EFBFBD>վֲ<D5BE><D6B2><EFBFBD><EFBFBD><EFBFBD>
FreeCUDAHost(antpy);
FreeCUDAHost(antpz);
FreeCUDAHost(antvx);
FreeCUDAHost(antvy);
FreeCUDAHost(antvz);
FreeCUDAHost(antdirectx);
FreeCUDAHost(antdirecty);
FreeCUDAHost(antdirectz);
FreeCUDAHost(antXaxisX);
FreeCUDAHost(antXaxisY);
FreeCUDAHost(antXaxisZ);
FreeCUDAHost(antYaxisX);
FreeCUDAHost(antYaxisY);
FreeCUDAHost(antYaxisZ);
FreeCUDAHost(antZaxisX);
FreeCUDAHost(antZaxisY);
FreeCUDAHost(antZaxisZ);
#endif
2024-11-25 17:51:20 +00:00
this->EchoSimulationData->saveToXml();
return ErrorCode::SUCCESS;
}