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