[cig-commits] r6067 - short/3D/PyLith/trunk/pylith/materials

brad at geodynamics.org brad at geodynamics.org
Fri Feb 23 09:56:01 PST 2007


Author: brad
Date: 2007-02-23 09:56:01 -0800 (Fri, 23 Feb 2007)
New Revision: 6067

Modified:
   short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py
   short/3D/PyLith/trunk/pylith/materials/Homogeneous.py
   short/3D/PyLith/trunk/pylith/materials/Material.py
   short/3D/PyLith/trunk/pylith/materials/MaterialsBin.py
Log:
Started cleaning up materials in preparation for creating element families.

Modified: short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py	2007-02-23 05:53:14 UTC (rev 6066)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py	2007-02-23 17:56:01 UTC (rev 6067)
@@ -11,8 +11,9 @@
 #
 
 ## @file pylith/materials/ElasticIsotropic3D.py
-## @brief Python object for 3-D isotropic linear elastic constitutive model.
 
+## @brief Python object for 3-D isotropic linear elastic material.
+
 from Material import Material
 
 # ElasticIsotropic3D class
@@ -62,23 +63,34 @@
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def initialize(self):
-    """Initialize material. If not using predefined database, create
-    one with given parameters."""
+    """
+    Initialize material. If not using predefined database, create one
+    with given parameters.
+    """
     if not self.useDB:
-      from spatialdata.spatialdb.SimpleDB import SimpleDB
-      self.db = SimpleDB()
-      self.db.create(values=["Vp", "Vs", "density"],
-                     units=["m/s", "m/s", "kg/m^3"],
-                     data=[ [self.vp, self.vs, self.density] ],
-                     topology="point")
+      self._info.log("Creating trivial database for uniform properties.")
+      # :TODO: Need method to create trivial database
+      #from spatialdata.spatialdb.SimpleDB import createdb
+      #import numpy
+      #coords = numpy.zeros( (1,3), dtype=numpy.float64)
+      #data = numpy.array( [ [self.vp, self.vs, self.density] ] )
+      #self.db = createdb(values=["Vp", "Vs", "density"],
+      #                   units=["m/s", "m/s", "kg/m^3"],
+      #                   data=data,
+      #                   coords=coords,
+      #                   spaceDim=0)
     Material.initialize(self)
     return
 
 
   def __init__(self, name="elasticisotropic3d"):
-    """Constructor."""
+    """
+    Constructor.
+    """
     Material.__init__(self, name)
-    # NEED TO CREATE HANDLE TO C++ BINDINGS
+    # :TODO: Need to create module for materials
+    # import pylith.materials.materials as bindings
+    # self.cppHandle = bindings.ElasticIsotropic3D()
     return
 
 
@@ -88,12 +100,9 @@
     """Set members using inventory."""
     self.useDB = self.inventory.useDB
     self.density = self.inventory.density
-    self.muLame = self.density * self.inventory.vs**2
-    self.lambdaLame = self.density * self.inventory.vp**2 - 2*self.muLame
+    self.vs = self.inventory.vs
+    self.vp = self.inventory.vp
     return
 
 
- # version
-__id__ = "$Id$"
-
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/materials/Homogeneous.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Homogeneous.py	2007-02-23 05:53:14 UTC (rev 6066)
+++ short/3D/PyLith/trunk/pylith/materials/Homogeneous.py	2007-02-23 17:56:01 UTC (rev 6067)
@@ -11,6 +11,7 @@
 #
 
 ## @file pylith/materials/Homogeneous.py
+
 ## @brief Python materials container with one material.
 
 from MaterialsBin import MaterialsBin
@@ -22,7 +23,9 @@
   # INVENTORY //////////////////////////////////////////////////////////
 
   class Inventory(MaterialsBin.Inventory):
-    """Python object for managing Homogeneous facilities and properties."""
+    """
+    Python object for managing Homogeneous facilities and properties.
+    """
     
     ## @class Inventory
     ## Python object for managing Homogeneous facilities and properties.
@@ -44,7 +47,6 @@
 
   def __init__(self, name="homogeneous"):
     """Constructor."""
-    
     MaterialsBin.__init__(self, name)
     return
 
@@ -53,13 +55,9 @@
 
   def _configure(self):
     """Set attributes from inventory."""
-
     MaterialsBin._configure(self)
     self.materials = [self.inventory.material]
     return
 
   
- # version
-__id__ = "$Id$"
-
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py	2007-02-23 05:53:14 UTC (rev 6066)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py	2007-02-23 17:56:01 UTC (rev 6067)
@@ -11,6 +11,7 @@
 #
 
 ## @file pylith/materials/Material.py
+
 ## @brief Python material property manager.
 
 from pyre.components.Component import Component
@@ -58,39 +59,17 @@
     """
     Initialize material property manager.
     """
-
-    self._info.log("Initializing material '%s'." % self.name)
+    self._info.log("Initializing material '%s'." % self.matname)
     self.db.initialize()
     return
 
 
-  def openDB(self):
-    """
-    Open material property database.
-    """
-
-    self._info.line("Material '%s' opening property database." % self.name)
-    self._info.log("  Setting up query for values: %s." % valNames)
-    self.db.open()
-    return
-
-
-  def closeDB(self):
-    """
-    Close material property database.
-    """
-
-    self._info.log("Material '%s' closing property database." % self.name)
-    self.db.close()
-    return
-
-
   def __init__(self, name="material"):
     """
     Constructor.
     """
-    
     Component.__init__(self, name, facility="material")
+    self.cppHandle = None
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/materials/MaterialsBin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/MaterialsBin.py	2007-02-23 05:53:14 UTC (rev 6066)
+++ short/3D/PyLith/trunk/pylith/materials/MaterialsBin.py	2007-02-23 17:56:01 UTC (rev 6067)
@@ -11,6 +11,7 @@
 #
 
 ## @file pylith/materials/MaterialsBin.py
+
 ## @brief Python container for materials.
 
 from pyre.components.Component import Component
@@ -23,22 +24,10 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
-  def initialize(self):
-    """
-    Initialize material property manager.
-    """
-
-    self._info.log("Initializing materials '%s'." % self.name)
-    for material in self.materials:
-      material.initialize()
-    return
-
-
   def __init__(self, name="materialsbin"):
     """
     Constructor.
     """
-    
     Component.__init__(self, name, facility="materialsbin")
     self.materials = []
     return



More information about the cig-commits mailing list