[cig-commits] r6863 - in short/3D/PyLith/trunk: pylith/feassemble pylith/utils unittests/pytests/feassemble

knepley at geodynamics.org knepley at geodynamics.org
Fri May 11 21:18:27 PDT 2007


Author: knepley
Date: 2007-05-11 21:18:27 -0700 (Fri, 11 May 2007)
New Revision: 6863

Modified:
   short/3D/PyLith/trunk/pylith/feassemble/FIATSimplex.py
   short/3D/PyLith/trunk/pylith/utils/testarray.py
   short/3D/PyLith/trunk/unittests/pytests/feassemble/TestFIATSimplex.py
   short/3D/PyLith/trunk/unittests/pytests/feassemble/TestQuadrature.py
Log:
More work on testing FE


Modified: short/3D/PyLith/trunk/pylith/feassemble/FIATSimplex.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/FIATSimplex.py	2007-05-12 01:37:42 UTC (rev 6862)
+++ short/3D/PyLith/trunk/pylith/feassemble/FIATSimplex.py	2007-05-12 04:18:27 UTC (rev 6863)
@@ -111,6 +111,13 @@
     return Lagrange(self._getShape(), self.degree).function_space()
 
 
+  def _setupVertices(self):
+    """
+    Setup evaluation functional points for reference cell.
+    """
+    from FIAT.Lagrange import Lagrange
+    return Lagrange(self._getShape(), self.degree).Udual.pts
+
   def _getShape(self):
     """
     Parse string into FIAT shape.

Modified: short/3D/PyLith/trunk/pylith/utils/testarray.py
===================================================================
--- short/3D/PyLith/trunk/pylith/utils/testarray.py	2007-05-12 01:37:42 UTC (rev 6862)
+++ short/3D/PyLith/trunk/pylith/utils/testarray.py	2007-05-12 04:18:27 UTC (rev 6863)
@@ -29,7 +29,10 @@
     # Check values
     for (vE, v) in zip(numpy.reshape(valuesE, -1),
                        numpy.reshape(values, -1)):
-        obj.assertAlmostEqual(1.0, v/vE, 6)
+        if vE == 0.0:
+            obj.assertAlmostEqual(v, vE, 6)
+        else:
+            obj.assertAlmostEqual(1.0, v/vE, 6)
 
     return
 

Modified: short/3D/PyLith/trunk/unittests/pytests/feassemble/TestFIATSimplex.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/feassemble/TestFIATSimplex.py	2007-05-12 01:37:42 UTC (rev 6862)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/TestFIATSimplex.py	2007-05-12 04:18:27 UTC (rev 6863)
@@ -23,22 +23,22 @@
   return -0.5*p*(1.0-p)
 
 def N0p(p):
-  return -0.5*(1.0-p) + 0.5*p
+  return 1.0*p - 0.5
 
 def N1(p):
   return 0.5*p*(1.0+p)
 
 def N1p(p):
-  return +0.5*(1.0+p) + 0.5*p
+  return 1.0*p + 0.5
 
 def N2(p):
-  return (1.0-p**2)
+  return (1.0-p*p)
 
 def N2p(p):
   return -2.0*p
 
-def verticesRef():
-  return [-1.0, 1.0, 0.5]
+def nodesRef():
+  return [-1.0, 1.0, 0.0]
 
 
 # ----------------------------------------------------------------------
@@ -77,9 +77,9 @@
     """
     from pylith.feassemble.FIATSimplex import FIATSimplex
     cell = FIATSimplex()
-    cell.shape = "line"
+    cell.shape  = "line"
     cell.degree = 2
-    cell.order = 2
+    cell.order  = 2
     quadPtsE = numpy.array( [(-1.0/3**0.5,),
                              (+1.0/3**0.5,)],
                             dtype=numpy.float64 )

Modified: short/3D/PyLith/trunk/unittests/pytests/feassemble/TestQuadrature.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/feassemble/TestQuadrature.py	2007-05-12 01:37:42 UTC (rev 6862)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/TestQuadrature.py	2007-05-12 04:18:27 UTC (rev 6863)
@@ -90,6 +90,7 @@
     quadrature = Quadrature1D()
     quadrature.cell = cell
 
+    print cell.basisVert
     quadrature.initialize()
 
     from pylith.utils.testarray import test_double



More information about the cig-commits mailing list