⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 radafdtdgui.ui.h

📁 The purpose of this program is to enable building a config file to the radarFDTD package using a mo
💻 H
📖 第 1 页 / 共 3 页
字号:
	for (unsigned int i=0; i<m_object.size(); i++)		nof_boxes += m_object[i].boxes.size();	fprintf(fp,"%d\n",nof_boxes);	for (unsigned int i=0; i<m_object.size(); i++) {    fprintf(fp,"##OBJ## %d %s %s\n",            m_object[i].boxes.size(),            (m_object[i].name != "") ? m_object[i].name.ascii() : "-",            m_object[i].type.ascii());		for (unsigned int j=0; j<m_object[i].boxes.size(); j++) {			fprintf(fp,"%d %d %d %d %d %d %d\n",							m_object[i].boxes[j].x0,m_object[i].boxes[j].y0,m_object[i].boxes[j].z0,							m_object[i].boxes[j].x1,m_object[i].boxes[j].y1,m_object[i].boxes[j].z1,							m_object[i].boxes[j].material_indx);		}	}	fprintf(fp,"# Number of transmitter boxes...\n");	fprintf(fp,"%d\n",m_xmt.size());	for (unsigned int i=0; i<m_xmt.size(); i++) {		fprintf(fp,"# %s\n",m_xmt[i].name.ascii());		fprintf(fp,"%d %d %d %d %d %d %d\n",						m_xmt[i].x0,m_xmt[i].y0,m_xmt[i].z0,						m_xmt[i].x1,m_xmt[i].y1,m_xmt[i].z1,m_xmt[i].skip);	}	fprintf(fp,"# Transission mode...\n");	fprintf(fp,"%d %e %e %e %e %d\n",m_xmt_mode,m_xmt_amp,					m_xmt_p1,m_xmt_p2,m_xmt_p3,m_xmt_component);	fprintf(fp,"# Number of receivers...\n");	fprintf(fp,"%d\n",m_rcv.size());	fprintf(fp,"# The receivers...\n");	for (unsigned int i=0; i<m_rcv.size(); i++) {		fprintf(fp,"# %s\n",m_rcv[i].name.ascii());		fprintf(fp,"%d %d %d %d %d %d %d %d\n",						m_rcv[i].x0,m_rcv[i].y0,m_rcv[i].z0,						m_rcv[i].x1,m_rcv[i].y1,m_rcv[i].z1,						m_rcv[i].component,m_rcv[i].skip);	}	fprintf(fp,"# End of configuration file.\n");	fclose(fp);}void MainWindowForm::updateData(){	m_max_memory = (long long)maxMemory->text().toLong();	m_sim_length = simulationLength->text().toFloat();	m_time_step = timeStep->text().toFloat();	m_pml_nof_layers = pmlNofLayers->text().toInt();	m_pml_max_cond = pmlMaxCond->text().toFloat();	m_pml_max_stretching = pmlStretching->text().toFloat();	m_pml_steepness = pmlSteepness->text().toFloat();	m_space_size_x = Lx->text().toInt();	m_space_size_y = Ly->text().toInt();	m_space_size_z = Lz->text().toInt();	m_cell_size_x =  DX->text().toFloat();	m_cell_size_y =  DY->text().toFloat();	m_cell_size_z =  DZ->text().toFloat();	m_snap_shot_skip = snapShotSkipLineEdit->text().toInt();	QString txt = snapShotPlaneComboBox->currentText();	m_snap_shot_plan = (txt == "YZ") ? 1 : ((txt == "XZ") ? 2 : 3);	m_snap_shot_height = snapShotHeightLineEdit->text().toInt();	txt = snapShotComponentComboBox->currentText();	if (txt == "H-total") {		m_snap_shot_component = 0;	} else if (txt == "Hx") {		m_snap_shot_component = 1;	} else if (txt == "Hy") {		m_snap_shot_component = 2;	} else if (txt == "Hz") {		m_snap_shot_component = 3;	} else if (txt == "Ex") {		m_snap_shot_component = 4;	} else if (txt == "Ey") {		m_snap_shot_component = 5;	} else if (txt == "Ez") {		m_snap_shot_component = 6;	} else {		m_snap_shot_component = 7;	}	m_rcv_skip = rcvSkipLineEdit->text().toInt();	m_xmt_component = (xmtPolCombo->currentText() == "X") ? 0 :										((xmtPolCombo->currentText() == "Y") ? 1 : 2);	txt = xmtModeCombo->currentText();	if (txt == "Sine") {		m_xmt_mode = 0;	} else if (txt == "Sine square") {		m_xmt_mode = 1;	} else if (txt == "Gaussian pulse") {		m_xmt_mode = 2;	} else {		m_xmt_mode = 3;	}}void MainWindowForm::takeNewBoxItem(QString name, int x0, int y0, int z0, 																		int x1, int y1, int z1, int indx ){	box_t box;	box.x0 = x0;	box.y0 = y0;	box.z0 = z0;	box.x1 = x1;	box.y1 = y1;	box.z1 = z1;	box.material_indx = indx;  object_t obj;  obj.name = name;  obj.type = "Box";	obj.boxes.push_back(box);	m_object.push_back(obj);	// Close dialog	delete m_addBoxForm;	m_addBoxForm = NULL;	// Update Table	objectTable->setNumRows(objectTable->numRows()+1);  // Add row	int row_num = objectTable->numRows()-1;  // last raw	// Write to the last new raw	objectTable->setText(row_num,0,name);	objectTable->setText(row_num,1,"Box");	objectTable->setText(row_num,2,QString::number(indx));	objectTable->adjustRow(row_num);	m_geometry_changed = true;  m_not_saved = true;}void MainWindowForm::addBoxItemCancel(){	delete m_addBoxForm;	m_addBoxForm = NULL;}void MainWindowForm::takeNewMaterial( QString name, float eps,                                       float sigma, QColor color ){	material_t mat;	mat.name = name;  mat.viewColor = color;	mat.eps = eps;	mat.sigma = sigma;	m_material.push_back(mat);  oglViewer->updateMaterialColorTable(m_material);	// Close dialog	delete m_addMaterialForm;	m_addMaterialForm = NULL;	// Update Table	materialTable->setNumRows(materialTable->numRows()+1);  // Add row	int row_num = materialTable->numRows()-1;  // last raw	// Write to the last new raw	materialTable->setText(row_num,0,name);	materialTable->setText(row_num,1,QString::number(eps));	materialTable->setText(row_num,2,QString::number(sigma));  QRect rect = materialTable->cellRect(row_num,3);  QPixmap pix(rect.width(),rect.height());  pix.fill(color);  materialTable->setPixmap(row_num,3,pix);	materialTable->adjustRow(row_num);	QHeader *headers = materialTable->verticalHeader();	headers->setLabel(headers->count()-1,QString::number(m_material.size()-1));  m_not_saved = true;}void MainWindowForm::addMaterialCancel(){	delete m_addMaterialForm;	m_addMaterialForm = NULL;}void MainWindowForm::takeNewSineModeParamsSlot( float delay, float freq, float amp ){	m_xmt_amp = amp;	m_xmt_p1 = delay;	m_xmt_p2 = freq;	m_xmt_p3 = 17.0; // Dummy	delete m_sineModeConfigForm;	m_sineModeConfigForm = NULL;  m_not_saved = true;}void MainWindowForm::SineModeCfgCancelSlot(){	delete m_sineModeConfigForm;	m_sineModeConfigForm = NULL;}void MainWindowForm::takeNewSineSquareModeParamsSlot( float delay, float freq, 																											float amp, int nof_half_cycles ){	m_xmt_amp = amp;	m_xmt_p1 = delay;	m_xmt_p2 = freq;	m_xmt_p3 = (float)nof_half_cycles;	delete m_sineSquareModeConfigForm;	m_sineSquareModeConfigForm = NULL;  m_not_saved = true;}void MainWindowForm::SineSquareModeCfgCancelSlot(){	delete m_sineSquareModeConfigForm;	m_sineSquareModeConfigForm = NULL;	}void MainWindowForm::takeNewGaussianPulseModeParamsSlot( float amp, float delay, float pulseWidth ){	m_xmt_amp = amp;	m_xmt_p1 = delay;	m_xmt_p2 = pulseWidth;	m_xmt_p3 = 17.0; // Dummy	delete m_gaussianPulseConfigForm;	m_gaussianPulseConfigForm = NULL;  m_not_saved = true;}void MainWindowForm::GaussianPulseModeCfgCancelSlot(){	delete m_gaussianPulseConfigForm;	m_gaussianPulseConfigForm = NULL;}void MainWindowForm::takeNewRadarPulseModeParamsSlot(float amp, float delay, int n, float a ){	m_xmt_amp = amp;	m_xmt_p1 = delay;	m_xmt_p2 = a;	m_xmt_p3 = (float)n;	delete m_radarPulseConfigForm;	m_radarPulseConfigForm = NULL;  m_not_saved = true;}void MainWindowForm::RadarPulseModeCfgCancelSlot(){	delete m_radarPulseConfigForm;	m_radarPulseConfigForm = NULL;}void MainWindowForm::takeNewSphereItem(QString name, int matIndx, 																			 int x0, int y0, int z0, float R ){	delete m_addSphereForm;	m_addSphereForm = NULL;	updateData();  object_t obj;  obj.name = name;  obj.type = "Sphere";	box_t box;	box.material_indx = matIndx;	int Nx = (int)ceil(R/m_cell_size_x);	int Ny = (int)ceil(R/m_cell_size_y);	int Nz = (int)ceil(R/m_cell_size_z);	float xx0 = x0*m_cell_size_x;	float yy0 = y0*m_cell_size_y;	float zz0 = z0*m_cell_size_z;	for (int i=(x0-Nx); i<=(x0+Nx); i++) {		for (int j=(y0-Ny); j<=(y0+Ny); j++) {			for (int k=(z0-Nz); k<=(z0+Nz); k++) {				if ((i >= 0)&&(i < m_space_size_x)&&						(j >= 0)&&(j < m_space_size_y)&&						(k >= 0)&&(k < m_space_size_z)) {  // If inside the solution space					float currR = 							sqrt(SQR(xx0-i*m_cell_size_x)+SQR(yy0-j*m_cell_size_y)+SQR(zz0-k*m_cell_size_z));					if (currR <= R) {						box.x0 = box.x1 = i;						box.y0 = box.y1 = j;						box.z0 = box.z1 = k;						obj.boxes.push_back(box);					}				}     			}		}	}	m_object.push_back(obj);	objectTable->setNumRows(objectTable->numRows()+1);  // Add row	int row_num = objectTable->numRows()-1;  // last raw	// Write to the last new raw	objectTable->setText(row_num,0,name);	objectTable->setText(row_num,1,"Sphere");	objectTable->setText(row_num,2,QString::number(matIndx));	objectTable->adjustRow(row_num);  m_geometry_changed = true;  m_not_saved = true;}void MainWindowForm::addSphereItemCancel(){	delete m_addSphereForm;	m_addSphereForm = NULL;}static float LinePointDist(float r0[3], float d[3], float P[3], float& t0){	t0 = d[0]*(P[0]-r0[0])+d[1]*(P[1]-r0[1])+d[2]*(P[2]-r0[2]);	// The closest point on the line to P	float rx = r0[0]+d[0]*t0;	float ry = r0[1]+d[1]*t0;	float rz = r0[2]+d[2]*t0;	float D = sqrt(SQR(P[0]-rx)+SQR(P[1]-ry)+SQR(P[2]-rz));	//printf("r0=[%g %g %g], d=[%g %g %g] <=> [%g %g %g] => t0=%g D=%g\n",	//      r0[0],r0[1],r0[2],d[0],d[1],d[2],P[0],P[1],P[2],t0,D);	return D;}void MainWindowForm::takeNewCylinderItem(QString name, int matIndx, int x0, int y0, int z0, 																				 float R, float H, float Phi, float theta ){	delete m_addCylinderForm;	m_addCylinderForm = NULL;	updateData();	//QValueList<box_t> l;  object_t obj;  obj.name = name;  obj.type = "Cylinder";	box_t box;	box.material_indx = matIndx;	float r0[3]; // Point of cylinder center	float d[3];  // Unit vector in the direction of the cylinder axis	d[0] = sin(theta)*cos(Phi);	d[1] = sin(theta)*sin(Phi);	d[2] = cos(theta);	r0[0] = x0*m_cell_size_x;	r0[1] = y0*m_cell_size_y;	r0[2] = z0*m_cell_size_z;	float t0,rtag[3];	for (int i=0; i<m_space_size_x; i++) {		for (int j=0; j<m_space_size_y; j++) {			for (int k=0; k<m_space_size_z; k++) {				rtag[0] = i*m_cell_size_x;				rtag[1] = j*m_cell_size_y;				rtag[2] = k*m_cell_size_z;				float D = LinePointDist(r0,d,rtag,t0);				if (D <= R) {					if ((t0 < (H/2.0))&&(t0 > (-H/2.0))) {						box.x0 = box.x1 = i;						box.y0 = box.y1 = j;						box.z0 = box.z1 = k;						//printf("Push: (%d %d %d) to cylinder.\n",i,j,k);						obj.boxes.push_back(box);            					}				}			}		}	}	m_object.push_back(obj);	objectTable->setNumRows(objectTable->numRows()+1);  // Add row	int row_num = objectTable->numRows()-1;  // last raw	// Write to the last new raw	objectTable->setText(row_num,0,name);	objectTable->setText(row_num,1,"Cylinder");	objectTable->setText(row_num,2,QString::number(matIndx));	objectTable->adjustRow(row_num);  m_geometry_changed = true;  m_not_saved = true;}void MainWindowForm::addCylinderItemCancel(){	delete m_addCylinderForm;	m_addCylinderForm = NULL;}void MainWindowForm::handleXmtTableClickSlot(int row, int, int button, 																						 const QPoint &){	m_currentTableItem = row;	if (button == 1) {        // Left click	} else if (button == 2) { // Right click		if (m_popup != NULL) {			delete m_popup;			m_popup = NULL;		}		m_popup = new QPopupMenu(this,"Message Operations");		m_popup->insertItem("&Add", this, SLOT(addXmtItem()));		m_popup->insertItem("&Edit", this, SLOT(editXmtItem()));		m_popup->insertItem("&Delete", this, SLOT(deleteXmtItem()));    m_popup->exec(QCursor::pos());	}}void MainWindowForm::addXmtItem(){	if (m_addXmtForm != NULL) {		delete m_addXmtForm;		m_addXmtForm = NULL;	}	m_addXmtForm = new AddXmtForm(this);	connect(m_addXmtForm,SIGNAL(NewXmtParams(QString,int,int,int,int,int,int,int)),					this,SLOT(takeNewXmtParamsSlot(QString,int,int,int,int,int,int,int)));	connect(m_addXmtForm,SIGNAL(Cancel()),this,SLOT(AddXmtCancelSlot()));	m_addXmtForm->show();}void MainWindowForm::editXmtItem(){	}void MainWindowForm::deleteXmtItem(){	if (xmtTable->numRows() == 0)  // There are no transmitters		return;	QValueList<xmt_t>::iterator it = m_xmt.at(m_currentTableItem);	// Erase the transmitter from the list	m_xmt.remove(it);	// REmove it from the table as well	xmtTable->removeRow(m_currentTableItem);  m_xmt_changed = true;}void MainWindowForm::takeNewXmtParamsSlot( QString name, int x0, int y0, int z0, 																					 int x1, int y1, int z1, int skip){	xmt_t xmt;	xmt.name = name;	xmt.x0 = x0;	xmt.y0 = y0;	xmt.z0 = z0;	xmt.x1 = x1;	xmt.y1 = y1;	xmt.z1 = z1;	xmt.skip = skip;	m_xmt.push_back(xmt);	// Add it to the table	xmtTable->setNumRows(xmtTable->numRows()+1);  // Add row	int row_num = xmtTable->numRows()-1;  // last raw	// Write to the last new raw	xmtTable->setText(row_num,0,name);	QString s;	s.sprintf("(%d,%d,%d)",x0,y0,z0);	xmtTable->setText(row_num,1,s);	s.sprintf("(%d,%d,%d)",x1,y1,z1);	xmtTable->setText(row_num,2,s);	s.sprintf("%d",skip);	xmtTable->setText(row_num,3,s);	xmtTable->adjustRow(row_num);  m_xmt_changed = true;  m_not_saved = true;}void MainWindowForm::AddXmtCancelSlot(){	delete m_addXmtForm;	m_addXmtForm = NULL;}void MainWindowForm::handleRcvTableClickSlot( int row, int, int button, const QPoint & ){	m_currentTableItem = row;	if (button == 1) {        // Left click	} else if (button == 2) { // Right click		if (m_popup != NULL) {			delete m_popup;			m_popup = NULL;		}		m_popup = new QPopupMenu(this,"Message Operations");		m_popup->insertItem("&Add", this, SLOT(addRcvItem()));		m_popup->insertItem("&Edit", this, SLOT(editRcvItem()));		m_popup->insertItem("&Delete", this, SLOT(deleteRcvItem()));    m_popup->exec(QCursor::pos());	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -