On Feb 21, 2011, at 3:37 PM, Jed Brown wrote: > ierr = > DMDAGetInfo(dac,&dimc,&Mc,&Nc,&Pc,&mc,&nc,&pc,&dofc,&sc,&wrapc,&stc);CHKERRQ(ierr); > ierr = > DMDAGetInfo(daf,&dimf,&Mf,&Nf,&Pf,&mf,&nf,&pf,&doff,&sf,&wrapf,&stf);CHKERRQ(ierr); > if (dimc != dimf) > SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Dimensions of DMDA do > not match %D %D",dimc,dimf);CHKERRQ(ierr); > if (dofc != doff) > SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"DOF of DMDA do not > match %D %D",dofc,doff);CHKERRQ(ierr); > if (sc != sf) > SETERRQ2(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Stencil width of DMDA > do not match %D %D",sc,sf);CHKERRQ(ierr); > if (wrapc != wrapf) > SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Periodic type > different in two DMDAs");CHKERRQ(ierr); > if (stc != stf) > SETERRQ(((PetscObject)daf)->comm,PETSC_ERR_ARG_INCOMP,"Stencil type different > in two DMDAs");CHKERRQ(ierr); > if (Mc < 2) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Coarse grid > requires at least 2 points in x direction"); > if (dimc > 1 && Nc < 2) > SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Coarse grid requires at > least 2 points in y direction"); > if (dimc > 2 && Pc < 2) > SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Coarse grid requires at > least 2 points in z direction"); > > Several of these are not necessary. DMGetInjection_DA_3D: > > ierr = DMDAGetInfo(dac,0,&Mx,&My,&Mz,0,0,0,0,0,&pt,0);CHKERRQ(ierr); > ierr = DMDAGetInfo(daf,0,&mx,&my,&mz,0,0,0,&dof,0,0,0);CHKERRQ(ierr); > > Seems silly to fail when not necessary. I'm inclined to move the guards into > the specific implementation so that only the necessary amount of consistency > needs to be checked. How about getting rid of DMGetInjection_DA entirely and > just set the appropriate ops slot?
Right. Feel free to split it apart into the separate functions that go into the slot and remove the DMGetInjection_DA It is just of this style because it was coded before DM was a gleam in my eye and needs refactoring Barry