Ejemplo n.º 1
0
void VTKWriter::plotParticle(Particle& p) {
	if (vtkFile->UnstructuredGrid().present()) {
		LOG4CXX_TRACE(iolog, "UnstructuredGrid is present");
	} else {
		LOG4CXX_ERROR(iolog, "No UnstructuredGrid present");
	}

	PointData::DataArray_sequence& pointDataSequence = vtkFile->UnstructuredGrid()->Piece().PointData().DataArray();
	PointData::DataArray_iterator dataIterator = pointDataSequence.begin();

	dataIterator->push_back(p.getM());
	//cout << "Appended mass data in: " << dataIterator->Name();

	dataIterator++;
	dataIterator->push_back(p.getV()[0]);
	dataIterator->push_back(p.getV()[1]);
	dataIterator->push_back(p.getV()[2]);
	//cout << "Appended velocity data in: " << dataIterator->Name();

	dataIterator++;
	dataIterator->push_back(p.getOldF()[0]);
	dataIterator->push_back(p.getOldF()[1]);
	dataIterator->push_back(p.getOldF()[2]);
	//cout << "Appended force data in: " << dataIterator->Name();

	dataIterator++;
	dataIterator->push_back(p.getType());

	Points::DataArray_sequence& pointsSequence = vtkFile->UnstructuredGrid()->Piece().Points().DataArray();
	Points::DataArray_iterator pointsIterator = pointsSequence.begin();
	pointsIterator->push_back(p.getX()[0]);
	pointsIterator->push_back(p.getX()[1]);
	pointsIterator->push_back(p.getX()[2]);
}
Ejemplo n.º 2
0
void VTKWriter::plotMDCell(double x,double y, double z, double rho, utils::Vector<double, 3> v) {
	if (vtkFile->UnstructuredGrid().present()) {
		//cout << "UnstructuredGrid is present" << endl;
	} else {
		cout << "ERROR: No UnstructuredGrid present" << endl;
	}

	PointData::DataArray_sequence& pointDataSequence = vtkFile->UnstructuredGrid()->Piece().PointData().DataArray();
	PointData::DataArray_iterator dataIterator = pointDataSequence.begin();

	if(rho>0.65)
		std::cout <<"rho" <<rho << " x" << x<<" y"<<y<<" z"<<z<<" rrho"<<(rho*6.69/39.304*pow(10,4))<<std::endl;
	dataIterator->push_back(rho*6.69/39.304*pow(10,4));
	//cout << "Appended mass data in: " << dataIterator->Name();

	dataIterator++;
	//dataIterator->push_back(v[0]*157);
	//dataIterator->push_back(v[1]*157);
	//dataIterator->push_back(v[2]*157);
	dataIterator->push_back(v[0]);
	dataIterator->push_back(v[1]);
	dataIterator->push_back(v[2]);
	//cout << "Appended velocity data in: " << dataIterator->Name();

	dataIterator++;
	dataIterator->push_back(0.0);
	dataIterator->push_back(0.0);
	dataIterator->push_back(0.0);
	//cout << "Appended force data in: " << dataIterator->Name();

	dataIterator++;
	dataIterator->push_back(199);

	dataIterator++;
	dataIterator->push_back(0);

	dataIterator++;
	dataIterator->push_back( 0);
#ifdef DEBUG
	dataIterator++;
	dataIterator->push_back(199);
#endif

	Points::DataArray_sequence& pointsSequence = vtkFile->UnstructuredGrid()->Piece().Points().DataArray();
	Points::DataArray_iterator pointsIterator = pointsSequence.begin();
	pointsIterator->push_back(x);
	pointsIterator->push_back(y);
	pointsIterator->push_back(z);
}
Ejemplo n.º 3
0
void VTKWriter::plotCell(OffsetArray<double> *_p, OffsetArray<utils::Vector<double,2> > *_v, int i, int j, double cellSize, double xOffset, double yOffset, double lb2md) {
	if (vtkFile->UnstructuredGrid().present()) {
		//cout << "UnstructuredGrid is present" << endl;
	} else {
		std::cout << "ERROR: No UnstructuredGrid present" << std::endl;
	}

	PointData::DataArray_sequence& pointDataSequence = vtkFile->UnstructuredGrid()->Piece().PointData().DataArray();
	PointData::DataArray_iterator dataIterator = pointDataSequence.begin();

	dataIterator->push_back(_p->get(i,j));
	//cout << "Appended mass data in: " << dataIterator->Name();

	dataIterator++;
	dataIterator->push_back(_v->get(i,j)[0]*901*lb2md);
	dataIterator->push_back(_v->get(i,j)[1]*901*lb2md);
	dataIterator->push_back(0.0);
	//cout << "Appended velocity data in: " << dataIterator->Name();


	dataIterator++;
	dataIterator->push_back(0.0);
	dataIterator->push_back(0.0);
	dataIterator->push_back(0.0);
	//cout << "Appended force data in: " << dataIterator->Name();

	dataIterator++;
	dataIterator->push_back(99);

	dataIterator++;
	dataIterator->push_back(0);

	dataIterator++;
	dataIterator->push_back( 0);
#ifdef DEBUG
	dataIterator++;
	dataIterator->push_back(99);
#endif

	Points::DataArray_sequence& pointsSequence = vtkFile->UnstructuredGrid()->Piece().Points().DataArray();
	Points::DataArray_iterator pointsIterator = pointsSequence.begin();
	pointsIterator->push_back(((double)i*cellSize+xOffset*cellSize+cellSize/2.0));
	pointsIterator->push_back(((double)j*cellSize+yOffset*cellSize+cellSize/2.0));
	pointsIterator->push_back(cellSize/2.0);
}
Ejemplo n.º 4
0
void VTKWriter::plotParticle(Particle& p) {
	if (vtkFile->UnstructuredGrid().present()) {
		//cout << "UnstructuredGrid is present" << endl;
	} else {
		cout << "ERROR: No UnstructuredGrid present" << endl;
	}

	PointData::DataArray_sequence& pointDataSequence = vtkFile->UnstructuredGrid()->Piece().PointData().DataArray();
	PointData::DataArray_iterator dataIterator = pointDataSequence.begin();

	dataIterator->push_back(p.getM());
	//cout << "Appended mass data in: " << dataIterator->Name();

	dataIterator++;
	dataIterator->push_back(p.getV()[0]*157);
	dataIterator->push_back(p.getV()[1]*157);
	dataIterator->push_back(p.getV()[2]*157);
	//cout << "Appended velocity data in: " << dataIterator->Name();

	dataIterator++;
	dataIterator->push_back(p.getF()[0]);
	dataIterator->push_back(p.getF()[1]);
	dataIterator->push_back(p.getF()[2]);
	//cout << "Appended force data in: " << dataIterator->Name();

	dataIterator++;
	dataIterator->push_back(p.getType());

	dataIterator++;
	dataIterator->push_back(p.getStress());

	dataIterator++;
	dataIterator->push_back(p.getFlag() == true? 1 : 0);
#ifdef DEBUG
	dataIterator++;
	dataIterator->push_back(p.getID());
#endif

	Points::DataArray_sequence& pointsSequence = vtkFile->UnstructuredGrid()->Piece().Points().DataArray();
	Points::DataArray_iterator pointsIterator = pointsSequence.begin();
	pointsIterator->push_back(p.getX()[0]);
	pointsIterator->push_back(p.getX()[1]);
	pointsIterator->push_back(p.getX()[2]);
}