Discussion: make grid geometries observable
For the new assembly, we could think about using the Observer design pattern on our grid geometries. This way, we could make all classes that need updating when the grid/gridGeometry changes observers of the grid geometry such that users don't have to update manually afterwards.
An example could be out grid variables. Upon construction, they could register themselves as observer to the grid geometry, and update themselves once notified that the grid geometry has changed.
In the current master, GridVariables
store a shared_ptr
to GridGeometry
. If we made the observable base class use shared_ptr
to the observers, we'd create a memory leak because both classes store shared_ptr
to each other. So we have to be careful and maybe use raw pointers (or weak_ptr
) somewhere...