Commits

Vijay Mahadevan  committed bc27cf6

Fixing some bugs and freeing memory like I was supposed to.

  • Participants
  • Parent commits 02b5432
  • Branches dmmoab

Comments (0)

Files changed (1)

File src/dm/impls/moab/dmmbmat.cxx

       nnz[i]*=bs;
       if (onz) onz[i]*=bs;
     }
+    PetscInfo3(dm, "Vertex ID: %D \t NNZ = %D \t ONZ = %D.\n",i,nnz[i],onz[i]);
     
     if (innz && (nnz[i]>*innz)) *innz=nnz[i];
     if ((ionz && onz) && (onz[i]>*ionz)) *ionz=onz[i];
         ierr = PetscFree(locala);CHKERRQ(ierr);
         ierr = PetscFree(dof_indices);CHKERRQ(ierr);
       }
-      ierr = PetscMalloc(sizeof(PetscScalar)*nconn*nconn*dmmoab->numFields,&locala);CHKERRQ(ierr);
-      ierr = PetscMemzero(locala,sizeof(PetscScalar)*nconn*nconn*dmmoab->numFields);CHKERRQ(ierr);
+      ierr = PetscMalloc(sizeof(PetscScalar)*nconn*nconn*dmmoab->numFields*dmmoab->numFields,&locala);CHKERRQ(ierr);
+      ierr = PetscMemzero(locala,sizeof(PetscScalar)*nconn*nconn*dmmoab->numFields*dmmoab->numFields);CHKERRQ(ierr);
       ierr = PetscMalloc(sizeof(PetscInt)*nconn,&dof_indices);CHKERRQ(ierr);
+      PetscInfo2(dm, "Allocating new memory and zeroing out for locala. [Prev: %d,  Curr-size: %d].\n",prev_nconn*prev_nconn*dmmoab->numFields*dmmoab->numFields,nconn*nconn*dmmoab->numFields*dmmoab->numFields);
       prev_nconn=nconn;
     }
 
   }
 
   /* clean up memory */
-  if (locala) {
-    ierr = PetscFree(locala);CHKERRQ(ierr);
-  }
+  ierr = PetscFree(locala);CHKERRQ(ierr);
+  ierr = PetscFree(dof_indices);CHKERRQ(ierr);
 
   /* finish assembly */
   ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);