[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Richard Tran Mills
Hi Folks, I want to set a LocalToGlobal mapping in a DMShell object. Should we add a DMShell routine to do this, or just add a DMSetLocalToGlobalMapping() routine? Thanks, Richard -- Richard Tran Mills, Ph.D. Computational Earth Scientist | Joint Assistant Professor Hydrogeochemical Dyn

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Jed Brown
It would be natural to have a matching interface, but why do you need it? You're in charge of making the matrices and vectors so you can give them local-to-global mappings. The only solver that calls DMGetLocalToGlobalMapping is PCEXOTIC, which only works with DMDA anyway. On Thu, Feb 21, 2013 at

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Peter Brune
Jed, I disagree; It's quite natural to want custom bindings for these things if you want some new mesh type to have local-to-global and global-to-local operations over that mesh. Having it abstracted out to the matrix or vector is constraining. They should totally be in there and should be implem

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Richard Tran Mills
Hi Jed, The reason is that in the PFLOTRAN code we currently have some code like this: > select case(discretization%itype) > case(STRUCTURED_GRID,STRUCTURED_GRID_MIMETIC) > call > DMLocalToGlobalBegin(dm_ptr%sgdm,local_vec,INSERT_VALUES,global_vec,ierr) > call > DMLocalToGloba

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Jed Brown
On Thu, Feb 21, 2013 at 12:48 PM, Peter Brune wrote: > Jed, I disagree; It's quite natural to want custom bindings for these > things if you want some new mesh type to have local-to-global and > global-to-local operations over that mesh. Having it abstracted out to the > matrix or vector is cons

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Dmitry Karpeev
On Thu, Feb 21, 2013 at 12:54 PM, Richard Tran Mills wrote: > Hi Jed, > > The reason is that in the PFLOTRAN code we currently have some code like > this: > > select case(discretization%itype) > case(STRUCTURED_GRID,STRUCTURED_GRID_MIMETIC) > call > DMLocalToGlobalBegin(dm_ptr%sgdm,lo

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Jed Brown
On Thu, Feb 21, 2013 at 12:58 PM, Dmitry Karpeev wrote: > I would vote for DMGetLocalToGlobalMapping() etc. > That has the flexibility to be used with DM-impl-oblivious codes. > http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMGetLocalToGlobalMapping.html It looks like Rich wan

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Peter Brune
On Thu, Feb 21, 2013 at 12:58 PM, Dmitry Karpeev wrote: > > > On Thu, Feb 21, 2013 at 12:54 PM, Richard Tran Mills eecs.utk.edu>wrote: > >> Hi Jed, >> >> The reason is that in the PFLOTRAN code we currently have some code like >> this: >> >> select case(discretization%itype) >> case(STRUCT

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Jed Brown
On Thu, Feb 21, 2013 at 1:05 PM, Peter Brune wrote: > > The Set is the issue at hand; > I think he needs scatters, not ISLocalToGlobalMappings, as mentioned in my other email. > and it probably belongs in DMShell as a Set/SetCreate pair like everything > else in DMShell. > Yes --

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Matthew Knepley
On Thu, Feb 21, 2013 at 2:07 PM, Jed Brown wrote: > > On Thu, Feb 21, 2013 at 1:05 PM, Peter Brune wrote: > >> >> The Set is the issue at hand; >> > > I think he needs scatters, not ISLocalToGlobalMappings, as mentioned in my > other email. > Yes, he needs the local to global scatters. Rich, I

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Jed Brown
On Thu, Feb 21, 2013 at 1:10 PM, Matthew Knepley wrote: > Yes, he needs the local to global scatters. Rich, I think the easiest way > to do this now may be > to define your data layout as a PetscSection (these are all local) using > DMSetDefaultSection(), > and record who owns which point using a

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Barry Smith
On Feb 21, 2013, at 1:23 PM, Jed Brown wrote: > > On Thu, Feb 21, 2013 at 1:10 PM, Matthew Knepley wrote: > Yes, he needs the local to global scatters. Rich, I think the easiest way to > do this now may be > to define your data layout as a PetscSection (these are all local) using > DMSetDefa

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Jed Brown
On Thu, Feb 21, 2013 at 1:31 PM, Barry Smith wrote: > I don't understand. There is a DMGlobalToLocalBegin/End() which includes > > } else { > ierr = (*dm->ops->globaltolocalbegin)(dm,g,mode == INSERT_ALL_VALUES ? > INSERT_VALUES : (mode == ADD_ALL_VALUES ? ADD_VALUES : > mode),l);CHKERRQ(i

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Barry Smith
On Feb 21, 2013, at 1:39 PM, Jed Brown wrote: > > On Thu, Feb 21, 2013 at 1:31 PM, Barry Smith wrote: > I don't understand. There is a DMGlobalToLocalBegin/End() which includes > > } else { > ierr = (*dm->ops->globaltolocalbegin)(dm,g,mode == INSERT_ALL_VALUES ? > INSERT_VALUES : (mod

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Jed Brown
On Thu, Feb 21, 2013 at 1:23 PM, Jed Brown wrote: > On Thu, Feb 21, 2013 at 1:10 PM, Matthew Knepley wrote: > >> Yes, he needs the local to global scatters. Rich, I think the easiest way >> to do this now may be >> to define your data layout as a PetscSection (these are all local) using >> DMSetD

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Barry Smith
Jed, The issue is not allowing or even often using SF. The issue is that DMGlobalToLocal() already has the flexibility to use a globaltolocal function pointer. And I object to hiding that or pretending it doesn't exist and saying one HAS to use SF especially if one already has code that

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Jed Brown
On Thu, Feb 21, 2013 at 2:02 PM, Barry Smith wrote: > The issue is not allowing or even often using SF. The issue is that > DMGlobalToLocal() already has the flexibility to use a globaltolocal > function pointer. And I object to hiding that or pretending it doesn't > exist and saying one HAS to

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Richard Tran Mills
I will add DMShellSetGlobalToLocal (and DMShellSetLocalToGlobal). One other thing: We also need to be do LocalToLocal operations. For the structured grid case, we call DMDALocalToLocalBegin/End, and for the unstructured grid case we construct our own VecScatter context essentially just how it i

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-21 Thread Barry Smith
On Feb 21, 2013, at 3:31 PM, Richard Tran Mills wrote: > I will add DMShellSetGlobalToLocal (and DMShellSetLocalToGlobal). > > One other thing: We also need to be do LocalToLocal operations. For the > structured grid case, we call DMDALocalToLocalBegin/End, and for the > unstructured grid cas

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-26 Thread Richard Tran Mills
I think that adding DMLocalToLocalBegin/End makes sense from a consistency standpoint. Should this be done by adding localtolocalbegin/end pointers to dm->ops? --Richard On 2/21/13 4:35 PM, Barry Smith wrote: > On Feb 21, 2013, at 3:31 PM, Richard Tran Mills wrote: > >> I will add DMShellSetG

[petsc-dev] Need mechanism to set LocalToGlobal mapping in a DMShell

2013-02-26 Thread Barry Smith
On Feb 26, 2013, at 2:24 PM, Richard Tran Mills wrote: > I think that adding DMLocalToLocalBegin/End makes sense from a consistency > standpoint. Should this be done by adding localtolocalbegin/end pointers to > dm->ops? Yes, I believe so. Barry > > --Richard > > On 2/21/13 4:35 PM