[petsc-users] Creating a Vec with DMCreateGlobalVector from a dmplex?

Matthew Knepley knepley at gmail.com
Wed Aug 13 07:09:03 CDT 2014


On Wed, Aug 13, 2014 at 2:48 AM, aymeric aymeric <sickofcowboys at hotmail.com>
wrote:

> - I create a dmplex with DMPlexCreateHexBoxMesh
> - Distribute it with DMPlexDistribute
>

Here you are missing a crucial step. You have to define a data layout over
the mesh. The most
basic way to do this is to create a PetscSection object, and then use
DMSetDefaulSection().
There is a helper function for this:


http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMPlexCreateSection.html

The DMDA has a default layout in which every vertex gets dof degrees of
freedom.

  Thanks,

     Matt


> - Create a Vec based on the distributed dmplex with DMCreateGlobalVector
> - But when I check the size of this Vec with VecGetOwnershipRange or
> VecGetSize, it is empty.
>
> What am I missing?
>
> I know this is possible, because in SNES ex12.c a vector is created using
> this sequence of commands. Unfortunately, it some other commands are also
> used, but they are not all documented.
>
> Thanks.
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140813/2290592b/attachment.html>


More information about the petsc-users mailing list