On Wed, Feb 10, 2010 at 4:16 PM, Derek Gaston <[email protected]> wrote: > On Feb 10, 2010, at 3:12 PM, John Peterson wrote: > >> Right now the generic LinearSolver::set_preconditioner_type() >> interface just sets its own _preconditioner_type variable and returns. >> This makes it hard to actually change preconditioners through the >> generic interface if you've already initialized your LinearSolver >> object. For example, in the PetscLinearSolver, >> PetscPreconditioner<T>::set_petsc_preconditioner_type(...) only gets >> called during init, so there's no easy way to change preconditioners >> between solves. Laspack is a little better, as it calls >> set_laspack_preconditioner_type before solving. Aztec follows the >> PETSc model, only allowing preconditioners to be set during init(). >> >> If we make LinearSolver::set_preconditioner_type() virtual, we can >> just have it call the underlying set_XXX_preconditioner_type function >> in the derived classes. What do y'all think? Another option is to >> call set_XXX_preconditioner_type in the solve function for each >> LinearSolver type, but that is just one more thing to remember >> everytime you write a new solve() method, and also might incur some >> additional unnecessary overhead. > > I vote for a pure virtual... and just rename the set_xxx_preconditioner_type > to satisfy the pure virtual.
> I'm all for this by the way... as long as it works. Like I mentioned > yesterday I seem to remember some issue with calling set preconditioner > multiple times with Petsc... especially involving Hypre. > > But I could be remembering wrongly. I'll check into this more closely, but it seems to be working now. The code I'm using uses bjacobi+ILU for some initial non-symmetric solves and then switches to AMG for some symmetric ones. If I find out it doesn't work then yeah, I think we should stick to only allowing the changes during init() -- John ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Libmesh-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-devel
