[cig-commits] r6176 - in short/3D/PyLith/trunk: libsrc/feassemble modulesrc/feassemble pylith/feassemble pylith/feassemble/quadrature pylith/materials unittests/pytests/feassemble

brad at geodynamics.org brad at geodynamics.org
Mon Mar 5 10:53:24 PST 2007


Author: brad
Date: 2007-03-05 10:53:23 -0800 (Mon, 05 Mar 2007)
New Revision: 6176

Modified:
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc
   short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
   short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
   short/3D/PyLith/trunk/pylith/feassemble/quadrature/Quadrature.py
   short/3D/PyLith/trunk/pylith/materials/Homogeneous.py
   short/3D/PyLith/trunk/pylith/materials/Material.py
   short/3D/PyLith/trunk/unittests/pytests/feassemble/Makefile.am
   short/3D/PyLith/trunk/unittests/pytests/feassemble/TestQuadrature.py
   short/3D/PyLith/trunk/unittests/pytests/feassemble/testfeassemble.py
Log:
Fixed some small bugs related to moving Python Quadrature objects to feassemble/quadrature. Created unit test in TestExplicitElasticity to isolate Integrator.initQuadrature bug.

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc	2007-03-05 06:44:06 UTC (rev 6175)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc	2007-03-05 18:53:23 UTC (rev 6176)
@@ -27,7 +27,6 @@
   _cellVector(0),
   _cellMatrix(0)
 { // constructor
-  std::cout << "In constructor, _quadrature: " << _quadrature << std::endl;
 } // constructor
 
 // ----------------------------------------------------------------------
@@ -57,8 +56,7 @@
 void
 pylith::feassemble::Integrator::quadrature(const Quadrature* q)
 { // quadrature
-  std::cout << "In quadrature(), _quadrature: " << _quadrature << std::endl;
-  //delete _quadrature;
+  delete _quadrature;
   _quadrature = (0 != q) ? q->clone() : 0;
 
   // Deallocate cell vector and matrix since size may change

Modified: short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src	2007-03-05 06:44:06 UTC (rev 6175)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src	2007-03-05 18:53:23 UTC (rev 6176)
@@ -298,7 +298,6 @@
     void* result = 0;
     try {
       result = (void*)(new pylith::feassemble::Quadrature2D);
-      std::cout << "Quadrature2D ptr: " << result << std::endl;
     } catch (const std::exception& err) {
       PyErr_SetString(PyExc_RuntimeError,
                       const_cast<char*>(err.what()));
@@ -439,9 +438,6 @@
       try {
         assert(0 != pObj);
         assert(0 != qObj);
-        // :BUG: Cannot cast void* to Quadrature* because we lose what
-        // type of Quadrature qObj is. 
-        std::cout << "qObj ptr: " << qObj << std::endl;
         pylith::feassemble::Quadrature* quadrature =
           (pylith::feassemble::Quadrature*) qObj;
         ((pylith::feassemble::Integrator*) pObj)->quadrature(quadrature);

Modified: short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Integrator.py	2007-03-05 06:44:06 UTC (rev 6175)
+++ short/3D/PyLith/trunk/pylith/feassemble/Integrator.py	2007-03-05 18:53:23 UTC (rev 6176)
@@ -44,6 +44,9 @@
     """
     Initialize quadrature.
     """
+    if self.cppHandle is None:
+      raise ValueError("C++ handle not set.")
+    
     self._info.log("Initialize quadrature")
     quadrature.initialize()
     self.quadrature = quadrature

Modified: short/3D/PyLith/trunk/pylith/feassemble/quadrature/Quadrature.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/quadrature/Quadrature.py	2007-03-05 06:44:06 UTC (rev 6175)
+++ short/3D/PyLith/trunk/pylith/feassemble/quadrature/Quadrature.py	2007-03-05 18:53:23 UTC (rev 6176)
@@ -71,6 +71,9 @@
     """
     Initialize C++ quadrature object.
     """
+    if self.cppHandle is None:
+      raise ValueError("C++ handle not set.")
+    
     self.cppHandle.minJacobian = self.minJacobian
 
     self._info.log("Initializing reference cell.")

Modified: short/3D/PyLith/trunk/pylith/materials/Homogeneous.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Homogeneous.py	2007-03-05 06:44:06 UTC (rev 6175)
+++ short/3D/PyLith/trunk/pylith/materials/Homogeneous.py	2007-03-05 18:53:23 UTC (rev 6176)
@@ -44,7 +44,7 @@
 
     import pyre.inventory
 
-    from ElasticIsotropic import ElasticIsotropic3D
+    from ElasticIsotropic3D import ElasticIsotropic3D
     material = pyre.inventory.facility("material", family="material",
                                        factory=ElasticIsotropic3D)
     material.meta['tip'] = "Material in problem."

Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py	2007-03-05 06:44:06 UTC (rev 6175)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py	2007-03-05 18:53:23 UTC (rev 6176)
@@ -63,7 +63,7 @@
                                  args=["db"])
     db.meta['tip'] = "Database of material property parameters."
     
-    from pylith.feassemble.Quadrature import Quadrature
+    from pylith.feassemble.quadrature.Quadrature import Quadrature
     quadrature = pyre.inventory.facility("quadrature", factory=Quadrature)
     quadrature.meta['tip'] = "Quadrature object for numerical integration."
 

Modified: short/3D/PyLith/trunk/unittests/pytests/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/feassemble/Makefile.am	2007-03-05 06:44:06 UTC (rev 6175)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/Makefile.am	2007-03-05 18:53:23 UTC (rev 6176)
@@ -18,8 +18,9 @@
 check_SCRIPTS = testfeassemble.py
 
 noinst_PYTHON = \
+	TestFIATSimplex.py \
 	TestQuadrature.py \
-	TestFIATSimplex.py
+	TestIntegrator.py
 
 
 # module

Modified: short/3D/PyLith/trunk/unittests/pytests/feassemble/TestQuadrature.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/feassemble/TestQuadrature.py	2007-03-05 06:44:06 UTC (rev 6175)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/TestQuadrature.py	2007-03-05 18:53:23 UTC (rev 6176)
@@ -16,8 +16,15 @@
 
 import unittest
 import numpy
-from pylith.feassemble.Quadrature import *
 
+from pylith.feassemble.quadrature.Quadrature1D import Quadrature1D
+from pylith.feassemble.quadrature.Quadrature1Din2D import Quadrature1Din2D
+from pylith.feassemble.quadrature.Quadrature1Din3D import Quadrature1Din3D
+from pylith.feassemble.quadrature.Quadrature2D import Quadrature2D
+from pylith.feassemble.quadrature.Quadrature2Din3D import Quadrature2Din3D
+from pylith.feassemble.quadrature.Quadrature3D import Quadrature3D
+
+
 # ----------------------------------------------------------------------
 def N0(p):
   return -0.5*p*(1.0-p)

Modified: short/3D/PyLith/trunk/unittests/pytests/feassemble/testfeassemble.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/feassemble/testfeassemble.py	2007-03-05 06:44:06 UTC (rev 6175)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/testfeassemble.py	2007-03-05 18:53:23 UTC (rev 6176)
@@ -56,6 +56,12 @@
     from TestQuadrature import TestQuadrature
     suite.addTest(unittest.makeSuite(TestQuadrature))
 
+    from TestIntegrator import TestIntegrator
+    suite.addTest(unittest.makeSuite(TestIntegrator))
+
+    from TestExplicitElasticity import TestExplicitElasticity
+    suite.addTest(unittest.makeSuite(TestExplicitElasticity))
+
     return suite
 
 



More information about the cig-commits mailing list