← Back to team overview

ffc team mailing list archive

[noreply@xxxxxxxxxxxxx: [Branch ~ffc-core/ffc/main] Rev 1738: Issue warning when more than 100 integration points are used to integrate a form.]

 

Great!

--
Anders
--- Begin Message ---
------------------------------------------------------------
revno: 1738
committer: Kristian B. Ølgaard <k.b.oelgaard@xxxxxxxxx>
branch nick: ffc
timestamp: Wed 2011-11-30 23:39:03 +0100
message:
  Issue warning when more than 100 integration points are used to integrate a form.
modified:
  ffc/analysis.py


--
lp:ffc
https://code.launchpad.net/~ffc-core/ffc/main

Your team FFC Core Team is subscribed to branch lp:ffc.
To unsubscribe from this branch go to https://code.launchpad.net/~ffc-core/ffc/main/+edit-subscription
=== modified file 'ffc/analysis.py'
--- ffc/analysis.py	2011-10-19 11:49:16 +0000
+++ ffc/analysis.py	2011-11-30 22:39:03 +0000
@@ -40,7 +40,8 @@
 from ufl.algorithms import extract_common_cell
 
 # FFC modules
-from ffc.log import log, info, begin, end, warning, debug, error, ffc_assert
+from ffc.log import log, info, begin, end, warning, debug, error, ffc_assert, warning_blue
+#from ufl.log import warning_blue
 from ffc.utils import all_equal
 from ffc.quadratureelement import default_quadrature_degree
 from ffc.utils import all_equal
@@ -213,8 +214,10 @@
                                                     form_data.unique_sub_elements)
                 info("quadrature_degree: auto --> %d" % qd)
                 integral_metadata["quadrature_degree"] = qd
+                _check_quadrature_degree(qd, form_data.topological_dimension)
             else:
                 info("quadrature_degree: %d" % qd)
+                _check_quadrature_degree(qd, form_data.topological_dimension)
 
             # Automatic selection of quadrature rule
             if qr == "auto":
@@ -402,3 +405,12 @@
     debug("Selecting quadrature degree based on total polynomial degree of integrand: " + str(q))
 
     return q
+
+def _check_quadrature_degree(degree, top_dim):
+    """Check that quadrature degree does not result in a unreasonable high
+    number of integration points."""
+    num_points = ((degree + 1 + 1) / 2)**top_dim
+    if num_points >= 100:
+        warning_blue("WARNING: The number of integration points for each cell will be: %d" % num_points)
+        warning_blue("         Consider using the option 'quadrature_degree' to reduce the number of points")
+


--- End Message ---