[cig-commits] r19022 - short/3D/PyLith/branches/v1.6-stable/pylith/feassemble

brad at geodynamics.org brad at geodynamics.org
Wed Oct 5 19:11:32 PDT 2011


Author: brad
Date: 2011-10-05 19:11:32 -0700 (Wed, 05 Oct 2011)
New Revision: 19022

Added:
   short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATQuadrature.py
Modified:
   short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATLagrange.py
   short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATSimplex.py
   short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/__init__.py
Log:
Added collocated quadrature rule.

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATLagrange.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATLagrange.py	2011-10-05 23:20:27 UTC (rev 19021)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATLagrange.py	2011-10-06 02:11:32 UTC (rev 19022)
@@ -36,22 +36,6 @@
   return dim
 
 
-from FIAT.quadrature import QuadratureRule
-class CollocatedQuadratureLineRule(QuadratureRule):
-  """
-  Quadrature points colocated with vertices.
-  """
-  def __init__(self, ref_el, m):
-    from FIAT.lagrange import Lagrange
-    vertices = Lagrange(ref_el, m).dual.get_nodes()
-    pts = [v.get_point_dict().keys()[0] for v in vertices]
-    npts = len(pts)
-    wts = (ref_el.volume()/npts,)*npts
-    
-    QuadratureRule.__init__(self, ref_el, pts, wts)
-    return
-
-
 # FIATLagrange class
 class FIATLagrange(ReferenceCell):
   """
@@ -482,13 +466,14 @@
     """
     Setup quadrature rule for reference cell.
     """
-    from FIAT.quadrature import make_quadrature
     from FIAT.reference_element import default_simplex
-
+    from FIAT.quadrature import make_quadrature
+    from FIATQuadrature import CollocatedQuadratureRule
+      
     if not self.collocateQuad:
       q = make_quadrature(default_simplex(1), self.order)
     else:
-      q = CollocatedQuadratureLineRule(default_simplex(1), self.order)
+      q = CollocatedQuadratureRule(default_simplex(1), self.order)
 
     return q
 

Added: short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATQuadrature.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATQuadrature.py	                        (rev 0)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATQuadrature.py	2011-10-06 02:11:32 UTC (rev 19022)
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard, U.S. Geological Survey
+# Charles A. Williams, GNS Science
+# Matthew G. Knepley, University of Chicago
+#
+# This code was developed as part of the Computational Infrastructure
+# for Geodynamics (http://geodynamics.org).
+#
+# Copyright (c) 2010-2011 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/feassemble/FIATQuadrature.py
+##
+## @brief Python object for special FIAT quadrature schemes.
+
+from FIAT.quadrature import QuadratureRule
+class CollocatedQuadratureRule(QuadratureRule):
+  """
+  Quadrature points colocated with vertices.
+  """
+  def __init__(self, ref_el, m):
+    from FIAT.lagrange import Lagrange
+    vertices = Lagrange(ref_el, m).dual.get_nodes()
+    pts = [v.get_point_dict().keys()[0] for v in vertices]
+    npts = len(pts)
+    wts = (ref_el.volume()/npts,)*npts
+    
+    QuadratureRule.__init__(self, ref_el, pts, wts)
+    return
+
+
+# End of file 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATSimplex.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATSimplex.py	2011-10-05 23:20:27 UTC (rev 19021)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATSimplex.py	2011-10-06 02:11:32 UTC (rev 19022)
@@ -39,6 +39,7 @@
                      name)
   return name
 
+
 # FIATSimplex class
 class FIATSimplex(ReferenceCell):
   """
@@ -76,6 +77,9 @@
     order = pyre.inventory.int("quad_order", default=-1)
     order.meta['tip'] = "Order of quadrature rule [-1, order = degree]."
     
+    collocateQuad = pyre.inventory.bool("collocate_quad", default=False)
+    collocateQuad.meta['tip'] = "Collocate quadrature points with vertices."
+    
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
@@ -163,6 +167,7 @@
       self.shape = self.inventory.shape
       self.degree = self.inventory.degree
       self.order = self.inventory.order
+      self.collocateQuad = self.inventory.collocateQuad
       if self.order == -1:
         self.order = self.degree
     except ValueError, err:
@@ -254,11 +259,18 @@
     """
     Setup quadrature rule for reference cell.
     """
-    
-    import FIAT.quadrature
-    return FIAT.quadrature.make_quadrature(self._getShape(), self.order)
+    from FIAT.reference_element import default_simplex
+    from FIAT.quadrature import make_quadrature
+    from FIATQuadrature import CollocatedQuadratureRule
+      
+    if not self.collocateQuad:
+      q = make_quadrature(self._getShape(), self.order)
+    else:
+      q = CollocatedQuadratureRule(self._getShape(), self.order)
 
+    return q
 
+
   def _setupBasisFns(self):
     """
     Setup basis functions for reference cell.

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/__init__.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/__init__.py	2011-10-05 23:20:27 UTC (rev 19021)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/__init__.py	2011-10-06 02:11:32 UTC (rev 19022)
@@ -26,6 +26,7 @@
            'ElasticityExplicitLgDeform',
            'ElasticityImplicit',
            'ElasticityImplicitLgDeform',
+           'FIATQuadrature',
            'FIATLagrange',
            'FIATSimplex',
            'IntegratorElasticity',



More information about the CIG-COMMITS mailing list