[vtkusers] Vtk and AMR

Jean Favre jfavre at cscs.ch
Thu Mar 1 08:16:47 EST 2007


alexposts at free.fr wrote:
> Hi,
>
> I want to use VTK (with python : pyvtk) to visualize of 2 dimensional mesh (more
> particulary adataptive mesh,

VTK (and ParaView) support AMR data quite well. You will need something 
that creates a vtkHierarchicalDataSet for you (2D or 3D)

1)What is your data format? If that is already fixed, you will need to 
write your own reader. Otherwise, you can use a VTK XML-based format

2) VTK supports AMR where each grid is a VtkImageData. Regions of grids 
which are "covered" by sub-grids at finer resolution are "blanked-out".

A *.vtm file would look like this:

<?xml version="1.0"?>
<VTKFile type="vtkHierarchicalBoxDataSet" version="0.1" 
byte_order="LittleEndian" compressor="vtkZLibDataCompressor">
  <vtkHierarchicalBoxDataSet>
    <RefinementRatio level="0" refinement="2"/>
    <RefinementRatio level="1" refinement="4"/>
    <DataSet group="0" dataset="0" amr_box="375 499 0 9 0 0" 
file="amr2d/amr2d_3.vti"/>
    <DataSet group="0" dataset="1" amr_box="500 624 0 9 0 0" 
file="amr2d/amr2d_4.vti"/>
    <DataSet group="1" dataset="0" amr_box="1014 1045 0 19 0 0" 
file="amr2d/amr2d_8.vti"/>
    <DataSet group="2" dataset="0" amr_box="4072 4167 0 79 0 0" 
file="amr2d/amr2d_9.vti"/>
  </vtkHierarchicalBoxDataSet>
</VTKFile>

you can see that the refinement ratio can change from one level to the 
other (In this example, of a 3-level hierarchy, it is 2 and 4)
each grid is defined as a standard <VTKFile type="ImageData"> file. The 
"group" id is the AMR level, and the amr_box represents the coverage of 
the current grid with respect to the original grid in cell coordinates. 
Each grid is stored in the sub-directory amr2d.

I suggest looking at http://www.vtk.org/doc/release/5.0/html/a01153.html 
for the documentation of vtkAMRBox.

You may also look here 
http://www.paraview.org/doc/nightly/html/classvtkHierarchicalFractal.html 
for an example of a source generating an AMR set.

Example of a practical use can be found here 
http://iacs.epfl.ch/colloqnum06/posters/18_Favre.pdf

-- 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070301/f5aea4c4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jf-sign.gif
Type: image/gif
Size: 11512 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070301/f5aea4c4/attachment.gif>


More information about the vtkusers mailing list