# Catalyst V2 API spacing not being passed properly for vtkImageData

**URL:** https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960
**Category:** In Situ Support
**Created:** [December 2, 2020, 4:20pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960 "2020-12-02T16:20:24Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [December 2, 2020, 4:20pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/1 "2020-12-02T16:20:24Z")

</div>

It looks like the `spacing` parameter isn’t being passed through the new Catalyst v2 API to construct vtkImageData. For the Catalyst2 CxxImageDataExample the spacing should be:

```auto
  double spacing[3] = { 1, 1.1, 1.3 };

```

but it’s at the default spacing of [1, 1, 1].

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [December 2, 2020, 4:24pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/2 "2020-12-02T16:24:46Z")

</div>

from [spec](https://llnl-conduit.readthedocs.io/en/latest/blueprint_mesh.html#uniform) should be passed as spacing/dx…spacing/dy etc. The example has a [bug](https://gitlab.kitware.com/paraview/paraview/-/blob/master/Examples/Catalyst2/CxxImageDataExample/CatalystAdaptor.h#L77-79) where it’s being passed as `spacing/x`, `spacing/y`… hence the issue.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [December 2, 2020, 4:40pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/3 "2020-12-02T16:40:42Z")

</div>

Yup, it looks like it’s the example that had the bug.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [December 2, 2020, 5:11pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/4 "2020-12-02T17:11:00Z")

</div>

Testing a bit more with this example, now in parallel – each partition has the same origin and the extents look like they all start at 0. I’m guessing the example should have the origin adjusted for each process according to the Blueprint spec, correct? Not sure how this should work with topologically regular grids and partitioned datasets though as this will likely require quite a bit of reconstruction underneath the covers to get things working properly. Maybe I’m missing something from not knowing enough about Blueprint.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [December 2, 2020, 6:17pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/5 "2020-12-02T18:17:09Z")

</div>

There too, the issue is simply with the example. the adaptor needs to adjust origin accordingly since Conduit blueprint has no notion of extent and only understands dimensions.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [December 2, 2020, 6:26pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/6 "2020-12-02T18:26:59Z")

</div>

> [@Andy\_Bauer](#):
>
> I’m guessing the example should have the origin adjusted for each process

Looking more closely at the example, it should have adjusted. Unless I am misunderstanding the original code – which I believe you wrote – `grid.GetLocalPoint(0, origin)` should have given me local origin for each of the grids – which should not be 0 on all ranks.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [December 2, 2020, 6:43pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/7 "2020-12-02T18:43:23Z")

</div>

No, the original example has a global origin that is the same on each process and the extent is different on each process. Similar to how vtkImageData is set in parallel. I’d guess that this is how a vtkImageData should also be set in a vtkPartitionedDataSet but am not 100% sure on that.

Conduit appears to assume the origin and dimensions the way that VisIt does it where each origin and dimensions are independent for each process and piecing them together is done at a higher level (from what little understanding I have).That is, each extent in VTK terms would be [0, 0, 0, Nx, Ny, Nz] for each proc.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [December 2, 2020, 7:03pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/8 "2020-12-02T19:03:03Z")

</div>

Any case, “origin/x”. “origin/y” shoudl be local to each rank and not global…feel free to update the example accordingly.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [December 2, 2020, 7:27pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/9 "2020-12-02T19:27:47Z")

</div>

So, a question for this – should operations like `Extract Subset` work at the block level or at the vtkPartitionedDataSet level? On my simulation code each process has an image data with dimensions of [17,33, 33] and when I run in parallel and then save it out and load the partitioned dataset into PV master and do an `Extract Subset` on it with VOI of [0, 8, 0, 8, 0, 8] I get the following (the reader output is shown in Outline representation and the Extract Subset output is shown in Surface with Edges representation).

 ![probablywrong](https://discourse.paraview.org/uploads/default/original/2X/2/2ec19d0b5e701ce558a88f618eec34bdab4aa447.png)

Basically, it appears to be doing the Extract Subset on each individual block instead of over the entire, pieced together dataset, which is what I would expect and want in this case.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [December 2, 2020, 7:30pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/10 "2020-12-02T19:30:15Z")

</div>

ParitionedDataSet is not fully supported by VTK/ParaView yet. It’s ongoing work and most likely be completed by 5.10/5.11. But yes, filters like ExtractSubset need to handle paritioned-dataset of uniform grids where the extents across ranks don’t share the same origin. Either that, or this will need to be handled in `vtkConduitSource` – a good place for this to be handled.

@berkgeveci, any thoughts?

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [December 3, 2020, 1:43pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/11 "2020-12-03T13:43:44Z")

</div>

On further thinking about this, here’re my thoughts:

- with partitioned-datasets, partitions can be mixed types i.e. some are structured data and others are not. that being the case, any requirement that local-extents per partition should use a global origin is unreasonable and potentially impossible.
- to support use-cases like Extract-Subset, maybe we add a new filter that the user can apply to align local extents across partitions when the user knows that it makes sense i.e. all partitions comprise of structured data and form a filled volume.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [December 3, 2020, 2:45pm UTC](https://discourse.paraview.org/t/catalyst-v2-api-spacing-not-being-passed-properly-for-vtkimagedata/5960/12 "2020-12-03T14:45:10Z")

</div>

Yeah, I’m probably mixing up concepts here in this long running discussion. Maybe the vtkMultiPieceDataSet would be a better choice though for the Catalyst V2 API implementation. I don’t really see very many folks creating a structured dataset on one process and then an unstructured dataset on another process, all with the same channel. Maybe Conduit allows it but at some point structure becomes more important than flexibility without control. Too much flexibility without control and it gets tough to do things with it. Think NetCDF without the CF conventions (even with CF conventions it gets confusing at times).
