On Fri, Sep 11, 2015 at 8:37 AM, Gideon Simpson <[email protected]> wrote:
> There doesn’t seem to be a global analog of DMCompositeGetLocalVectors. > Do I need to do manual indexing? > Its simple, lets just write it: http://www.mcs.anl.gov/petsc/petsc-current/src/dm/impls/composite/pack.c.html#DMCompositeGetLocalVectors and from looking at the code here http://www.mcs.anl.gov/petsc/petsc-current/src/dm/impls/composite/pack.c.html#DMCompositeScatter All we have to do is write one function which gives back a bunch of Global vectors pointing at the same memory. We use PlaceArray() on the Get call, and ResetArray() on the Restore call. I can't believe this isn't in there already, but I think O(0) people use DMComposite right now. Matt > -gideon > > On Sep 11, 2015, at 9:36 AM, Matthew Knepley <[email protected]> wrote: > > On Fri, Sep 11, 2015 at 8:15 AM, Gideon Simpson <[email protected]> > wrote: > >> Ok, so here’s some behavior I don’t understand. I am working with a >> DMComposite structure, and I do the following, >> >> SNESComputeFunction(snes,U_refine,r); >> SNESGetDM(snes, &dm_refine); >> >> DMCompositeGetLocalVectors(dm_refine, &rp, &rQ); >> DMCompositeScatter(dm_refine, r, rp, rQ); >> >> VecNorm(r, NORM_2, &r_norm); >> VecNorm(rp, NORM_2, &rp_norm); >> VecNorm(rQ, NORM_2, &rQ_norm); >> >> VecGetSize(r,&r_size); >> VecGetSize(rp, &rp_size); >> VecGetSize(rQ, &rQ_size); >> >> DMCompositeRestoreLocalVectors(dm_refine, &rp, &rQ); >> VecDestroy(&r); >> >> PetscPrintf(PETSC_COMM_WORLD," ||r|| = %g, %i >> entries\n",r_norm,r_size); >> PetscPrintf(PETSC_COMM_WORLD," ||rp|| = %g, %i >> entries\n",rp_norm,rp_size); >> PetscPrintf(PETSC_COMM_WORLD," ||rQ|| = %g, %i >> entries\n",rQ_norm,rQ_size); >> >> and my output is: >> >> ||r|| = 225.31, 7999 entries >> ||rp|| = 140.021, 3 entries >> ||rQ|| = 176.56, 8004 entries >> >> >> The arithmetic, is off, no? >> > > I think you want Global vectors for this, not Local vectors. > > Matt > > >> -gideon >> >> On Sep 10, 2015, at 5:28 PM, Barry Smith <[email protected]> wrote: >> >> >> SNESGetDM() this will return not the original DM you set but the >> refined one. >> >> On Sep 10, 2015, at 3:47 PM, Gideon Simpson <[email protected]> >> wrote: >> >> I’m using a DMCompsosite along with grid sequencing and here’s what I’m >> trying to accomplish. After running the SNES solve, I’d like to evaluate >> the residual on the refined grid, on each piece of the DMComposite. How do >> I get a DM for the refined grid which I can then use with >> DMCompositeGetLocalVectors in order to get each piece of the problem? Or >> is there a better way? >> >> -gideon >> >> >> >> > > > -- > 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 > > > -- 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
