1998-01-07 03:57:39 +08:00
|
|
|
/*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*/
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
*
|
1998-02-18 01:56:00 +08:00
|
|
|
* HYPRE_StructStencil interface
|
1998-01-07 03:57:39 +08:00
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "headers.h"
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
1999-09-07 15:03:59 +08:00
|
|
|
* HYPRE_StructStencilCreate
|
1998-01-07 03:57:39 +08:00
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
1998-12-19 08:46:37 +08:00
|
|
|
int
|
1999-09-07 15:03:59 +08:00
|
|
|
HYPRE_StructStencilCreate( int dim,
|
1999-09-01 07:31:24 +08:00
|
|
|
int size,
|
|
|
|
|
HYPRE_StructStencil *stencil )
|
1998-01-07 03:57:39 +08:00
|
|
|
{
|
1998-02-18 01:56:00 +08:00
|
|
|
hypre_Index *shape;
|
1998-01-07 03:57:39 +08:00
|
|
|
|
1998-02-18 01:56:00 +08:00
|
|
|
shape = hypre_CTAlloc(hypre_Index, size);
|
1998-01-07 03:57:39 +08:00
|
|
|
|
2000-04-20 05:31:17 +08:00
|
|
|
*stencil = hypre_StructStencilCreate(dim, size, shape);
|
1998-12-19 08:46:37 +08:00
|
|
|
|
|
|
|
|
return 0;
|
1998-01-07 03:57:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
1999-09-07 15:03:59 +08:00
|
|
|
* HYPRE_StructStencilSetElement
|
1998-01-07 03:57:39 +08:00
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
1998-12-22 04:00:10 +08:00
|
|
|
int
|
1999-09-07 15:03:59 +08:00
|
|
|
HYPRE_StructStencilSetElement( HYPRE_StructStencil stencil,
|
1998-02-19 07:45:29 +08:00
|
|
|
int element_index,
|
2000-04-20 05:31:17 +08:00
|
|
|
int *offset )
|
1998-01-07 03:57:39 +08:00
|
|
|
{
|
2000-04-20 05:31:17 +08:00
|
|
|
int ierr = 0;
|
|
|
|
|
|
|
|
|
|
hypre_Index *shape;
|
|
|
|
|
int d;
|
1998-01-07 03:57:39 +08:00
|
|
|
|
2000-04-20 05:31:17 +08:00
|
|
|
shape = hypre_StructStencilShape(stencil);
|
1998-03-14 00:56:50 +08:00
|
|
|
hypre_ClearIndex(shape[element_index]);
|
2000-04-20 05:31:17 +08:00
|
|
|
for (d = 0; d < hypre_StructStencilDim(stencil); d++)
|
1998-01-07 03:57:39 +08:00
|
|
|
{
|
1998-02-18 01:56:00 +08:00
|
|
|
hypre_IndexD(shape[element_index], d) = offset[d];
|
1998-01-07 03:57:39 +08:00
|
|
|
}
|
1998-12-22 04:00:10 +08:00
|
|
|
|
|
|
|
|
return ierr;
|
1998-01-07 03:57:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
1999-09-07 15:03:59 +08:00
|
|
|
* HYPRE_StructStencilDestroy
|
1998-01-07 03:57:39 +08:00
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
1998-12-22 04:00:10 +08:00
|
|
|
int
|
1999-09-07 15:03:59 +08:00
|
|
|
HYPRE_StructStencilDestroy( HYPRE_StructStencil stencil )
|
1998-01-07 03:57:39 +08:00
|
|
|
{
|
2000-04-20 05:31:17 +08:00
|
|
|
return ( hypre_StructStencilDestroy(stencil) );
|
1998-01-07 03:57:39 +08:00
|
|
|
}
|
|
|
|
|
|