示例#1
0
void PPTKQsubBash::on_save_dir_choose_clicked()
{
    m_save_dir_edit->setText(choose_dir());
}
示例#2
0
void PPTKBARBash::on_barbash_choose_clicked()
{
    m_barbash_dir_edit->setText(choose_dir(m_barbash_dir_edit->text()));
}
示例#3
0
bool network_generator::network_gen(){
	
	int inlet_dir = -1, outlet_dir = -1, line_layer = 0;
	pair <int, int> path_head;
	vector < pair <int, int> > inlet(channel_layer*4), outlet(channel_layer*4);
	vector <int> inlet_lock(channel_layer*4), outlet_lock(channel_layer*4);
	vector < pair <int, int> > centers(4);
	
	centers[0].first = 55;
	centers[0].second = 50;
	centers[1].first = 50;
	centers[1].second = 45;
	centers[2].first = 45;
	centers[2].second = 50;
	centers[3].first = 50;
	centers[3].second = 55;
	//random_in_out_let(inlet, outlet);
	
	inlet[0].first = 77;//53
    inlet[0].second = 100;//0
    inlet[1].first = 19;
    inlet[1].second = 0;
    inlet[2].first = 100;
    inlet[2].second = 23;
    inlet[3].first = 0;
    inlet[3].second = 27;
    outlet[0].first = 53;//77
    outlet[0].second = 0;//100
    outlet[1].first = 100;
    outlet[1].second = 35;
    outlet[2].first = 0;
    outlet[2].second = 65;
    outlet[3].first = 49;
    outlet[3].second = 100;
	
	for( int i=0;i<inlet.size();i++ ){
		pout(inlet[i]);
		cout << " ";
		pout(outlet[i]);
		cout << endl;
	}
	getchar();
	
	for( int line_num=0;line_num<channel_layer*4;line_num++ ){
		vector < vector <double> > temp_heat_map(101, vector <double>(101));
		bool reverse = 0;
		for( int x=0;x<101;x++ ){
			for( int y=0;y<101;y++ ){
				double distance_square = pow(x-outlet[line_num].first, 2) + pow(y-outlet[line_num].second, 2);
				temp_heat_map[y][x] += 1000 * 10 * (pow(30, 2) / (pow(30, 2) + distance_square));
			}
		}
		path_head = inlet[line_num];
		liquid_network[line_num/4][inlet[line_num].second][inlet[line_num].first] = 4;
		while(path_head != outlet[line_num]){
			//pout(path_head);
			//cout <<endl;
			//getchar();
			if(Is_close_center(path_head, centers[line_num%4]) && reverse == 0){
				for( int x=0;x<101;x++ ){
					for( int y=0;y<101;y++ ){
						if(liquid_network[line_num/4][y][x] == 4){
							liquid_network[line_num/4][y][x] = 1;
						}
					}
				}
				reverse = 1;
			}
			if(reverse){
				choose_dir(path_head, line_num/4, &temp_heat_map);
				liquid_network[line_num/4][path_head.second][path_head.first] = 4;
			}
			else{
				choose_dir(path_head, line_num/4, &init_heat_network[line_num%4]);
				liquid_network[line_num/4][path_head.second][path_head.first] = 4;
			}
		}
		
		for( int x=0;x<101;x++ ){
			for( int y=0;y<101;y++ ){
				if(liquid_network[line_num/4][y][x] == 4){
					liquid_network[line_num/4][y][x] = 1;
				}
			}
		}
		//cout << "line done !" << endl;
		//print_liquid_network();
		
		//getchar();
	}
	for( int i=0;i<channel_layer*4;i++ ){
		liquid_network[i/4][inlet[i].second][inlet[i].first] = 2;
		liquid_network[i/4][outlet[i].second][outlet[i].first] = 3;
	}
	for( int l=0;l<channel_layer;l++ ){
		for( int x=0;x<101;x++ ){
			for( int y=0;y<101;y++ ){
				if(liquid_network[l][y][x] == 7){
					liquid_network[l][y][x] = 0;
				}
			}
		}
	}
	
	print_liquid_network();
	//getchar();
	return true;
}