Ejemplo n.º 1
0
void Color::setAlpha( float value )
{
	_alpha = getValidValue( value );
}
Ejemplo n.º 2
0
void Color::setBlue( float value )
{
	_blue = getValidValue( value );
}
Ejemplo n.º 3
0
void Color::setRed( float value )
{
	_red = getValidValue( value );
}
Ejemplo n.º 4
0
void Color::setGreen( float value )
{
	_green = getValidValue( value );
}
Ejemplo n.º 5
0
void write_vtkFile_debug(const char *szProblem,
		int    timeStepNumber,
		double xlength,
		double ylength,
		double zlength,
		int    imax,
		int    jmax,
		int    kmax,
		double dx,
		double dy,
		double dz,
		double ***U,
		double ***V,
		double ***W,
		double ***P,
		int ***Flag) {

	int i,j,k;
	double uVel,vVel,wVel;
	char szFileName[80];
	FILE *fp=NULL;
	//sprintf( szFileName, "simulation/%s.%i_debug.vtk", szProblem, timeStepNumber );
	sprintf( szFileName, "/media/norbert/940CB6150CB5F27A/Documents/simulation/%s.%i_debug.vtk", szProblem, timeStepNumber );

	fp = fopen( szFileName, "w");
	if( fp == NULL )
	{
		char szBuff[80];
		sprintf( szBuff, "Failed to open %s", szFileName );
		ERROR( szBuff );
		return;
	}

	write_vtkHeader_debug(fp, imax, jmax, kmax, dx, dy, dz);
	write_vtkPointCoordinates_debug(fp, imax, jmax, kmax, dx, dy, dz);


	fprintf(fp,"POINT_DATA %i \n", (imax+3)*(jmax+3)*(kmax+3) );

	fprintf(fp,"\n");
	fprintf(fp, "VECTORS velocity float\n");
	for(k = -1; k < kmax+2; k++) {
		for(j = -1; j < jmax+2; j++) {
			for(i = -1; i < imax+2; i++) {
				if(i >= 0 && j >= 0 && k >= 0 && i < imax+1 && j < jmax+1 && k < kmax+1){
					uVel = getValidValue((U[i][j][k] + U[i][j+1][k] + U[i][j][k+1] + U[i][j+1][k+1]) * 0.25);
					vVel = getValidValue((V[i][j][k] + V[i+1][j][k] + V[i][j][k+1] + V[i+1][j][k+1]) * 0.25);
					wVel = getValidValue((W[i][j][k] + W[i+1][j][k] + W[i][j+1][k] + W[i+1][j+1][k]) * 0.25);
					fprintf(fp, "%f %f %f\n",uVel,vVel,wVel);
				}
				else{
					fprintf(fp, "0 0 0\n");
				}
			}
		}
	}

	fprintf(fp,"\n");
	fprintf(fp,"CELL_DATA %i \n", ((imax+2)*(jmax+2)*(kmax+2)) );
	fprintf(fp, "SCALARS pressure float 1 \n");
	fprintf(fp, "LOOKUP_TABLE default \n");
	for(k = 0; k < kmax+2; k++) {
		for(j = 0; j < jmax+2; j++) {
			for(i = 0; i < imax+2; i++) {
				fprintf(fp, "%f\n",getValidValue(P[i][j][k]));
			}
		}
	}


	fprintf(fp,"\n");
	fprintf(fp, "SCALARS flag short 1 \n");
	fprintf(fp, "LOOKUP_TABLE default \n");

	for(k = 0; k < kmax+2; k++) {
		for(j = 0; j < jmax+2; j++) {
			for(i = 0; i < imax+2; i++) {
				fprintf(fp, "%d\n",getcelltype(Flag[i][j][k]));
			}
		}
	}

	if( fclose(fp) )
	{
		char szBuff[80];
		sprintf( szBuff, "Failed to close %s", szFileName );
		ERROR( szBuff );
	}
}