Пример #1
0
int
display_trace_info( char *in_trace ) {
	int i, trace_set;
	FILE *trace_Ptr;
	for( i = 0; i <= 100;i++ )
		printf("=");	
	putchar('\n');
	printf("Input file : %s\n",in_trace);
	if( ( trace_Ptr = fopen( in_trace, "r" ) ) == NULL) {
		printf("Can't open %s\n", in_trace);
		error_1(0);
	}
	fclose( trace_Ptr );
	trace_set = check_trace_type(in_trace);
	if( trace_set == 1 ) {
		printf("File Format: pcap");
		putchar('\n');
	}
	else if( trace_set == 2 )
		printf("File Format: tsh\n");		
	else 	error_1(1);
	for( i = 0; i <= 100;i++ )
		printf("=");	
	putchar('\n');
	return(trace_set);
}
Пример #2
0
void test_2_run(int level, Float& e1, Float& e2, Float& e3) {
	const st dim = 2;
	// new shape--------------------
	Shape2D shape;
	Shape2D cir;
	//CreatCircle(cir, 2.1, 2.1, 0.8, 359);
	Float x1 = -0.5, y1 = -0.5, x2 = 0.5, y2 = 0.5;
	CreatCube(shape, x1, y1, x2, y2);
	// define unit length
	Float UL = 1.0;
	// build grid ------------------
	Domain_<Float, Float, dim> domain(&shape, UL, level, level + 1);
	//domain.adaptive().adapt_shape_boundary(cir);
	domain.build();
	//domain.new_data(4,0,0,0); // idx = 3 used for exact
	//domain.set_val(3,exact_fun_2);
	Poisson_<Float, Float, dim> poisson(&domain);
	poisson.set_beta(coe_set_b);
	poisson.set_f(f_fun_2);
	// set exact
	domain.set_val(0, exact_fun_2);
	// boundary condition
	Poisson_<Float, Float, dim>::BoundaryCondition bc;
	//bc.set_default_1_bc(exact_fun_2);
	poisson.set_boundary_condition(0, 0, poisson.phi_idx(), &bc);
	poisson.set_boundary_condition(0, 1, poisson.phi_idx(), &bc);
	poisson.set_boundary_condition(0, 2, poisson.phi_idx(), &bc);
	poisson.set_boundary_condition(0, 3, poisson.phi_idx(), &bc);
	std::cout << "solve -----------\n";
	poisson.solve();
	cout << "end solve -------\n";
	e1 = error_1(domain, 2, 0);
	e2 = error_2(domain, 2, 0);
	e3 = error_i(domain, 2, 0);
	//cout << "error 1  " << e1 << "\n";
	//cout << "error 2  " << e2 << "\n";
	//cout << "error 3  " << e3 << "\n";
	// show ================================
	GnuplotActor::list_spActor lga;
	lga.push_back(
			GnuplotActor::LeafNodesContour(domain.grid(), poisson.phi_idx()));
	lga.push_back(
			GnuplotActor::GhostNodesContours(domain.ghost(),
					poisson.phi_idx()));
	lga.push_back(GnuplotActor::Shape(shape, 0));
	Gnuplot gp;
	gp.set_equal_ratio();
	//gp.set_xrange(2.0,3.0);
	//gp.set_yrange(1.5,2.5);
	//gp.set_cbrange(-2.0, 2.0);
	gp.plot(lga);
	//delete shape
}
Пример #3
0
int
Fdisplay_trace_info( char *in_trace, int interval ) {
	int i, trace_set;
	FILE *trace_Ptr;

	char file_buf[15]={"Display_PKT_"};
	char file_buf2[3];
	sprintf(file_buf2,"%d",interval);
	strcat(file_buf, file_buf2);

	FILE *output_Ptr;
	output_Ptr = fopen( file_buf, "a" );

	for( i = 0; i <= 100;i++ )
		fprintf(output_Ptr,"=");	
	fprintf(output_Ptr, "\n");
	fprintf(output_Ptr,"Input file : %s\n",in_trace);
	if( ( trace_Ptr = fopen( in_trace, "r" ) ) == NULL) {
		fprintf(output_Ptr,"Can't open %s\n", in_trace);
		error_1(0);
	}
	fclose( trace_Ptr );
	trace_set = check_trace_type(in_trace);
	if( trace_set == 1 ) {
		fprintf(output_Ptr,"File Format: pcap");
		fprintf(output_Ptr, "\n");
	}
	else if( trace_set == 2 )
		fprintf(output_Ptr,"File Format: tsh\n");		
	else 	error_1(1);
	for( i = 0; i <= 100;i++ )
		fprintf(output_Ptr, "=");	
	fprintf(output_Ptr, "\n");

	fclose(output_Ptr);

	return(trace_set);
}