17 #ifndef daxToVtk_DataSetConverter_h
18 #define daxToVtk_DataSetConverter_h
36 #include <dax/cont/UnstructuredGrid.h>
37 #include <dax/cont/UniformGrid.h>
38 #include <dax/cont/ArrayHandle.h>
50 template<
typename CellType>
63 raw_ids[i*(CellType::NUM_POINTS+1)]=CellType::NUM_POINTS;
68 template<
typename CellType>
89 template<
typename CellType>
99 template<
typename ContainerTag,
typename Gr
idType,
typename OutputType>
105 typedef typename ::daxToVtk::CellTypeToType<
106 typename GridType::CellTag > CellType;
109 const vtkIdType num_cells = grid.GetNumberOfCells();
110 const vtkIdType alloc_size = grid.GetCellConnections().GetNumberOfValues();
113 typedef typename GridType::CellConnectionsType::PortalConstControl
115 DaxPortalType daxPortal = grid.GetCellConnections().GetPortalConstControl();
125 *cellPointer = CellType::NUM_POINTS;
127 for(
vtkIdType j=0; j < CellType::NUM_POINTS; ++j, ++cellPointer, ++
index)
129 *cellPointer = daxPortal.Get(
index);
133 daxToVtk::detail::setCells<CellType>(cells,output);
137 template<
typename CellType,
typename Gr
idType,
typename OutputType>
146 vtkCellArray* cells = grid.GetCellConnections().GetPortalControl().GetVtkData();
152 daxToVtk::detail::writeCellTags<CellType>(cells);
154 daxToVtk::detail::setCells<CellType>(cells,output);
158 template<
typename ContainerTag,
typename Gr
idType,
typename OutputType>
166 const vtkIdType num_points = grid.GetNumberOfPoints();
173 dax::Vector3 *raw_pts =
reinterpret_cast<dax::Vector3*
>(
174 points->GetData()->GetVoidPointer(0));
177 typedef typename GridType::PointCoordinatesType::PortalConstControl
179 DaxPortalType daxPortal = grid.GetPointCoordinates().GetPortalConstControl();
181 std::copy(daxPortal.GetIteratorBegin(),
182 daxPortal.GetIteratorEnd(),
185 output->SetPoints(
points );
190 template<
typename Gr
idType,
typename OutputType>
195 vtkPoints *p = grid.GetPointCoordinates().GetPortalControl().GetVtkData();
196 output->SetPoints(p);
208 dax::Vector3 origin = grid.GetOrigin();
209 dax::Vector3
spacing = grid.GetSpacing();
210 dax::Extent3
extent = grid.GetExtent();
212 output->
SetOrigin(origin[0],origin[1],origin[2]);
220 template<
typename CellType,
typename TopoTag,
typename Po
intTag>
229 template<
typename CellType,
typename TopoTag,
typename Po
intTag>
231 dax::cont::UnstructuredGrid<CellType,TopoTag,PointTag>& grid,
238 template<
typename FieldType>
240 FieldType& outputArray,
249 template<
typename FieldType>
251 FieldType& outputArray,
object to represent cell connectivity
virtual vtkIdType GetNumberOfCells()
Get the number of cells in the array.
vtkIdType * GetPointer()
Get pointer to array of cell data.
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
vtkPointData * GetPointData()
Return a pointer to this dataset's point data.
vtkCellData * GetCellData()
Return a pointer to this dataset's cell data.
int AddArray(vtkAbstractArray *array)
Add an array to the array list.
a cell that represents a linear 3D hexahedron
topologically and geometrically regular array of data
virtual void SetSpacing(double, double, double)
Set the spacing (width,height,length) of the cubical cells that compose the data set.
virtual void SetOrigin(double, double, double)
Set/Get the origin of the dataset.
virtual void SetExtent(int extent[6])
Set/Get the extent.
cell represents a 1D line
represent and manipulate point attribute data
represent and manipulate 3D points
concrete dataset represents vertices, lines, polygons, and triangle strips
void SetPolys(vtkCellArray *p)
Set the cell array defining polygons.
void SetLines(vtkCellArray *l)
Set the cell array defining lines.
void SetVerts(vtkCellArray *v)
Set the cell array defining vertices.
a cell that represents a 2D quadrilateral
a 3D cell that represents a tetrahedron
a cell that represents a triangle
dataset represents arbitrary combinations of all possible cell types
void SetCells(int type, vtkCellArray *cells)
Special methods specific to vtkUnstructuredGrid for defining the cells composing the dataset.
a cell that represents a 3D orthogonal parallelepiped
a 3D cell that represents a linear wedge
void convertCells(ContainerTag, GridType &grid, OutputType *output)
void convertPoints(ContainerTag, GridType &grid, OutputType *output)
void setCells(vtkCellArray *cells, vtkPolyData *output)
void writeCellTags(vtkCellArray *cell)
void addPointData(vtkDataSet *output, FieldType &outputArray, const std::string &name)
void dataSetConverter(const dax::cont::UniformGrid<> &grid, vtkImageData *output)
void addCellData(vtkDataSet *output, FieldType &outputArray, const std::string &name)
pointer allocate(size_type n, self::const_pointer hint=0)