[petsc-dev] Some questions about adding default global to local, etc., functions for DMShell
Matthew Knepley
knepley at gmail.com
Wed Mar 6 14:18:33 CST 2013
On Wed, Mar 6, 2013 at 2:54 PM, Richard Tran Mills <rtm at eecs.utk.edu> wrote:
> Hi Folks,
>
> I am adding some pointers to scatter contexts within the internal "data"
> struct for DMShell, e.g. the 'gtol' and 'ltog' members in
>
> typedef struct {
> Vec Xglobal;
> Vec Xlocal;
> Mat A;
> VecScatter *gtol;
> VecScatter *ltog;
> } DM_Shell;
>
> First question: When in DMCreate_Shell we do
>
> ierr = PetscNewLog(dm,DM_Shell,&shell);CHKERRQ(ierr);
>
> will this guarantee that gtol and ltog are set to NULL, or do I need to
> explicitly set these somewhere? I see that the allocated memory is zeroed
> but I'm not sure how NULL might actually be represented in memory.
>
Yes, they will be NULL.
> I have also added some new functions like
> DMShellDefaultGlobalToLocalBegin()/End(), and in DMCreate_Shell I do
>
> dm->ops->globaltolocalbegin = DMShellDefaultGlobalToLocalBegin;
> dm->ops->globaltolocalend = DMShellDefaultGlobalToLocalEnd;
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130306/32951c50/attachment.html>
More information about the petsc-dev
mailing list