diff --git a/python/dune/perftool/options.py b/python/dune/perftool/options.py index dfc1e837b9172e579ce59842ffc847bd8e5d9610..60f66248d2dee8d521f04cfa55acd3337f70454a 100644 --- a/python/dune/perftool/options.py +++ b/python/dune/perftool/options.py @@ -35,6 +35,7 @@ def get_form_compiler_arguments(): parser.add_argument("--interactive", action="store_true", help="whether the optimization process should be guided interactively (also useful for debugging)") parser.add_argument("--print-transformations", action="store_true", help="print out dot files after ufl tree transformations") parser.add_argument("--print-transformations-dir", type=str, help="place where to put dot files (can be omitted)") + parser.add_argument("--quadrature-order", type=int, help="Quadrature order used for all integrals.") parser.add_argument("--diagonal-transformation-matrix", action="store_true", help="set option if the jacoby of the transformation is diagonal (axiparallel grids)") parser.add_argument("--ini-file", type=str, help="An inifile to use. A generated driver will be hard-coded to it, a [formcompiler] section will be used as default values to form compiler arguments (use snake case)") parser.add_argument("--timer", action="store_true", help="measure times") diff --git a/python/dune/perftool/pdelab/quadrature.py b/python/dune/perftool/pdelab/quadrature.py index b87c79dcb5874710fd600a3d5f36f9f4f3dce2e3..64f015ed9d1a86f44d942a6de18161fa5bc0e91c 100644 --- a/python/dune/perftool/pdelab/quadrature.py +++ b/python/dune/perftool/pdelab/quadrature.py @@ -9,6 +9,7 @@ from dune.perftool.generation import (cached, instruction, temporary_variable, ) +from dune.perftool.options import get_option @iname @@ -88,16 +89,16 @@ def estimate_quadrature_order(): def name_order(): - # TODO: It should be possible to set the quadrature order as a - # user. A global option in the ini file is not really what we want - # since it would not be possible to take different quadrature - # order for different integral types. Maybe the following would - # work: - # - # - One quadrature order that can be used everywhere - # - [formcompiler.quadrature]: Give orders for specific integral - # types. + # Quadrature order from UFL estimation quadrature_order = estimate_quadrature_order() + + # If set use quadrature_order from formcompiler arguments + # + # TODO: make it possible to choose different quadrature order for + # different integral types? + if get_option("quadrature_order"): + quadrature_order = get_option("quadrature_order") + return str(quadrature_order)