[petsc-users] linking and compiling cg.c with examples from tutorials

Elena Smith suguleasa at gmail.com
Fri Aug 20 14:57:30 CDT 2010


Hello All,

I am a new PETSc user and I need some help.
This is what I am trying to do:
- use one of the examples provided under "tutorials"
(src/ksp/ksp/examples/tutorials) and make it used one of the iterative
methods already in src/ksp/ksp/impls.
For example, instead of using KSPSetType(ksp,KSPCG) and then KSPSolve,
I want to just do: KSPSolve_CG, where KSPSolve_CG comes from cg.c
which would have some changes I would make.

>From a previous post
(https://lists.mcs.anl.gov/mailman/htdig/petsc-dev/2008-November/001049.html
) I understood that KSPSolve (with the KSPCG type set as above) calls
actually KSPSolve_CG that is implemented in cg.c from
src/ksp/ksp/impls/cg/cg.c.
Does this mean I can change cg.c and somehow (magically) when I
compile the example, it will know to compile the modified cg.c as
well, perhaps through something like PETSC_KSP_LIB?  I have tried this
and it doesn't work, but it could be because not knowing how to set up
the makefile... or my simplistic approach.

Or would I have to recompile the entire source code to reflect the
changes? I believe the answer is much simpler than this question
suggests.

Your help would be greatly appreciated.
Thank you in advance,
    Elena


More information about the petsc-users mailing list