[Paraview] Attribute for grid collection

Nikolaos Beratlis nikos.beratlis at gmail.com
Thu Apr 4 13:57:08 EDT 2013


When I try to transform the "Collection" grid from cartesian coordinates to
cylindrical coordinates using the following script:

pdi = self.GetInput()
pdo = self.GetOutput()
newPoints = vtk.vtkPoints()
numPoints = pdi.GetNumberOfPoints()
for i in range(0, numPoints):
  coord = pdi.GetPoint(i)
  x, y, z = coord[:3]
  r = x * cos(y)
  t = x * sin(y)
  newPoints.InsertPoint(i, r, t, z)
pdo.SetPoints(newPoints)
pdo.GetPointData().AddArray(pdi.GetPointData().GetArray(0))
pdo.GetPointData().AddArray(pdi.GetPointData().GetArray(1))
pdo.GetPointData().AddArray(pdi.GetPointData().GetArray(2))

I get the following error:

Traceback (most recent call last):
File "<string>", line 26, in <module>
File "<string>", line 7, in RequestData
AttributeError: GetPoint

The script works well if the grid is not of GridType Collection.

Thank you,

Nikos


On Thu, Apr 4, 2013 at 3:57 AM, Felipe Bordeu <felipe.bordeu at ec-nantes.fr>wrote:

>  you must put the attributes inside each grid:
>
> Felipe
>
>
> <?xml version="1.0" ?>
> <!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
> <Xdmf Version="2.2">
> <Domain>
>     <Grid GridType="Collection">
>         <Grid GridType="Uniform">
>         <Topology TopologyType="3DRectMesh" Dimensions="     2     4
> 3"/>
>         <Geometry GeometryType="VXVYVZ">
>         <DataItem Dimensions="    3" NumberType="Float" Precision="4"
> Format="XML">
>            0.0000   1.0000   2.0000
>         </DataItem>
>         <DataItem Dimensions="    4" NumberType="Float" Precision="4"
> Format="XML">
>            0.0000   2.0944   4.1888   6.2832
>         </DataItem>
>         <DataItem Dimensions="    2" NumberType="Float" Precision="4"
> Format="XML">
>            1.0000   2.0000
>         </DataItem>
>         </Geometry>
>         <Attribute Name="var" AttributeType="Scalar" Center="Node">
>        <DataItem Dimensions="24 1 1" NumberType="Float" Precision="4"
> Format="XML">
>
>        0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
>        </DataItem>
>        </Attribute>
>
>     </Grid>
> <Grid GridType="Uniform">
> <Topology TopologyType="3DRectMesh" Dimensions="     2     4     3"/>
> <Geometry GeometryType="VXVYVZ">
> <DataItem Dimensions="    3" NumberType="Float" Precision="4" Format="XML">
>    1.0000   2.0000   3.0000
> </DataItem>
> <DataItem Dimensions="    4" NumberType="Float" Precision="4" Format="XML">
>    0.0000   2.0944   4.1888   6.2832
> </DataItem>
> <DataItem Dimensions="    2" NumberType="Float" Precision="4" Format="XML">
>    2.0000   3.0000
> </DataItem>
> </Geometry>
> <Attribute Name="var" AttributeType="Scalar" Center="Node">
> <DataItem Dimensions="24 1 1" NumberType="Float" Precision="4"
> Format="XML">
>
> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
> </DataItem>
> </Attribute>
> </Grid>
> </Grid>
> </Domain>
> </Xdmf>
>
>
> Le 04/04/2013 04:36, Nikolaos Beratlis a écrit :
>
> I have a domain that consists of patches of orthogonal cartesian grids in
> the following XDMF file:
>
>  <?xml version="1.0" ?>
> <!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
> <Xdmf Version="2.2">
> <Domain>
> <Grid GridType="Collection">
> <Grid GridType="Uniform">
> <Topology TopologyType="3DRectMesh" Dimensions="     2     4     3"/>
> <Geometry GeometryType="VXVYVZ">
> <DataItem Dimensions="    3" NumberType="Float" Precision="4" Format="XML">
>    0.0000   1.0000   2.0000
> </DataItem>
> <DataItem Dimensions="    4" NumberType="Float" Precision="4" Format="XML">
>    0.0000   2.0944   4.1888   6.2832
> </DataItem>
> <DataItem Dimensions="    2" NumberType="Float" Precision="4" Format="XML">
>    1.0000   2.0000
> </DataItem>
> </Geometry>
>  </Grid>
> <Grid GridType="Uniform">
> <Topology TopologyType="3DRectMesh" Dimensions="     2     4     3"/>
> <Geometry GeometryType="VXVYVZ">
> <DataItem Dimensions="    3" NumberType="Float" Precision="4" Format="XML">
>    1.0000   2.0000   3.0000
> </DataItem>
> <DataItem Dimensions="    4" NumberType="Float" Precision="4" Format="XML">
>    0.0000   2.0944   4.1888   6.2832
> </DataItem>
> <DataItem Dimensions="    2" NumberType="Float" Precision="4" Format="XML">
>    2.0000   3.0000
> </DataItem>
> </Geometry>
> </Grid>
> <Attribute Name="var" AttributeType="Scalar" Center="Node">
> <DataItem Dimensions="48" NumberType="Float" Precision="4" Format="XML">
> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
> </DataItem>
> </Attribute>
> </Grid>
> </Domain>
> </Xdmf>
>
>  The grid is declared as GridType Collection. When I read it in Paraview
> the grid is read correctly as shown in the attached picture, however I
> don't get the values for the attribute. I think the attribute is not read
> at all. Is there sth wrong with this file? How should the attribute be
> specified for GridType Collection?
>
>  Thank you,
>
>  Nikos
>
>
> _______________________________________________
> 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
>
>
>
> --
> Felipe Bordeu Weldt
> Ingénieur de Recherche
> -------------------------------------
> Tél. : 33 (0)2 40 37 16 57
> Fax. : 33 (0)2 40 74 74 06Felipe.Bordeu at ec-nantes.fr
> Institut GeM - UMR CNRS 6183
> École Centrale Nantes
> 1 Rue de La Noë, 44321 Nantes, FRANCE
> -------------------------------------
>
>
> _______________________________________________
> 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/20130404/d3892e70/attachment.htm>


More information about the ParaView mailing list