]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move implementation of functions into the .cc file. 11932/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 17 Mar 2021 08:59:22 +0000 (09:59 +0100)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 17 Mar 2021 09:37:57 +0000 (10:37 +0100)
include/deal.II/sundials/kinsol.h
source/sundials/kinsol.cc

index c801f28fecf5be132cfb3474df9dbcafa1172921..82ba7f519c08aac9bbe5afbf5f292ad40c912c09 100644 (file)
@@ -253,7 +253,7 @@ namespace SUNDIALS
        * @param dq_relative_error Relative error for different quotient
        * computation
        *
-       * Linesearch parameters:
+       * Line search parameters:
        *
        * @param maximum_beta_failures Maximum number of beta-condition failures
        *
@@ -261,29 +261,16 @@ namespace SUNDIALS
        *
        * @param anderson_subspace_size Anderson acceleration subspace size
        */
-      AdditionalData(
-        // Global parameters
-        const SolutionStrategy &strategy                      = linesearch,
-        const unsigned int      maximum_non_linear_iterations = 200,
-        const double            function_tolerance            = 0.0,
-        const double            step_tolerance                = 0.0,
-        const bool              no_init_setup                 = false,
-        const unsigned int      maximum_setup_calls           = 0,
-        const double            maximum_newton_step           = 0.0,
-        const double            dq_relative_error             = 0.0,
-        const unsigned int      maximum_beta_failures         = 0,
-        const unsigned int      anderson_subspace_size        = 0)
-        : strategy(strategy)
-        , maximum_non_linear_iterations(maximum_non_linear_iterations)
-        , function_tolerance(function_tolerance)
-        , step_tolerance(step_tolerance)
-        , no_init_setup(no_init_setup)
-        , maximum_setup_calls(maximum_setup_calls)
-        , maximum_newton_step(maximum_newton_step)
-        , dq_relative_error(dq_relative_error)
-        , maximum_beta_failures(maximum_beta_failures)
-        , anderson_subspace_size(anderson_subspace_size)
-      {}
+      AdditionalData(const SolutionStrategy &strategy = linesearch,
+                     const unsigned int maximum_non_linear_iterations = 200,
+                     const double       function_tolerance            = 0.0,
+                     const double       step_tolerance                = 0.0,
+                     const bool         no_init_setup                 = false,
+                     const unsigned int maximum_setup_calls           = 0,
+                     const double       maximum_newton_step           = 0.0,
+                     const double       dq_relative_error             = 0.0,
+                     const unsigned int maximum_beta_failures         = 0,
+                     const unsigned int anderson_subspace_size        = 0);
 
       /**
        * Add all AdditionalData() parameters to the given ParameterHandler
@@ -324,53 +311,7 @@ namespace SUNDIALS
        * using `prm`.
        */
       void
