1999-04-22 07:50:29 +08:00
|
|
|
/*BHEADER**********************************************************************
|
2008-07-18 09:34:48 +08:00
|
|
|
* Copyright (c) 2008, Lawrence Livermore National Security, LLC.
|
2006-07-28 07:26:57 +08:00
|
|
|
* 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.
|
1999-04-22 07:50:29 +08:00
|
|
|
*
|
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.
|
1999-04-22 07:50:29 +08:00
|
|
|
*
|
|
|
|
|
* $Revision$
|
2006-07-28 07:26:57 +08:00
|
|
|
***********************************************************************EHEADER*/
|
|
|
|
|
|
2006-09-23 06:06:21 +08:00
|
|
|
|
|
|
|
|
|
2007-11-14 01:54:43 +08:00
|
|
|
|
1999-04-22 07:50:29 +08:00
|
|
|
/******************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* Member functions for hypre_DistributedMatrix class for par_csr storage scheme.
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "./distributed_matrix.h"
|
|
|
|
|
|
1999-08-20 10:55:32 +08:00
|
|
|
#include "HYPRE_parcsr_mv.h"
|
1999-04-22 07:50:29 +08:00
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
1999-09-21 01:53:45 +08:00
|
|
|
* hypre_DistributedMatrixDestroyParCSR
|
1999-04-22 07:50:29 +08:00
|
|
|
* Internal routine for freeing a matrix stored in Parcsr form.
|
|
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int
|
1999-09-21 01:53:45 +08:00
|
|
|
hypre_DistributedMatrixDestroyParCSR( hypre_DistributedMatrix *distributed_matrix )
|
1999-04-22 07:50:29 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
1999-09-21 01:53:45 +08:00
|
|
|
* hypre_DistributedMatrixInitializeParCSR
|
1999-04-22 07:50:29 +08:00
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* matrix must be set before calling this function*/
|
|
|
|
|
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int
|
1999-09-21 01:53:45 +08:00
|
|
|
hypre_DistributedMatrixInitializeParCSR(hypre_DistributedMatrix *matrix)
|
1999-04-22 07:50:29 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
* Optional routines that depend on underlying storage type
|
|
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
1999-09-21 01:53:45 +08:00
|
|
|
* hypre_DistributedMatrixPrintParCSR
|
1999-04-22 07:50:29 +08:00
|
|
|
* Internal routine for printing a matrix stored in Parcsr form.
|
|
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int
|
1999-09-21 01:53:45 +08:00
|
|
|
hypre_DistributedMatrixPrintParCSR( hypre_DistributedMatrix *matrix )
|
1999-04-22 07:50:29 +08:00
|
|
|
{
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int ierr=0;
|
1999-04-22 07:50:29 +08:00
|
|
|
HYPRE_ParCSRMatrix Parcsr_matrix = (HYPRE_ParCSRMatrix) hypre_DistributedMatrixLocalStorage(matrix);
|
|
|
|
|
|
1999-09-18 03:13:50 +08:00
|
|
|
HYPRE_ParCSRMatrixPrint( Parcsr_matrix, "STDOUT" );
|
1999-04-22 07:50:29 +08:00
|
|
|
return(ierr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
1999-09-21 01:53:45 +08:00
|
|
|
* hypre_DistributedMatrixGetLocalRangeParCSR
|
1999-04-22 07:50:29 +08:00
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int
|
1999-09-21 01:53:45 +08:00
|
|
|
hypre_DistributedMatrixGetLocalRangeParCSR( hypre_DistributedMatrix *matrix,
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int *row_start,
|
|
|
|
|
HYPRE_Int *row_end,
|
|
|
|
|
HYPRE_Int *col_start,
|
|
|
|
|
HYPRE_Int *col_end )
|
1999-04-22 07:50:29 +08:00
|
|
|
{
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int ierr=0;
|
1999-04-22 07:50:29 +08:00
|
|
|
HYPRE_ParCSRMatrix Parcsr_matrix = (HYPRE_ParCSRMatrix) hypre_DistributedMatrixLocalStorage(matrix);
|
|
|
|
|
|
|
|
|
|
if (!Parcsr_matrix) return(-1);
|
|
|
|
|
|
|
|
|
|
|
1999-09-18 03:13:50 +08:00
|
|
|
ierr = HYPRE_ParCSRMatrixGetLocalRange( Parcsr_matrix, row_start, row_end,
|
1999-08-18 03:42:02 +08:00
|
|
|
col_start, col_end );
|
1999-04-22 07:50:29 +08:00
|
|
|
|
|
|
|
|
return(ierr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
1999-09-21 01:53:45 +08:00
|
|
|
* hypre_DistributedMatrixGetRowParCSR
|
1999-04-22 07:50:29 +08:00
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int
|
1999-09-21 01:53:45 +08:00
|
|
|
hypre_DistributedMatrixGetRowParCSR( hypre_DistributedMatrix *matrix,
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int row,
|
|
|
|
|
HYPRE_Int *size,
|
|
|
|
|
HYPRE_Int **col_ind,
|
2013-10-12 03:48:06 +08:00
|
|
|
HYPRE_Real **values )
|
1999-04-22 07:50:29 +08:00
|
|
|
{
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int ierr = 0;
|
1999-04-22 07:50:29 +08:00
|
|
|
HYPRE_ParCSRMatrix Parcsr_matrix = (HYPRE_ParCSRMatrix) hypre_DistributedMatrixLocalStorage(matrix);
|
|
|
|
|
|
|
|
|
|
if (!Parcsr_matrix) return(-1);
|
|
|
|
|
|
1999-09-18 03:13:50 +08:00
|
|
|
ierr = HYPRE_ParCSRMatrixGetRow( Parcsr_matrix, row, size, col_ind, values);
|
1999-04-22 07:50:29 +08:00
|
|
|
|
|
|
|
|
return(ierr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
1999-09-21 01:53:45 +08:00
|
|
|
* hypre_DistributedMatrixRestoreRowParCSR
|
1999-04-22 07:50:29 +08:00
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int
|
1999-09-21 01:53:45 +08:00
|
|
|
hypre_DistributedMatrixRestoreRowParCSR( hypre_DistributedMatrix *matrix,
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int row,
|
|
|
|
|
HYPRE_Int *size,
|
|
|
|
|
HYPRE_Int **col_ind,
|
2013-10-12 03:48:06 +08:00
|
|
|
HYPRE_Real **values )
|
1999-04-22 07:50:29 +08:00
|
|
|
{
|
2010-12-21 03:27:44 +08:00
|
|
|
HYPRE_Int ierr;
|
1999-04-22 07:50:29 +08:00
|
|
|
HYPRE_ParCSRMatrix Parcsr_matrix = (HYPRE_ParCSRMatrix) hypre_DistributedMatrixLocalStorage(matrix);
|
|
|
|
|
|
|
|
|
|
if (Parcsr_matrix == NULL) return(-1);
|
|
|
|
|
|
1999-09-18 03:13:50 +08:00
|
|
|
ierr = HYPRE_ParCSRMatrixRestoreRow( Parcsr_matrix, row, size, col_ind, values);
|
1999-04-22 07:50:29 +08:00
|
|
|
|
|
|
|
|
return(ierr);
|
|
|
|
|
}
|