[cig-commits] r14456 - in short/3D/PyLith/branches/pylith-swig: examples/twocells/twoquad4 libsrc/materials modulesrc modulesrc/materials modulesrc/topology pylith/apps pylith/bc pylith/materials pylith/problems pylith/topology unittests/libtests unittests/libtests/materials unittests/pytests/materials

brad at geodynamics.org brad at geodynamics.org
Wed Mar 25 16:41:59 PDT 2009


Author: brad
Date: 2009-03-25 16:41:57 -0700 (Wed, 25 Mar 2009)
New Revision: 14456

Added:
   short/3D/PyLith/branches/pylith-swig/pylith/apps/__init__.py
Modified:
   short/3D/PyLith/branches/pylith-swig/examples/twocells/twoquad4/pylithapp.cfg
   short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.icc
   short/3D/PyLith/branches/pylith-swig/modulesrc/Makefile.am
   short/3D/PyLith/branches/pylith-swig/modulesrc/materials/Material.i
   short/3D/PyLith/branches/pylith-swig/modulesrc/topology/MeshOps.i
   short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py
   short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py
   short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBC.py
   short/3D/PyLith/branches/pylith-swig/pylith/materials/Material.py
   short/3D/PyLith/branches/pylith-swig/pylith/problems/Explicit.py
   short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py
   short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py
   short/3D/PyLith/branches/pylith-swig/pylith/problems/Problem.py
   short/3D/PyLith/branches/pylith-swig/pylith/problems/SolverLinear.py
   short/3D/PyLith/branches/pylith-swig/pylith/problems/TimeDependent.py
   short/3D/PyLith/branches/pylith-swig/pylith/topology/Distributor.py
   short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshGenerator.py
   short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshImporter.py
   short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshRefiner.py
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/Makefile.am
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/TestMaterial.cc
   short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestMaterial.py
Log:
Fixed a bunch of small bugs. Updated settings for example.

Modified: short/3D/PyLith/branches/pylith-swig/examples/twocells/twoquad4/pylithapp.cfg
===================================================================
--- short/3D/PyLith/branches/pylith-swig/examples/twocells/twoquad4/pylithapp.cfg	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/examples/twocells/twoquad4/pylithapp.cfg	2009-03-25 23:41:57 UTC (rev 14456)
@@ -38,7 +38,7 @@
 # This component specification means we are using PyLith ASCII format,
 # and we then specify the filename and number of space dimensions for
 # the mesh.
-[pylithapp.mesh_generator.importer]
+[pylithapp.mesh_generator.reader]
 filename = twoquad4.mesh
 coordsys.space_dim = 2
 
@@ -78,10 +78,9 @@
 
 # The properties for this material are given in the spatial database file
 # 'matprops.spatialdb'.
-db.iohandler.filename = matprops.spatialdb
+properties_db.iohandler.filename = matprops.spatialdb
 
-# We are doing 2D quadrature for a quad.
-quadrature = pylith.feassemble.quadrature.Quadrature2D
+# Set cell type to quadrilateral (2-d Lagrange).
 quadrature.cell = pylith.feassemble.FIATLagrange
 quadrature.cell.dimension = 2
 

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.hh	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.hh	2009-03-25 23:41:57 UTC (rev 14456)
@@ -84,7 +84,7 @@
    *
    * @returns Label of material
    */
-  const std::string& label(void) const;
+  const char* label(void) const;
 
   /** Set current time step.
    *

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.icc	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/materials/Material.icc	2009-03-25 23:41:57 UTC (rev 14456)
@@ -58,9 +58,9 @@
 
 // Get label of material.
 inline
-const std::string&
+const char*
 pylith::materials::Material::label(void) const {
-  return _label;
+  return _label.c_str();
 }
 
 // Set current time step.

Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/Makefile.am	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/Makefile.am	2009-03-25 23:41:57 UTC (rev 14456)
@@ -12,7 +12,6 @@
 
 SUBDIRS = \
 	bc \
-	faults \
 	feassemble \
 	materials \
 	meshio \
@@ -21,5 +20,6 @@
 	topology \
 	utils
 
+#	faults
 
 # End of file 

Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/materials/Material.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/materials/Material.i	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/materials/Material.i	2009-03-25 23:41:57 UTC (rev 14456)
@@ -66,7 +66,7 @@
        *
        * @returns Label of material
        */
