[petsc-dev] Getting "from" and "to" IS from a VecScatter
Blaise Bourdin
bourdin at lsu.edu
Wed Jun 20 21:40:12 CDT 2012
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.
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
More information about the petsc-dev
mailing list