-      add_parameters(ParameterHandler &prm)
-      {
-        static std::string strategy_str("newton");
-        prm.add_parameter("Solution strategy",
-                          strategy_str,
-                          "Choose among newton|linesearch|fixed_point|picard",
-                          Patterns::Selection(
-                            "newton|linesearch|fixed_point|picard"));
-        prm.add_action("Solution strategy", [&](const std::string &value) {
-          if (value == "newton")
-            strategy = newton;
-          else if (value == "linesearch")
-            strategy = linesearch;
-          else if (value == "fixed_point")
-            strategy = fixed_point;
-          else if (value == "picard")
-            strategy = picard;
-          else
-            Assert(false, ExcInternalError());
-        });
-        prm.add_parameter("Maximum number of nonlinear iterations",
-                          maximum_non_linear_iterations);
-        prm.add_parameter("Function norm stopping tolerance",
-                          function_tolerance);
-        prm.add_parameter("Scaled step stopping tolerance", step_tolerance);
-
-        prm.enter_subsection("Newton parameters");
-        prm.add_parameter("No initial matrix setup", no_init_setup);
-        prm.add_parameter("Maximum iterations without matrix setup",
-                          maximum_setup_calls);
-        prm.add_parameter("Maximum allowable scaled length of the Newton step",
-                          maximum_newton_step);
-        prm.add_parameter("Relative error for different quotient computation",
-                          dq_relative_error);
-        prm.leave_subsection();
-
-        prm.enter_subsection("Linesearch parameters");
-        prm.add_parameter("Maximum number of beta-condition failures",
-                          maximum_beta_failures);
-        prm.leave_subsection();
-
-
-        prm.enter_subsection("Fixed point and Picard parameters");
-        prm.add_parameter("Anderson acceleration subspace size",
-                          anderson_subspace_size);
-        prm.leave_subsection();
-      }
+      add_parameters(ParameterHandler &prm);
 
       /**
        * The solution strategy to use. If you choose SolutionStrategy::newton
index 695532c3530ed2d23a6e4dbf966cfe13bfa7e980..9e7d553242f15abcb0e76f743bfcbb0d375c54c7 100644 (file)
@@ -52,6 +52,83 @@ namespace SUNDIALS
 {
   using namespace internal;
 
+
+  template <typename VectorType>
+  KINSOL<VectorType>::AdditionalData::AdditionalData(
+    const SolutionStrategy &strategy,
+    const unsigned int      maximum_non_linear_iterations,
+    const double            function_tolerance,
+    const double            step_tolerance,
+    const bool              no_init_setup,
+    const unsigned int      maximum_setup_calls,
+    const double            maximum_newton_step,
+    const double            dq_relative_error,
+    const unsigned int      maximum_beta_failures,
+    const unsigned int      anderson_subspace_size)
+    : strategy(strategy)
+    , maximum_non_linear_iterations(maximum_non_linear_iterations)
+    , function_tolerance(function_tolerance)
+    , step_tolerance(step_tolerance)
+    , no_init_setup(no_init_setup)
+    , maximum_setup_calls(maximum_setup_calls)
+    , maximum_newton_step(maximum_newton_step)
+    , dq_relative_error(dq_relative_error)
+    , maximum_beta_failures(maximum_beta_failures)
+    , anderson_subspace_size(anderson_subspace_size)
+  {}
+
+
+
+  template <typename VectorType>
+  void
+  KINSOL<VectorType>::AdditionalData::add_parameters(ParameterHandler &prm)
+  {
+    static std::string strategy_str("newton");
+    prm.add_parameter("Solution strategy",
+                      strategy_str,
+                      "Choose among newton|linesearch|fixed_point|picard",
+                      Patterns::Selection(
+                        "newton|linesearch|fixed_point|picard"));
+    prm.add_action("Solution strategy", [&](const std::string &value) {
+      if (value == "newton")
+        strategy = newton;
+      else if (value == "linesearch")
+        strategy = linesearch;
+      else if (value == "fixed_point")
+        strategy = fixed_point;
+      else if (value == "picard")
+        strategy = picard;
+      else
+        Assert(false, ExcInternalError());
+    });
+    prm.add_parameter("Maximum number of nonlinear iterations",
+                      maximum_non_linear_iterations);
+    prm.add_parameter("Function norm stopping tolerance", function_tolerance);
+    prm.add_parameter("Scaled step stopping tolerance", step_tolerance);
+
+    prm.enter_subsection("Newton parameters");
+    prm.add_parameter("No initial matrix setup", no_init_setup);
+    prm.add_parameter("Maximum iterations without matrix setup",
+                      maximum_setup_calls);
+    prm.add_parameter("Maximum allowable scaled length of the Newton step",
+                      maximum_newton_step);
+    prm.add_parameter("Relative error for different quotient computation",
+                      dq_relative_error);
+    prm.leave_subsection();
+
+    prm.enter_subsection("Linesearch parameters");
+    prm.add_parameter("Maximum number of beta-condition failures",
+                      maximum_beta_failures);
+    prm.leave_subsection();
+
+
+    prm.enter_subsection("Fixed point and Picard parameters");
+    prm.add_parameter("Anderson acceleration subspace size",
+                      anderson_subspace_size);
+    prm.leave_subsection();
+  }
+
+
   namespace
   {
     template <typename VectorType>

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.