next up previous contents index
Next: 3.5 Symmetric Matrices Up: 3 Structured-Grid System Interface Previous: 3.3 Setting Up the

3.4 Setting Up the Struct Right-Hand-Side Vector

 

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''.


next up previous contents index
Next: 3.5 Symmetric Matrices Up: 3 Structured-Grid System Interface Previous: 3.3 Setting Up the

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