ffc command line argument -fquadrature_degree appears broken
Issue #121
resolved
Since ffc-2016.1.0 using ffc with the command line option -fquadrature_degree returns an error:
Traceback (most recent call last):
File "/usr/local/fenics/fenics-project-master/petsc-3.7.3/debug/bin/ffc", line 33, in <module>
sys.exit(main(sys.argv[1:]))
File "/usr/local/fenics/fenics-project-master/petsc-3.7.3/debug/lib/python2.7/site-packages/ffc/main.py", line 205, in main
parameters=parameters)
File "/usr/local/fenics/fenics-project-master/petsc-3.7.3/debug/lib/python2.7/site-packages/ffc/compiler.py", line 155, in compile_form
analysis = analyze_forms(forms, parameters)
File "/usr/local/fenics/fenics-project-master/petsc-3.7.3/debug/lib/python2.7/site-packages/ffc/analysis.py", line 61, in analyze_forms
parameters) for form in forms)
File "/usr/local/fenics/fenics-project-master/petsc-3.7.3/debug/lib/python2.7/site-packages/ffc/analysis.py", line 61, in <genexpr>
parameters) for form in forms)
File "/usr/local/fenics/fenics-project-master/petsc-3.7.3/debug/lib/python2.7/site-packages/ffc/analysis.py", line 149, in _analyze_form
_attach_integral_metadata(form_data, parameters)
File "/usr/local/fenics/fenics-project-master/petsc-3.7.3/debug/lib/python2.7/site-packages/ffc/analysis.py", line 316, in _attach_integral_metadata
qd = _autoselect_quadrature_degree(integral_metadatas[i], integral, form_data)
File "/usr/local/fenics/fenics-project-master/petsc-3.7.3/debug/lib/python2.7/site-packages/ffc/analysis.py", line 188, in _autoselect_quadrature_degree
error("Invalid quadrature_degree {}." % (qd,))
TypeError: not all arguments converted during string formatting
because the quadrature_degree is a string.
I've fixed this locally using:
diff --git a/ffc/analysis.py b/ffc/analysis.py
index 0244dd7..354e6c7 100644
--- a/ffc/analysis.py
+++ b/ffc/analysis.py
@@ -179,6 +179,12 @@ def _autoselect_quadrature_degree(integral_metadata, integral, form_data):
if qd == "auto":
qd = pd
info("quadrature_degree: auto --> %d" % qd)
+
+ try:
+ qd = int(qd)
+ except:
+ pass
+
if isinstance(qd, int):
if qd >= 0:
info("quadrature_degree: %d" % qd)
Is there a workaround I'm missing that doesn't require code modifications?
Comments (6)
-
-
- changed status to resolved
Fix pushed.
-
reporter - changed status to open
Thanks!
Small issue with your fix... you're always using the default value, not converting the value from the command line. Need this patch:
diff --git a/ffc/main.py b/ffc/main.py index 14ae138..8999b75 100644 --- a/ffc/main.py +++ b/ffc/main.py @@ -146,9 +146,9 @@ def main(argv): return 1 default = parameters[key] if isinstance(default, int): - value = int(default) + value = int(value) elif isinstance(default, float): - value = float(default) + value = float(value) parameters[key] = value elif len(arg.split("==")) == 1: key = arg.split("=")[0]
-
Thanks, I realised this late on Friday but didn't have the opportunity to fix then. Fix on the way...
-
- changed status to resolved
-
reporter Thanks!
- Log in to comment
I'll push a fix at the right place. Keep your local fix until you upgrade.