[Paraview] Explicit numbering of nodes indexes in Xdmf/h5
Jason Fleming
jason.fleming at seahorsecoastal.com
Mon Nov 25 12:28:37 EST 2013
Hello Andy
Ok I think I have a better understanding of what you need. You'd like to
pick several nodes out of a larger dataset and feed them to Paraview
without having to change the node numbers, is that right? I don't think
that is possible at all, unfortunately. The XDMF reader doesn't distinguish
between the node's ID and the node's index in the array.
However, I was able to modify your example with an Attribute to reflect the
original node numbers, while also providing connectivity that complies with
the expectation of 0-offset. I loaded the result into Paraview and was able
to display your original node numbers (pls see attached).
It might be easy for you to provide a little conversion code to do the node
renumbering for XDMF. You'd have to make an array to act as a lookup table
between the original node numbers and the new, contiguous, 0-offset node
numbers. Then map old to new, and store to XDMF. The Attribute element is
then used to store the lookup table.
Here is your example with the modifications described above:
<?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>
<Attribute Name="myNodeLabel" AttributeType="Scalar" Center="Node">
<DataItem Dimensions="4" NumberType="Int" Precision="4"
Format="XML">
300 20 22 80
</DataItem>
</Attribute>
</Grid>
</Domain>
</Xdmf>
Cheers
Jason
On Mon, Nov 25, 2013 at 11:48 AM, Andrew Parker <
andy.john.parker at googlemail.com> wrote:
> Hi Jason,
>
> Many thanks for your reply. In my case I'm not quite sure how attributes
> would help me, but I may not fully understand how they work. As I posted
> in the second xmf example file in my last email, given 4 nodes with 4
> unique positions, I can completely define the plane topologically by
> writing the node numbers out in the correct order, their actual
> label/value/number doesn't matter (as long as it consistently refers to the
> correct position).
>
> In my example I used [300 20 22 80] as the node labels to define a 2D
> plane. However, my current understanding of xdmf(2) is that I would need
> to supply in the geometry section (regardless of GeometryType) 301 x, y and
> z node positions (even if 297 are just zeros), just so that I could conform
> to the zero-based implicit numbering of that section. That allows paraview
> to index that data and pick out (the only) 4 positions it requires to
> define the plane.
>
> I'm asking whether there is a way round this so that, as I gave as an
> example in my second xmf file, one could additionally provide an explicit
> node number next to each x,y,z position so that the implicit zero-based
> numbering could be skipped and only 4 x,y,z positions needed to be added to
> the file in addition to their label/value/number.
>
> Can attributes do this? If so could you provide a quick example, ideally
> just with reference to the second example file I included in my email? Do
> you have a link to the xdmf(2) mail list?
>
> Many thanks again,
> Andy
>
>
> On 25 November 2013 16:13, Jason Fleming <
> jason.fleming at seahorsecoastal.com> wrote:
>
>> Hello Andy
>>
>> The XDMF2 library has the ability to assign Attributes and Information
>> data to Geometry objects. So you wouldn't be changing the node numbers,
>> you'd just be adding a new Attribute that has different values at each
>> node, and you'd need to display this new Attribute in Paraview instead of
>> the node numbers.
>>
>> Since you mentioned offsets for XDMF arrays: I've been working on an
>> XDMF2 implementation for ADCIRC, a finite element coastal ocean model.
>> Being a fortran code, ADCIRC uses 1-offset arrays, while the XDMF2 standard
>> is 0-offset.
>>
>> Its easy enough for us to subtract 1 from the node numbers in the element
>> table when storing mesh data as XDMF2, reversing the operation upon read
>> into ADCIRC or leaving them as-is for reading into Paraview. However, when
>> looking at node and element number labels on ADCIRC data in Paraview, the
>> analyst has to remember that all the displayed values are actually off by
>> 1.
>>
>> I emailed the XDMF mailing list and got a reply from the primary
>> developers that they were previously unaware of the demand for 1-offset
>> arrays, but they are now researching the possibility of adding this.
>>
>> Your case is a little different, since it seems you are interested in
>> arbitrary node numbering. But I thought I would mention the above
>> background info for completeness. As I said, XDMF2 Attributes may be the
>> solution for you.
>>
>> Cheers
>> Jason
>>
>>
>>
>>
>>
>>
>> On Mon, Nov 25, 2013 at 10:41 AM, Andrew Parker <
>> andy.john.parker at googlemail.com> wrote:
>>
>>> All,
>>>
>>> I thought I'd forward this onto the paraview list in case somebody could
>>> think of a way to do this? Please see my email below which I originally
>>> sent to the vtk user list. Any help would be very much appreciated,
>>> including the fact that it just cannot be done. I would in particular
>>> welcome thoughts from those who have helped develop the xdmf2 lib within
>>> the paraview source.
>>>
>>> Many thanks again,
>>> Andy
>>>
>>> ---------- Forwarded message ----------
>>> Date: 23 November 2013 17:13
>>> Subject: [vtkusers] Explicit numbering of nodes for Xdmf/h5
>>> To: "vtkusers at vtk.org" <vtkusers at vtk.org>
>>>
>>>
>>> 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
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>>
>> --
>> Dr. Jason G. Fleming
>> Chief Engineer, Seahorse Coastal Consulting
>> 3103 Mandy Ln
>> Morehead City, NC 28557
>> Tel: (252) 726-6323
>> Mobile: (252) 269-0962
>> Web: http://www.seahorsecoastal.com
>>
>
>
--
Dr. Jason G. Fleming
Chief Engineer, Seahorse Coastal Consulting
3103 Mandy Ln
Morehead City, NC 28557
Tel: (252) 726-6323
Mobile: (252) 269-0962
Web: http://www.seahorsecoastal.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20131125/40b2634d/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex3.png
Type: image/png
Size: 5463 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20131125/40b2634d/attachment-0001.png>
More information about the ParaView
mailing list