<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Le 07/12/2017 � 08:23, Mohammad Hassan
      Baghaei a �crit�:<br>
    </div>
    <blockquote type="cite"
      cite="mid:004001d36f2c$29b9c140$7d2d43c0$@mail.sjtu.edu.cn">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">Hello<o:p></o:p></p>
        <p class="MsoNormal">I am using DMPlex to construct a fully
          circular 2D domain for my PDEs. As I am discretizing the PDEs
          using finite difference method, I need to know , to define the
          layout of PetscSection, how I can find the boundary condition
          IS. I know the location of the boundaries in Sieve chart.
          However, I noticed that I need to know the Index Set of that
          location. Can I use the Sieve point number for Index Set. It
          seems I think I am not familiar with IS. Can you help me?
          Thank for your help. <o:p></o:p></p>
        <p class="MsoNormal">Amir<o:p></o:p></p>
      </div>
    </blockquote>
    <p>Hello,</p>
    <p>In snes/examples/tutorials/ex56.c you can find the following
      code, which does what you want as i understood :</p>
    <p>260:�� {<br>
      261:���� DMLabel�������� label;<br>
      262:���� IS������������� is;<br>
      263:���� DMCreateLabel(dm, "boundary");<br>
      264:���� DMGetLabel(dm, "boundary", &label);<br>
      265:���� DMPlexMarkBoundaryFaces(dm, label);<br>
      266:���� if (run_type==0) {<br>
      267:������ DMGetStratumIS(dm, "boundary", 1,� &is);<br>
      268:������ DMCreateLabel(dm,"Faces");<br>
      269:������ if (is) {<br>
      270:�������� PetscInt������� d, f, Nf;<br>
      271:�������� const PetscInt *faces;<br>
      272:�������� PetscInt������� csize;<br>
      273:�������� PetscSection��� cs;<br>
      274:�������� Vec������������ coordinates ;<br>
      275:�������� DM������������� cdm;<br>
      276:�������� ISGetLocalSize(is, &Nf);<br>
      277:�������� ISGetIndices(is, &faces);<br>
      278:�������� DMGetCoordinatesLocal(dm, &coordinates);<br>
      279:�������� DMGetCoordinateDM(dm, &cdm);<br>
      280:�������� DMGetDefaultSection(cdm, &cs);<br>
      281:�������� /* Check for each boundary face if any component of
      its centroid is either 0.0 or 1.0 */<br>
      282:�������� for (f = 0; f < Nf; ++f) {<br>
      283:���������� PetscReal�� faceCoord;<br>
      284:���������� PetscInt��� b,v;<br>
      285:���������� PetscScalar *coords = NULL;<br>
      286:���������� PetscInt��� Nv;<br>
      287:���������� DMPlexVecGetClosure(cdm, cs, coordinates, faces[f],
      &csize, &coords);<br>
      288:���������� Nv�� = csize/dim; /* Calculate mean coordinate
      vector */<br>
      289:���������� for (d = 0; d < dim; ++d) {<br>
      290:������������ faceCoord = 0.0;<br>
      291:������������ for (v = 0; v < Nv; ++v) faceCoord +=
      PetscRealPart(coords[v*dim+d]);<br>
      292:������������ faceCoord /= Nv;<br>
      293:������������ for (b = 0; b < 2; ++b) {<br>
      294:�������������� if (PetscAbs(faceCoord - b) < PETSC_SMALL) {
      /* domain have not been set yet, still [0,1]^3 */<br>
      295:���������������� DMSetLabelValue(dm, "Faces", faces[f],
      d*2+b+1);<br>
      296:�������������� }<br>
      297:������������ }<br>
      298:���������� }<br>
      299:���������� DMPlexVecRestoreClosure(cdm, cs, coordinates,
      faces[f], &csize, &coords);<br>
      300:�������� }<br>
      301:�������� ISRestoreIndices(is, &faces);<br>
      302:������ }<br>
      303:������ ISDestroy(&is);<br>
      304:������ DMGetLabel(dm, "Faces", &label);<br>
      305:������ DMPlexLabelComplete(dm, label);<br>
      306:���� }<br>
      307:�� }</p>
    <p><br>
    </p>
    <p>The idea is to mark boundary faces with DMPlexMarkBoundaryFaces,
      and get the IS of the labeled faces, and sort them with the
      position of the centroid of the face.<br>
    </p>
    <p>Regards,</p>
    <p>Yann<br>
    </p>
  </body>
</html>