- tree(node, max_depth=None)[source]#
Displays the model tree.
This is a convenience function to visualize, in an interactive Python session, the branch of the model tree underneath a given
node. It produces console output such as this:
>>> mph.tree(model/'physics') physics ├─ electrostatic │ ├─ Laplace equation │ ├─ zero charge │ ├─ initial values │ ├─ anode │ └─ cathode └─ electric currents ├─ current conservation ├─ insulation ├─ initial values ├─ anode └─ cathode
max_depthto possibly limit the number of lower branches.
Often the node would refer to the model’s root in order to inspect the entire model tree. A
Modelobject is therefore also accepted as a value for
Note that this function performs poorly in client–server mode, the default on Linux and macOS, especially for complex models. The client–server communication introduces inefficiencies that do not occur in stand-alone mode, the default on Windows, where the model tree, i.e. the hierarchy of related Java objects, can be traversed reasonably fast.