<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jun 21, 2012, at 7:42 AM, Matthew Knepley wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">On Wed, Jun 20, 2012 at 8:40 PM, Blaise Bourdin <span dir="ltr"><<a href="mailto:bourdin@lsu.edu" target="_blank">bourdin@lsu.edu</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I want to change the way I handle boundary conditions in my finite elements code:<br>
Right now, I skip the rows and columns during the matrices assembly, using a flag (a SectionInt). Using an IS denoting all dof with a BC and MatZeroRowsColumns, MatZeroRowsColumnsIS or MatZeroRowsColumnsLocal would make much more sense.<br>

<br>
The difficulty comes up when applying a Dirichlet boundary condition on only one of the dof associated with a vertex (roller boundary conditions in elasticity, for instance). What I can easily get from Sieve is the point number associated with a vertex, for instance, from which I can obtain the _local_ index of the dof associated with a given component of a field at this point. For vectors, I can then set values on the local Vec or the Section. For matrices, though I can't just use MatGetLocalSubMatrix since I need also to modify the out of diagonal block terms.<br>

<br>
I guess I need the LocalToGlobalMapping or to renumber the IS describing my BC and convert it to global indices. I am sure that this information is somewhere in Sieve (in the overlap, I guess), but I was thinking that since getting a Local to Global scatter is trivial, there may be a way to obtain the mapping or renumbering the IS from the scatter.<br>

<br>
Now that I think about it more, the right way is most likely to get the information I need from Sieve.</blockquote><div><br></div><div>Yes, in the new version there is jsut a LocalToGlobalMapping. In C++, you can use the GlobalNumbering,</div>
<div><br></div><div>  numbering->getIndex(point) + dof offset</div></div></blockquote><div><br></div>And for the record, in the old version, where a DMMesh can be associated with several data layout, the following seems to work (adapted from DMCreateLocalToGlobalMapping_Mesh):</div><div><div><br></div><div>  Obj<PETSC_MESH_TYPE::real_section_type> s;</div><div>  ALE::Obj<PETSC_MESH_TYPE> m;</div><div>  ierr = DMMeshGetMesh(dm, m);CHKERRQ(ierr);</div><div>  ierr = SectionRealGetSection(vsec,s);CHKERRQ(ierr);</div><div>  const ALE::Obj<PETSC_MESH_TYPE::order_type>& globalOrder = m->getFactory()->getGlobalOrder(m, s->getName(), s);</div><div><div><br></div><div><br></div><div>  offset = globalOrder->getIndex(point) + dof ;</div></div><div><br></div><div>Blaise</div><div><span class="Apple-style-span" style="font-size: 12px; ">-- </span></div></div><div apple-content-edited="true"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 12px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Department of Mathematics and Center for Computation & Technology</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Louisiana State University, Baton Rouge, LA 70803, USA</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 <a href="http://www.math.lsu.edu/~bourdin">http://www.math.lsu.edu/~bourdin</a></div><div><br class="khtml-block-placeholder"></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></div></span></div></span><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></body></html>