[cig-commits] r6958 - in short/3D/PyLith/trunk: libsrc/bc modulesrc/bc pylith/bc unittests/pytests/bc

brad at geodynamics.org brad at geodynamics.org
Thu May 24 17:03:10 PDT 2007


Author: brad
Date: 2007-05-24 17:03:09 -0700 (Thu, 24 May 2007)
New Revision: 6958

Modified:
   short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.cc
   short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh
   short/3D/PyLith/trunk/libsrc/bc/Dirichlet.hh
   short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src
   short/3D/PyLith/trunk/pylith/bc/BCIntegrator.py
   short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
   short/3D/PyLith/trunk/pylith/bc/Dirichlet.py
   short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichlet.py
Log:
Updated boundary condition interfaces to use Constraint and Integrator.

Modified: short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.cc	2007-05-24 23:16:10 UTC (rev 6957)
+++ short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.cc	2007-05-25 00:03:09 UTC (rev 6958)
@@ -30,53 +30,5 @@
   _db = 0;
 } // destructor
 
-// ----------------------------------------------------------------------
-// Set number of degrees of freedom that are constrained at points in field.
-void
-pylith::bc::BoundaryCondition::setConstraintSizes(
-				     const ALE::Obj<real_section_type>& field,
-				     const ALE::Obj<ALE::Mesh>& mesh)
-{ // setConstraintSizes
-} // setConstraintSizes
 
-// ----------------------------------------------------------------------
-// Set which degrees of freedom are constrained at points in field.
-void
-pylith::bc::BoundaryCondition::setConstraints(
-				    const ALE::Obj<real_section_type>& field,
-				    const ALE::Obj<ALE::Mesh>& mesh)
-{ // setConstraints
-} // setConstraints
-
-// ----------------------------------------------------------------------
-// Set constrained degrees of freedom in field.
-void
-pylith::bc::BoundaryCondition::integrateJacobian(
-				     PetscMat* jacobian,
-				     const ALE::Obj<real_section_type>& field,
-				     const ALE::Obj<ALE::Mesh>& mesh)
-{ // integrateJacobian
-} // integrateJacobian
-
-// ----------------------------------------------------------------------
-// Set constrained degrees of freedom in field.
-void
-pylith::bc::BoundaryCondition::integrateResidual(
-			      const ALE::Obj<real_section_type>& residual,
-			      const ALE::Obj<real_section_type>& fieldT,
-			      const ALE::Obj<real_section_type>& fieldTmdt,
-			      const ALE::Obj<ALE::Mesh>& mesh)
-{ // integrateResidual
-} // integrateResidual
-
-// ----------------------------------------------------------------------
-// Set values in field.
-void
-pylith::bc::BoundaryCondition::setField(const double t,
-					const ALE::Obj<real_section_type>& field,
-					const ALE::Obj<ALE::Mesh>& mesh)
-{ // setField
-} // setField
-
-
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh	2007-05-24 23:16:10 UTC (rev 6957)
+++ short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh	2007-05-25 00:03:09 UTC (rev 6958)
@@ -98,59 +98,6 @@
   void initialize(const ALE::Obj<ALE::Mesh>& mesh,
 		  const spatialdata::geocoords::CoordSys* cs) = 0;
 
-  /** Set number of degrees of freedom that are constrained at points in field.
-   *
-   * @param field Solution field
-   * @param mesh PETSc mesh
-   */
-  virtual
-  void setConstraintSizes(const ALE::Obj<real_section_type>& field,
-			  const ALE::Obj<ALE::Mesh>& mesh);
-
-  /** Set which degrees of freedom are constrained at points in field.
-   *
-   * @param field Solution field
-   * @param mesh PETSc mesh
-   */
-  virtual
-  void setConstraints(const ALE::Obj<real_section_type>& field,
-		      const ALE::Obj<ALE::Mesh>& mesh);
-
-  /** Integrate boundary condition's contribution to the Jacobian.
-   *
-   * @param jacobian Matrix for Jacobian of system
-   * @param field Solution field
-   * @param mesh PETSc mesh
-   */
-  virtual
-  void integrateJacobian(PetscMat* jacobian,
-			 const ALE::Obj<real_section_type>& field,
-			 const ALE::Obj<ALE::Mesh>& mesh);
-
-  /** Integrate boundary condition's contribution to the residual.
-   *
-   * @param residual Residual field
-   * @param fieldT Solution field at time t
-   * @param fieldTmdt Solution field at time t-dt
-   * @param mesh PETSc mesh
-   */
-  virtual
-  void integrateResidual(const ALE::Obj<real_section_type>& residual,
-			 const ALE::Obj<real_section_type>& fieldT,
-			 const ALE::Obj<real_section_type>& fieldTmdt,
-			 const ALE::Obj<ALE::Mesh>& mesh);
-
-  /** Set values in field.
-   *
-   * @param t Current time
-   * @param field Solution field
-   * @param mesh PETSc mesh
-   */
-  virtual
-  void setField(const double t,
-		const ALE::Obj<real_section_type>& field,
-		const ALE::Obj<ALE::Mesh>& mesh);
-
   // NOT IMPLEMENTED ////////////////////////////////////////////////////
 private :
 

