[petsc-dev] DMDA_*PERIODIC and DMDA_XYZGHOSTED
Lisandro Dalcin
dalcinl at gmail.com
Thu Mar 10 16:14:27 CST 2011
Ups, my previous patch was missing the bit below:
$ hg diff src/dm/impls/da/da1.c
diff -r 3923fa35e382 src/dm/impls/da/da1.c
--- a/src/dm/impls/da/da1.c Thu Mar 10 15:03:35 2011 -0600
+++ b/src/dm/impls/da/da1.c Thu Mar 10 19:12:41 2011 -0300
@@ -297,7 +297,7 @@
*/
for (i=0; i<Xe-IXe; i++) {idx[nn++] = -1; } /* pad with -1s if
needed for ghosted case*/
- ierr = ISLocalToGlobalMappingCreate(comm,nn,idx,PETSC_OWN_POINTER,&da->ltogmap);CHKERRQ(ierr);
+ ierr = ISLocalToGlobalMappingCreate(comm,nn,idx,PETSC_COPY_VALUES,&da->ltogmap);CHKERRQ(ierr);
ierr = ISLocalToGlobalMappingBlock(da->ltogmap,dd->w,&da->ltogmapb);CHKERRQ(ierr);
ierr = PetscLogObjectParent(da,da->ltogmap);CHKERRQ(ierr);
On 10 March 2011 19:07, Lisandro Dalcin <dalcinl at gmail.com> wrote:
> On 10 March 2011 18:55, Ethan Coon <ecoon at lanl.gov> wrote:
>>
>>> >
>>> > What about renaming DMDAPeriodicType -> DMDABoundaryType ?
>>>
>>> I like this suggestion. A patch to make this change can easily be generated.
>>>
>>
>> I'd considered this but wasn't sure if Barry would want to change the
>> API when the rest of this doesn't affect any existing user code. It's
>> definitely clearer with DMDABoundaryType. Should have known the
>> answer ;)
>>
>>> Barry
>>>
>>>
>>> > GHOSTED and
>>> > PERIODIC are different concepts, the enumeration should have a more
>>> > generic name.
>>> >
>>> > BTW, Why don't you?:
>>> >
>>> > +#define DMDAXPeriodic(pt) ((pt) & (DMDA_XPERIODIC ^ DMDA_XGHOSTED))
>>> > instead of the hardwired value?
>>> >
>>
>> No real reason. I'd done the algebra and had it written down that way
>> in my notes, and added the comments as an explanation later. Will
>> happily swap it since it's clearer.
>
> OK.
>
>>
>> Will get patches for these (and the doc fix).
>>
>
> Could you also consider the patch below? I think the CHKMEMQ macros
> should not be there, we are not calling "untrusted" user code, right?
> And the missing free is causing the following output in petsc4py
> testsuite:
>
> $ python test/runtests.py -i da
> [0 at nikola] Python 2.6 (/usr/bin/python)
> [0 at nikola] PETSc 3.1.0-p7 development (conf: 'arch-linux2-c-opt')
> [0 at nikola] petsc4py 1.1.2 (build/lib.linux-x86_64-2.6/petsc4py)
> [0]Total space allocated 123685312 bytes
> [ 0]10137008 bytes DMSetUp_DA_3D() line 1272 in
> /usr/local/petsc/dev/src/dm/impls/da/da3.c
> [ 0]1302848 bytes DMSetUp_DA_3D() line 1272 in
> /usr/local/petsc/dev/src/dm/impls/da/da3.c
>
>
> diff -r 3923fa35e382 src/dm/impls/da/da2.c
> --- a/src/dm/impls/da/da2.c Thu Mar 10 15:03:35 2011 -0600
> +++ b/src/dm/impls/da/da2.c Thu Mar 10 19:03:28 2011 -0300
> @@ -1734,7 +1734,6 @@
> /* ierr = PetscLogObjectMemory(da,nn*dof*sizeof(PetscInt));CHKERRQ(ierr);*/
> ierr = ISGetIndices(ltogis, &idx_full);
> ierr = PetscMemcpy(idx_cpy,idx_full,nn*dof*sizeof(PetscInt));CHKERRQ(ierr);
> - CHKMEMQ;
> ierr = ISRestoreIndices(ltogis, &idx_full);
> ierr = ISLocalToGlobalMappingCreateIS(ltogis,&da->ltogmap);CHKERRQ(ierr);
> ierr = PetscLogObjectParent(da,da->ltogmap);CHKERRQ(ierr);
> diff -r 3923fa35e382 src/dm/impls/da/da3.c
> --- a/src/dm/impls/da/da3.c Thu Mar 10 15:03:35 2011 -0600
> +++ b/src/dm/impls/da/da3.c Thu Mar 10 19:03:28 2011 -0300
> @@ -1273,7 +1273,6 @@
> /* ierr = PetscLogObjectMemory(da,nn*dof*sizeof(PetscInt));CHKERRQ(ierr); */
> ierr = ISGetIndices(ltogis, &idx_full);
> ierr = PetscMemcpy(idx_cpy,idx_full,nn*dof*sizeof(PetscInt));CHKERRQ(ierr);
> - CHKMEMQ;
> ierr = ISRestoreIndices(ltogis, &idx_full);
> ierr = ISLocalToGlobalMappingCreateIS(ltogis,&da->ltogmap);CHKERRQ(ierr);
> ierr = PetscLogObjectParent(da,da->ltogmap);CHKERRQ(ierr);
> diff -r 3923fa35e382 src/dm/impls/da/dadestroy.c
> --- a/src/dm/impls/da/dadestroy.c Thu Mar 10 15:03:35 2011 -0600
> +++ b/src/dm/impls/da/dadestroy.c Thu Mar 10 19:03:28 2011 -0300
> @@ -106,6 +106,7 @@
> ierr = AODestroy(dd->ao);CHKERRQ(ierr);
> }
>
> + ierr = PetscFree(dd->idx);CHKERRQ(ierr);
> ierr = PetscFree(dd->lx);CHKERRQ(ierr);
> ierr = PetscFree(dd->ly);CHKERRQ(ierr);
> ierr = PetscFree(dd->lz);CHKERRQ(ierr);
>
>
> --
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> 3000 Santa Fe, Argentina
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169
>
--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
More information about the petsc-dev
mailing list