%===============================================================================
\section{{\hypre} example problems}\label{s:ex_parhyp}
%===============================================================================

\subsection{A nonstiff example: cvAdvDiff\_non\_ph}\label{ss:cvAdvDiff_ph}

This example is same as \id{cvAdvDiff\_non\_p}, except that it
uses the {\hypre} vector type instead of the {\sundials} native
parallel vector implementation. 
The outputs from the two examples are identical. In the following, we will point 
out only the differences between the two. Familiarity with {\hypre} library 
\cite{hypre_um} is helpful.  

We use the {\hypre} IJ vector interface to allocate the template vector and 
create parallel partitioning: 
\begin{verbatim}
  HYPRE_IJVectorCreate(comm, my_base, my_base + local_N - 1, &Uij);
  HYPRE_IJVectorSetObjectType(Uij, HYPRE_PARCSR);
  HYPRE_IJVectorInitialize(Uij);
\end{verbatim}
The initialize call means that vector elements are ready to be set using 
the IJ interface. We choose an initial condition vector $x_0 = x(t_0)$ as the 
template vector and we set its values in the \verb|SetIC(...)| function. We 
complete the {\hypre} vector assembly by:
\begin{verbatim}
  HYPRE_IJVectorAssemble(Uij);
  HYPRE_IJVectorGetObject(Uij, (void**) &Upar);
\end{verbatim}
The assemble call is collective and it makes {\hypre} vector ready to use. 
This sets the handle \verb|Upar| to the actual {\hypre} vector. 
The handle is then passed to the \verb|N_VMake| function, which creates 
the template \verb|N_Vector| as a wrapper around the {\hypre} vector. 
All other vectors in the computation are created by cloning the template 
vector. The template vector does not own the underlying {\hypre} vector, 
and it is the user's responsibility to destroy it using a
\verb|HYPRE_IJVectorDestroy(Uij)| call after the template vector has been 
destroyed. This function will destroy both the {\hypre} vector and its IJ 
interface.

To access individual elements of solution vectors \verb|u| and \verb|udot| 
in the residual function, the user needs to extract the {\hypre} vector first 
by calling \verb|N_VGetVector_ParHyp|, and then use {\hypre} methods from 
that point on. 

\paragraph{\bf Notes} 
           
\begin{itemize}
                                        
\item
  {\warn}At this point interfaces to {\hypre} solvers and preconditioners are 
  not available. They will be provided in subsequent {\sundials} releases. 
  The interface to {\hypre} vector is included in this release mainly for 
  testing purposes and as a preview of functionality to come.

\end{itemize}



%-------------------------------------------------------------------------------

