Skip to content
Snippets Groups Projects
Commit be233e54 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Put the code for numerical jacobian into a separate function

parent da6a28f1
No related branches found
No related tags found
No related merge requests found
......@@ -25,17 +25,21 @@ def measure_specific_details(measure):
# The return dictionary that this memoized method will grant direct access to.
ret = {}
if measure == "cell":
base_class('Dune::PDELab::FullVolumePattern')
def numerical_jacobian(which):
if get_option("numerical_jacobian"):
# Add a base class
from dune.perftool.pdelab.driver import type_localoperator
loptype = type_localoperator()
base_class("Dune::PDELab::NumericalJacobianVolume<{}>".format(loptype))
base_class("Dune::PDELab::NumericalJacobian{}<{}>".format(which, loptype))
# Add the initializer list for that base class
ini = name_initree_constructor()
initializer_list("Dune::PDELab::NumericalJacobianVolume<{}>({}.get(\"numerical_epsilon.volume\", 1e-9))".format(loptype, ini))
initializer_list("Dune::PDELab::NumericalJacobian{}<{}>({}.get(\"numerical_epsilon.{}\", 1e-9))".format(which, loptype, ini, which.lower()))
if measure == "cell":
base_class('Dune::PDELab::FullVolumePattern')
numerical_jacobian("Volume")
ret["residual_signature"] = ['template<typename EG, typename LFSV0, typename X, typename LFSV1, typename R>',
'void alpha_volume(const EG& eg, const LFSV0& lfsv0, const X& x, const LFSV1& lfsv1, R& r) const']
......@@ -44,6 +48,7 @@ def measure_specific_details(measure):
if measure == "exterior_facet":
base_class('Dune::PDELab::FullBoundaryPattern')
numerical_jacobian("Boundary")
ret["residual_signature"] = ['template<typename IG, typename LFSV0, typename X, typename LFSV1, typename R>',
'void alpha_boundary(const IG& ig, const LFSV0& lfsv0, const X& x, const LFSV1& lfsv1, R& r) const']
......@@ -52,6 +57,7 @@ def measure_specific_details(measure):
if measure == "interior_facet":
base_class('Dune::PDELab::FullSkeletonPattern')
numerical_jacobian("Skeleton")
ret["residual_signature"] = ['template<typename IG, typename LFSV0_S, typename X, typename LFSV1_S, typename LFSV0_N, typename R, typename LFSV1_N>',
'void alpha_skeleton(const IG& ig, const LFSV0_S& lfsv0_s, const X& x_s, const LFSV1_S& lfsv1_s, const LFSV0_N& lfsv0_n, const X& x_n, const LFSV1_N& lfsv1_n, R& r_s, R& r_n) const']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment