<div dir="ltr">Dear all,<div><br></div><div>My name is Mohammad and I am a PhD student at the University of California, Santa Barbara. I am currently working on a code that uses OcTree data structures to generate adaptive Cartesian grids for finite difference approximations to PDEs. I am interested in making my code parallel by using PETSc. However there are some issues I am not sure about.</div>

<div><br></div><div>My code is relatively a huge one, above 35-40K of lines, and is written in c++ so that it enables us to use all good features like objects and templates. There are several places I can benefit from PETSc. The most obvious one, and easiest to implement, is just to use PETSc as my linear solver. i.e so everything in serial but only solve the linear system in parallel using PETSc. However, this is not enough and I&#39;d like to do more. The problem, however, is that I am using lots of data structures and objects and my question is the possibility of  using PETSc along with them, i.e is it possible to write a kind of interface that translates my objects to PETSc variables?</div>

<div><br></div><div>For instance, I have an object called OctCell, which is an octree type of cell which has a lot of information inside (what are the neighbors, what are connected nodes, who is the parent of this cell, who are the childs, etc). My grid, is then generated consisting of such (and other objects like OctNode and so on) objects, i.e my grid is an array of such objects. Right now, the template feature of c++ allows me to do this very naturally. Now I&#39;m wondering if it is possible to use array data structures in PETSc instead of array types and still pass my objects as some sort of  template? (I know PETSc is written in c which does not support template -- still I&#39;m hopeful!) This way, my grid generation would also run in parallel which saves me a considerable amount of time.</div>

<div><br></div><div>Thanks in advance and sorry for the lengthy email.</div><div><br></div><div>-M</div></div>