Creating a field that is piece-wise over the finite elements

How would you like this field to look like?
Can it be defined geometrically?
See for instance: How to define different materials / importet 3D geometry (gmsh)