]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make it possible to include nonlinear.h when no external libs are enabled 17682/head
authorSimon Sticko <simon@sticko.se>
Sat, 7 Sep 2024 12:50:42 +0000 (14:50 +0200)
committerSimon Sticko <simon@sticko.se>
Sat, 7 Sep 2024 16:18:02 +0000 (18:18 +0200)
The file nonlinear.h can not be included when none of SUNDIALS,
TRILINOS, or PETSC are enabled. Fix this.

include/deal.II/numerics/nonlinear.h
tests/numerics/nonlinear_solver_selector_04.cc [new file with mode: 0644]
tests/numerics/nonlinear_solver_selector_04.output [new file with mode: 0644]

index bde8ee41b6a90616cf68a5a758013ced3b228e4a..712db8b5c7c277b4ccf472ee823c1e76625460db 100644 (file)
@@ -689,15 +689,15 @@ NonlinearSolverSelector<VectorType>::solve(
     }
   else
     {
-      const std::string solvers =
+      const std::string solvers = ""
 #ifdef DEAL_II_WITH_SUNDIALS
-        "kinsol\n"
+                                  "kinsol\n"
 #endif
 #ifdef DEAL_II_TRILINOS_WITH_NOX
-        "NOX\n"
+                                  "NOX\n"
 #endif
 #ifdef DEAL_II_WITH_PETSC
-        "SNES\n"
+                                  "SNES\n"
 #endif
         ;
 
diff --git a/tests/numerics/nonlinear_solver_selector_04.cc b/tests/numerics/nonlinear_solver_selector_04.cc
new file mode 100644 (file)
index 0000000..2ce8c47
--- /dev/null
@@ -0,0 +1,37 @@
+// ------------------------------------------------------------------------
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+// Copyright (C) 2022 - 2024 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// Part of the source code is dual licensed under Apache-2.0 WITH
+// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
+// governing the source code and code contributions can be found in
+// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
+//
+// ------------------------------------------------------------------------
+
+
+
+// Tests that nonlinear.h can be included and that an object of
+// NonlinearSolverSelector can be created, even when none of SUNDIALS,
+// TRILINOS, or PETSC are enabled. Test added to trigger the bug, that this was
+// not possibles.
+
+#include <deal.II/base/function.h>
+
+#include <deal.II/numerics/nonlinear.h>
+
+#include "../tests.h"
+
+
+int
+main()
+{
+  initlog();
+
+  NonlinearSolverSelector solver;
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/numerics/nonlinear_solver_selector_04.output b/tests/numerics/nonlinear_solver_selector_04.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

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.