[cig-commits] [commit] split_mt: Added reset of attributes during EoS reset (69e63fe)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Sun Jan 4 09:24:40 PST 2015


Repository : https://github.com/geodynamics/burnman

On branch  : split_mt
Link       : https://github.com/geodynamics/burnman/compare/a363ce0c42843325e78f51130e473e03cedeae7e...69e63fe58f5ca98a9452b9046fbcc5b552660fbb

>---------------------------------------------------------------

commit 69e63fe58f5ca98a9452b9046fbcc5b552660fbb
Author: Bob Myhill <myhill.bob at gmail.com>
Date:   Sun Jan 4 18:24:19 2015 +0100

    Added reset of attributes during EoS reset


>---------------------------------------------------------------

69e63fe58f5ca98a9452b9046fbcc5b552660fbb
 burnman/mineral.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/burnman/mineral.py b/burnman/mineral.py
index c762a36..4f7f22a 100644
--- a/burnman/mineral.py
+++ b/burnman/mineral.py
@@ -65,7 +65,15 @@ class Mineral(Material):
             raise Exception("Please derive your method from object (see python old style classes)")
 
         if self.method is not None and type(new_method) is not type(self.method):
+            # Reset everything but params
+            for key, elem in self.__dict__.items():
+                if key != 'params':
+                    elem = float('nan')
+
+            # Set new EoS
             self.params['equation_of_state']=equation_of_state
+
+            # Warn user that they are changing the EoS
             warnings.warn('Overriding database equation of state. From ' + self.method.__class__.__name__ + ' to ' + new_method.__class__.__name__, stacklevel=2)
 
         self.method = new_method



More information about the CIG-COMMITS mailing list