# HyperTreeGrid support in VTKHDF

**URL:** https://discourse.vtk.org/t/hypertreegrid-support-in-vtkhdf/15150
**Category:** Development
**Tags:** proposal
**Created:** [January 14, 2025, 3:12pm UTC](https://discourse.vtk.org/t/hypertreegrid-support-in-vtkhdf/15150 "2025-01-14T15:12:24Z")
**Posts on this page:** 7
**Page:** 2

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 5, 2025, 11:55am UTC](https://discourse.vtk.org/t/hypertreegrid-support-in-vtkhdf/15150/21 "2025-06-05T11:55:47Z")

</div>

You can now upload files

---

<div class="post-metadata">

### Author: ![Louis\_Gombert](https://discourse.vtk.org/user_avatar/discourse.vtk.org/louis_gombert/32/7766_2.png) [@Louis\_Gombert](https://discourse.vtk.org/u/Louis_Gombert)
#### Post date: [June 5, 2025, 12:31pm UTC](https://discourse.vtk.org/t/hypertreegrid-support-in-vtkhdf/15150/22 "2025-06-05T12:31:19Z")

</div>

How would you expect the 2 trees to render? Currently, only the second one is shown because both have the same coordinates.

You can show that by using a mask, where we hide 2 cells at level 1 on each piece

```python
mask = pack_binary_string("0 0011 00000000 000 0 1100 00000000 000")

[...]
vtkgrp.create_dataset(
    "Mask",
    data=mask,
    dtype='u1',
    shape=mask.shape,
    maxshape=(None,)
)

```

(1 value for each cell + byte padding)

On ParaView with composite index as coloring:

 ![pvhtg](https://discourse.vtk.org/uploads/default/original/2X/5/5da1f3c792e682a80a07a36ff26b39c189d97ee5.jpeg)

---

<div class="post-metadata">

### Author: ![colive](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/d07c76/32.png) [@colive](https://discourse.vtk.org/u/colive)
#### Post date: [June 5, 2025, 12:51pm UTC](https://discourse.vtk.org/t/hypertreegrid-support-in-vtkhdf/15150/23 "2025-06-05T12:51:24Z")

</div>

Yes, I was hoping for some result like the image. The actual code I am using does not necessarily share the same descriptors for the tree on all processes and so for now I have been using MPIIO trickery to write a single “piece” file. I did try something similar previously with multiblock datasets and the mask field(s) but it seems that VTK/Paraview filters treated these as discontinuous.

Is it safe to say if using masking with the multipiece HTG datasets will treat CellData in the composed tree as continuous? Admittedly I haven’t tried this out yet.

---

<div class="post-metadata">

### Author: ![Louis\_Gombert](https://discourse.vtk.org/user_avatar/discourse.vtk.org/louis_gombert/32/7766_2.png) [@Louis\_Gombert](https://discourse.vtk.org/u/Louis_Gombert)
#### Post date: [June 5, 2025, 12:57pm UTC](https://discourse.vtk.org/t/hypertreegrid-support-in-vtkhdf/15150/24 "2025-06-05T12:57:47Z")

</div>

What do you mean by “continuous”? Which ParaView filters do you expect to work with your multi-piece dataset?

---

<div class="post-metadata">

### Author: ![Louis\_Gombert](https://discourse.vtk.org/user_avatar/discourse.vtk.org/louis_gombert/32/7766_2.png) [@Louis\_Gombert](https://discourse.vtk.org/u/Louis_Gombert)
#### Post date: [June 5, 2025, 1:04pm UTC](https://discourse.vtk.org/t/hypertreegrid-support-in-vtkhdf/15150/25 "2025-06-05T13:04:00Z")

</div>

If we’re talking contours or ghost cell generation, the computation may not cross the multi-block boundary, but I assume it would for multi-piece HyperTreeGrids

---

<div class="post-metadata">

### Author: ![colive](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/d07c76/32.png) [@colive](https://discourse.vtk.org/u/colive)
#### Post date: [June 5, 2025, 1:12pm UTC](https://discourse.vtk.org/t/hypertreegrid-support-in-vtkhdf/15150/26 "2025-06-05T13:12:06Z")

</div>

Mostly with regards to the most common ones e.g. contours/isosurfaces. Previously my group was mostly writing the tree as an unstructured grid which had a connectivity issue w.r.t. hanging nodes. It has been hopeful so far to see that HTG solves this issue but I am still hoping to get a writer working that doesn’t rely massively on MPI/MPIIO coordination to put everything into a single file.

---

<div class="post-metadata">

### Author: ![Louis\_Gombert](https://discourse.vtk.org/user_avatar/discourse.vtk.org/louis_gombert/32/7766_2.png) [@Louis\_Gombert](https://discourse.vtk.org/u/Louis_Gombert)
#### Post date: [June 5, 2025, 1:20pm UTC](https://discourse.vtk.org/t/hypertreegrid-support-in-vtkhdf/15150/27 "2025-06-05T13:20:29Z")

</div>

Note that for the vtkHDFWriter class we provide, for MPI parallel writing, we don’t rely on MPIIO, but each rank will create a file on its own with its data. Then, when all ranks are done writing, rank 0 will create a “main” file that glues datasets together using [HDF5 “Virtual Datasets”](https://docs.h5py.org/en/stable/vds.html), basically soft-linking datasets from each piece/rank to make a single file, without hard copies of the data. This is an approach you may want to try as well.

[Previous page](https://discourse.vtk.org/t/hypertreegrid-support-in-vtkhdf/15150.md?page=1)
