[cig-commits] r6139 - in short/3D/PyLith/trunk: . pylith pylith/feassemble pylith/materials pylith/problems pylith/topology pylith/utils

brad at geodynamics.org brad at geodynamics.org
Wed Feb 28 22:54:50 PST 2007


Author: brad
Date: 2007-02-28 22:54:49 -0800 (Wed, 28 Feb 2007)
New Revision: 6139

Added:
   short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic.py
Removed:
   short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py
Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/pylith/Makefile.am
   short/3D/PyLith/trunk/pylith/PyLithApp.py
   short/3D/PyLith/trunk/pylith/feassemble/ExplicitElasticity.py
   short/3D/PyLith/trunk/pylith/feassemble/FIATSimplex.py
   short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
   short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py
   short/3D/PyLith/trunk/pylith/materials/Homogeneous.py
   short/3D/PyLith/trunk/pylith/materials/Material.py
   short/3D/PyLith/trunk/pylith/materials/__init__.py
   short/3D/PyLith/trunk/pylith/problems/EqDeformation.py
   short/3D/PyLith/trunk/pylith/problems/Explicit.py
   short/3D/PyLith/trunk/pylith/problems/Formulation.py
   short/3D/PyLith/trunk/pylith/problems/Problem.py
   short/3D/PyLith/trunk/pylith/problems/TimeDependent.py
   short/3D/PyLith/trunk/pylith/topology/Mesh.py
   short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
   short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
   short/3D/PyLith/trunk/pylith/utils/CheckpointTimer.py
   short/3D/PyLith/trunk/pylith/utils/PetscManager.py
Log:
Worked on setting up integrators (element families).

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/TODO	2007-03-01 06:54:49 UTC (rev 6139)
@@ -2,9 +2,10 @@
 
 0. Create element families for materials.
    a. Move quadrature component from Integrator to Material?
-      [Integrator will hold material; user configures quadrature w/material]
-   a. Create method in spatialdata for generating a trivial database.
+      [Integrator will hold quadrature; user configures quadrature w/material]
+     [DONE]
    b. In Formulation?, create an integrator for each "material"
+     [IN PROGRESS]
    c. C++ Material (1 per element family)
       Holds physical properties
       Initialize involves getting parameters from db

Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/Makefile.am	2007-03-01 06:54:49 UTC (rev 6139)
@@ -22,7 +22,7 @@
 	feassemble/Quadrature.py \
 	feassemble/ReferenceCell.py \
 	materials/__init__.py \
-	materials/ElasticIsotropic3D.py \
+	materials/ElasticIsotropic.py \
 	materials/Homogeneous.py \
 	materials/Material.py \
 	materials/MaterialsBin.py \

Modified: short/3D/PyLith/trunk/pylith/PyLithApp.py
===================================================================
--- short/3D/PyLith/trunk/pylith/PyLithApp.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/PyLithApp.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -79,7 +79,7 @@
 
     self.petsc.initialize()
     mesh = self.mesher.create()
-    #self.problem.mesh = mesh.distribute()
+    self.problem.initialize(mesh.distribute())
     self.problem.run(self)
     self.petsc.finalize()
     return

Modified: short/3D/PyLith/trunk/pylith/feassemble/ExplicitElasticity.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/ExplicitElasticity.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/feassemble/ExplicitElasticity.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -24,29 +24,6 @@
   equation using finite-elements.
   """
 
-  # INVENTORY //////////////////////////////////////////////////////////
-
-  class Inventory(IntegratorExplicit.Inventory):
-    """
-    Python object for managing ExplicitElasticity facilities and properties.
-    """
-
-    ## @class Inventory
-    ## Python object for managing ExplicitElasticity facilities and properties.
-    ##
-    ## \b Properties
-    ## @li None
-    ##
-    ## \b Facilities
-    ## @li \b db Database for material property parameters.
-
-    import pyre.inventory
-
-    from spatialdata.spatialdb.SimpleDB import SimpleDB
-    db = pyre.inventory.facility("db", factory=SimpleDB)
-    db.meta['tip'] = "Database for material property parameters."
-
-
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="explicitelasticity"):
@@ -60,23 +37,18 @@
     return
 
 
-  def initialize(self, mesh):
+  def initialize(self, mesh, material):
     """
