vthb file structure


I am learning about the structure of the VTK AMR file with suffix .vthb. As I now understand it, the top level meta data with *.vthb contains the base grid information, and the refined AMR boxes on each subsequent level:

<VTKFile type="vtkOverlappingAMR" version="1.1" byte_order="LittleEndian" header_type="UInt64">
  <vtkOverlappingAMR origin="-2 -2 0" grid_description="XY">
    <Block level="0" spacing="0.5 0.5 0.5">
      <DataSet index="0" amr_box="0 4 0 4 0 -1" file="test_0.vti"/>
    <Block level="1" spacing="0.25 0.25 0.5">
      <DataSet index="0" amr_box="0 3 0 5 0 -1" file="test_1.vti"/>
      <DataSet index="1" amr_box="6 9 4 9 0 -1" file="test_2.vti"/>

Then each child file with *.vti is just regular image files on a structured grid.

However, I am not sure is this is efficient in handling many small image files. For example, if the refined cells are distributed in an irregular shape (e.g. figure 9 in visualization-analysis-of-amr-datasets), theoretically there will be a lot of small file pieces. I am wondering if anyone has any experience in handling this kind of AMR dataset, and to what extent can it work properly?

With overlapping AMR, the number of images files can easilly be kept small. You can basically have one image by level of rafinement. Just blank the voxel that you consider not defined in a level of rafinement.

Here is an example level 0 image file:

<VTKFile type="ImageData" version="2.2" byte_order="LittleEndian" header_type="UInt64">
  <ImageData WholeExtent="0 5 0 5 0 0" Origin="-2 -2 0" Spacing="0.5 0.5 0.5" Direction="1 0 0 0 1 0 0 0 1">
  <Piece Extent="0 5 0 5 0 0">
      <DataArray type="Float64" Name="Gaussian-Pulse" format="ascii" RangeMin="1.1448674228227765e-11" RangeMax="0.3032653298563167">
        1.1448674228227765e-11 4.618724830985297e-9 2.52173831283944e-7 0.0000018633265860393355 0.0000018633265860393355 4.618724830985297e-9
        0.0000018633265860393355 0.00010173418450532208 0.0007517195964887862 0.0007517195964887862 2.52173831283944e-7 0.00010173418450532208
        0.005554498269121153 0.0410424993119494 0.0410424993119494 0.0000018633265860393355 0.0007517195964887862 0.0410424993119494
        0.3032653298563167 0.3032653298563167 0.0000018633265860393355 0.0007517195964887862 0.0410424993119494 0.3032653298563167
      <DataArray type="UInt8" Name="vtkGhostType" format="ascii" RangeMin="0" RangeMax="8">
        8 8 0 0 0 8
        8 0 0 0 8 8
        0 8 8 0 0 0
        8 8 0 0 0 8

Do you mean that we can take advantage of this vtkGhostType UInt8 array to specify whether or not a cell has been refined? For this image file to be valid, I still need to provide some data to these cells even if they are refined right, as been shown here by the Gaussian-Pulse Float64 array?

Yes, non refined cell should still be present in the refined layer but set as blank.

I still need to provide some data to these cells even if they are refined right, as been shown here by the Gaussian-Pulse Float64 array?


This is the tradeoff of overlapping vs non-overlapping AMR.

1 Like

Btw, do we have a non-overlapping AMR class?

of course. A vthb can contains a overlapping or non-overlapping amr. I can provide example dataset if needed.

1 Like

I am having some issues blanking cells on the finest AMR level. I tried to follow your suggestion by creating one image file per level, using vtkGhostType described in ghost-and-blanking-visibility-changes and defined in vtkDataSetAttributes to blank the cells. Each image file covers the same simulation domain, but with different resolutions. However, somehow ParaView couldn’t recognize that certain cells on the finest refinement level do not exist, and the vtkGhostType values shown in the Information panel did not match the values in the image file.

Here are the sample files I am talking about.
my2d.vthb (443 Bytes)
test_0.vti (1.2 KB) test_1.vti (3.2 KB)

Where am I doing wrong? How should I use vtkGhostType properly?

In the VTK repository, I found this AMR visibility test for XYZ, but it is not clear to me how the visibility is handled.

  1. It seems like visibility is set by the BlankCells method in vtkParallelAMRUtilities.cxx. But somehow I couldn’t find where the internal function Search · BlankGridsAtLevel (github.com) in the loop over AMR level is defined.
  2. In the XYZ test setup
      // Root block
      origin[0] = origin[1] = origin[2] = 0.0;
      spacing[0] = spacing[1] = spacing[2] = 1.0;
      ndims[0] = ndims[1] = ndims[2] = 4;
      gridPtr = GetGrid(origin, spacing, ndims);
      box = vtkAMRBox(origin, ndims, spacing, amrDataSet->GetOrigin(), description);
      amrDataSet->SetSpacing(0, spacing);
      amrDataSet->SetAMRBox(0, 0, box);
      amrDataSet->SetDataSet(0, 0, gridPtr);

      // Refined patch that covers entire root domain
      origin[0] = origin[1] = origin[2] = 0.0;
      spacing[0] = spacing[1] = spacing[2] = 0.5;
      ndims[0] = ndims[1] = ndims[2] = 6;
      gridPtr = GetGrid(origin, spacing, ndims);
      box = vtkAMRBox(origin, ndims, spacing, amrDataSet->GetOrigin(), description);
      amrDataSet->SetSpacing(1, spacing);
      amrDataSet->SetAMRBox(1, 0, box);
      amrDataSet->SetDataSet(1, 0, gridPtr);

Why does the refined patch covers the entire root domain given ndims on the level 6 and spacing 0.5, while in the root level ndims is 4 and spacing is 1.0?

I’d suggest using a nightly version of ParaView first, I’ve made some fixes recently.

The version I was using is ParaView v5.9.0.

Now I am testing on the nightly build of ParaView v5.9.1. Indeed I can see the changes reading the same file I posted:

  • On the coarse level, those cells with vtkGhostType==0 are not displayed anymore (which is actually a bit of strange since this is supposed to be vtkOverlappingAMR)
  • On the fine level, I still cannot visualize the coarse cells that are denoted with vtkGhostType!=0 correctly. I tried UInt8 values 8, 16, and 32.

How should I proceed @mwestphal ?

I find this description of AMR dataset in the documentation. It would be great to have some more sample data that we can play with.

My apologies for bumping this thread, would it be possible to get an example dataset for non-overlapping amr?

spcth.0 (2.1 MB)

Thank you very much. Is that similar to a vtkNonOverlappingAMR xml file?
(Edit: if that’s a thing)

Here is the .vthb version (XML VTK File format)

vthb.zip (56.3 KB)

That is extremely useful, thank you!

Hi @mwestphal - thank you for sharing the .vthb set of data

I’m finding I can only visualize the block level=“0” set of vtis, is there an obvious/known explanation for this?

(I’ve tried replacing other levels with a level 0 tag, in which case only the last block of level 0 is shown. Happy to explain further if necessary.)

Set the default number of levels to 5 ?

ah yes that did the trick, thanks!

Last one, is NonOverlappingAMR compatible with Volume Rendering?
Your first example (spcth.0) and the next one seem to fail (PV 5.9.1) with:

ERROR: In C:\glr\builds\paraview\paraview-ci\build\superbuild\paraview\src\VTK\Common\ExecutionModel\vtkCompositeDataPipeline.cxx, line 154
vtkPVDataRepresentationPipeline (0000021E16F58090): Can not execute simple algorithm without output ports

Not yet.