[petsc-users] DMPlexCreateFromCellList and hybrid meshes
Matthew Knepley
knepley at gmail.com
Fri Oct 25 09:31:59 CDT 2013
On Fri, Oct 25, 2013 at 7:23 AM, Cedric Doucet <cedric.doucet at inria.fr>wrote:
> Hello,
>
> I've noticed that DMPlexCreateFromCellList assumes that cells have the
> same number of vertices (numcorners argument).
> What should be done when one wants to create a DMPlex from a mesh
> containing different types of cells?
> Does one have to create several DMPlex structures and merge them?
> Does one have to create a unique DMPlex by hand?
>
The code is very short:
ierr = DMPlexSetChart(dm, 0, numCells+numVertices);CHKERRQ(ierr);
for (c = 0; c < numCells; ++c) {
ierr = DMPlexSetConeSize(dm, c, numCorners);CHKERRQ(ierr);
}
ierr = DMSetUp(dm);CHKERRQ(ierr);
ierr = DMGetWorkArray(dm, numCorners, PETSC_INT, &cone);CHKERRQ(ierr);
for (c = 0; c < numCells; ++c) {
for (p = 0; p < numCorners; ++p) {
cone[p] = cells[c*numCorners+p]+numCells;
}
ierr = DMPlexSetCone(dm, c, cone);CHKERRQ(ierr);
}
ierr = DMRestoreWorkArray(dm, numCorners, PETSC_INT, &cone);CHKERRQ(ierr);
ierr = DMPlexSymmetrize(dm);CHKERRQ(ierr);
ierr = DMPlexStratify(dm);CHKERRQ(ierr);
This code is all in plexcreate.c. If you want different cells, you can
change numCorners for each cell.
I could make a convenience form if necessary.
Matt
>
> Thank you very much for your help.
>
> Cédric
>
>
>
>
--
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/20131025/e2c480f0/attachment.html>
More information about the petsc-users
mailing list