-    Initialize integrator.
+    Initialize C++ integrator object.
     """
-    self.cppHandle.setupMatProp(mesh.cppHandle, mesh.coordsys, db.cppHandle)
+    self._info.log("Initializing integrator for material '%s'." % \
+                   material.matname)
+    material.initialize()
+    
+    self.material = material
+    self.cppHandle.material = self.material.cppHandle
+    self.cppHandle.createParameters(mesh.cppHandle)
     return
-
-
-  # PRIVATE METHODS ////////////////////////////////////////////////////
-
-  def _configure(self):
-    """
-    Set members based using inventory.
-    """
-    IntegratorExplicit._configure(self)
-    self.db = self.inventory.db
-    return
-
-
+  
+  
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/feassemble/FIATSimplex.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/FIATSimplex.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/feassemble/FIATSimplex.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -19,7 +19,7 @@
 
 import numpy
 
-def validateShape(self, shape):
+def validateShape(shape):
   name = shape.lower()
   if not ("tetrahedron" == name or 
           "triangle" == name or 
@@ -62,8 +62,8 @@
     degree = pyre.inventory.int("degree", default=1)
     degree.meta['tip'] = "Degree of finite-element cell."
 
-    quadOrder = pyre.inventory.int("quad_order", default=1)
-    quadOrder.meta['tip'] = "Order of quadrature rule."
+    order = pyre.inventory.int("quad_order", default=1)
+    order.meta['tip'] = "Order of quadrature rule."
     
 
   # PUBLIC METHODS /////////////////////////////////////////////////////

Modified: short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Integrator.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/feassemble/Integrator.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -24,29 +24,6 @@
   finite-elements.
   """
 
-  # INVENTORY //////////////////////////////////////////////////////////
-
-  class Inventory(Component.Inventory):
-    """
-    Python object for managing Integrator facilities and properties.
-    """
-
-    ## @class Inventory
-    ## Python object for managing Integrator facilities and properties.
-    ##
-    ## \b Properties
-    ## @li None
-    ##
-    ## \b Facilities
-    ## @li \b quadrature Quadrature object for integration
-
-    import pyre.inventory
-
-    from Quadrature import Quadrature
-    quadrature = pyre.inventory.facility("quadrature", factory=Quadrature)
-    quadrature.meta['tip'] = "Quadrature object for integration."
-
-
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="integrator"):
@@ -59,27 +36,14 @@
     return
 
 
-  def initialize(self, mesh):
+  def initQuadrature(self, quadrature):
     """
-    Initialize C++ integrator object.
+    Initialize quadrature.
     """
-    q = self.quadrature
-    q.initialize()
-    self.cppHandle.quadrature = q.cppHandle
-    self.cppHandle.createParameters(mesh.cppHandle)
+    quadrature.initialize()
+    self.quadrature = quadrature    
+    self.cppHandle.quadrature = self.quadrature.cppHandle
     return
   
   
-  # PRIVATE METHODS ////////////////////////////////////////////////////
-
-  def _configure(self):
-    """
-    Set members based using inventory.
-    """
-    Component._configure(self)
-    self.quadrature = self.inventory.quadrature
-    self.db = self.inventory.db
-    return
-
-
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -10,10 +10,10 @@
 # ----------------------------------------------------------------------
 #
 
-## @file pylith/feassemble/IntegratorInertia.py
+## @file pylith/feassemble/IntegratorExplicit.py
 
-## @brief Python object for integration of inertial operator
-## actions with finite-elements.
+## @brief Python object for explicit time integration of actions with
+## finite-elements.
 
 from Integrator import Integrator
 
@@ -24,7 +24,6 @@
   finite-elements.
   """
 
-
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="integratorexplicit"):
@@ -50,17 +49,10 @@
     return self.cppHandle.getStableTimeStep()
 
 
-  def initialize(self, mesh):
-    """
-    Initialize integrator.
-    """
-    return
-
-
   def integrateResidual(self,
                         residual, fieldInT, fieldInTmdt, coords, lumpJacobian):
     """
