[petsc-users] DMPlexVecGetClosure for DM forest

Matthew Knepley knepley at gmail.com
Sun Nov 12 11:31:25 CST 2017


On Fri, Nov 10, 2017 at 5:13 AM, Yann JOBIC <yann.jobic at univ-amu.fr> wrote:

> On 11/09/2017 07:22 PM, Matthew Knepley wrote:
>
> On Thu, Nov 9, 2017 at 1:20 PM, Yann Jobic <yann.jobic at univ-amu.fr> wrote:
>
>> Hello,
>> I'm trying to access to the values of a p4est forest.
>> I know how to do that by converting my forest to a DMPlex, and then use
>> DMPlexVecGetClosure over the converted DM.
>> However, i want to assign a label and access to the values of the forest
>> directly.
>>
>
> What do you mean by "directly". p4est only has topology. We use a Section
> to map points to values, just like Plex.
>
> I feel stupid, but i don't know how to use a section to map points to
> values.
>

There is a manual section on it, however it is quite simple. Everything in
the mesh is numbered consecutively, so each point
(cell, face, edge, vertex) has a number. The Section maps this number p to
a pair (dof, off)

  p --> (dof, off)

where dof is a number of degrees of freedom, and off is an offset into the
Vec holding these values.


> In my code i use (from ex11.c and DMComputeL2GradientDiff_Plex) :
>   ierr = DMGetDefaultSection(forest, &section);CHKERRQ(ierr);
>

This default section is the Section for the solution field.

Before here just call

  ierr = DMConvert(forest, DMPLEX, &plex);CHKERRQ(ierr);

and use that in all the subsequent calls.

  Thanks,

     Matt

  ierr = DMForestGetCellChart(forest,&cStart,&cEnd);CHKERRQ(ierr);
>   ierr = DMGetLocalVector(forest, &localX);CHKERRQ(ierr);
>   ierr = DMGlobalToLocalBegin(forest, u, INSERT_VALUES,
> localX);CHKERRQ(ierr);
>   ierr = DMGlobalToLocalEnd  (forest, u, INSERT_VALUES,
> localX);CHKERRQ(ierr);
>
>   for (c = cStart; c < cEnd; c++) {
>
>      DMPlexVecGetClosure(forest, section, localX, c, NULL, &x);
>
> [...]
>
> And i would like to get "x" for a DM forest.
>
> I looked at dm/impls/forest/p4est/pforest.c, but it looks like quite
> difficult to import.
> I also search in vec/is/utils/vsectionis.c in order to find the correct
> section function, but i didn't catch how to use the right one.
>
> It looks so simple to use DMPlexVecGetClosure for DM Plex, getting into
> the code of DMPlexVecGetClosure is also kind of difficult, at my level i
> mean.
>
> Where can i find the correct way to do it ? Is there an example for what i
> want to do ?
>
> Thanks,
>
> Yann
>
>
>  Thanks,
>
>     Matt
>
>
>> Is it possible ?
>> Thanks,
>> Yann
>>
>>
>> ---
>> L'absence de virus dans ce courrier électronique a été vérifiée par le
>> logiciel antivirus Avast.
>> https://www.avast.com/antivirus
>>
>>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/%7Emk51/>
>
>
> --
> ___________________________
>
> Yann JOBIC
> HPC engineer
> Polytech Marseille DME
> IUSTI-CNRS UMR 6595
> Technopôle de Château Gombert5 rue Enrico Fermi <https://maps.google.com/?q=5+rue+Enrico+Fermi&entry=gmail&source=g>
> 13453 Marseille cedex 13
> Tel : (33) 4 91 10 69 39
>   ou  (33) 4 91 10 69 43
> Fax : (33) 4 91 10 69 69
>
>


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

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20171112/f94a3ce4/attachment-0001.html>


More information about the petsc-users mailing list