[petsc-users] Interfacing PETSc

Mohammad Mirzadeh mirzadeh at gmail.com
Mon May 24 13:04:06 CDT 2010


Dear all,

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.

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'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?

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'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'm
hopeful!) This way, my grid generation would also run in parallel which
saves me a considerable amount of time.

Thanks in advance and sorry for the lengthy email.

-M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100524/f2e135ef/attachment.htm>


More information about the petsc-users mailing list