This is my first question and english is not my first language, so sorry in advance. I have been recently started learning about finite elements in a graduate curse. I have a question about the following theorem. Let $\overline{\Omega}=\cup^N_{i=1} \overline{\Omega_i} $ be a descomposition of $\Omega$ such that $\Omega_i$ is an open subset of $\mathbb{R}^n$ with a piecewise $\mathcal{C}^1$ boundary for all $i=1,\dots,N$, and $\Omega_i\cap\Omega_j=\emptyset$ for $i\neq j$. Then:
Theorem
Let $f$ be a continous function in $\Omega$ such that its restriction to $\Omega_i$, $f|_{\Omega_i}$, belongs to $H^1(\Omega_i)$ for all $i=1,\dots,N$. Then $f\in H^1(\Omega)$.
I am struggling with the continous condition. Is it really necesary in the previous theorem? In the context of finite elements, our basis functions are polynomials and continuity in the whole domain is trivial due to its definition in each element. But in a more general case, is it true that if a function is in $H^1(\Omega_i)$ then is $H^1(\Omega)$ in the whole domain?
The only troublesome aspect might be the boundaries of the subdomains, but I have no idea why a non continous funtion in the boundaries of the subdomains (a zero measure region) could affect to the $H^1$ behavior.
Your feeling about the boundary behavior is right. The simplest counterexample (with the continuity assumption dropped) I can think of is the following:
Let $\Omega = (-1,1)$, $\Omega_1 = (-1,0)$, $\Omega_2 = (0,1)$ and let $f$ be the sign function $$ f(x) = \begin{cases}1 & \text{if } x \ge 0, \\ -1 & \text{if } x < 0.\end{cases} $$ Clearly $f \in H^1(\Omega_1),H^1(\Omega_2)$ but $f \notin H^1(\Omega)$.
I think it could be worthwile for you to look up the proof of the theorem, and find the place where it fails for this particular $f$.