[petsc-dev] VecNestSetSubVec for VecNest.

Vijay S. Mahadevan vijay.m at gmail.com
Mon Oct 17 19:53:07 CDT 2011


Is there any interest for a Merge operation on Nest vectors ? I have a
basic version of this ready but it needs a little more testing but the
idea is that you can start with a nest vector and transform it to a
vector of type SEQ or MPI. I originally tried VecGetSubVector (with an
IS concatenated with all block IS) for this but did not realize that
the IS has to match the entire block correctly. Hence, ended up with
"Index set not found in nested Vec!" error. I didn't debug this
further but if you want details, I can provide them. But basically
that motivated me to create a MergeSubVecs routine to handle the case.

This functionality originally existed in petsc-ext and don't think it
made it to petsc nest. If there is a cleaner alternative, I would like
to know. But if you would like to see the new routine, I can create a
patch for that with an updated test (ex41.c). Either way, let me know.

Vijay

On Sun, Oct 16, 2011 at 3:26 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> Yes, I made this transformation for MatNest in January. It will be easier
> for VecNest.
>
> On Oct 16, 2011 3:23 PM, "Vijay S. Mahadevan" <vijay.m at gmail.com> wrote:
>>
>> > Let's wait on optimizing until we have a use case where it matters.
>> > Since
>> > everything else expects data structures to be rebuilt if anything
>> > changes, I
>> > don't think it's a concern just yet. If we allow more resizing in the
>> > future, we can optimize this routine.
>>
>> Agreed. No need for premature optimization.
>>
>> I do find the flow of creating a Nest vector odd now that the
>> SetSubVec* are in place. Because due to the VecCreateNest signature,
>> you still need to provide a set of vectors to create the leaf nodes.
>> Perhaps it might be useful to modify this signature to conform to the
>> usual strategy now ? i.e., VecCreate(), VecSetSizes(), VecSetType(),
>> VecSetFromOptions(), VecSetSubVecs(), VecAssemblyBegin/End() ?
>>
>> On Sun, Oct 16, 2011 at 11:25 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>> > On Sat, Oct 15, 2011 at 10:12, Vijay S. Mahadevan <vijay.m at gmail.com>
>> > wrote:
>> >>
>> >> Find attached the bundle with the changes for
>> >> VecNestSetSubVec/VecNestSetSubVecs. The test file and the outputs are
>> >> also included in the bundle. Feel free to modify the documentation if
>> >> need be.
>> >
>> > Thanks, applied.
>> >
>> >>
>> >> The only thing that I think needs a better implementation is the
>> >> SetSubVecs where I've just looped over the indices and recursively
>> >> called the single SetSubVec. This was hard to optimize since
>> >> accommodating variable vectors involves traversing the IS one by one
>> >> and I couldn't figure out a way to implement this concurrently.
>> >> Anyway, if you can think of something better, let me know.
>> >
>> > Let's wait on optimizing until we have a use case where it matters.
>> > Since
>> > everything else expects data structures to be rebuilt if anything
>> > changes, I
>> > don't think it's a concern just yet. If we allow more resizing in the
>> > future, we can optimize this routine.
>



More information about the petsc-dev mailing list