[petsc-users] Some questions regarding VecNest type.

Vijay S. Mahadevan vijay.m at gmail.com
Tue Oct 11 00:16:15 CDT 2011

I understand that the Vec/Mat Nest types in the current release of
petsc are designed to be similar in philosophy to Dave May's petsc-ext
"block" vectors and matrices. I have some existing code based on
petsc-ext and am trying to figure out the amount of work involved to
make a transition from petsc-ext to pure petsc (>=3.2).

Here are a list of my questions after looking at the VecNest type:

1) Does VecDuplicate create a shallow or deep copy ? i.e., are all
leaf vectors/matrices recreated based on a recursive duplicate or does
it only replicate the higher level structure ?
2) Do I need to restore the references after I get the vectors ? Say
VecNestGetSubVecs and something along the lines of
VecNestRestoreSubVecs (I dont see such a routine though) ? Or is this
unnecessary ?
3) Is there a way to lazily set the reference to one of the vectors
that is part of the nest structure ? Or does it always have to be
specified during creation of VECNEST ? I see that this is not the case
for matrices since there is a MatNestSetSubMats but I don't see
something similar for Vec. Can this be handled via VecNestGetSubVecs ?
In petsc-ext, there was a function that handled VecBlockSetValue and I
guess I am looking for a suitable replacement, if that shows better
light on the context.
4) Are there any examples that make use of the VecNest type ? Even a
trivial one might help clarify some trouble I'm having in
understanding calling sequence.

Most of these questions might also be applicable for Mat/PC/.. but I
haven't started looking at these objects in detail yet. If there is an
overlap in the understanding, hopefully I'll have lot less questions
the next time and they should be more specific.


More information about the petsc-users mailing list