-      const std::string& label(void) const;
+      const char* label(void) const;
       
       /** Set current time step.
        *

Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/topology/MeshOps.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/topology/MeshOps.i	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/topology/MeshOps.i	2009-03-25 23:41:57 UTC (rev 14456)
@@ -16,10 +16,9 @@
  * @brief Python interface to C++ MeshOps.
  */
 
-//  %apply(int* INPLACE_ARRAY1, int DIM1) {
-//     (int* const materialIds,
-//      const int numMaterials)
-//  };
+%apply(int* IN_ARRAY1, int DIM1) {
+  (int* const materialIds, const int numMaterials)
+  };
 %inline %{
   /** Check to make sure material id of every cell matches the id of
    *  one of the materials.
@@ -37,7 +36,7 @@
 						materialIds, numMaterials);
   } // checkMaterialIds
 %}
-//%clear(int* const materialIds, const int numMaterials);
+%clear(int* const materialIds, const int numMaterials);
 
 
 // End of file 

Modified: short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/apps/PyLithApp.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -88,8 +88,7 @@
     interfaces = None
     if "interfaces" in dir(self.problem):
       interfaces = self.problem.interfaces.components()
-    mesh = self.mesher.create(self.problem.dimension,
-                              self.problem.normalizer, interfaces)
+    mesh = self.mesher.create(self.problem.normalizer, interfaces)
     self._debug.log(resourceUsageString())
     self._logger.stagePop()
 
@@ -142,7 +141,7 @@
     """
     from pylith.utils.EventLogger import EventLogger
     logger = EventLogger()
-    logger.setClassName("PyLith")
+    logger.className("PyLith")
     logger.initialize()
     logger.registerEvent("PyLith main")
 

Added: short/3D/PyLith/branches/pylith-swig/pylith/apps/__init__.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/apps/__init__.py	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/pylith/apps/__init__.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/apps/__init__.py
+
+## @brief Python PyLith apps module initialization.
+
+__all__ = ['PyLithApp',
+           ]
+
+
+# End of file

Modified: short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -131,7 +131,7 @@
     Call constructor for module object for access to C++ object.
     """
     raise NotImplementedError, \
-          "Please implement _createModuleOb() in derived class."
+          "Please implement _createModuleObj() in derived class."
 
 
 # End of file 

Modified: short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBC.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBC.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/bc/DirichletBC.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -87,7 +87,7 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
-  def __init__(self, name="dirichletpoints"):
+  def __init__(self, name="dirichletbc"):
     """
     Constructor.
     """
@@ -117,8 +117,7 @@
     logEvent = "%sverify" % self._loggingPrefix
     self._logger.eventBegin(logEvent)
 
-    BoundaryCondition.verifyConfiguration(self)
-    Constraint.verifyConfiguration(self)
+    BoundaryCondition.verifyConfiguration(self, self.mesh)
 
     self._logger.eventEnd(logEvent)
     return

Modified: short/3D/PyLith/branches/pylith-swig/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/materials/Material.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/materials/Material.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -122,7 +122,7 @@
               "Quadrature spatial dimension: %d\n" \
               "Mesh cell dimension: %d\n" \
               "Mesh spatial dimension: %d" % \
-              (self.matLabel,
+              (self.label(),
                self.quadrature.cellDim, self.quadrature.spaceDim,
                self.mesh.dimension(), self.mesh.coordsys().spaceDim())
     
@@ -150,7 +150,6 @@
     if self.inventory.useInitialState:
       self.dbInitialState(self.inventory.dbInitialState)
 
-    self.matLabel = self.inventory.label
     self.quadrature = self.inventory.quadrature
     return
 

Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/Explicit.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/Explicit.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -46,7 +46,7 @@
     """
     Formulation.__init__(self, name)
     self._loggingPrefix = "TSEx "
-    self.solnField = {'name': "dispT",
+    self.solnField = {'name': "disp(t)",
                       'label': "displacements"}
     return
 
@@ -69,15 +69,29 @@
     Formulation.initialize(self, dimension, normalizer)
 
     self._info.log("Creating other fields and matrices.")
-    self.fields.addReal("dispTpdt")
-    self.fields.addReal("dispTmdt")
-    self.fields.addReal("residual")
-    self.fields.createHistory(["dispTpdt", "dispT", "dispTmdt"])    
-    self.fields.copyLayout("dispT")
-    self.jacobian = self.mesh.createMatrix(self.fields.getSolution())
+    self.fields.add("disp(t+dt)")
+    self.fields.add("disp(t-dt)")
+    self.fields.add("residual")
+    self.fields.createHistory(["disp(t+dt), disp(t), disp(t-dt)"])    
+    self.fields.copyLayout("disp(t)")
+    self._debug.log(resourceUsageString())
 
-    self.solver.initialize(self.mesh, self.fields.getSolution())
+    # Create Petsc vectors for fields involved in solve
+    dispTpdt = self.fields.get("disp(t+dt)")
+    dispTpdt.createVector()
+    residual = self.fields.get("residual")
+    residual.createVector()
 
+    self._info.log("Creating Jacobian matrix.")
+    from pylith.topology.Jacobian import Jacobian
+    self.jacobian = Jacobian(self.fields)
+    self.jacobian.zero() # TEMPORARY, to get correct memory usage
+    self._debug.log(resourceUsageString())
+
+    self._info.log("Initializing solver.")
+    self.solver.initialize(self.fields, self.jacobian, self)
+    self._debug.log(resourceUsageString())
+
     # Solve for total displacement field
     for constraint in self.constraints:
       constraint.useSolnIncr(False)
@@ -95,7 +109,7 @@
     logEvent = "%sprestep" % self._loggingPrefix
     self._logger.eventBegin(logEvent)
     
-    dispTpdt = self.fields.getReal("dispTpdt")
+    dispTpdt = self.fields.get("disp(t+dt)")
     for constraint in self.constraints:
       constraint.setField(t+dt, dispTpdt)
 
@@ -121,17 +135,10 @@
     self._reformResidual(t, dt)
     
     self._info.log("Solving equations.")
-    residual = self.fields.getReal("residual")
-    self.solver.solve(self.fields.getReal("dispTpdt"), self.jacobian, residual)
+    residual = self.fields.get("residual")
+    dispTpdt = self.fields.get("disp(t+dt)")
+    self.solver.solve(dispTpdt, self.jacobian, residual)
 
-    # BEGIN TEMPORARY
-    #import pylith.topology.topology as bindings
-    #bindings.sectionView(residual, "RHS");
-    #bindings.sectionView(self.fields.getReal("dispTpdt"), "SOLUTION");
-    #import pylith.utils.petsc as petscbindings
-    #print "JACOBIAN"
-    #petscbindings.mat_view(self.jacobian)
-    # END TEMPORARY
     self._logger.eventEnd(logEvent)
     return
 
@@ -144,10 +151,10 @@
     self._logger.eventBegin(logEvent)
     
     self.fields.shiftHistory()
-    if not self.solver.guessZero:
-      import pylith.topology.topology as bindings
-      bindings.copyRealSection(self.fields.getReal("dispTpdt"),
-                               self.fields.getReal("dispT"))
+    if not self.solver.guessZero: # only works for KSP solver
+      dispTpdt = self.fields.get("disp(t+dt)")
+      dispT = self.fields.get("disp(t)")
+      dispTpdt.copy(dispT)
 
     Formulation.poststep(self, t, dt)
 

Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/Formulation.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -35,7 +35,7 @@
 
 
 # Formulation class
-class Formulation(Component):
+class Formulation(Component, ModuleFormulation):
   """
   Python abstract base class for formulations of solving equations.
 
@@ -74,7 +74,7 @@
                                        factory=TimeStepUniform)
     timeStep.meta['tip'] = "Time step size manager."
 
-    from pylith.solver.SolverLinear import SolverLinear
+    from SolverLinear import SolverLinear
     solver = pyre.inventory.facility("solver", family="solver",
                                      factory=SolverLinear)
     solver.meta['tip'] = "Algebraic solver."
@@ -194,14 +194,16 @@
 
     self._info.log("Creating solution field.")
     solnName = self.solnField['name']
-    self.fields.addReal(solnName)
+    self.fields.add(solnName)
     self.fields.solutionName(solnName)
-    self.fields.setFiberDimension(solnName, dimension)
+    solution = self.fields.solution()
+    solution.newSection(solution.VERTICES_FIELD, dimension)
     for constraint in self.constraints:
-      constraint.setConstraintSizes(self.fields.getSolution())
-    self.fields.allocate(solnName)
+      constraint.setConstraintSizes(solution)
+    solution.allocate()
     for constraint in self.constraints:
-      constraint.setConstraints(self.fields.getSolution())
+      constraint.setConstraints(solution)
+    solution.createScatter()
     self._debug.log(resourceUsageString())
 
     self._logger.eventEnd(logEvent)
@@ -406,7 +408,7 @@
     self._debug.log(resourceUsageString())
     self._logger.stagePush("Reform Jacobian")
 
-    self.updateSettings(fields, jacobian, t, dt)
+    self.updateSettings(self.jacobian, self.fields, t, dt)
     self.reformJacobian()
 
     self._logger.stagePop()
@@ -425,7 +427,7 @@
     self._info.log("Integrating residual term in operator.")
     self._logger.stagePush("Reform Residual")
 
-    self.updateSettings(fields, jacobian, t, dt)
+    self.updateSettings(self.jacobian, self.fields, t, dt)
     self.reformResidual()
 
     self._logger.stagePop()
@@ -442,7 +444,7 @@
 
     from pylith.utils.EventLogger import EventLogger
     logger = EventLogger()
-    logger.setClassName("PDE Formulation")
+    logger.className("PDE Formulation")
     logger.initialize()
 
     events = ["preinit",

Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/Implicit.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -70,7 +70,7 @@
     """
     Formulation.__init__(self, name)
     self._loggingPrefix = "TSIm "
-    self.solnField = {'name': "dispTBctpdt",
+    self.solnField = {'name': "disp(t), bc(t+dt)",
                       'label': "displacements"}
     self._stepCount = None
     return
@@ -94,25 +94,25 @@
     Formulation.initialize(self, dimension, normalizer)
 
     self._info.log("Creating other fields.")
+    self.fields.add("dispIncr(t)")
+    self.fields.add("residual")
+    self.fields.copyLayout("disp(t), bc(t+dt)")
     self._debug.log(resourceUsageString())
-    self.fields.addReal("dispIncr")
-    self.fields.addReal("residual")
-    self.fields.copyLayout("dispTBctpdt")
-    self._debug.log(resourceUsageString())
 
     self._info.log("Creating Jacobian matrix.")
-    self.jacobian = self.mesh.createMatrix(self.fields.getSolution())
-
-    # BEGIN TEMPORARY
-    # Access entries in matrix here to get correct memory usage
-    import pylith.utils.petsc as petsc
-    petsc.mat_setzero(self.jacobian)
-    # END TEMPORARY
-
+    from pylith.topology.Jacobian import Jacobian
+    self.jacobian = Jacobian(self.fields)
+    self.jacobian.zero() # TEMPORARY, to get correct memory usage
     self._debug.log(resourceUsageString())
 
+    # Create Petsc vectors for fields involved in solve
+    dispIncr = self.fields.get("dispIncr(t)")
+    dispIncr.createVector()
+    residual = self.fields.get("residual")
+    residual.createVector()
+
     self._info.log("Initializing solver.")
-    self.solver.initialize(self.mesh, self.fields.getSolution())
+    self.solver.initialize(self.fields, self.jacobian, self)
     self._debug.log(resourceUsageString())
 
     # Initial time step solves for total displacement field, not increment
@@ -144,7 +144,7 @@
     # Set dispTBctpdt to the BC t time t+dt. Unconstrained DOF are
     # unaffected and will be equal to their values at time t.
     self._info.log("Setting constraints.")
-    dispTBctpdt = self.fields.getReal("dispTBctpdt")
+    dispTBctpdt = self.fields.get("disp(t), bc(t+dt)")
     for constraint in self.constraints:
       constraint.setField(t+dt, dispTBctpdt)
 
@@ -179,24 +179,22 @@
     logEvent = "%sstep" % self._loggingPrefix
     self._logger.eventBegin(logEvent)
 
-    dispIncr = self.fields.getReal("dispIncr")
-    import pylith.topology.topology as bindings
-    bindings.zeroRealSection(dispIncr)
+    dispIncr = self.fields.get("dispIncr(t)")
+    dispIncr.zero()
 
     ### NONLINEAR: This moves under SNES control as IntegrateResidual()
     ### NONLINEAR: Also move updateState() from Integrator.poststep() to this function
     self._reformResidual(t+dt, dt)
 
     self._info.log("Solving equations.")
-    residual = self.fields.getReal("residual")
+    residual = self.fields.get("residual")
     self._logger.stagePush("Solve")
     self.solver.solve(dispIncr, self.jacobian, residual)
     self._logger.stagePop()
 
     # BEGIN TEMPORARY
-    #import pylith.topology.topology as bindings
-    #bindings.sectionView(self.fields.getReal("dispIncr"), "DISPINCR SOLUTION");
-    #bindings.sectionView(self.fields.getReal("residual"), "RESIDUAL");
+    #dispIncr.view("DISPINCR SOLUTION")
+    #residual.view("RESIDUAL")
     # END TEMPORARY
 
     self._logger.eventEnd(logEvent)
@@ -215,10 +213,9 @@
     # constrained DOF. We add in the displacement increments (only
     # nonzero at unconstrained DOF) so that after poststep(),
     # dispTBctpdt contains the displacement field at time t+dt.
-    import pylith.topology.topology as bindings
-    dispIncr = self.fields.getReal("dispIncr")
-    dispTBctpdt = self.fields.getSolution()
-    bindings.addRealSections(dispTBctpdt, dispTBctpdt, dispIncr)
+    dispIncr = self.fields.get("dispIncr(t)")
+    dispTBctpdt = self.fields.solution()
+    dispTBctpdt += dispIncr
 
     Formulation.poststep(self, t, dt)
 

Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/Problem.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/Problem.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -34,8 +34,8 @@
   Factory for boundary condition items.
   """
   from pyre.inventory import facility
-  from pylith.bc.DirichletPoints import DirichletPoints
-  return facility(name, family="boundary_condition", factory=DirichletPoints)
+  from pylith.bc.DirichletBC import DirichletBC
+  return facility(name, family="boundary_condition", factory=DirichletBC)
 
 
 def faultFactory(name):
@@ -155,28 +155,30 @@
     # Check to make sure ids of materials and interfaces are unique
     materialIds = {}
     for material in self.materials.components():
-      if material.quadrature.spaceDim != self.dimension:
+      if material.quadrature.spaceDim() != self.dimension:
         raise ValueError, \
               "Spatial dimension of problem is '%d' but quadrature " \
               "for material '%s' is for spatial dimension '%d'." % \
-              (self.dimension, material.label, material.quadrature.spaceDim)
-      if material.id in materialIds.keys():
+              (self.dimension, material.label(), material.quadrature.spaceDim())
+      if material.id() in materialIds.keys():
         raise ValueError, \
             "ID values for materials '%s' and '%s' are both '%d'. " \
             "Material id values must be unique." % \
-            (material.label, materialIds[material.id], material.id)
-      materialIds[material.id] = material.label
+            (material.label(), materialIds[material.id()], material.id())
+      materialIds[material.id()] = material.label()
     
     for interface in self.interfaces.components():
-      if interface.id in materialIds.keys():
+      if interface.id() in materialIds.keys():
         raise ValueError, \
             "ID values for material '%s' and interface '%s' are both '%d'. " \
             "Material and interface id values must be unique." % \
-            (materialIds[interface.id], interface.label, interface.id)
-      materialIds[interface.id] = interface.label
+            (materialIds[interface.id()], interface.label(), interface.id())
+      materialIds[interface.id()] = interface.label()
 
     # Check to make sure material-id for each cell matches the id of a material
-    self.mesh.checkMaterialIds(materialIds.keys())
+    import numpy
+    idValues = numpy.array(materialIds.keys(), dtype=numpy.int32)
+    self.mesh.checkMaterialIds(idValues)
 
     self._logger.eventEnd(logEvent)
     return
@@ -243,7 +245,7 @@
 
     from pylith.utils.EventLogger import EventLogger
     logger = EventLogger()
-    logger.setClassName("Problem")
+    logger.className("Problem")
     logger.initialize()
 
     events = ["preinit",

Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/SolverLinear.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/SolverLinear.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/SolverLinear.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -56,6 +56,15 @@
     return
 
 
+  def initialize(self, fields, jacobian, formulation):
+    """
+    Initialize linear solver.
+    """
+    ModuleSolverLinear.initialize(self, fields, jacobian, formulation)
+    self.initialGuessZero(self.guessZero)
+    return
+
+
   # PRIVATE METHODS /////////////////////////////////////////////////////
 
   def _configure(self):
@@ -63,7 +72,7 @@
     Set members based using inventory.
     """
     Solver._configure(self)
-    self.initialGuessZero(self.inventory.guessZero)
+    self.guessZero = self.inventory.guessZero
     return
 
 

Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/TimeDependent.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/TimeDependent.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/TimeDependent.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -111,7 +111,6 @@
     self._logger.eventBegin(logEvent)
 
     self._info.log("Initializing problem.")
-    self.normalizer.initialize()
     self.checkpointTimer.initialize(self.normalizer)
     self.formulation.initialize(self.dimension, self.normalizer)
 

Modified: short/3D/PyLith/branches/pylith-swig/pylith/topology/Distributor.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/Distributor.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/Distributor.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -125,7 +125,7 @@
     self._loggingPrefix = "Dist "
     from pylith.utils.EventLogger import EventLogger
     logger = EventLogger()
-    logger.setClassName("FE Distribution")
+    logger.className("FE Distribution")
     logger.initialize()
     events = ["distribute"]
     for event in events:

Modified: short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshGenerator.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshGenerator.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshGenerator.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -64,7 +64,7 @@
     return
 
 
-  def create(self, dim, normalizer, faults=None):
+  def create(self, normalizer, faults=None):
     """
     Generate a Mesh.
     """
@@ -109,7 +109,7 @@
 
     from pylith.utils.EventLogger import EventLogger
     logger = EventLogger()
-    logger.setClassName("Mesh Generator")
+    logger.className("Mesh Generator")
     logger.initialize()
 
     events = ["create",

Modified: short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshImporter.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshImporter.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -75,7 +75,7 @@
     return
 
 
-  def create(self, dim, normalizer, faults=None):
+  def create(self, normalizer, faults=None):
     """
     Hook for creating mesh.
     """
@@ -85,9 +85,9 @@
     logEvent = "%screate" % self._loggingPrefix
     self._logger.eventBegin(logEvent)    
 
-    mesh = self.reader.read(dim, normalizer, self.debug, self.interpolate)
+    mesh = self.reader.read(normalizer, self.debug, self.interpolate)
     if self.debug:
-      mesh.view()
+      mesh.view("Finite-element mesh.")
     self._debug.log(resourceUsageString())
     self._info.log("Adjusting topology.")
     self._adjustTopology(mesh, faults)
@@ -96,13 +96,11 @@
     if mpi.MPI_Comm_size(mpi.MPI_COMM_WORLD) > 1:
       self._info.log("Distributing mesh.")
       mesh = self.distributor.distribute(mesh)
-    if self.debug:
-      mesh.view()
+      if self.debug:
+        mesh.view("Distributed mesh.")
 
     # refine mesh (if necessary)
     mesh = self.refiner.refine(mesh)
-    if self.debug:
-      mesh.view()
 
     self._logger.eventEnd(logEvent)    
     return mesh

Modified: short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshRefiner.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshRefiner.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshRefiner.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -95,7 +95,7 @@
     self._loggingPrefix = "Refin "
     from pylith.utils.EventLogger import EventLogger
     logger = EventLogger()
-    logger.setClassName("FE Refinement")
+    logger.className("FE Refinement")
     logger.initialize()
     events = ["refine"]
     for event in events:

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/Makefile.am	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/Makefile.am	2009-03-25 23:41:57 UTC (rev 14456)
@@ -12,12 +12,12 @@
 
 SUBDIRS = \
 	bc \
-	faults \
 	feassemble \
 	materials \
 	meshio \
 	topology \
 	utils
 
+#	faults 
 
 # End of file 

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/TestMaterial.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/TestMaterial.cc	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/materials/TestMaterial.cc	2009-03-25 23:41:57 UTC (rev 14456)
@@ -63,7 +63,7 @@
   ElasticIsotropic3D material;
   material.label(label.c_str());
   
-  CPPUNIT_ASSERT_EQUAL(label, material.label());
+  CPPUNIT_ASSERT_EQUAL(label, std::string(material.label()));
 } // testLabel
     
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestMaterial.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestMaterial.py	2009-03-25 22:48:13 UTC (rev 14455)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestMaterial.py	2009-03-25 23:41:57 UTC (rev 14456)
@@ -47,8 +47,7 @@
     """
     label = "material abc"
     self.material.label(label)
-
-    # No test of result.
+    self.assertEqual(label, self.material.label())
     return
 
 



More information about the CIG-COMMITS mailing list