# [petsc-users] Input arguments of DMPlexCreateFromDAG

Cedric Doucet cedric.doucet at inria.fr
Fri Jan 31 06:14:35 CST 2014

```Thank you very much for your help!
I will test this solution.
Best regards,
Cédric

----- Mail original -----

> De: "Matthew Knepley" <knepley at gmail.com>
> À: "Cedric Doucet" <cedric.doucet at inria.fr>
> Cc: petsc-users at mcs.anl.gov
> Envoyé: Vendredi 31 Janvier 2014 13:11:14
> Objet: Re: [petsc-users] Input arguments of DMPlexCreateFromDAG

> On Fri, Jan 31, 2014 at 5:55 AM, Cedric Doucet <
> cedric.doucet at inria.fr > wrote:

> > Hello,
>

> > DMPlexInterpolate is very interesting!
>
> > Is it slow?
>

> It is as fast as I know how to make it. It uses hashing to find the
> matches.

> > If I want to call DMplexInterpolate, just after DMPlexCreateFromDAG
> > call, for the example of two triangles sharing an edge, I only have
> > to specify cells and vertices like this in DMPlexCreateFromDAG:
>

> > PetscInt numPoints[3] = {4, 0, 2};
>
> > PetscInt coneSize[11] = {3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0};
>
> > PetscScalar vertexCoords[8] = {-0.5, 0.5, 0.0, 0.0, 0.0, 1.0, 0.5,
> > 0.5};
>

> > and let cones and coneOrientations be empty?
>

> cones[] would be the vertices in each cell, and coneOrientations
> would be all zeros.

> Matt

> > Cédric
>

> > > De: "Matthew Knepley" < knepley at gmail.com >
> >
>
> > > À: "Cedric Doucet" < cedric.doucet at inria.fr >
> >
>
> > > Cc: petsc-users at mcs.anl.gov
> >
>
> > > Envoyé: Vendredi 31 Janvier 2014 12:21:40
> >
>
> > > Objet: Re: [petsc-users] Input arguments of DMPlexCreateFromDAG
> >
>

> > > On Fri, Jan 31, 2014 at 3:23 AM, Cedric Doucet <
> > > cedric.doucet at inria.fr > wrote:
> >
>

> > >
> >
>
> > > > I understand well the reason why coneSize begins with faces of
> > > > cells
> > > > and vertices first.
> > >
> >
>
> > > > However, I am not sure to understand how cone points are
> > > > numbered
> > > > in
> > > > the definition of <start>.
> > >
> >
>
> > > > For example, in CreateSimplex2D in ex5.c (two triangles sharing
> > > > an
> > > > edge), we have:
> > >
> >
>

> > > > PetscInt numPoints[3] = {4, 5, 2};
> > >
> >
>
> > > > PetscInt coneSize[11] = {3, 3, 0, 0, 0, 0, 2, 2, 2, 2, 2};
> > >
> >
>
> > > > PetscInt cones[16] = {6, 7, 8, 9, 7, 10, 2, 3, 3, 4, 4, 2, 5,
> > > > 4,
> > > > 3,
> > > > 5};
> > >
> >
>
> > > > PetscInt coneOrientations[16] = {0, 0, 0, 0, -2, 0, 0, 0, 0, 0,
> > > > 0,
> > > > 0,
> > > > 0, 0, 0, 0};
> > >
> >
>
> > > > PetscScalar vertexCoords[8] = {-0.5, 0.5, 0.0, 0.0, 0.0, 1.0,
> > > > 0.5,
> > > > 0.5};
> > >
> >
>

> > > > The fact that coneOrientations[4] equals -2 means that edge
> > > > cones[4]=7 must be oriented in reverse order starting at vertex
> > > > 1.
> > >
> >
>
> > > > However, edge 7 is defined by vertices (3,4). Does it mean that
> > > > a
> > > > local numbering is used here: (3,4)~(v0,v1)?
> > >
> >
>

> > > Yes, exactly the numbering from cones[8-9].
> >
>

> > > > In algebraic topology, a convenient way to orient simplices is
> > > > to
> > > > number their vertices in ascendant order.
> > >
> >
>
> > > > For example, an edge (i,j) is oriented so that i<j, a face
> > > > (i,j,k)
> > > > is
> > > > oriented so that i<j<k, etc.
> > >
> >
>
> > > > Can we adopt the same convention here and does it simplify
> > > > something?
> > >
> >
>

> > > No, because we do not have exclusively simplices.
> >
>

> > > You can simplify by only specifying cells and vertices, which
> > > need
> > > no
> > > orientations, and then calling DMPlexInterpolate().
> >
>

> > > Matt
> >
>

> > > > Best regards,
> > >
> >
>

> > > > Cédric Doucet
> > >
> >
>

> > > > > De: "Matthew Knepley" < knepley at gmail.com >
> > > >
> > >
> >
>
> > > > > À: "Cedric Doucet" < cedric.doucet at inria.fr >
> > > >
> > >
> >
>
> > > > > Cc: petsc-users at mcs.anl.gov
> > > >
> > >
> >
>
> > > > > Envoyé: Jeudi 30 Janvier 2014 19:26:36
> > > >
> > >
> >
>
> > > > > Objet: Re: [petsc-users] Input arguments of
> > > > > DMPlexCreateFromDAG
> > > >
> > >
> >
>

> > > > > On Thu, Jan 30, 2014 at 12:19 PM, Cedric Doucet <
> > > > > cedric.doucet at inria.fr > wrote:
> > > >
> > >
> >
>

> > > > > > Hello,
> > > > >
> > > >
> > >
> >
>
> > > > > > I tried to use DMPlexCreateFromDAG function to create a DM
> > > > > > structure
> > > > > > from a hybrid mesh.
> > > > >
> > > >
> > >
> >
>
> > > > > > To understand how it works, I look at ex5.c file.
> > > > >
> > > >
> > >
> >
>
> > > > > > Unfortunately, there are some things that I do not
> > > > > > understand.
> > > > >
> > > >
> > >
> >
>
> > > > > > 1. Why does coneSize lists faces of cells first, then faces
> > > > > > of
> > > > > > vertices and finally faces of edges (in 2D)? Listing faces
> > > > > > of
> > > > > > vertices, then faces of edges and finally faces of cells is
> > > > > > not
> > > > > > simpler?
> > > > >
> > > >
> > >
> >
>

> > > > > This is really about what order you number points. I wanted
> > > > > to
> > > > > support meshes with just cells and vertices, as well as
> > > >
> > >
> >
>
> > > > > those with face and edges. I also wanted to be able to
> > > > > convert
> > > > > between them. Thus it made sense to leave the cell
> > > >
> > >
> >
>
> > > > > and vertex numbers invariant under this change. I still think
> > > > > this
> > > > > is
> > > > > the best pragmatic alternative.
> > > >
> > >
> >
>

> > > > > > 2 What does coneOrientations contain? For two
> > > > > > counterclockwise
> > > > > > oriented triangles sharing an edge e={v0,v1}, I understand
> > > > > > that
> > > > > > {v0,v1} is the right oriented edge for the second triangle
> > > > > > (and
> > > > > > e
> > > > > > for the first one) but what is the meaning of value -2? I
> > > > > > read
> > > > > > that
> > > > > > it is -(o+1) with o=1 but why does o equal 1 in this case?
> > > > >
> > > >
> > >
> >
>
> > > > > Right now, orientation o = <sign><start> means:
> > > >
> > >
> >
>

> > > > > <sign>: + means traverse in cone order
> > > >
> > >
> >
>
> > > > > - means traverse in the reverse of cone order
> > > >
> > >
> >
>

> > > > > <start>: cone point to start iteration on
> > > >
> > >
> >
>
> > > > > if <sign> is -, then start on point -(<start>+1)
> > > >
> > >
> >
>

> > > > > Thus -2 means start on point 1 and go in reverse order, so
> > > >
> > >
> >
>
> > > > > for an edge that would be {1, 0} which is what you want.
> > > >
> > >
> >
>

> > > > > What we should really have is <start> identify a group
> > > > > element
> > > > > from
> > > > > the symmetry
> > > >
> > >
> >
>
> > > > > group of the point, and <sign> indicate inversion. However,
> > > > > that
> > > > > will
> > > > > be a big rewrite
> > > >
> > >
> >
>
> > > > > and needs to be motivated by applications.
> > > >
> > >
> >
>

> > > > > Matt
> > > >
> > >
> >
>

> > > > > > Thank you very much for your help!
> > > > >
> > > >
> > >
> >
>
> > > > > > Best regards,
> > > > >
> > > >
> > >
> >
>
> > > > > > Cédric Doucet
> > > > >
> > > >
> > >
> >
>

> > > > > --
> > > >
> > >
> >
>
> > > > > 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
> > > >
> > >
> >
>
> > > --
> >
>
> > > 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
> >
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which