[petsc-dev] Some questions about adding default global to local, etc., functions for DMShell

Richard Tran Mills rtm at eecs.utk.edu
Wed Mar 6 13:54:39 CST 2013


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.

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()?

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130306/3b8c48c8/attachment.html>


More information about the petsc-dev mailing list