[Paraview] Set Id for unordered cells in vtkunstructeredgrid

David E DeMarle dave.demarle at kitware.com
Fri Jun 7 10:10:18 EDT 2013


Can you insert the the cell associated values at the same time or in the
same order that you inserted the cells themselves?
Like so:
  unstructeredgirdP->InsertNextCell(hex->GetCellType(), hex->GetPointIds());
  floatarrayP->InsertNextTuple(uuTmp);

If not, use the fact that InsertNextCell returns a vtkIdType indicating the
new cell's location (or you could just maintain a counter). Store the cell
location's in a map indexed by your elemId for the cell, and use that when
you make the cell associated data array to find the corresponding location
in the cell array.

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Thu, Jun 6, 2013 at 4:04 AM, Dennis Pfleiderer <Pfleide at gmx.de> wrote:

>  Hello;
>
>
>
> i´m writing a paraview reader for my specific geo-file, combined with a
> specific solution-file.the files don´t have any vtk format, only a list of
> floats.
>
> First I created a vtkHexahedron out of vtkpoints and than i commited the
> cells to an vtkunstructeredgrid. this is only a geo-file.
>
> the points i read in and then i set them with InsertPoint(nodeId, x_coord,
> y_coord, z_coord) and the hexahedron i created so:
>
>
>
> vtkSmartPointer<vtkHexahedron> hex = vtkHexahedron::New();
>
> hex->GetPointIds()->SetId(0,vl[0]);
>
> hex->GetPointIds()->SetId(1,vl[1]);
>
> ...
>
> next i commited the cells to the unstructeredgrid with
>
> unstructeredgirdP->InsertNextCell(hex->GetCellType(), hex->GetPointIds());
>
> the elements(cells) are unordered.for example elem1 then elem20...
>
>
>
> Later i read in the solution the nodes (points) in and buffered in the
> float array with
>
> floatarrayP->InsertTuple(nodeId, uuTmp);
>
>
>
> Then i combined geo file and solution file of the nodes in the unstrutered
> grid.
>
> unstructeredgridP->GetPointData()->AddArray(uu);
>
>
>
> Allright.
>
>
>
> I want to do the same with the cells, i have to combine the cells which i
> created with the solution of the cell.
>
> Therefore i want to create a new float arrays with the solution.
>
> floatarrayP->InsertTuple(elemId, uuTmp);
>
>
>
> now my problem:
>
> for the points i set the id consciously in the unstructeredegrid. the
> cells8hexahedron i set by and by.
>
> but i need the exact id of element for InsertTuple(elemId, uuTmp).
>
>
>
> is there a possibility to set the id for cells by while read in the
> geometry or can i get the possibly existing id?
>
>
>
> Thanks
>
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130607/3f51019e/attachment.htm>


More information about the ParaView mailing list