[vtkusers] Explicit numbering of nodes for Xdmf/h5
David E DeMarle
dave.demarle at kitware.com
Mon Nov 25 18:13:36 EST 2013
I could see doing it by writing out an indirection array:
-1 ... -1 0 -1 1 -1 ... -1 2 -1 ... -1 4
where the 0 is in the 20'th place, 1 the 22'nd, 2 the 88'th and 4 the
300'th,
and using an arcane function syntax that goes something like
JOIN($0[20];$0[22];$0[88];$0[300]).
I wouldn't recommend it because:
1) it would make the output bigger
2) the indirection step is likely to make the reader really slow
3) function support is notoriously iffy in the history of xdmf and
vtkXdmfReader
4) in order to make the indirection array your exporter would have to
gather just as much information as it would need to reorder the data
upfront.
Instead I recommend renumbering the indices in the exporter and then use
the GlobalIds attribute type in xdmf to keep a record around of what the
original indices for each VTK array were.
Yes I see your point that it would be useful to add a new indirection
function type to xdmf. Unfortunately, I think that is very low on the list
of priorities for the nebulous xdmf developer community.
David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909
On Mon, Nov 25, 2013 at 2:41 AM, Andrew Parker <
andy.john.parker at googlemail.com> wrote:
> Hey George,
>
> In this instance I'm going the other way. My application knows the
> NodeLabels, but it's paraview that I need to get to understand that they
> are not-contiguously implicitly numbered. Paraview is assuming an implicit
> zero-based ordering when it reads the node positions in, and I want a way
> to tell it that actually these nodes have an explicit label/number, and not
> to go for zero-based, but instead to use this number when relating to the
> topology information. I need to be able to write out as per my demo file
> so that paraview can read it in. I'm trying to do this in a way that means
> my code does not have to renumber the nodes - this would be a problem for
> me and I'd really like to avoid that. Do you know if it would be possible
> doing it the way I suggested in my previous post? Do any of the xdmf2
> developers have some thoughts/comments on this?
>
> Cheers,
> Andy
>
>
> On 24 November 2013 21:24, George Zagaris <george.zagaris at kitware.com>wrote:
>
>> I am not very familiar with xdmf/h5, so I could be way off, but couldn't
>> you add a node-attribute array to your mesh (just like you add the
>> velocities), which would store the "NodeLabels"? That way, the geometry
>> would still be read in using the local, contiguous numbering, 0-N, but your
>> application can infer the "NodeLabels", explicitly by accessing the
>> node-attribute array. Does this help?
>>
>> Best,
>> George
>>
>>
>> On Sat, Nov 23, 2013 at 12:13 PM, Andrew Parker <
>> andy.john.parker at googlemail.com> wrote:
>>
>>> All,
>>>
>>> In an effort to spark some comments I thought I'd try to provide a small
>>> example for what I want to do in case my previous post (below) was unclear.
>>> Below is a valid xdmf file that paraview understands for a plane.
>>>
>>> <?xml version="1.0"?>
>>> <!DOCTYPE Xdmf SYSTEM "Xdmf.dtd">
>>> <Xdmf xmlns:xi="http://www.w3.org/2003/XInclude" Version="2.2">
>>> <Domain>
>>> <Grid GridType="Uniform">
>>> <Topology TopologyType="Quadrilateral" Dimensions="1">
>>> <DataItem Dimensions="1 4" NumberType="Int" Precision="8"
>>> Format="XML">
>>> 0 1 3 2
>>> </DataItem>
>>> </Topology>
>>> <Geometry GeometryType="XYZ">
>>> <DataItem Dimensions="4 3" NumberType="Float" Precision="4"
>>> Format="XML">
>>> -0.5 -0.5 0
>>> 0.5 -0.5 0
>>> -0.5 0.5 0
>>> 0.5 0.5 0
>>> </DataItem>
>>> </Geometry>
>>> </Grid>
>>> </Domain>
>>> </Xdmf>
>>>
>>> --- Now, what I want to do is to allow for the fact that the nodes
>>> defining this plane, may happen to be labelled 300, 20, 22, 80 instead of
>>> 0->3. The key point being that there is still only 4 nodes, not 300 in the
>>> file for which I only need 4 to define the geom, but need to write out 300
>>> to all for the 0-based implicit ordering. Therefore, I'd like a section in
>>> the geom part of the xmf file to qualify this numbering. It doesn't bother
>>> me if they're subsequently renumbered inside paraview/vtk, only that I
>>> don't have to, as this is a simplistic version of something more
>>> complicated. So to be verbose, it should now look like:
>>>
>>> <?xml version="1.0"?>
>>> <!DOCTYPE Xdmf SYSTEM "Xdmf.dtd">
>>> <Xdmf xmlns:xi="http://www.w3.org/2003/XInclude" Version="2.2">
>>> <Domain>
>>> <Grid GridType="Uniform">
>>> <Topology TopologyType="Quadrilateral" Dimensions="1">
>>> <DataItem Dimensions="1 4" NumberType="Int" Precision="8"
>>> Format="XML">
>>> * 300 20 22 80 *
>>> </DataItem>
>>> </Topology>
>>> <Geometry GeometryType="*XYZ_Explicit*">
>>> <DataItem Dimensions="4 3" NumberType="Float" Precision="4"
>>> Format="XML">
>>> * 20 -0.5 -0.5 0 *
>>> * 22 0.5 -0.5 0 *
>>> * 80 -0.5 0.5 0 *
>>> * 300 0.5 0.5 0 *
>>> </DataItem>
>>> </Geometry>
>>> </Grid>
>>> </Domain>
>>> </Xdmf>
>>>
>>> Can this be done, or could this be done in the future? Am I being daft
>>> and there is an easy way to do this?
>>>
>>> Cheers again,
>>> Andy
>>>
>>>
>>> On 22 November 2013 17:19, Andrew Parker <
>>> andy.john.parker at googlemail.com> wrote:
>>>
>>>> All,
>>>>
>>>> Hopefully this is a simple question. I'm using xdmf with h5 files to
>>>> store my mesh and view via paraview. However, due to a recent change in my
>>>> code, I now want to be able to specify "NodeNumber XPosition YPosition
>>>> ZPosition" as a tuple for each node/point position in the mesh (it's
>>>> unstructured) so that I can explicitly number the nodes. Currently I do
>>>> something like:
>>>>
>>>> <Geometry Type= "X_Y_Z">
>>>> <DataItem Name="VX" NumberType="Float" Dimensions="1660" Precision="8"
>>>> Format="HDF">
>>>> points.h5:/Mesh/Xposition/
>>>> </DataItem>
>>>> <DataItem Name="VY" NumberType="Float" Dimensions="1660" Precision="8"
>>>> Format="HDF">
>>>> points.h5:/Mesh/Yposition/
>>>> </DataItem>
>>>> <DataItem Name="VZ" NumberType="Float" Dimensions="1660" Precision="8"
>>>> Format="HDF">
>>>> points.h5:/Mesh/Zposition/
>>>> </DataItem>
>>>> </Geometry>
>>>>
>>>> But this assume that the first x, y, and z in the file are meant to be
>>>> for node 0, and node 0 is referenced in the topology section. Now what I
>>>> want to do is to be able to define for each x, y, z tuple the specific node
>>>> number that those positions refer to. So explicit numbering rather than
>>>> implicit numbering. Can this be done with xdmf, I assume it can? If not a
>>>> massive amount of renumbering is needed.....
>>>>
>>>> Any help really appreciated.
>>>>
>>>> Cheers,
>>>> Andy
>>>>
>>>
>>>
>>> _______________________________________________
>>> 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 VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>
> _______________________________________________
> 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20131125/9cc4f45a/attachment.htm>
More information about the vtkusers
mailing list