Commits

Matt Knepley  committed c83e374

DM: Removed code to uncompose nullspace/pmat
- This was to prevent reference cycles, which happen with MatNullSpace using DM Vecs, but its fragile
- My current solution is to strip out DM from Vecs in a MatNullSpace, but that sucks too. Need a better solution

  • Participants
  • Parent commits 9987a3f

Comments (0)

Files changed (1)

File src/dm/interface/dm.c

 @*/
 PetscErrorCode  DMDestroy(DM *dm)
 {
-  PetscInt       i, cnt = 0, Nf = 0, f;
+  PetscInt       i, cnt = 0;
   DMNamedVecLink nlink,nnext;
   PetscErrorCode ierr;
 
   if (!*dm) PetscFunctionReturn(0);
   PetscValidHeaderSpecific((*dm),DM_CLASSID,1);
 
-  if ((*dm)->prob) {
-    PetscObject disc;
-
-    /* I think it makes sense to dump all attached things when you are destroyed, which also eliminates circular references */
-    ierr = PetscDSGetNumFields((*dm)->prob, &Nf);CHKERRQ(ierr);
-    for (f = 0; f < Nf; ++f) {
-      ierr = PetscDSGetDiscretization((*dm)->prob, f, &disc);CHKERRQ(ierr);
-      ierr = PetscObjectCompose(disc, "pmat", NULL);CHKERRQ(ierr);
-      ierr = PetscObjectCompose(disc, "nullspace", NULL);CHKERRQ(ierr);
-      ierr = PetscObjectCompose(disc, "nearnullspace", NULL);CHKERRQ(ierr);
-    }
-  }
   /* count all the circular references of DM and its contained Vecs */
   for (i=0; i<DM_MAX_WORK_VECTORS; i++) {
     if ((*dm)->localin[i])  cnt++;