-    Integrate residual term for dynamic elasticity terms for finite-elements.
+    Integrate residual term for dynamic terms for finite-elements.
     """
     if lumpJacobian:
       self.cppHandle.integrateResidualLumped(residual,
@@ -72,7 +64,7 @@
 
   def integrateJacobian(self, jacobian, fieldInT, coords, lumpJacobian):
     """
-    Integrate Jacobian term for dynamic elasticity terms for finite-elements.
+    Integrate Jacobian term for dynamic terms for finite-elements.
     """
     if lumpJacobian:
       self.cppHandle.integrateJacobianLumped(jacobian, fieldInT, coords)

Copied: short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic.py (from rev 6137, short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py)
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py	2007-02-28 20:32:25 UTC (rev 6137)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/materials/ElasticIsotropic.py
+
+## @brief Python objects implementing isotropic linear elastic materials.
+
+from Material import Material
+
+# import pylith.materials.materials as bindings
+
+
+# ======================================================================
+# ElasticIsotropic1D class
+
+## @brief Python object implementing 1-D isotropic linear elastic material.
+class ElasticIsotropic3D(Material):
+  """
+  Python object implementing 1-D isotropic linear elastic material.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="elasticisotropic1d"):
+    """
+    Constructor.
+    """
+    Material.__init__(self, name)
+    # :TODO: Need to create module for materials
+    # self.cppHandle = bindings.ElasticIsotropic1D()
+    return
+
+
+# ======================================================================
+# ElasticIsotropic2D class
+
+## @brief Python object implementing 2-D isotropic linear elastic material.
+class ElasticIsotropic2D(Material):
+  """
+  Python object implementing 2-D isotropic linear elastic material.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="elasticisotropic2d"):
+    """
+    Constructor.
+    """
+    Material.__init__(self, name)
+    # :TODO: Need to create module for materials
+    # self.cppHandle = bindings.ElasticIsotropic2D()
+    return
+
+
+# ======================================================================
+# ElasticIsotropic3D class
+
+## @brief Python object implementing 3-D isotropic linear elastic material.
+class ElasticIsotropic3D(Material):
+  """
+  Python object implementing 3-D isotropic linear elastic material.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="elasticisotropic3d"):
+    """
+    Constructor.
+    """
+    Material.__init__(self, name)
+    # :TODO: Need to create module for materials
+    # self.cppHandle = bindings.ElasticIsotropic3D()
+    return
+
+
+# End of file 

