/*@C DMDASetFieldNames - Sets the name of each component in the vector associated with the DMDA Collective on TS Input Parameters: + dm - the DMDA object - names - the names of the components, final string must be NULL, must have the same number of entries as the dof used in creating the DMDA Level: intermediate .keywords: distributed array, get, component name .seealso: DMDAGetFieldName(), DMDASetCoordinateName(), DMDAGetCoordinateName(), DMDASetFieldName() @*/ PetscErrorCode DMDASetFieldNames(DM da,const char * const *names) { PetscErrorCode ierr; DM_DA *dd = (DM_DA*)da->data; PetscFunctionBegin; ierr = PetscStrArrayDestroy(&dd->fieldname);CHKERRQ(ierr); ierr = PetscStrArrayallocpy(names,&dd->fieldname);CHKERRQ(ierr); PetscFunctionReturn(0); }
/*@C PetscDrawBarDestroy - Frees all space taken up by bar graph data structure. Collective over PetscDrawBar Input Parameter: . bar - The bar graph context Level: intermediate .seealso: PetscDrawBarCreate() @*/ PetscErrorCode PetscDrawBarDestroy(PetscDrawBar *bar) { PetscErrorCode ierr; PetscFunctionBegin; if (!*bar) PetscFunctionReturn(0); PetscValidHeaderSpecific(*bar,PETSC_DRAWBAR_CLASSID,1); if (--((PetscObject)(*bar))->refct > 0) PetscFunctionReturn(0); ierr = PetscFree((*bar)->values);CHKERRQ(ierr); ierr = PetscStrArrayDestroy(&(*bar)->labels);CHKERRQ(ierr); ierr = PetscDrawAxisDestroy(&(*bar)->axis);CHKERRQ(ierr); ierr = PetscDrawDestroy(&(*bar)->win);CHKERRQ(ierr); ierr = PetscHeaderDestroy(bar);CHKERRQ(ierr); PetscFunctionReturn(0); }
/*@C PetscBagDestroy - Destroys a bag values Collective on PetscBag Input Parameter: . bag - the bag of values Level: beginner .seealso: PetscBag, PetscBagSetName(), PetscBagView(), PetscBagLoad(), PetscBagGetData() PetscBagRegisterReal(), PetscBagRegisterInt(), PetscBagRegisterBool(), PetscBagRegisterScalar() PetscBagSetFromOptions(), PetscBagCreate(), PetscBagGetName(), PetscBagRegisterEnum() @*/ PetscErrorCode PetscBagDestroy(PetscBag *bag) { PetscErrorCode ierr; PetscBagItem nitem = (*bag)->bagitems,item; PetscFunctionBegin; while (nitem) { item = nitem->next; if (nitem->list) { ierr = PetscStrArrayDestroy(&nitem->list);CHKERRQ(ierr); } ierr = PetscFree(nitem);CHKERRQ(ierr); nitem = item; } if ((*bag)->bagprefix) { ierr = PetscFree((*bag)->bagprefix);CHKERRQ(ierr); } ierr = PetscFree(*bag);CHKERRQ(ierr); PetscFunctionReturn(0); }