The right-hand-side vector is set up similarly to the matrix set up described in Section 3.3 above. The main difference is that there is no stencil (note that a stencil currently does appear in the interface, but this will eventually be removed).
On process 0, the following code will set up the right-hand-side vector values.
HYPRE_StructVector b; double values[18]; int i; HYPRE_StructVectorCreate(MPI_COMM_WORLD, grid, &b); HYPRE_StructVectorInitialize(b); for (i = 0; i < 18; i++) { values[i] = 0.0; } HYPRE_StructVectorSetBoxValues(b, ilower[0], iupper[0], values); HYPRE_StructVectorSetBoxValues(b, ilower[1], iupper[1], values); HYPRE_StructVectorAssemble(b);
The Create()
routine creates an empty vector object. The
Initialize()
routine indicates that the vector coefficients
(or values) are ready to be set. This routine follows the same rules
as its corresponding Matrix
routine. The SetBoxValues()
routine sets the vector coefficients over the gridpoints in some box,
and again, follows the same rules as its corresponding Matrix
routine. The Assemble()
routine is a collective call, and
finalizes the vector assembly, making the vector ``ready to use''.