This adds a simple function for replacing a rundata's data object. This functionality came up in a particular application of GeoClaw where all the rundata objects were essentially the same save for one and it was nice to replace only the one. Care had to be taken to make sure to delete the object's member as well as the object from the data_list as not doing so would mean the object would be replaced by the newer object but the when the write routine was called the older object's write would be called.
Arguably it would be better to in general construct one's own rundata similar to how the basic types are done (classic, amrclaw, geoclaw) but I think this will provide users an easy way to do this themselves with a minimum of fuss.
This adds a simple function for replacing a
rundata
's data object. This functionality came up in a particular application of GeoClaw where all therundata
objects were essentially the same save for one and it was nice to replace only the one. Care had to be taken to make sure to delete the object's member as well as the object from thedata_list
as not doing so would mean the object would be replaced by the newer object but the when thewrite
routine was called the older object'swrite
would be called.Arguably it would be better to in general construct one's own
rundata
similar to how the basic types are done (classic
,amrclaw
,geoclaw
) but I think this will provide users an easy way to do this themselves with a minimum of fuss.