<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10px"><div dir="ltr" id="yui_3_16_0_ym19_1_1507126861333_4335">What's the concept to interface with PETSc from another application to solve a linear system with PETSc?<br id="yui_3_16_0_ym19_1_1507126861333_4314"><br id="yui_3_16_0_ym19_1_1507126861333_4315">The standard procedure of the job:<br id="yui_3_16_0_ym19_1_1507126861333_4316"><br id="yui_3_16_0_ym19_1_1507126861333_4317">1: The application provides a matrix which needs to be converted and be loaded into PETSc<br id="yui_3_16_0_ym19_1_1507126861333_4318"><br id="yui_3_16_0_ym19_1_1507126861333_4319">2: The application provides the rhs vector (containing pointers!) which needs to be loaded into PETSc <br id="yui_3_16_0_ym19_1_1507126861333_4320"><br id="yui_3_16_0_ym19_1_1507126861333_4321">3: The linear system is to be solved using PETSc<br id="yui_3_16_0_ym19_1_1507126861333_4322"><br id="yui_3_16_0_ym19_1_1507126861333_4323">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)<br id="yui_3_16_0_ym19_1_1507126861333_4324"><br id="yui_3_16_0_ym19_1_1507126861333_4325"><br id="yui_3_16_0_ym19_1_1507126861333_4326">The problem - maybe a completely wrong approach when it comes to using PETSc: <br id="yui_3_16_0_ym19_1_1507126861333_4327"><br id="yui_3_16_0_ym19_1_1507126861333_4328">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. <br id="yui_3_16_0_ym19_1_1507126861333_4329"><br id="yui_3_16_0_ym19_1_1507126861333_4330">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.<br id="yui_3_16_0_ym19_1_1507126861333_4331"><br id="yui_3_16_0_ym19_1_1507126861333_4332">How to interface with PETSc from a software application? (I am using c++ and Ubuntu)<br id="yui_3_16_0_ym19_1_1507126861333_4333"><br id="yui_3_16_0_ym19_1_1507126861333_4334">Klaus<br></div></div></body></html>