<html><body>Hi All,<br>My team is working on a PETSC version of an existent code.<br>In order to convert the main part of this work retaining the c++ levels of abstraction,<br><div>we would access to c++ vector data structures easily.</div><div><br></div><div>We would like to use the memory area allocated using c++ as a Petsc Vector<br></div><div><br></div><div>a supposed pseudocode could be:</div><div><i><br></i></div><i>int data[] = { 1,2,3,4,5,6,7,8,9 };<br>unsigned int sizeVectorPetsC = data.size();<br><b>Vec v(data, sizeVectorPetsC); (Can it exists with easy access petsc routines?)</b><br></i><div><i>cout<< "The mapped vector v is: [";</i></div><div><i> PetscScalar *vecArray;<br></i></div><i>PetscGetArray(v, &array);<br>for (unsigned int i = 0; i < sizeVectorPetsC; i++)<br>{<br><u><b>Informations of v are the informations of data.(same memory read by both data structures)</b></u><br>}<br>PetscRestoreArray(v,&array);<br></i><div><i>
cout<< "]"<< endl;</i></div><div><i><br></i></div><div><i><br></i></div><div>Is it provided this kind of duality between c++ and Petsc objects without a re-copy of the concerned informations?</div><div><br></div><div>Thank you,</div><div>Alice <br><i></i></div></body></html>