Simplify adding more boundary models

...using some C++ nested classes and template magic.