Commits

Lisandro Dalcin committed 7c7de69

Quick fix IGASetFieldName()

  • Participants
  • Parent commits 40d08ae

Comments (0)

Files changed (1)

File src/petiga.c

   if (field < 0 || field >= iga->dof)
     SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,
              "Field number must be in range [0,%D], got %D",iga->dof-1,field);
-  if (!iga->fieldname) {
-    ierr = PetscMalloc1(iga->dof+1,&iga->fieldname);CHKERRQ(ierr);
-    ierr = PetscMemzero(iga->fieldname,(iga->dof+1)*sizeof(char*));CHKERRQ(ierr);
-  }
+  if (!iga->fieldname) {ierr = PetscCalloc1(iga->dof+1,&iga->fieldname);CHKERRQ(ierr);}
   ierr = PetscStrallocpy(name,&fname);CHKERRQ(ierr);
   ierr = PetscFree(iga->fieldname[field]);CHKERRQ(ierr);
   iga->fieldname[field] = fname;
-  if (iga->node_dm) {ierr = DMDASetFieldName(iga->node_dm,field,name);CHKERRQ(ierr);}
+  if (iga->node_dm) {ierr = DMDASetFieldName(iga->node_dm,field,fname);CHKERRQ(ierr);}
   PetscFunctionReturn(0);
 }