On Wed, Jun 20, 2012 at 8:40 PM, Blaise Bourdin <bourdin at lsu.edu> wrote:
> Hi, > > I want to change the way I handle boundary conditions in my finite > elements code: > 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. > > 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. > > 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. > > Now that I think about it more, the right way is most likely to get the > information I need from Sieve. Yes, in the new version there is jsut a LocalToGlobalMapping. In C++, you can use the GlobalNumbering, numbering->getIndex(point) + dof offset Matt > > Blaise > > > On Jun 20, 2012, at 7:23 PM, Barry Smith wrote: > > > > > Why do you need them? Maybe there is a better way? > > > > > > On Jun 20, 2012, at 6:19 PM, Blaise Bourdin wrote: > > > >> Hi, > >> > >> I need to reconstruct the IS that were used to build a VecScatter > between a local and a global Vec. > >> > >> From what I see in VecScatterView_MPI (vpscat.c:13), it looks like I > can get the indices from from->local.vslots[i],to->local.vslots[i], i=0 .. > i<to->local.n where from and to are obtained with > >> VecScatter_MPI_General *to=(VecScatter_MPI_General*)ctx->todata; > >> VecScatter_MPI_General *from=(VecScatter_MPI_General*)ctx->fromdata; > >> > >> From there, constructing the IS is trivial. Is there a way that does > not involve poking inside the VecScatter data structure? > >> > >> Blaise > >> > >> > >> -- > >> Department of Mathematics and Center for Computation & Technology > >> Louisiana State University, Baton Rouge, LA 70803, USA > >> Tel. +1 (225) 578 1612, Fax +1 (225) 578 4276 > http://www.math.lsu.edu/~bourdin > >> > >> > >> > >> > >> > >> > >> > > > > -- > Department of Mathematics and Center for Computation & Technology > Louisiana State University, Baton Rouge, LA 70803, USA > Tel. +1 (225) 578 1612, Fax +1 (225) 578 4276 > http://www.math.lsu.edu/~bourdin > > > > > > > > -- 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-dev/attachments/20120621/e5269bd8/attachment.html>