# AMR XML file structure for many AMR blocks?

**URL:** https://discourse.paraview.org/t/amr-xml-file-structure-for-many-amr-blocks/13862
**Category:** ParaView Support
**Tags:** vtk
**Created:** [February 4, 2024, 1:33pm UTC](https://discourse.paraview.org/t/amr-xml-file-structure-for-many-amr-blocks/13862 "2024-02-04T13:33:52Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![risingBubbles](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@risingBubbles](https://discourse.paraview.org/u/risingBubbles)
#### Post date: [February 4, 2024, 1:33pm UTC](https://discourse.paraview.org/t/amr-xml-file-structure-for-many-amr-blocks/13862/1 "2024-02-04T13:33:52Z")

</div>

Hello all,

I am trying to write an AMR writer for our AMR code. So far, we just write `UnstructuredGrid` in `.vtu` files. However, we would like to make use of the `vtkNonOverlappingAMR` or `vtkOverlappingAMR` support because we expect it to remove lots of unnecessary overhead. Our code has a 2:1 refinement restriction and decomposes the whole domain into blocks of uniform grids. For the total domain, we can have millions of these blocks. My Problem is now, how to structure the XML files to combine several of the blocks in one file. So far, I only have one block per file:

[example.zip](https://discourse.paraview.org/uploads/short-url/5HW9W5oC3AXZ8XNZxJQICgFPBtC.zip) (9.8 KB)

I tried to put several `ImageData` in one file, but paraview seems to just drop all `ImageData` except for one in this case. What would be your recommendations for this problem?

Thank you all in advance,  
Markus

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 5, 2024, 7:53am UTC](https://discourse.paraview.org/t/amr-xml-file-structure-for-many-amr-blocks/13862/2 "2024-02-05T07:53:56Z")

</div>

> [@risingBubbles](#):
>
> What would be your recommendations for this problem?

While XML file formats supports that, I would recommend trying out VTKHDF format:  
[https://docs.vtk.org/en/latest/design\_documents/VTKFileFormats.html#vtkhdf-file-format](https://docs.vtk.org/en/latest/design_documents/VTKFileFormats.html#vtkhdf-file-format)

---

<div class="post-metadata">

### Author: ![risingBubbles](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@risingBubbles](https://discourse.paraview.org/u/risingBubbles)
#### Post date: [February 5, 2024, 8:31am UTC](https://discourse.paraview.org/t/amr-xml-file-structure-for-many-amr-blocks/13862/3 "2024-02-05T08:31:30Z")

</div>

Thank you very much for your answer!

I still don’t understand how XML would support that. In the example I provided, 8 AMR blocks are on the same level, but the data is stored in different files. I would like to have only 2 files. One for level 0 and one for level 1. However, putting the ImageData of one file to another does not work for ParaView somehow. Also, storing the data once I have loaded it into ParaView leads to the same result. ParaView creates one file for each block of data.

I did not look into the HDF5 support so far, but does this also support a ParallelReader? What is the big advantage using HDF5 instead of the XML format?

Best,  
Markus

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 5, 2024, 8:33am UTC](https://discourse.paraview.org/t/amr-xml-file-structure-for-many-amr-blocks/13862/4 "2024-02-05T08:33:56Z")

</div>

> I did not look into the HDF5 support so far, but does this also support a ParallelReader?

Yes, I think so, but I defer to @Lucas_Givord

> What is the big advantage using HDF5 instead of the XML format?

A single file instead of hundreds of files
