示例#1
0
int
hypre_StructMatrixDestroy( hypre_StructMatrix *matrix )
{
    int  i;
    int  ierr = 0;

    if (matrix)
    {
        hypre_StructMatrixRefCount(matrix) --;
        if (hypre_StructMatrixRefCount(matrix) == 0)
        {
            if (hypre_StructMatrixDataAlloced(matrix))
            {
                hypre_SharedTFree(hypre_StructMatrixData(matrix));
            }
            hypre_CommPkgDestroy(hypre_StructMatrixCommPkg(matrix));

            hypre_ForBoxI(i, hypre_StructMatrixDataSpace(matrix))
            hypre_TFree(hypre_StructMatrixDataIndices(matrix)[i]);
            hypre_TFree(hypre_StructMatrixDataIndices(matrix));

            hypre_BoxArrayDestroy(hypre_StructMatrixDataSpace(matrix));

            hypre_TFree(hypre_StructMatrixSymmElements(matrix));
            hypre_StructStencilDestroy(hypre_StructMatrixUserStencil(matrix));
            hypre_StructStencilDestroy(hypre_StructMatrixStencil(matrix));
            hypre_StructGridDestroy(hypre_StructMatrixGrid(matrix));

            hypre_TFree(matrix);
        }
    }

    return ierr;
}
int
HYPRE_CommPkgDestroy( HYPRE_CommPkg comm_pkg )
{
   return ( hypre_CommPkgDestroy(comm_pkg) );
}