Deleted: short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -1,108 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/materials/ElasticIsotropic3D.py
-
-## @brief Python object for 3-D isotropic linear elastic material.
-
-from Material import Material
-
-# ElasticIsotropic3D class
-class ElasticIsotropic3D(Material):
-  """Python object for 3-D isotropic linear elastic constitutive model."""
-
-  # INVENTORY //////////////////////////////////////////////////////////
-
-  class Inventory(Material.Inventory):
-    """Python object for managing ElasticIsotropic3D facilities and
-    properties."""
-
-    ## @class Inventory
-    ## Python object for managing ElasticIsotropic3D facilities and
-    ## properties.
-    ##
-    ## \b Properties
-    ## @li \b use_db Use spatial database for properties instead of
-    ##               uniform values supplied here.
-    ## @li \b vp P-wave speed.
-    ## @li \b vs S-wave speed.
-    ## @li \b density Mass density.
-    ##
-    ## \b Facilities
-    ## @li None
-
-    import pyre.inventory
-
-    useDB = pyre.inventory.bool("use_db", default=False)
-    useDB.meta['tip'] = "Use spatial database for properties instead of " \
-                        "uniform values supplied here."
-
-    from pyre.units.length import km
-    from pyre.units.time import s
-    vs = pyre.inventory.dimensional("vs", default=3.0*km/s)
-    vs.meta['tip'] = "S-wave speed."
-
-    vp = pyre.inventory.dimensional("vs", default=3.0*(3**0.5)*km/s)
-    vp.meta['tip'] = "P-wave speed."
-
-    from pyre.units.mass import kg
-    from pyre.units.length import m
-    density = pyre.inventory.dimensional("density", default=3000.0*kg/m**3)
-    density.meta['tip'] = "Mass density."
-    
-  
-  # PUBLIC METHODS /////////////////////////////////////////////////////
-
-  def initialize(self):
-    """
-    Initialize material. If not using predefined database, create one
-    with given parameters.
-    """
-    if not self.useDB:
-      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.
-    """
-    Material.__init__(self, name)
-    # :TODO: Need to create module for materials
-    # import pylith.materials.materials as bindings
-    # self.cppHandle = bindings.ElasticIsotropic3D()
-    return
-
-
-  # PRIVATE METHODS ////////////////////////////////////////////////////
-
-  def _configure(self):
-    """Set members using inventory."""
-    self.useDB = self.inventory.useDB
-    self.density = self.inventory.density
-    self.vs = self.inventory.vs
-    self.vp = self.inventory.vp
-    return
-
-
-# End of file 

Modified: short/3D/PyLith/trunk/pylith/materials/Homogeneous.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Homogeneous.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/materials/Homogeneous.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -18,7 +18,9 @@
 
 # Homogeneous class
 class Homogeneous(MaterialsBin):
-  """Python materials container with one material."""
+  """
+  Python materials container with one material.
+  """
 
   # INVENTORY //////////////////////////////////////////////////////////
 
@@ -38,7 +40,7 @@
 
     import pyre.inventory
 
-    from ElasticIsotropic3D import ElasticIsotropic3D
+    from ElasticIsotropic import ElasticIsotropic3D
     material = pyre.inventory.facility("material", factory=ElasticIsotropic3D)
     material.meta['tip'] = "Material in problem."
 
@@ -46,7 +48,9 @@
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="homogeneous"):
-    """Constructor."""
+    """
+    Constructor.
+    """
     MaterialsBin.__init__(self, name)
     return
 
@@ -54,7 +58,9 @@
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
-    """Set attributes from inventory."""
+    """
+    Set attributes from inventory.
+    """
     MaterialsBin._configure(self)
     self.materials = [self.inventory.material]
     return

Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -38,6 +38,7 @@
     ##
     ## \b Facilities
     ## @li \b db Database of material property parameters
+    ## @li \b quadrature Quadrature object for numerical integration
 
     import pyre.inventory
 
@@ -52,34 +53,43 @@
                                  args=["db"])
     db.meta['tip'] = "Database of material property parameters."
     
+    from pylith.feassemble.Quadrature import Quadrature
+    quadrature = pyre.inventory.facility("quadrature", factory=Quadrature)
+    quadrature.meta['tip'] = "Quadrature object for numerical integration."
 
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
-  def initialize(self):
+  def __init__(self, name="material"):
     """
-    Initialize material property manager.
+    Constructor.
     """
-    self._info.log("Initializing material '%s'." % self.matname)
-    self.db.initialize()
+    Component.__init__(self, name, facility="material")
+    self.cppHandle = None
     return
 
 
-  def __init__(self, name="material"):
+  def initialize(self):
     """
-    Constructor.
+    Initialize material property manager.
     """
-    Component.__init__(self, name, facility="material")
-    self.cppHandle = None
+    self._info.log("Initializing material '%s'." % self.matname)
+    #self.cppHandle.id = self.id
+    #self.cppHandle.matname = self.matname
+    self.db.initialize()
     return
 
 
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
-    """Setup members using inventory."""
+    """
+    Setup members using inventory.
+    """
     self.id = self.inventory.id
     self.matname = self.inventory.matname
     self.db = self.inventory.db
+    self.quadrature = self.inventory.quadrature
     return
 
   

Modified: short/3D/PyLith/trunk/pylith/materials/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/__init__.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/materials/__init__.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -11,9 +11,12 @@
 #
 
 ## @file pylith/materials/__init__.py
+
 ## @brief Python PyLith materials module initialization
 
-all = ['Material',
+all = ['ElasticIsotropic',
+       'Homogeneous',
+       'Material',
        'MaterialsBin']
 
 

Modified: short/3D/PyLith/trunk/pylith/problems/EqDeformation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/EqDeformation.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/problems/EqDeformation.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -49,6 +49,14 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
+  def __init__(self, name="eqdeformation"):
+    """
+    Constructor.
+    """
+    TimeDependent.__init__(self, name)
+    return
+
+
   def checkpoint(self):
     """
     Save problem state for restart.
@@ -64,14 +72,6 @@
     return
   
 
