当前位置: 首页>>代码示例>>C++>>正文


C++ Points::DataArray方法代码示例

本文整理汇总了C++中Points::DataArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Points::DataArray方法的具体用法?C++ Points::DataArray怎么用?C++ Points::DataArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Points的用法示例。


在下文中一共展示了Points::DataArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initializeVTKFile

/** 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);
}
开发者ID:p-hoffmann,项目名称:madpac,代码行数:37,代码来源:VTKGridWriterImplementation.cpp

示例2: initializeOutput

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);
}
开发者ID:Gruppe3,项目名称:MolSimGR3,代码行数:31,代码来源:VTKWriter.cpp

示例3: initializeOutput

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);
}
开发者ID:p-hoffmann,项目名称:madpac,代码行数:40,代码来源:VTKWriter.cpp


注:本文中的Points::DataArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。