Modified: short/3D/PyLith/trunk/libsrc/bc/Dirichlet.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/Dirichlet.hh	2007-05-24 23:16:10 UTC (rev 6957)
+++ short/3D/PyLith/trunk/libsrc/bc/Dirichlet.hh	2007-05-25 00:03:09 UTC (rev 6958)
@@ -20,6 +20,7 @@
 #define pylith_bc_dirichlet_hh
 
 #include "BoundaryCondition.hh" // ISA BoundaryCondition
+#include "pylith/feassemble/Constraint.hh" // ISA Constraint
 
 #include "pylith/utils/array.hh" // USES std::vector, double_array, int_array
 
@@ -33,7 +34,8 @@
 
 
 /// C++ implementation of Dirichlet boundary conditions.
-class pylith::bc::Dirichlet : public BoundaryCondition
+class pylith::bc::Dirichlet : public BoundaryCondition, 
+			      public feassemble::Constraint
 { // class Dirichlet
   friend class TestDirichlet; // unit testing
 
@@ -70,7 +72,6 @@
    * @param field Solution field
    * @param mesh PETSc mesh
    */
-  virtual
   void setConstraintSizes(const ALE::Obj<real_section_type>& field,
 			  const ALE::Obj<ALE::Mesh>& mesh);
 
@@ -79,7 +80,6 @@
    * @param field Solution field
    * @param mesh PETSc mesh
    */
-  virtual
   void setConstraints(const ALE::Obj<real_section_type>& field,
 		      const ALE::Obj<ALE::Mesh>& mesh);
 
@@ -113,7 +113,7 @@
 
 #include "Dirichlet.icc" // inline methods
 
-#endif // pylith_bc_fault_hh
+#endif // pylith_bc_dirichlet_hh
 
 
 // End of file 

Modified: short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src	2007-05-24 23:16:10 UTC (rev 6957)
+++ short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src	2007-05-25 00:03:09 UTC (rev 6958)
@@ -12,6 +12,7 @@
 
 #header{
 #include "pylith/bc/BoundaryCondition.hh"
+#include "pylith/feassemble/Constraint.hh"
 #include "pylith/bc/Dirichlet.hh"
 
 #include "pylith/utils/array.hh"
@@ -100,172 +101,6 @@
     return
 
 
-  def setConstraintSizes(self, field, mesh):
-    """
-    Set number of degrees of freedom that are constrained at points in field.
-    """
-    # create shim for method 'setConstraintSizes'
-    #embed{ void BoundaryCondition_setConstraintSizes(void* objVptr, void* fieldVptr, void* meshVptr)
-    try {
-      assert(0 != objVptr);
-      assert(0 != fieldVptr);
-      assert(0 != meshVptr);
-      ALE::Obj<pylith::real_section_type>* field = (ALE::Obj<pylith::real_section_type>*) fieldVptr;
-      ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
-      ((pylith::bc::BoundaryCondition*) objVptr)->setConstraintSizes(*field, *mesh);
-      } catch (const std::exception& err) {
-      PyErr_SetString(PyExc_RuntimeError,
-                      const_cast<char*>(err.what()));
-    } catch (...) {
-      PyErr_SetString(PyExc_RuntimeError,
-                      "Caught unknown C++ exception.");
-    } // try/catch      
-    #}embed
-
-    if not mesh.name == "pylith_topology_Mesh":
-      raise TypeError, \
-            "Argument must be extension module type " \
-            "'pylith::topology::Mesh'."
-    BoundaryCondition_setConstraintSizes(self.thisptr,
-                                         PyCObject_AsVoidPtr(field),
-                                         ptrFromHandle(mesh))
-    return
-
-
-  def setConstraints(self, field, mesh):
-    """
-    Set which degrees of freedom that are constrained at points in field.
-    """
-    # create shim for method 'setConstraints'
-    #embed{ void BoundaryCondition_setConstraints(void* objVptr, void* fieldVptr, void* meshVptr)
-    try {
-      assert(0 != objVptr);
-      assert(0 != fieldVptr);
-      assert(0 != meshVptr);
-      ALE::Obj<pylith::real_section_type>* field = (ALE::Obj<pylith::real_section_type>*) fieldVptr;
-      ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
-      ((pylith::bc::BoundaryCondition*) objVptr)->setConstraints(*field, *mesh);
-      } catch (const std::exception& err) {
-      PyErr_SetString(PyExc_RuntimeError,
-                      const_cast<char*>(err.what()));
-    } catch (...) {
-      PyErr_SetString(PyExc_RuntimeError,
-                      "Caught unknown C++ exception.");
-    } // try/catch      
-    #}embed
-
-    if not mesh.name == "pylith_topology_Mesh":
-      raise TypeError, \
-            "Argument must be extension module type " \
-            "'pylith::topology::Mesh'."
-    BoundaryCondition_setConstraints(self.thisptr, PyCObject_AsVoidPtr(field), ptrFromHandle(mesh))
-    return
-
-
-  def integrateJacobian(self, jacobian, field, mesh):
-    """
-    Integrate boundary condition's contribution to the Jacobian.
-    """
-    # create shim for method 'integrateJacobian'
-    #embed{ void BoundaryCondition_integrateJacobian(void* objVptr, void* jacobianVptr, void* fieldVptr, void* meshVptr)
-    try {
-      assert(0 != objVptr);
-      assert(0 != jacobianVptr);
-      assert(0 != fieldVptr);
-      assert(0 != meshVptr);
-      PetscMat* jacobian = (PetscMat*) jacobianVptr;
-      ALE::Obj<pylith::real_section_type>* field = (ALE::Obj<pylith::real_section_type>*) fieldVptr;
-      ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
-      ((pylith::bc::BoundaryCondition*) objVptr)->integrateJacobian(jacobian, *field, *mesh);
-      } catch (const std::exception& err) {
-      PyErr_SetString(PyExc_RuntimeError,
-                      const_cast<char*>(err.what()));
-    } catch (...) {
-      PyErr_SetString(PyExc_RuntimeError,
-                      "Caught unknown C++ exception.");
-    } // try/catch      
-    #}embed
-
-    if not mesh.name == "pylith_topology_Mesh":
-      raise TypeError, \
-            "Argument must be extension module type " \
-            "'pylith::topology::Mesh'."
-    BoundaryCondition_integrateJacobian(self.thisptr,
-                                        PyCObject_AsVoidPtr(jacobian),
-                                        PyCObject_AsVoidPtr(field),
-                                        ptrFromHandle(mesh))
-    return
-
-
-  def integrateResidual(self, residual, fieldT, fieldTmdt, mesh):
-    """
-    Integrate boundary condition's contribution to the residual.
-    """
-    # create shim for method 'integrateResidual'
-    #embed{ void BoundaryCondition_integrateResidual(void* objVptr, void* residualVptr, void* fieldTVptr, void* fieldTmdtVptr, void* meshVptr)
-    try {
-      assert(0 != objVptr);
-      assert(0 != residualVptr);
-      assert(0 != fieldTVptr);
-      assert(0 != fieldTmdtVptr);
-      assert(0 != meshVptr);
-      ALE::Obj<pylith::real_section_type>* residual = (ALE::Obj<pylith::real_section_type>*) residualVptr;
-      ALE::Obj<pylith::real_section_type>* fieldT = (ALE::Obj<pylith::real_section_type>*) fieldTVptr;
-      ALE::Obj<pylith::real_section_type>* fieldTmdt = (ALE::Obj<pylith::real_section_type>*) fieldTmdtVptr;
-      ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
-      ((pylith::bc::BoundaryCondition*) objVptr)->integrateResidual(*residual, *fieldT, *fieldTmdt, *mesh);
-      } catch (const std::exception& err) {
-      PyErr_SetString(PyExc_RuntimeError,
-                      const_cast<char*>(err.what()));
-    } catch (...) {
-      PyErr_SetString(PyExc_RuntimeError,
-                      "Caught unknown C++ exception.");
-    } // try/catch      
-    #}embed
-
-    if not mesh.name == "pylith_topology_Mesh":
-      raise TypeError, \
-            "Argument must be extension module type " \
-            "'pylith::topology::Mesh'."
-    BoundaryCondition_integrateResidual(self.thisptr,
-                                        PyCObject_AsVoidPtr(residual),
-                                        PyCObject_AsVoidPtr(fieldT),
-                                        PyCObject_AsVoidPtr(fieldTmdt),
-                                        ptrFromHandle(mesh))
-    return
-
-
-  def setField(self, t, field, mesh):
-    """
-    Set values in field.
-    """
-    # create shim for method 'setField'
-    #embed{ void BoundaryCondition_setField(void* objVptr, double t, void* fieldVptr, void* meshVptr)
-    try {
-      assert(0 != objVptr);
-      assert(0 != fieldVptr);
-      assert(0 != meshVptr);
-      ALE::Obj<pylith::real_section_type>* field = (ALE::Obj<pylith::real_section_type>*) fieldVptr;
-      ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
-      ((pylith::bc::BoundaryCondition*) objVptr)->setField(t, *field, *mesh);
-      } catch (const std::exception& err) {
-      PyErr_SetString(PyExc_RuntimeError,
-                      const_cast<char*>(err.what()));
-    } catch (...) {
-      PyErr_SetString(PyExc_RuntimeError,
-                      "Caught unknown C++ exception.");
-    } // try/catch      
-    #}embed
-
-    if not mesh.name == "pylith_topology_Mesh":
-      raise TypeError, \
-            "Argument must be extension module type " \
-            "'pylith::topology::Mesh'."
-    BoundaryCondition_setField(self.thisptr, t, PyCObject_AsVoidPtr(field),
-                               ptrFromHandle(mesh))
-    return
-
-
   def _createHandle(self):
     """
     Wrap pointer to C++ object in PyCObject.
@@ -423,4 +258,96 @@
       free(fixedDOF)
 
 
+  def setConstraintSizes(self, field, mesh):
+    """
+    Set number of degrees of freedom that are constrained at points in field.
+    """
+    # create shim for method 'setConstraintSizes'
+    #embed{ void Dirichlet_setConstraintSizes(void* objVptr, void* fieldVptr, void* meshVptr)
+    try {
+      assert(0 != objVptr);
+      assert(0 != fieldVptr);
+      assert(0 != meshVptr);
+      ALE::Obj<pylith::real_section_type>* field = (ALE::Obj<pylith::real_section_type>*) fieldVptr;
+      ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
+      ((pylith::bc::Dirichlet*) objVptr)->setConstraintSizes(*field, *mesh);
+      } catch (const std::exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.what()));
+    } catch (...) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      "Caught unknown C++ exception.");
+    } // try/catch      
+    #}embed
+
+    if not mesh.name == "pylith_topology_Mesh":
+      raise TypeError, \
+            "Argument must be extension module type " \
+            "'pylith::topology::Mesh'."
+    Dirichlet_setConstraintSizes(self.thisptr, PyCObject_AsVoidPtr(field),
+                                  ptrFromHandle(mesh))
+    return
+
+
+  def setConstraints(self, field, mesh):
+    """
+    Set which degrees of freedom that are constrained at points in field.
+    """
+    # create shim for method 'setConstraints'
+    #embed{ void Dirichlet_setConstraints(void* objVptr, void* fieldVptr, void* meshVptr)
+    try {
+      assert(0 != objVptr);
+      assert(0 != fieldVptr);
+      assert(0 != meshVptr);
+      ALE::Obj<pylith::real_section_type>* field = (ALE::Obj<pylith::real_section_type>*) fieldVptr;
+      ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
+      ((pylith::bc::Dirichlet*) objVptr)->setConstraints(*field, *mesh);
+      } catch (const std::exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.what()));
+    } catch (...) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      "Caught unknown C++ exception.");
+    } // try/catch      
+    #}embed
+
+    if not mesh.name == "pylith_topology_Mesh":
+      raise TypeError, \
+            "Argument must be extension module type " \
+            "'pylith::topology::Mesh'."
+    Dirichlet_setConstraints(self.thisptr, PyCObject_AsVoidPtr(field), ptrFromHandle(mesh))
+    return
+
+
+  def setField(self, t, field, mesh):
+    """
+    Set values in field.
+    """
+    # create shim for method 'setField'
+    #embed{ void Dirichlet_setField(void* objVptr, double t, void* fieldVptr, void* meshVptr)
+    try {
+      assert(0 != objVptr);
+      assert(0 != fieldVptr);
+      assert(0 != meshVptr);
+      ALE::Obj<pylith::real_section_type>* field = (ALE::Obj<pylith::real_section_type>*) fieldVptr;
+      ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
+      ((pylith::bc::Dirichlet*) objVptr)->setField(t, *field, *mesh);
+      } catch (const std::exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.what()));
+    } catch (...) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      "Caught unknown C++ exception.");
+    } // try/catch      
+    #}embed
+
+    if not mesh.name == "pylith_topology_Mesh":
+      raise TypeError, \
+            "Argument must be extension module type " \
+            "'pylith::topology::Mesh'."
+    Dirichlet_setField(self.thisptr, t, PyCObject_AsVoidPtr(field),
+                          ptrFromHandle(mesh))
+    return
+
+
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/bc/BCIntegrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/BCIntegrator.py	2007-05-24 23:16:10 UTC (rev 6957)
+++ short/3D/PyLith/trunk/pylith/bc/BCIntegrator.py	2007-05-25 00:03:09 UTC (rev 6958)
@@ -16,26 +16,28 @@
 ## that requires integration.
 ##
 ## This implementation of a boundary condition applies to a single
-## face of an domain and associates both a quadrature scheme with a
+## face of a domain and associates both a quadrature scheme with a
 ## physical boundary condition. Thus, applying different quadrature
 ## schemes along a face with the same physical boundary condition
-## requires two "bc", which can use the same database.
+## requires two boundary condition integrators, which can use the same
+## database.
 ##
 ## Factory: boundary_condition
 
 from BoundaryCondition import BoundaryCondition
+from pylith.feassemble.Integrator import Integrator
 
 # BCIntegrator class
-class BCIntegrator(BoundaryCondition):
+class BCIntegrator(BoundaryCondition, Integrator):
   """
   Python abstract base class for managing a boundary condition that
   requires integration.
 
-  This implementation of a boundary condition applies to a single
-  face of an domain and associates both a quadrature scheme with a
-  physical boundary condition. Thus, applying different quadrature
-  schemes along a face with the same physical boundary condition
-  requires two 'bc', which can use the same database.
+  This implementation of a boundary condition applies to a single face
+  of a domain and associates both a quadrature scheme with a physical
+  boundary condition. Thus, applying different quadrature schemes
+  along a face with the same physical boundary condition requires two
+  boundary condition integrators, which can use the same database.
 
   Factory: boundary_condition
   """
@@ -70,9 +72,20 @@
     Constructor.
     """
     BoundaryCondition.__init__(self, name)
+    Integrator.__init__(self)
     return
 
 
+  def initialize(self, mesh):
+    """
+    Initialize boundary condition.
+    """
+    assert(None != self.cppHandle)
+    Integrator.initQuadrature(self, self.quadrature)
+    BoundaryCondition.initialize(self, mesh)
+    return
+  
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py	2007-05-24 23:16:10 UTC (rev 6957)
+++ short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py	2007-05-25 00:03:09 UTC (rev 6958)
@@ -84,45 +84,12 @@
     assert(None != self.cppHandle)
     self.cppHandle.id = self.id
     self.cppHandle.label = self.label
-    self.cppHandle.db = self.db.cppHandle
+    self.cppHandle.db = self.db.cppHandle    
+    self.mesh = mesh
+    self.cppHandle.initialize(mesh.cppHandle, mesh.coordsys.cppHandle)
     return
 
 
-  def setConstraintSizes(self, field, mesh):
-    """
-    Set number of constraints at points in field.
-    """
-    return
-
-
-  def setConstraints(self, field, mesh):
-    """
-    Set which degrees of freedom are constrained at points in field.
-    """
-    return
-
-
-  def integrateJacobian(self, jacobian, field, mesh):
-    """
-    Integrate contribution to Jacobian.
-    """
-    return
-
-
-  def integrateResidual(self, residual, fieldT, fieldTmdt, mesh):
-    """
-    Integrate contribution to residual.
-    """
-    return
-
-
-  def setField(self, t, field, mesh):
-    """
-    Set solution field at time t.
-    """
-    return
-  
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/bc/Dirichlet.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/Dirichlet.py	2007-05-24 23:16:10 UTC (rev 6957)
+++ short/3D/PyLith/trunk/pylith/bc/Dirichlet.py	2007-05-25 00:03:09 UTC (rev 6958)
@@ -18,6 +18,7 @@
 ## Factory: boundary_condition
 
 from BoundaryCondition import BoundaryCondition
+from pylith.feassemble.Constraint import Constraint
 
 def validateDOF(value):
   """
@@ -37,7 +38,7 @@
   
 
 # Dirichlet class
-class Dirichlet(BoundaryCondition):
+class Dirichlet(BoundaryCondition, Constraint):
   """
   Python object for managing a Dirichlet (prescribed displacements)
   boundary condition.
@@ -75,6 +76,7 @@
     Constructor.
     """
     BoundaryCondition.__init__(self, name)
+    Constraint.__init__(self)
     self.fixedDOF = []
     import pylith.bc.bc as bindings
     self.cppHandle = bindings.Dirichlet()
@@ -85,39 +87,12 @@
     """
     Initialize Dirichlet boundary condition.
     """
+    assert(None != self.cppHandle)
+    self.cppHandle.fixedDOF = self.fixedDOF    
     BoundaryCondition.initialize(self, mesh)
-    self.cppHandle.fixedDOF = self.fixedDOF
-    self.cppHandle.initialize(mesh.cppHandle, mesh.coordsys.cppHandle)
     return
   
 
-  def setConstraintSizes(self, field, mesh):
-    """
-    Set number of constraints at points in field.
-    """
-    assert(None != self.cppHandle)
-    self.cppHandle.setConstraintSizes(field, mesh.cppHandle)
-    return
-
-
-  def setConstraints(self, field, mesh):
-    """
-    Set which degrees of freedom are constrained at points in field.
-    """
-    assert(None != self.cppHandle)
-    self.cppHandle.setConstraints(field, mesh.cppHandle)
-    return
-
-
-  def setField(self, t, field, mesh):
-    """
-    Set solution field at time t.
-    """
-    assert(None != self.cppHandle)
-    self.cppHandle.setField(t, field, mesh.cppHandle)
-    return
-  
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichlet.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichlet.py	2007-05-24 23:16:10 UTC (rev 6957)
+++ short/3D/PyLith/trunk/unittests/pytests/bc/TestDirichlet.py	2007-05-25 00:03:09 UTC (rev 6958)
@@ -60,7 +60,7 @@
 
     (mesh, bc) = self._initialize()
     field = mesh.createRealSection("field", mesh.dimension())
-    bc.setConstraintSizes(field, mesh)
+    bc.setConstraintSizes(field)
 
     # We should really add something here to check to make sure things
     # actually initialized correctly    
@@ -77,9 +77,9 @@
 
     (mesh, bc) = self._initialize()
     field = mesh.createRealSection("field", mesh.dimension())
-    bc.setConstraintSizes(field, mesh)
+    bc.setConstraintSizes(field)
     mesh.allocateRealSection(field)
-    bc.setConstraints(field, mesh)
+    bc.setConstraints(field)
 
     # We should really add something here to check to make sure things
     # actually initialized correctly    
@@ -96,11 +96,11 @@
 
     (mesh, bc) = self._initialize()
     field = mesh.createRealSection("field", mesh.dimension())
-    bc.setConstraintSizes(field, mesh)
+    bc.setConstraintSizes(field)
     mesh.allocateRealSection(field)
-    bc.setConstraints(field, mesh)
+    bc.setConstraints(field)
     t = 1.0
-    bc.setField(t, field, mesh)
+    bc.setField(t, field)
 
     # We should really add something here to check to make sure things
     # actually initialized correctly    



More information about the cig-commits mailing list