next up previous contents index
Next: 3.2 Setting Up the Up: 3 Structured-Grid System Interface Previous: 3 Structured-Grid System Interface

3.1 Setting Up the Struct Grid

 

The grid is described via a global index space, i.e., via integer tuples (triples in 3D). The integers may have any value, negative or positive. The global indexes allow HYPRE to discern how data is related spatially, and how it is distributed across the parallel machine. Each process describes that portion of the grid that it ``owns'', one box at a time. For example, in the figure, the global grid can be described in terms of three boxes, two owned by process 0, and one owned by process 1. A box is described in terms of a lower and upper index.

On process 0, the following code will set up the grid shown in the figure (the code for process 1 is similar).

HYPRE_StructGrid  grid;
int               ilower[2][2] = {{-3, 1}, {0, 1}};
int               iupper[2][2] = {{-1, 2}, {2, 4}};

HYPRE_StructGridCreate(MPI_COMM_WORLD, 2, &grid);

HYPRE_StructGridSetExtents(grid, ilower[0], iupper[0]);
HYPRE_StructGridSetExtents(grid, ilower[1], iupper[1]);

HYPRE_StructGridAssemble(grid);
The Create() routine creates an empty 2D grid object that lives on the MPI_COMM_WORLD communicator. The SetExtents() routine adds a new box to the grid. The Assemble() routine is a collective call (i.e., must be called on all processes from a common synchronization point), and finalizes the grid assembly, making the grid ``ready to use''.


next up previous contents index
Next: 3.2 Setting Up the Up: 3 Structured-Grid System Interface Previous: 3 Structured-Grid System Interface

Thomas Treadway
Fri Jul 27 10:01:25 PDT 2001