-  def __init__(self, name="eqdeformation"):
-    """
-    Constructor.
-    """
-    TimeDependent.__init__(self, name)
-    return
-
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -55,6 +55,30 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
+  def __init__(self, name="explicit"):
+    """
+    Constructor.
+    """
+    Formulation.__init__(self, name)
+    return
+
+
+  def initialize(self, mesh, materials):
+    """
+    Create explicit integrators for each element family.
+    """
+    self._info.log("Initializing integrators.")
+    from pylith.feassemble.ExplicitElasticity import ExplicitElasticity
+    
+    self.integrators = []
+    for material in materials:
+      integrator = ExplicitElasticity()
+      integrator.initQuadrature(material.quadrature)
+      #integrator.initMaterial(mesh, material)
+      self.integrators.append(integrator)
+    return
+
+
   def stableTimeStep(self):
     """
     Get stable time step for advancing forward in time.
@@ -97,14 +121,6 @@
     return
 
 
-  def __init__(self, name="explicit"):
-    """
-    Constructor.
-    """
-    Formulation.__init__(self, name)
-    return
-
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -29,11 +29,11 @@
 
   class Inventory(Component.Inventory):
     """
-    Python object for managing Explicit facilities and properties.
+    Python object for managing Formulation facilities and properties.
     """
 
     ## @class Inventory
-    ## Python object for managing Explicit facilities and properties.
+    ## Python object for managing Formulation facilities and properties.
     ##
     ## \b Properties
     ## @li None
@@ -50,19 +50,20 @@
   
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
-  def initialize(self):
+  def __init__(self, name="formulation"):
     """
-    Initialize the formulation.
+    Constructor.
     """
-    self._info.log("WARNING: Formulation::initialize not implemented.")
+    Component.__init__(self, name)
+    self.integrators = None
     return
 
 
-  def __init__(self, name="formulation"):
+  def initialize(self, mesh, materials):
     """
-    Constructor.
+    Create integrators for each element family.
     """
-    Component.__init__(self, name)
+    raise NotImplementedError, "initialize() not implemented."
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Problem.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/problems/Problem.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -52,11 +52,29 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
+  def __init__(self, name="problem"):
+    """
+    Constructor.
+    """
+    Component.__init__(self, name, facility="problem")
+    self.mesh = None
+    return
+
+
+  def initialize(self, mesh):
+    """
+    Setup integrators for each element family (material/quadrature,
+    bc/quadrature, etc.).
+    """
+    raise NotImplementedError, "initialize() not implemented."
+    return
+
+
   def run(self, app):
     """
     Solve the problem.
     """
-    raise NotImplementedError, "Problem::run() not implemented."
+    raise NotImplementedError, "run() not implemented."
     return
 
 
@@ -64,19 +82,10 @@
     """
     Save problem state for restart.
     """
-    raise NotImplementedError, "Problem::checkpoint() not implemented."
+    raise NotImplementedError, "checkpoint() not implemented."
     return
   
 
-  def __init__(self, name="problem"):
-    """
-    Constructor.
-    """
-    Component.__init__(self, name, facility="problem")
-    self.mesh = None
-    return
-
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/problems/TimeDependent.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/TimeDependent.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/problems/TimeDependent.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -64,10 +64,30 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
+  def __init__(self, name="timedependent"):
+    """
+    Constructor.
+    """
+    Problem.__init__(self, name)
+    return
+
+
+  def initialize(self, mesh):
+    """
+    Setup integrators for each element family (material/quadrature,
+    bc/quadrature, etc.).
+    """
+    self._info.log("Initializing problem.")
+    self.mesh = mesh
+    #self.formulation.initialize(mesh, self.materials)
+    return
+
+
   def run(self, app):
     """
     Solve time dependent problem.
     """
+    self._info.log("Solving problem.")
     self.checkpointTimer.toplevel = app # Set handle for saving state
     
     from pyre.units.time import second
@@ -112,20 +132,13 @@
     return
   
 
-  def __init__(self, name="timedependent"):
-    """
-    Constructor.
-    """
-    Problem.__init__(self, name)
-    return
-
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
     """
     Set members based using inventory.
     """
+    Problem._configure(self)
     self.totalTime = self.inventory.totalTime
     self.dt = self.inventory.dt
     self.formulation = self.inventory.formulation

Modified: short/3D/PyLith/trunk/pylith/topology/Mesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Mesh.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/topology/Mesh.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -11,6 +11,7 @@
 #
 
 ## @file pylith/topology/Mesh.py
+
 ## @brief Python Mesh for finite-element topology information.
 
 from pyre.components.Component import Component
@@ -45,14 +46,6 @@
   
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
-  def distribute(self):
-    """
-    Distribute mesh across processors.
-    """
-    self._info.log("WARNING: Mesh::distribute() not implemented.")
-    return self
-
-
   def __init__(self, name="mesh"):
     """
     Constructor.
