Hi Barry, I used the names without underscores because at first my intention had been for those to simply be user functions like SNESConvergedDefault(), and if a user wanted them to be used then this had to be explicitly set via DMShellSetGlobalToLocalBegin()/End(). After adding DMShellSetGlobalToLocalVecScatter(), I'm having trouble thinking of a good reason that DMShellDefaultGlobalToLocalBegin()/End() need to be user functions, but I think I lean towards keeping them that way because
1) DMShell is supposed to be able to wrap *anything*, and maybe there is some weird situation in which DMShellDefaultGlobalToLocalBegin()/End() should be called, but something else should happen as well to some ancillary data, analogous to how in PFLOTRAN we call SNESConvergedDefault() in our convergence routines but then run a bunch of other checks as well. 2) Since the user can set dm->ops->globaltolocalbegin/end to whatever they want via DMShellSetGlobalToLocalBegin()/End(), I just like the completeness of having the default functions exposed so that the user could set things back to that. But if everyone prefers, we can make those private. Thanks for the pointer to the current developers guide. After hacking on some PETSc internals after a long hiatus, I had been about to ask where that lived these days, actually. =) --Richard On 3/6/13 4:19 PM, Barry Smith wrote: > [...] > I have also added some new functions like > DMShellDefaultGlobalToLocalBegin()/End(), and in DMCreate_Shell I do > > dm->ops->globaltolocalbegin = DMShellDefaultGlobalToLocalBegin; > dm->ops->globaltolocalend = DMShellDefaultGlobalToLocalEnd; > > Bad names. Since they are not user functions they should have an > underscore in them and specification of implementation after the underscore. > Perhaps DMGlobalToLocalBegin_Shell_Default? > > Check out the PETSc developers manual style guide (which is now chapter > one so people actually read it :-)) Section 1.1 and 1.2 > http://www.mcs.anl.gov/petsc/developers/developers.pdf > > > Barry > > > >> The user can set different routines via >> DMShellSetGlobalToLocalBegin()/End(), but if the user only sets the gtol and >> ltog scatter contexts, then the default routines will perform the >> appropriate scatter operations. >> >> Second question: What is the proper "PETSc way" to throw an error if gtol is >> NULL and tell the user that DMShellDefaultGlobalToLocalBegin() cannot be >> used without first setting the scatter context via >> DMShellSetGlobalToLocalVecScatter()? >> >> SETERRQ(comm, PETSC_ERR_ARG_WRONGSTATE, "DMShellDefaultGlobalToLocalBegin() >> cannot be used without first setting the scatter context via >> DMShellSetGlobalToLocalVecScatter()"); >> >> Matt >> >> Thanks, >> Richard >> >> >> >> -- >> Richard Tran Mills, Ph.D. >> Computational Earth Scientist | Joint Assistant Professor >> Hydrogeochemical Dynamics Team | EECS and Earth & Planetary Sciences >> Oak Ridge National Laboratory | University of Tennessee, Knoxville >> E-mail: >> rmills at ornl.gov V: 865-241-3198 http://climate.ornl.gov/~rmills >> >> >> >> -- >> 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 -- Richard Tran Mills, Ph.D. Computational Earth Scientist | Joint Assistant Professor Hydrogeochemical Dynamics Team | EECS and Earth & Planetary Sciences Oak Ridge National Laboratory | University of Tennessee, Knoxville E-mail: rmills at ornl.gov V: 865-241-3198 http://climate.ornl.gov/~rmills
