/** TODO: there's redundancy in adding the data members (the same has to be done
 * for the parallel VTK File. -> use array of structs?
 */
void VTKGridWriterImplementation::initializeVTKFile() {
	PointData pointData;
	// we don't need point data at all!?
	//DataArray_t position(type::Int32, "id", 0);
	//pointData.DataArray().push_back(position);

	CellData cellData;
	DataArray_t cells_count(type::Int32, "numberOfMolecules", 1);
	cellData.DataArray().push_back(cells_count);
	DataArray_t node_rank(type::Int32, "node-rank", 1);
	cellData.DataArray().push_back(node_rank);
	DataArray_t index(type::UInt32, "index", 1);
	cellData.DataArray().push_back(index);
	DataArray_t velocity(type::Float64, "velocity", 3);
	cellData.DataArray().push_back(velocity);

	// 3 coordinates
	Points points;
	DataArray_t pointCoordinates(type::Float32, "points", 3);
	points.DataArray().push_back(pointCoordinates);

	Cells cells;
	DataArray_t cells_connectivity(type::Int32, "connectivity", 1);
	cells.DataArray().push_back(cells_connectivity);
	DataArray_t cells_offsets(type::Int32, "offsets", 1);
	cells.DataArray().push_back(cells_offsets);
	DataArray_t cells_type(type::Int32, "types", 1);
	cells.DataArray().push_back(cells_type);

	PieceUnstructuredGrid_t piece(pointData, cellData, points, cells, 0, 0);
	UnstructuredGrid_t unstructuredGrid(piece);
	_vtkFile = new VTKFile_t("UnstructuredGrid");
	_vtkFile->UnstructuredGrid(unstructuredGrid);
}
Пример #2
0
void VTKWriter::initializeOutput(int numParticles) {

	vtkFile = new VTKFile_t("UnstructuredGrid");

	// per point, we add type, position, velocity and force
	PointData pointData;
	DataArray_t mass(type::Float32, "mass", 1);
	DataArray_t velocity(type::Float32, "velocity", 3);
	DataArray_t forces(type::Float32, "force", 3);
	DataArray_t type(type::Int32, "type", 1);
	pointData.DataArray().push_back(mass);
	pointData.DataArray().push_back(velocity);
    pointData.DataArray().push_back(forces);
    pointData.DataArray().push_back(type);

	CellData cellData; // we don't have cell data => leave it empty

	// 3 coordinates
	Points points;
	DataArray_t pointCoordinates(type::Float32, "points", 3);
	points.DataArray().push_back(pointCoordinates);

	Cells cells; // we don't have cells, => leave it empty
	// for some reasons, we have to add a dummy entry for paraview
	DataArray_t cells_data(type::Float32, "types", 0);
	cells.DataArray().push_back(cells_data);

	PieceUnstructuredGrid_t piece(pointData, cellData, points, cells, numParticles, 0);
	UnstructuredGrid_t unstructuredGrid(piece);
	vtkFile->UnstructuredGrid(unstructuredGrid);
}
Пример #3
0
void VTKWriter::initializeOutput(int numParticles) {
	vtkFile = new VTKFile_t("UnstructuredGrid");

	// per point, we add mass, velocity, force, type and stress
	// and in DEBUG mode the id of the molecules
	PointData pointData;
	DataArray_t mass(type::Float32, "mass", 1);
	DataArray_t velocity(type::Float32, "velocity", 3);
	DataArray_t forces(type::Float32, "force", 3);
	DataArray_t type(type::Int32, "type", 1);
	DataArray_t stress(type::Float32, "stress", 1);
	DataArray_t flag(type::Int32, "flag", 1);
	pointData.DataArray().push_back(mass);
	pointData.DataArray().push_back(velocity);
    pointData.DataArray().push_back(forces);
    pointData.DataArray().push_back(type);
    pointData.DataArray().push_back(stress);
    pointData.DataArray().push_back(flag);

#ifdef DEBUG
    DataArray_t id(type::Int32, "id", 1);
    pointData.DataArray().push_back(id);
#endif

	CellData cellData; // we don't have cell data => leave it empty

	// 3 coordinates
	Points points;
	DataArray_t pointCoordinates(type::Float32, "points", 3);
	points.DataArray().push_back(pointCoordinates);

	Cells cells; // we don't have cells, => leave it empty
	// for some reasons, we have to add a dummy entry for paraview
	DataArray_t cells_data(type::Float32, "types", 0);
	cells.DataArray().push_back(cells_data);

	PieceUnstructuredGrid_t piece(pointData, cellData, points, cells, numParticles, 0);
	UnstructuredGrid_t unstructuredGrid(piece);
	vtkFile->UnstructuredGrid(unstructuredGrid);
}