| 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_StructGrid interface
|
|---|
| 17 | *
|
|---|
| 18 | *****************************************************************************/
|
|---|
| 19 |
|
|---|
| 20 | #include "headers.h"
|
|---|
| 21 |
|
|---|
| 22 | /*--------------------------------------------------------------------------
|
|---|
| 23 | * HYPRE_StructGridCreate
|
|---|
| 24 | *--------------------------------------------------------------------------*/
|
|---|
| 25 |
|
|---|
| 26 | int
|
|---|
| 27 | HYPRE_StructGridCreate( MPI_Comm comm,
|
|---|
| 28 | int dim,
|
|---|
| 29 | HYPRE_StructGrid *grid )
|
|---|
| 30 | {
|
|---|
| 31 | int ierr;
|
|---|
| 32 |
|
|---|
| 33 | ierr = hypre_StructGridCreate(comm, dim, grid);
|
|---|
| 34 |
|
|---|
| 35 | return ierr;
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | /*--------------------------------------------------------------------------
|
|---|
| 39 | * HYPRE_StructGridDestroy
|
|---|
| 40 | *--------------------------------------------------------------------------*/
|
|---|
| 41 |
|
|---|
| 42 | int
|
|---|
| 43 | HYPRE_StructGridDestroy( HYPRE_StructGrid grid )
|
|---|
| 44 | {
|
|---|
| 45 | return ( hypre_StructGridDestroy(grid) );
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | /*--------------------------------------------------------------------------
|
|---|
| 49 | * HYPRE_StructGridSetExtents
|
|---|
| 50 | *--------------------------------------------------------------------------*/
|
|---|
| 51 |
|
|---|
| 52 | int
|
|---|
| 53 | HYPRE_StructGridSetExtents( HYPRE_StructGrid grid,
|
|---|
| 54 | int *ilower,
|
|---|
| 55 | int *iupper )
|
|---|
| 56 | {
|
|---|
| 57 | hypre_Index new_ilower;
|
|---|
| 58 | hypre_Index new_iupper;
|
|---|
| 59 |
|
|---|
| 60 | int d;
|
|---|
| 61 |
|
|---|
| 62 | hypre_ClearIndex(new_ilower);
|
|---|
| 63 | hypre_ClearIndex(new_iupper);
|
|---|
| 64 | for (d = 0; d < hypre_StructGridDim((hypre_StructGrid *) grid); d++)
|
|---|
| 65 | {
|
|---|
| 66 | hypre_IndexD(new_ilower, d) = ilower[d];
|
|---|
| 67 | hypre_IndexD(new_iupper, d) = iupper[d];
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | return ( hypre_StructGridSetExtents(grid, new_ilower, new_iupper) );
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | /*--------------------------------------------------------------------------
|
|---|
| 74 | * HYPRE_SetStructGridPeriodicity
|
|---|
| 75 | *--------------------------------------------------------------------------*/
|
|---|
| 76 |
|
|---|
| 77 | int
|
|---|
| 78 | HYPRE_StructGridSetPeriodic( HYPRE_StructGrid grid,
|
|---|
| 79 | int *periodic )
|
|---|
| 80 | {
|
|---|
| 81 | hypre_Index new_periodic;
|
|---|
| 82 |
|
|---|
| 83 | int d;
|
|---|
| 84 |
|
|---|
| 85 | hypre_ClearIndex(new_periodic);
|
|---|
| 86 | for (d = 0; d < hypre_StructGridDim(grid); d++)
|
|---|
| 87 | {
|
|---|
| 88 | hypre_IndexD(new_periodic, d) = periodic[d];
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | return ( hypre_StructGridSetPeriodic(grid, new_periodic) );
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | /*--------------------------------------------------------------------------
|
|---|
| 95 | * HYPRE_StructGridAssemble
|
|---|
| 96 | *--------------------------------------------------------------------------*/
|
|---|
| 97 |
|
|---|
| 98 | int
|
|---|
| 99 | HYPRE_StructGridAssemble( HYPRE_StructGrid grid )
|
|---|
| 100 | {
|
|---|
| 101 | #ifdef HYPRE_NO_GLOBAL_PARTITION
|
|---|
| 102 | return ( hypre_StructGridAssembleWithAP(grid) );
|
|---|
| 103 | #else
|
|---|
| 104 | return ( hypre_StructGridAssemble(grid) );
|
|---|
| 105 | #endif
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | /*---------------------------------------------------------------------------
|
|---|
| 109 | * GEC0902
|
|---|
| 110 | * HYPRE_StructGridSetNumGhost
|
|---|
| 111 | * to set the numghost array inside the struct_grid_struct using an internal
|
|---|
| 112 | * function. This is just a wrapper.
|
|---|
| 113 | *--------------------------------------------------------------------------*/
|
|---|
| 114 | int
|
|---|
| 115 | HYPRE_StructGridSetNumGhost( HYPRE_StructGrid grid, int *num_ghost )
|
|---|
| 116 | {
|
|---|
| 117 | return ( hypre_StructGridSetNumGhost(grid, num_ghost) );
|
|---|
| 118 | }
|
|---|