<jupyter_start><jupyter_text>04 Notebook exercise:Let us utilize `SubDomain`s to write an `Operator` to produce the following result in a sinlge iteration:```f.data = Data([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],               [0., 1., 1., 1., 1., 3., 3., 3., 3., 0.],               [0., 1., 1., 1., 1., 3., 3., 3., 3., 0.],               [0., 1., 1., 1., 1., 3., 3., 3., 3., 0.],               [0., 1., 1., 1., 1., 3., 3., 3., 3., 0.],               [0., 2., 2., 2., 2., 4., 4., 4., 4., 0.],               [0., 2., 2., 2., 2., 4., 4., 4., 4., 0.],               [0., 2., 2., 2., 2., 4., 4., 4., 4., 0.],               [0., 2., 2., 2., 2., 4., 4., 4., 4., 0.],               [0., 0., 0., 0., 0., 0., 0., 0., 3., 0.]], dtype=float32)```<jupyter_code># Devito code:
from devito import *

# Define 4 subdomains:
class TopLeft(SubDomain):
    name = 'topleft'
    def define(self, dimensions):
        x, y = dimensions
        return {x: ('middle', 1, 5), y: ('middle', 1, 5)}
tl = TopLeft()

class TopRight(SubDomain):
    name = 'topright'
    def define(self, dimensions):
        x, y = dimensions
        return {x: ('middle', 1, 5), y: ('middle', 5, 1)}
tr = TopRight()

class BottomLeft(SubDomain):
    name = 'bottomleft'
    def define(self, dimensions):
        x, y = dimensions
        return {x: ('middle', 5, 1), y: ('middle', 1, 5)}
bl = BottomLeft()

class BottomRight(SubDomain):
    name = 'bottomright'
    def define(self, dimensions):
        x, y = dimensions
        return {x: ('middle', 5, 1), y: ('middle', 5, 1)}
br = BottomRight()

grid = Grid(shape = (10, 10), subdomains = (tl, tr, bl, br))
f = Function(name = 'f', grid = grid)

eq1 = Eq(f, f+1, subdomain = grid.subdomains['topleft'])
eq2 = Eq(f, f+3, subdomain = grid.subdomains['topright'])
eq3 = Eq(f, f+2, subdomain = grid.subdomains['bottomleft'])
eq4 = Eq(f, f+4, subdomain = grid.subdomains['bottomright'])

Operator([eq1, eq2, eq3, eq4])()
# Lets check the result:
f.data<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.23316582914572864, 'fraction_numerical': 0.06884422110552764, 'mean_word_length': 2.2112903225806453, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '51063', 'license': 'MIT', 'n_tokens_mistral': 858, 'n_tokens_neox': 733, 'n_words': 255, 'path': 'additional_material/nb4_exercise.ipynb', 'repo_name': 'devitocodes/transform2020', 'size': '1990'}