hypre/distributed_matrix/HYPRE_distributed_matrix.c
falgout 46488e8cbc Added HYPRE_Complex and HYPRE_Real types in place of double.
Added an example code to test CG on a 4D HYPRE_SSTRUCT complex problem.
Added regression tests for bigint, maxdim, and complex.
Added a test to make sure double types are not added to the source.
See [Issue995] in the tracker for more details.
2013-10-11 19:48:06 +00:00

279 lines
9.7 KiB
C

/*BHEADER**********************************************************************
* Copyright (c) 2008, Lawrence Livermore National Security, LLC.
* Produced at the Lawrence Livermore National Laboratory.
* This file is part of HYPRE. See file COPYRIGHT for details.
*
* 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*/
/******************************************************************************
*
* HYPRE_DistributedMatrix interface
*
*****************************************************************************/
#include "./distributed_matrix.h"
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixCreate
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixCreate( MPI_Comm context, HYPRE_DistributedMatrix *matrix )
{
HYPRE_Int ierr = 0;
*matrix = (HYPRE_DistributedMatrix)
hypre_DistributedMatrixCreate( context );
return ( ierr );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixDestroy
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixDestroy( HYPRE_DistributedMatrix matrix )
{
return( hypre_DistributedMatrixDestroy( (hypre_DistributedMatrix *) matrix ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixLimitedDestroy
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixLimitedDestroy( HYPRE_DistributedMatrix matrix )
{
return( hypre_DistributedMatrixLimitedDestroy( (hypre_DistributedMatrix *) matrix ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixInitialize
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixInitialize( HYPRE_DistributedMatrix matrix )
{
return( hypre_DistributedMatrixInitialize( (hypre_DistributedMatrix *) matrix ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixAssemble
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixAssemble( HYPRE_DistributedMatrix matrix )
{
return( hypre_DistributedMatrixAssemble( (hypre_DistributedMatrix *) matrix ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixSetLocalStorageType
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixSetLocalStorageType( HYPRE_DistributedMatrix matrix,
HYPRE_Int type )
{
return( hypre_DistributedMatrixSetLocalStorageType(
(hypre_DistributedMatrix *) matrix, type ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixGetLocalStorageType
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixGetLocalStorageType( HYPRE_DistributedMatrix matrix )
{
return( hypre_DistributedMatrixGetLocalStorageType(
(hypre_DistributedMatrix *) matrix ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixSetLocalStorage
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixSetLocalStorage( HYPRE_DistributedMatrix matrix,
void *LocalStorage )
{
return( hypre_DistributedMatrixSetLocalStorage(
(hypre_DistributedMatrix *) matrix, LocalStorage ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixGetLocalStorage
*--------------------------------------------------------------------------*/
void *
HYPRE_DistributedMatrixGetLocalStorage( HYPRE_DistributedMatrix matrix )
{
return( hypre_DistributedMatrixGetLocalStorage(
(hypre_DistributedMatrix *) matrix ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixSetTranslator
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixSetTranslator( HYPRE_DistributedMatrix matrix,
void *Translator )
{
return( hypre_DistributedMatrixSetTranslator(
(hypre_DistributedMatrix *) matrix, Translator ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixGetTranslator
*--------------------------------------------------------------------------*/
void *
HYPRE_DistributedMatrixGetTranslator( HYPRE_DistributedMatrix matrix )
{
return( hypre_DistributedMatrixGetTranslator(
(hypre_DistributedMatrix *) matrix ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixSetAuxiliaryData
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixSetAuxiliaryData( HYPRE_DistributedMatrix matrix,
void *AuxiliaryData )
{
return( hypre_DistributedMatrixSetAuxiliaryData(
(hypre_DistributedMatrix *) matrix, AuxiliaryData ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixGetAuxiliaryData
*--------------------------------------------------------------------------*/
void *
HYPRE_DistributedMatrixGetAuxiliaryData( HYPRE_DistributedMatrix matrix )
{
return( hypre_DistributedMatrixAuxiliaryData(
(hypre_DistributedMatrix *) matrix ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixGetContext
*--------------------------------------------------------------------------*/
MPI_Comm
HYPRE_DistributedMatrixGetContext( HYPRE_DistributedMatrix matrix )
{
return( hypre_DistributedMatrixContext(
(hypre_DistributedMatrix *) matrix ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixGetDims
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixGetDims( HYPRE_DistributedMatrix matrix,
HYPRE_Int *M, HYPRE_Int *N )
{
HYPRE_Int ierr=0;
*M = hypre_DistributedMatrixM( (hypre_DistributedMatrix *) matrix );
*N = hypre_DistributedMatrixN( (hypre_DistributedMatrix *) matrix );
return(ierr);
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixSetDims
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixSetDims( HYPRE_DistributedMatrix matrix,
HYPRE_Int M, HYPRE_Int N )
{
HYPRE_Int ierr=0;
hypre_DistributedMatrixM( (hypre_DistributedMatrix *) matrix ) = M;
hypre_DistributedMatrixN( (hypre_DistributedMatrix *) matrix ) = N;
return(ierr);
}
/*--------------------------------------------------------------------------
* Optional routines that depend on underlying storage type
*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixPrint
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixPrint( HYPRE_DistributedMatrix matrix )
{
return( hypre_DistributedMatrixPrint( (hypre_DistributedMatrix *) matrix ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixGetLocalRange
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixGetLocalRange( HYPRE_DistributedMatrix matrix,
HYPRE_Int *row_start, HYPRE_Int *row_end ,
HYPRE_Int *col_start, HYPRE_Int *col_end )
{
return( hypre_DistributedMatrixGetLocalRange( (hypre_DistributedMatrix *) matrix,
row_start, row_end, col_start, col_end ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixGetRow
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixGetRow( HYPRE_DistributedMatrix matrix,
HYPRE_Int row,
HYPRE_Int *size,
HYPRE_Int **col_ind,
HYPRE_Real **values )
{
return( hypre_DistributedMatrixGetRow( (hypre_DistributedMatrix *) matrix,
row,
size,
col_ind,
values ) );
}
/*--------------------------------------------------------------------------
* HYPRE_DistributedMatrixRestoreRow
*--------------------------------------------------------------------------*/
HYPRE_Int
HYPRE_DistributedMatrixRestoreRow( HYPRE_DistributedMatrix matrix,
HYPRE_Int row,
HYPRE_Int *size,
HYPRE_Int **col_ind,
HYPRE_Real **values )
{
return( hypre_DistributedMatrixRestoreRow( (hypre_DistributedMatrix *) matrix,
row,
size,
col_ind,
values ) );
}