# [GT4Py] concat_where
- Shaped by: @tehrengruber
- Appetite (FTEs, weeks): 1 cycle, 1 FTE
- Developers: @tehrengruber
## Problem
<!-- The raw idea, a use case, or something we’ve seen that motivates us to work on this -->
While calls to `if_` (IR level) are sufficient to express boundary conditions, they fail to provide the toolchain with sufficient information to reason about the domain a field is defined on. Consider for example the following snippet from a stencil used in an `as_fieldop`:
```python
if_(on_boundary, 0, deref(shift(I, -1)(it)))
```
Since `on_boundary` can be an arbitrary expression it is unclear on what domain `it` is being accessed on. If `it` is referencing a temporary we can therefore not infer its domain.
## Appetite
<!-- Explain how much time we want to spend and how that constrains the solution -->
## Solution
Introduction of a new builtin `concat_where(domain, field1, field2)`. Our example now looks like:
```python
concat_where(
boundary_domain,
as_fieldop(lambda: 0)(),
as_fieldop(lambda it: deref(shift(I, -1)(it)))()
)
```
The domain inference can then propagate `domain` to `field1` and the complement of `domain` to `field2` (both after intersection with the domain of the entire expression). The frontend will look very similar to before:
```python
concat_where(IDim < 10, 0, field_b)
```
Work on this has already started in https://github.com/GridTools/gt4py/pull/1806 a while ago. The frontend part is already done and a significant fraction of the GTIR changes is already working. Beside finishing this, support in the backends (gtfn & dace) and tests are missing.
## Rabbit holes
<!-- Details about the solution worth calling out to avoid problems -->
## No-gos
<!-- Anything specifically excluded from the concept: functionality or use cases we intentionally aren’t covering to fit the ## appetite or make the problem tractable -->