On Fri, Jan 23, 2009 at 3:19 PM, Derek Gaston <fried...@gmail.com> wrote: > Ok - all good arguments... and I'm seeing some of your reasoning now.... but > let me show you the use case I'm thinking of which might better explain why > I think the LinearSolver link is useful... > > I'm needing to solve individual systems _just_ for preconditioning > purposes... and they use a preconditioner _as a solver_. If a > Preconditioner was _not_ a LinearSolver this would be what I would have to > do (and is close to what I'm doing now... although there is even more manual > manipulation). > > ApplyPreconditioner(Vector x, Vector & y) > { > LinearImplicitSystem sys; > sys.add_variable("u"); > > AssemblePrecMatrix(sys.matrix); > > copyCorrectPiecesOfX(x, sys.rhs); > > Preconditioner pre(sys.matrix); > pre.apply(sys.rhs, sys.solution); > > copyCorrectPiecesOfSolution(sys.solution, y); > } > > This really doesn't look too bad... the problem is that there's > datastructures that aren't used... or are redundant. For instance there's a > KSP object inside of that LinearImplicitSystem that never gets used... and > it has it's own PC object... again that never gets used. Then there's the > fact that you have to call apply() and pass in two things that are both held > within the system.
I know that's a simple example but it really doesn't look too bad. It seems that x, and y are only temporary, so if they became members of Preconditioner and you called the ApplyPreconditioner function solve() instead, I think it would be very close to what you want... Also, I wouldn't worry too much about unused PC/KSP objects. They can't possibly take up much memory or take much time to build up/destroy, can they?. In any event, an ImplicitSystem may be more applicable in your example (assuming it's not a virtual base class, I didn't check!) if System::solve() is *never* to be called. The System hierarchy doesn't get a LinearSolver until the LinearImplicitSystem level. -- John ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Libmesh-devel mailing list Libmesh-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-devel