[Paraview] Extension to EnSight readers to read nfaced elements
Yvan Fournier
yvan.fournier at free.fr
Fri Mar 3 20:16:42 EST 2006
Hello,
I modified VTK's EnSight Gold readers (binary and text) to read
EnSight's "nfaced" (convex polyhedra) element types
(using VTK_CONVEX_POINT_SET).
The modified files (based on the current CVS head) are at the
following URL hoping that they may good enough for inclusion in
ParaView/VTK:
http://yvan.fournier.free.fr/paraview/nfaced/index.html
As EnSight's nfaced elements are defined by n polygonal faces,
vertices appear in an element's node list once per face to which
they belong. This does not seem to be the case with
VTK_CONVEX_POINT_SET, so I used a nodeMarker array, initialized to
-1 for each node. Looping on elements, when a node is first used
for a given element, its marker value is set to the current
element index, so if we encounter it again for this element,
seeing that its marker value is not lower than the current
element index, we know that it has already been counted.
This seems to work fine.
For the Ensight Gold text reader, I had to add a "ElementIdsListed"
member to the "vtkEnSightGoldReader" class (similar to the one
used in "vtkEnSightGoldBinaryReader"), because the method used
for polygons ("nsided") to skip optional element ids was not
extensible to polyhedra. In the vtk_EnSight_minimal_changes.tar.gz
version of the modified files, this member is only used for
polyhedra. In the vtk_EnSight.tar.gz version, it is also
used for polygons, for consistency (and simplification). Further
cleanup would be possible, but I would rather check first that
the modifications are OK for inclusion in ParaView.
Everything seems to work fine, except for "cell centers" outside
the VTK_CONVEX_POINT_SET (which I suspect is an unrelated
bug). "shrink" shows cells having the correct shape.
I also include test data including "nfaced" elements (in both
text and little-endian binary).
Hoping this is can be useful (it is for us).
Best regards,
Yvan Fournier
Research Engineer,
EDF R&D
MFEE Department
6 quai Watier - BP49 - 78401 Chatou Cedex - France
phone: 33 1 30 87 78 14 - fax: 33 1 30 87 74 61
e-mail: yvan dot fournier at edf dot fr
Note: as an aside, I noted that the VTK EnSight readers read
nodes of nsided (polygonal) elements in reverse order.
This is probably due to a strict interpretation of the
EnSight documentation, in which nsided elements seem
to be defined in an clockwise (counter direct trigonometric
order) manner. The last time I checked (building an
elevated surface depending on face normals), EnSight
did not in fact seem to use an inverse order, but the
direct trigonometric order, so the node order of
polygons read from EnSight into VTK should probably be reversed
(I can check again if anyone is interested).
More information about the ParaView
mailing list