Model.morphstoredomains#

Model.morphstoredomains(mode)#

Stores or restores a copy of current domains, handles and shapes.

Parameters:

mode (int) –

The mode you want to use the function in:

1 - Store domains

2 - Restore domains

3 - Free (empty) the memory used for storage

Example#

Store the current domains, handles and shapes#
import hm
import hm.entities as ent

model = hm.Model()

model.morphstoredomains(mode=1)

Note

This function either stores a copy of all the handles, domain, and shapes in the database, restores that copy - replacing the current entities in the database, or clears the memory where the stored copy was kept. This is how HyperMorph enables the reject function for the extensive changes which can result from domain creation or updating.

Typical usage would be to call this function with mode = 1, call any function which modifies handles, domains, and shapes, and then call this function with mode = 2 if you want to reject the previous changes. Then make sure to call this function with mode = 3 to free up the memory used for storage.