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*
>(
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]);
213 output->
SetSpacing(spacing[0],spacing[1],spacing[2]);
214 output->
SetExtent(extent.Min[0],extent.Max[0],
215 extent.Min[1],extent.Max[1],
216 extent.Min[2],extent.Max[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,
262 #endif // daxToVtk_DataSetConverter_h
vtkIdType * GetPointer()
Get pointer to array of cell data.
pointer allocate(size_type n, self::const_pointer hint=0)
int AddArray(vtkAbstractArray *array)
Add an array to the array list.
void dataSetConverter(const dax::cont::UniformGrid<> &grid, vtkImageData *output)
represent and manipulate point attribute data
virtual void * GetVoidPointer(vtkIdType valueIdx)=0
Return a void pointer.
void SetLines(vtkCellArray *l)
Set the cell array defining lines.
void SetPolys(vtkCellArray *p)
Set the cell array defining polygons.
abstract class to specify dataset behavior
vtkCellData * GetCellData()
Return a pointer to this dataset's cell data.
a cell that represents a 2D quadrilateral
concrete dataset represents vertices, lines, polygons, and triangle strips
virtual vtkIdType GetNumberOfCells()
Get the number of cells in the array.
void convertCells(ContainerTag, GridType &grid, OutputType *output)
virtual void SetName(const char *)
Set/get array's name.
vtkPointData * GetPointData()
Return a pointer to this dataset's point data.
a 3D cell that represents a tetrahedron
cell represents a 1D line
virtual void SetExtent(int extent[6])
Set/Get the extent.
a cell that represents a 3D orthogonal parallelepiped
void writeCellTags(vtkCellArray *cell)
void convertPoints(ContainerTag, GridType &grid, OutputType *output)
topologically and geometrically regular array of data
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
void addPointData(vtkDataSet *output, FieldType &outputArray, const std::string &name)
void SetVerts(vtkCellArray *v)
Set the cell array defining vertices.
a cell that represents a linear 3D hexahedron
virtual void SetSpacing(double, double, double)
Set the spacing (width,height,length) of the cubical cells that compose the data set.
void SetCells(int type, vtkCellArray *cells)
Special methods specific to vtkUnstructuredGrid for defining the cells composing the dataset...
object to represent cell connectivity
a cell that represents a triangle
virtual void SetOrigin(double, double, double)
Set/Get the origin of the dataset.
void addCellData(vtkDataSet *output, FieldType &outputArray, const std::string &name)
void setCells(vtkCellArray *cells, vtkPolyData *output)
a 3D cell that represents a linear wedge
represent and manipulate 3D points