Commits

Anders Logg committed d8e66f5

Propagate parameters to wrapped solver instances

Comments (0)

Files changed (6)

dolfin/la/KrylovSolver.cpp

 // Modified by Anders Logg 2008-2012
 //
 // First added:  2007-07-03
-// Last changed: 2012-08-21
+// Last changed: 2013-11-25
 
 #include <dolfin/common/Timer.h>
 #include <dolfin/parameter/GlobalParameters.h>

dolfin/la/KrylovSolver.h

 // Modified by Anders Logg, 2008.
 //
 // First added:  2007-07-03
-// Last changed: 2011-10-19
+// Last changed: 2013-11-25
 
 #ifndef __KRYLOV_SOLVER_H
 #define __KRYLOV_SOLVER_H
     /// Default parameter values
     static Parameters default_parameters();
 
+    /// Update solver parameters (pass parameters down to wrapped implementation)
+    virtual void update_parameters(const Parameters& parameters)
+    {
+      this->parameters.update(parameters);
+      solver->parameters.update(parameters);
+    }
+
   private:
 
     // Initialize solver

dolfin/la/LUSolver.h

 // Modified by Kent-Andre Mardal 2008
 //
 // First added:  2007-07-03
-// Last changed: 2012-08-20
+// Last changed: 2013-11-25
 
 #ifndef __LU_SOLVER_H
 #define __LU_SOLVER_H
       return p;
     }
 
+    /// Update solver parameters (pass parameters down to wrapped implementation)
+    virtual void update_parameters(const Parameters& parameters)
+    {
+      this->parameters.update(parameters);
+      solver->parameters.update(parameters);
+    }
+
   private:
 
     // Initialize solver

dolfin/la/LinearSolver.h

 // Modified by Ola Skavhaug 2008.
 //
 // First added:  2004-06-19
-// Last changed: 2013-11-20
+// Last changed: 2013-11-25
 
 #ifndef __LINEAR_SOLVER_H
 #define __LINEAR_SOLVER_H
     /// Update solver parameters (pass parameters down to wrapped implementation)
     virtual void update_parameters(const Parameters& parameters)
     {
-      solver->parameters.update(parameters);
+      this->parameters.update(parameters);
+      solver->update_parameters(parameters);
     }
 
   private:

dolfin/la/PETScKrylovSolver.cpp

 // Modified by Fredrik Valdmanis 2011
 //
 // First added:  2005-12-02
-// Last changed: 2013-03-18
+// Last changed: 2013-11-25
 
 #ifdef HAS_PETSC
 

dolfin/nls/NewtonSolver.cpp

 // Modified by Johan Hake, 2010.
 //
 // First added:  2005-10-23
-// Last changed: 2013-11-21
+// Last changed: 2013-11-25
 
 #include <iostream>
 #include <dolfin/common/constants.h>
 
   // Set parameters for linear solver
   if (solver_type == "direct" || solver_type == "lu")
-  {
     _solver->update_parameters(parameters("lu_solver"));
-  }
-  else if (solver_type == "iterative")
+  else if (solver_type == "iterative" || solver_type == "gmres")
     _solver->update_parameters(parameters("krylov_solver"));
   else
     warning("Unable to set parameters for linear solver type \"%s\".", solver_type.c_str());
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.