69 lines
2.0 KiB
C
69 lines
2.0 KiB
C
/*BHEADER**********************************************************************
|
|
* (c) 1997 The Regents of the University of California
|
|
*
|
|
* See the file COPYRIGHT_and_DISCLAIMER for a complete copyright
|
|
* notice, contact person, and disclaimer.
|
|
*
|
|
* $Revision$
|
|
*********************************************************************EHEADER*/
|
|
/******************************************************************************
|
|
*
|
|
* HYPRE_StructStencil interface
|
|
*
|
|
*****************************************************************************/
|
|
|
|
#include "headers.h"
|
|
|
|
/*--------------------------------------------------------------------------
|
|
* HYPRE_StructStencilCreate
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
int
|
|
HYPRE_StructStencilCreate( int dim,
|
|
int size,
|
|
HYPRE_StructStencil *stencil )
|
|
{
|
|
hypre_Index *shape;
|
|
|
|
shape = hypre_CTAlloc(hypre_Index, size);
|
|
|
|
*stencil = hypre_StructStencilCreate(dim, size, shape);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*--------------------------------------------------------------------------
|
|
* HYPRE_StructStencilSetElement
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
int
|
|
HYPRE_StructStencilSetElement( HYPRE_StructStencil stencil,
|
|
int element_index,
|
|
int *offset )
|
|
{
|
|
int ierr = 0;
|
|
|
|
hypre_Index *shape;
|
|
int d;
|
|
|
|
shape = hypre_StructStencilShape(stencil);
|
|
hypre_ClearIndex(shape[element_index]);
|
|
for (d = 0; d < hypre_StructStencilDim(stencil); d++)
|
|
{
|
|
hypre_IndexD(shape[element_index], d) = offset[d];
|
|
}
|
|
|
|
return ierr;
|
|
}
|
|
|
|
/*--------------------------------------------------------------------------
|
|
* HYPRE_StructStencilDestroy
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
int
|
|
HYPRE_StructStencilDestroy( HYPRE_StructStencil stencil )
|
|
{
|
|
return ( hypre_StructStencilDestroy(stencil) );
|
|
}
|
|
|