hypre/distributed_matrix/distributed_matrix_parcsr.c

134 lines
4.6 KiB
C
Raw Normal View History

/*BHEADER**********************************************************************
2008-07-18 09:34:48 +08:00
* Copyright (c) 2008, Lawrence Livermore National Security, LLC.
* Produced at the Lawrence Livermore National Laboratory.
2008-07-18 09:34:48 +08:00
* This file is part of HYPRE. See file COPYRIGHT for details.
*
2008-07-18 09:34:48 +08:00
* HYPRE is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License (as published by the Free
* Software Foundation) version 2.1 dated February 1999.
*
* $Revision$
***********************************************************************EHEADER*/
2006-09-23 06:06:21 +08:00
/******************************************************************************
*
* Member functions for hypre_DistributedMatrix class for par_csr storage scheme.
*
*****************************************************************************/
#include "./distributed_matrix.h"
#include "HYPRE_parcsr_mv.h"
/*--------------------------------------------------------------------------
1999-09-21 01:53:45 +08:00
* hypre_DistributedMatrixDestroyParCSR
* Internal routine for freeing a matrix stored in Parcsr form.
*--------------------------------------------------------------------------*/
HYPRE_Int
1999-09-21 01:53:45 +08:00
hypre_DistributedMatrixDestroyParCSR( hypre_DistributedMatrix *distributed_matrix )
{
return(0);
}
/*--------------------------------------------------------------------------
1999-09-21 01:53:45 +08:00
* hypre_DistributedMatrixInitializeParCSR
*--------------------------------------------------------------------------*/
/* matrix must be set before calling this function*/
HYPRE_Int
1999-09-21 01:53:45 +08:00
hypre_DistributedMatrixInitializeParCSR(hypre_DistributedMatrix *matrix)
{
return 0;
}
/*--------------------------------------------------------------------------
* Optional routines that depend on underlying storage type
*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------
1999-09-21 01:53:45 +08:00
* hypre_DistributedMatrixPrintParCSR
* Internal routine for printing a matrix stored in Parcsr form.
*--------------------------------------------------------------------------*/
HYPRE_Int
1999-09-21 01:53:45 +08:00
hypre_DistributedMatrixPrintParCSR( hypre_DistributedMatrix *matrix )
{
HYPRE_Int ierr=0;
HYPRE_ParCSRMatrix Parcsr_matrix = (HYPRE_ParCSRMatrix) hypre_DistributedMatrixLocalStorage(matrix);
HYPRE_ParCSRMatrixPrint( Parcsr_matrix, "STDOUT" );
return(ierr);
}
/*--------------------------------------------------------------------------
1999-09-21 01:53:45 +08:00
* hypre_DistributedMatrixGetLocalRangeParCSR
*--------------------------------------------------------------------------*/
HYPRE_Int
1999-09-21 01:53:45 +08:00
hypre_DistributedMatrixGetLocalRangeParCSR( hypre_DistributedMatrix *matrix,
HYPRE_Int *row_start,
HYPRE_Int *row_end,
HYPRE_Int *col_start,
HYPRE_Int *col_end )
{
HYPRE_Int ierr=0;
HYPRE_ParCSRMatrix Parcsr_matrix = (HYPRE_ParCSRMatrix) hypre_DistributedMatrixLocalStorage(matrix);
if (!Parcsr_matrix) return(-1);
ierr = HYPRE_ParCSRMatrixGetLocalRange( Parcsr_matrix, row_start, row_end,
col_start, col_end );
return(ierr);
}
/*--------------------------------------------------------------------------
1999-09-21 01:53:45 +08:00
* hypre_DistributedMatrixGetRowParCSR
*--------------------------------------------------------------------------*/
HYPRE_Int
1999-09-21 01:53:45 +08:00
hypre_DistributedMatrixGetRowParCSR( hypre_DistributedMatrix *matrix,
HYPRE_Int row,
HYPRE_Int *size,
HYPRE_Int **col_ind,
HYPRE_Real **values )
{
HYPRE_Int ierr = 0;
HYPRE_ParCSRMatrix Parcsr_matrix = (HYPRE_ParCSRMatrix) hypre_DistributedMatrixLocalStorage(matrix);
if (!Parcsr_matrix) return(-1);
ierr = HYPRE_ParCSRMatrixGetRow( Parcsr_matrix, row, size, col_ind, values);
return(ierr);
}
/*--------------------------------------------------------------------------
1999-09-21 01:53:45 +08:00
* hypre_DistributedMatrixRestoreRowParCSR
*--------------------------------------------------------------------------*/
HYPRE_Int
1999-09-21 01:53:45 +08:00
hypre_DistributedMatrixRestoreRowParCSR( hypre_DistributedMatrix *matrix,
HYPRE_Int row,
HYPRE_Int *size,
HYPRE_Int **col_ind,
HYPRE_Real **values )
{
HYPRE_Int ierr;
HYPRE_ParCSRMatrix Parcsr_matrix = (HYPRE_ParCSRMatrix) hypre_DistributedMatrixLocalStorage(matrix);
if (Parcsr_matrix == NULL) return(-1);
ierr = HYPRE_ParCSRMatrixRestoreRow( Parcsr_matrix, row, size, col_ind, values);
return(ierr);
}