VecGetValues and tutorail?

Barry Smith bsmith at mcs.anl.gov
Sun Feb 26 17:07:38 CST 2006


   If you are using a structured grid you should use DA's to
manage all this. You won't need to monkey with IS or VectorScatter
or VecCreateGhost. Otherwise, ... see below....

On Sun, 26 Feb 2006, billy at dem.uminho.pt wrote:

> Hi,
>
> I want to parallelize an unstructured finite volume CFD code. The code is
> second-order in space, so I only need one layer of overlap between domains. The
> time advancement is implicit.
>
> I renumbered the cells in my application to respect PETSc ordering.
> Do I need to use AO: Application Orderings? Or is this optional?

You do not have to use AO to manage getting the "PETSc style" ordering,
you can do it anyway you like, so long as you have a "PETSc style" ordering.

>
> P0             P1
> ----------     ----------
> | 0| 1| 2| <-> | 9|10|11|
> | 3| 4| 5| <-> |12|13|14|
> | 6| 7| 8| <-> |15|16|17|
> ----------     ----------
>
> Should I use VecCreateGhost to include the ghost cells or another type of vector
> like VecCreateSeq?

    Likely you will wish to use VecCreateGhost()

>
> P0                P1
> -------------     -------------
> | 0| 1| 2| 9| <-> |18| 9|10|11|
> | 3| 4| 5|10| <-> |19|12|13|14|
> | 6| 7| 8|11| <-> |21|15|16|17|
> -------------     -------------
>
> Do I need to create IS: Index Sets?

If you use VecCreateGhost() and friends (VecGhostUpdateBegin/End(), 
VecGhostGetLocalForm() etc) you will not need to deal with index sets.
>
> P0                P1
> -------------     -------------
> | 0| 1| 2| 9| <-> | 9| 0| 1| 2|
> | 3| 4| 5|10| <-> |10| 3| 4| 5|
> | 6| 7| 8|11| <-> |11| 6| 7| 8|
> -------------     -------------
>
> Then I should apply VecScatter routines to update ghost cells, right?

If you use VecCreateGhost() then it manages the scatters during the 
VecGhostUpdateBegin/End() for you; you do not need to use IS or VecScatter.

If you do not use VecCreateGhost() then you need to use IS followed by
VecScatterCreate() to build the scatter data structures and 
VecScatterBegin/End() to update the ghost values.

    Barry

>
> Sorry for asking so many questions, but this is all very confusing to me.
>
>
> Billy.
>
>
> Quoting Satish Balay <balay at mcs.anl.gov>:
>
>> On Fri, 24 Feb 2006, billy at dem.uminho.pt wrote:
>>
>>>
>>> Hello,
>>>
>>>
>>> "VecGetValues - Gets values from certain locations of a vector. Currently
>> can
>>> only get values on the same processor"
>>>
>>> How can I get a value of the vector belonging to a different processor?
>>>
>>>
>>> I am trying to learn how to adapt my code to work in parallel. Have looked
>> at
>>> src/snes/examples/tutorials/ex10d/ex10.c, but I am still confused on how to
>> use
>>> petsc with unstructured meshes. Is there any simple step-by-step
>> tutorial?
>>
>> Basically - you'll have to use VecScatter routines to specify the
>> communication required. Then use VecScatterBegin/End() to invoke this
>> communication. Some of this info is in the tutorial slides [check
>> arround slide 150] in:
>> http://www-unix.mcs.anl.gov/petsc/petsc-as/documentation/tutorials/PetscTu06.pdf
>>
>> Not usre if there is an unstructured grid example code. [but there are
>> examples using VecScatters in src/dm/da/examples/tutorials]
>>
>> Satish
>>
>>
>
>
>




More information about the petsc-users mailing list