@@ -63,6 +56,14 @@
     return
 
 
+  def distribute(self):
+    """
+    Distribute mesh across processors.
+    """
+    self._info.log("WARNING: Mesh::distribute() not implemented.")
+    return self
+
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -11,6 +11,7 @@
 #
 
 ## @file pylith/topology/MeshGenerator.py
+
 ## @brief Python abstract base class for mesh generator.
 
 from pyre.components.Component import Component
@@ -23,19 +24,19 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
-  def create(self):
+  def __init__(self, name="meshgenerator"):
     """
-    Hook for creating mesh.
+    Constructor.
     """
-    raise NotImplementedError, "MeshGenerator::create() not implemented."
+    Component.__init__(self, name, facility="meshgenerator")
     return
 
 
-  def __init__(self, name="meshgenerator"):
+  def create(self):
     """
-    Constructor.
+    Hook for creating mesh.
     """
-    Component.__init__(self, name, facility="meshgenerator")
+    raise NotImplementedError, "MeshGenerator::create() not implemented."
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshImporter.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/topology/MeshImporter.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -11,6 +11,7 @@
 #
 
 ## @file pylith/topology/MeshImporter.py
+
 ## @brief Python implementation of importing a mesh.
 
 from MeshGenerator import MeshGenerator
@@ -46,13 +47,6 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
-  def create(self):
-    """
-    Hook for creating mesh.
-    """
-    return self.importer.read()
-
-
   def __init__(self, name="meshimporter"):
     """
     Constructor.
@@ -61,6 +55,13 @@
     return
 
 
+  def create(self):
+    """
+    Hook for creating mesh.
+    """
+    return self.importer.read()
+
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/utils/CheckpointTimer.py
===================================================================
--- short/3D/PyLith/trunk/pylith/utils/CheckpointTimer.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/utils/CheckpointTimer.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -55,6 +55,19 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
+  def __init__(self, name="checkpoint"):
+    """
+    Constructor.
+    """
+    Component.__init__(self, name, facility="checkpoint")
+
+    from pyre.units.time import second
+    self.t = -8.9e+99*second
+
+    self.toplevel = None
+    return
+
+
   def update(self, t):
     """
     CheckpointTimer if necessary.
@@ -69,19 +82,6 @@
     return
   
 
-  def __init__(self, name="checkpoint"):
-    """
-    Constructor.
-    """
-    Component.__init__(self, name, facility="checkpoint")
-
-    from pyre.units.time import second
-    self.t = -8.9e+99*second
-
-    self.toplevel = None
-    return
-
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/utils/PetscManager.py
===================================================================
--- short/3D/PyLith/trunk/pylith/utils/PetscManager.py	2007-03-01 05:27:24 UTC (rev 6138)
+++ short/3D/PyLith/trunk/pylith/utils/PetscManager.py	2007-03-01 06:54:49 UTC (rev 6139)
@@ -27,6 +27,15 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
+  def __init__(self, name="petsc"):
+    """
+    Constructor.
+    """
+    Component.__init__(self, name, facility="petsc")
+    self.options = []
+    return
+
+
   def initialize(self):
     """
     Initialize PETSc.
@@ -65,15 +74,6 @@
 
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
-  def __init__(self, name="petsc"):
-    """
-    Constructor.
-    """
-    Component.__init__(self, name, facility="petsc")
-    self.options = []
-    return
-
-
   def _getOptions(self):
     """
     Cleanup options for PETSc.



More information about the cig-commits mailing list