On process 0, the following code will set up the grid shown in the figure (the code for processes 1 and 2 is similar).
HYPRE_SStructGrid grid;
int ilower[2][2] = {{-1, 0}, {1, 0}};
int iupper[2][2] = {{ 0, 3}, {2, 3}};
HYPRE_SStructVariable vars[1] = {HYPRE_SSTRUCT_VARIABLE_CELL};
int addindex[2] = {1,2};
HYPRE_SStructVariable addvars[1] = {HYPRE_SSTRUCT_VARIABLE_CELL};
HYPRE_SStructGridCreate(MPI_COMM_WORLD, 2, 3, &grid);
HYPRE_SStructGridSetExtents(grid, 0, ilower[0], iupper[0]);
HYPRE_SStructGridSetExtents(grid, 0, ilower[1], iupper[1]);
HYPRE_SStructGridSetVariables(grid, 0, 1, vars);
HYPRE_SStructGridAddVariables(grid, 0, addindex, 1, addvars);
HYPRE_SStructGridAssemble(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 SetVariables() routine
sets the variables on a grid part, and the AddVariables()
routine adds variables to a grid part index (in the above example,
there are two cell-centered variables at index (1,2)). 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''.