[petsc-users] How to interface with PETSc from another application?

Jed Brown jed at jedbrown.org
Wed Oct 4 10:17:21 CDT 2017


Klaus Burkart <k_burkart at yahoo.com> writes:

> What's the concept to interface with PETSc from another application to solve a linear system with PETSc?
>
> The standard procedure of the job:
>
> 1: The application provides a matrix which needs to be converted and be loaded into PETSc
>
> 2: The application provides the rhs vector (containing pointers!) which needs to be loaded into PETSc 
>
> 3: The linear system is to be solved using PETSc
>
> 4: The application provides the result vector x, the PETSc result needs to be copied back to the application into vector x (also expecting pointers)
>
>
> The problem - maybe a completely wrong approach when it comes to using PETSc: 
>
> With other linear algebra libraries, I included the library functionality in the code of a new solver accessing the functionality usually via header files and created a plugin which can be called from the application when running a simulation. 
>
> Even so the mixed code including PETSc code can be compiled, the bit of the plugin, interfacing with the application is broken as soon as I include more than a PETSc declaration in the mixed code.

Sounds like maybe you haven't correctly linked to the PETSc library.
Sending us the commands run and output/errors would be helpful to debug.

> How to interface with PETSc from a software application?  (I am using c++ and Ubuntu)
>
> Klaus


More information about the petsc-users mailing list