# Which functions can be approximated by piecewise constant functions?

Let $\Omega \subset \mathbb{R}^d$ be a connected and bounded domain. We call a function $f\in L^\infty(\Omega)$ nice if for each $\epsilon>0$ there exist $n\in \mathbb{N}, a_1,\dots,a_n \in \mathbb{R}$ and connected domains $U_1,\dots,U_n \subset \Omega$ with $\left\|f-\sum_{i=1}^n a_i \mathbb{1}_{U_i}\right\|_{L^\infty}\leq \epsilon.$ Does the space of nice function have a name? For $d=1$, I think its the space of functions with bounded Total Variation. Does this also hold true for $d>1$? It is clear that all continuous functions are nice and that there are functions in $L^\infty$ which are not nice.

This question popped up in my research where I am working on some kind of approximations of functions $f\in L^{\infty} \cap W^{m,p}$ and was able to reduce an error term to the form $\max_{i \in I^h}\|f-c_i(f)\|_{L^\infty(B_h(x_i))}$ with $c_i \in L^{\infty}(B_h(x_i))^*$ (dual space of $L^\infty(B_h(x_i))$) and $c_i(f)=1$ if $f\equiv 1$. Now I want to know if I have to add some additional assumptions on $f$ or if I can bound this error term for all $f \in L^{\infty} \cap W^{m,p}$. By the Sobolev Embedding theorem the assumption $m>n/p$ would imply continuity of $f$ and hence $\lim_{h\rightarrow 0}\max_{i \in I^h}\|f-c_i(f)\|_{L^\infty(B_h(x_i))}=0$. However I want (if possible) avoid the assumption $m>n/p$.