| [2aa6644] | 1 | /*BHEADER**********************************************************************
|
|---|
| 2 | * Copyright (c) 2008, Lawrence Livermore National Security, LLC.
|
|---|
| 3 | * Produced at the Lawrence Livermore National Laboratory.
|
|---|
| 4 | * This file is part of HYPRE. See file COPYRIGHT for details.
|
|---|
| 5 | *
|
|---|
| 6 | * HYPRE is free software; you can redistribute it and/or modify it under the
|
|---|
| 7 | * terms of the GNU Lesser General Public License (as published by the Free
|
|---|
| 8 | * Software Foundation) version 2.1 dated February 1999.
|
|---|
| 9 | *
|
|---|
| 10 | * $Revision: 2.4 $
|
|---|
| 11 | ***********************************************************************EHEADER*/
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | /******************************************************************************
|
|---|
| 15 | *
|
|---|
| 16 | * HYPRE_StructStencil interface
|
|---|
| 17 | *
|
|---|
| 18 | *****************************************************************************/
|
|---|
| 19 |
|
|---|
| 20 | #include "headers.h"
|
|---|
| 21 |
|
|---|
| 22 | /*--------------------------------------------------------------------------
|
|---|
| 23 | * HYPRE_StructStencilCreate
|
|---|
| 24 | *--------------------------------------------------------------------------*/
|
|---|
| 25 |
|
|---|
| 26 | int
|
|---|
| 27 | HYPRE_StructStencilCreate( int dim,
|
|---|
| 28 | int size,
|
|---|
| 29 | HYPRE_StructStencil *stencil )
|
|---|
| 30 | {
|
|---|
| 31 | hypre_Index *shape;
|
|---|
| 32 |
|
|---|
| 33 | shape = hypre_CTAlloc(hypre_Index, size);
|
|---|
| 34 |
|
|---|
| 35 | *stencil = hypre_StructStencilCreate(dim, size, shape);
|
|---|
| 36 |
|
|---|
| 37 | return 0;
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | /*--------------------------------------------------------------------------
|
|---|
| 41 | * HYPRE_StructStencilSetElement
|
|---|
| 42 | *--------------------------------------------------------------------------*/
|
|---|
| 43 |
|
|---|
| 44 | int
|
|---|
| 45 | HYPRE_StructStencilSetElement( HYPRE_StructStencil stencil,
|
|---|
| 46 | int element_index,
|
|---|
| 47 | int *offset )
|
|---|
| 48 | {
|
|---|
| 49 | int ierr = 0;
|
|---|
| 50 |
|
|---|
| 51 | hypre_Index *shape;
|
|---|
| 52 | int d;
|
|---|
| 53 |
|
|---|
| 54 | shape = hypre_StructStencilShape(stencil);
|
|---|
| 55 | hypre_ClearIndex(shape[element_index]);
|
|---|
| 56 | for (d = 0; d < hypre_StructStencilDim(stencil); d++)
|
|---|
| 57 | {
|
|---|
| 58 | hypre_IndexD(shape[element_index], d) = offset[d];
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | return ierr;
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | /*--------------------------------------------------------------------------
|
|---|
| 65 | * HYPRE_StructStencilDestroy
|
|---|
| 66 | *--------------------------------------------------------------------------*/
|
|---|
| 67 |
|
|---|
| 68 | int
|
|---|
| 69 | HYPRE_StructStencilDestroy( HYPRE_StructStencil stencil )
|
|---|
| 70 | {
|
|---|
| 71 | return ( hypre_StructStencilDestroy(stencil) );
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|