hypre/krylov/cgnr.h
falgout e3181f26b1 Added 64 bit feature using HYPRE_Int (see tracker [issue489] for details).
Changed MPI routines to hypre_MPI routines.
Added hypre_printf, etc. routines.
Added AUTOTEST tests to look for 'int' and 'MPI_' calls.
Added a new approach for the Fortran interface (not implemented everywhere yet).
2010-12-20 19:27:44 +00:00

167 lines
4.8 KiB
C

/*BHEADER**********************************************************************
* Copyright (c) 2008, Lawrence Livermore National Security, LLC.
* Produced at the Lawrence Livermore National Laboratory.
* This file is part of HYPRE. See file COPYRIGHT for details.
*
* HYPRE is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License (as published by the Free
* Software Foundation) version 2.1 dated February 1999.
*
* $Revision$
***********************************************************************EHEADER*/
/******************************************************************************
*
* cgnr (conjugate gradient on the normal equations A^TAx = A^Tb) functions
*
*****************************************************************************/
#ifndef hypre_KRYLOV_CGNR_HEADER
#define hypre_KRYLOV_CGNR_HEADER
/*--------------------------------------------------------------------------
*--------------------------------------------------------------------------*/
/**
* @name Generic CGNR Interface
*
* A general description of the interface goes here...
*
* @memo A generic CGNR linear solver interface
* @version 0.1
* @author Jeffrey F. Painter
**/
/*@{*/
/*--------------------------------------------------------------------------
*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------
* hypre_CGNRData and hypre_CGNRFunctions
*--------------------------------------------------------------------------*/
/**
* @name CGNR structs
*
* Description...
**/
/*@{*/
/**
* The {\tt hypre\_CGNRSFunctions} object ...
**/
typedef struct
{
HYPRE_Int (*CommInfo) ( void *A, HYPRE_Int *my_id, HYPRE_Int *num_procs );
void * (*CreateVector) ( void *vector );
HYPRE_Int (*DestroyVector) ( void *vector );
void * (*MatvecCreate) ( void *A, void *x );
HYPRE_Int (*Matvec) ( void *matvec_data, double alpha, void *A,
void *x, double beta, void *y );
HYPRE_Int (*MatvecT) ( void *matvec_data, double alpha, void *A,
void *x, double beta, void *y );
HYPRE_Int (*MatvecDestroy) ( void *matvec_data );
double (*InnerProd) ( void *x, void *y );
HYPRE_Int (*CopyVector) ( void *x, void *y );
HYPRE_Int (*ClearVector) ( void *x );
HYPRE_Int (*ScaleVector) ( double alpha, void *x );
HYPRE_Int (*Axpy) ( double alpha, void *x, void *y );
HYPRE_Int (*precond_setup) ( void *vdata, void *A, void *b, void *x );
HYPRE_Int (*precond) ( void *vdata, void *A, void *b, void *x );
HYPRE_Int (*precondT) ( void *vdata, void *A, void *b, void *x );
} hypre_CGNRFunctions;
/**
* The {\tt hypre\_CGNRData} object ...
**/
typedef struct
{
double tol;
double rel_residual_norm;
HYPRE_Int min_iter;
HYPRE_Int max_iter;
HYPRE_Int stop_crit;
void *A;
void *p;
void *q;
void *r;
void *t;
void *matvec_data;
void *precond_data;
hypre_CGNRFunctions * functions;
/* log info (always logged) */
HYPRE_Int num_iterations;
/* additional log info (logged when `logging' > 0) */
HYPRE_Int logging;
double *norms;
char *log_file_name;
} hypre_CGNRData;
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name generic CGNR Solver
*
* Description...
**/
/*@{*/
/**
* Description...
*
* @param param [IN] ...
**/
hypre_CGNRFunctions *
hypre_CGNRFunctionsCreate(
HYPRE_Int (*CommInfo) ( void *A, HYPRE_Int *my_id, HYPRE_Int *num_procs ),
void * (*CreateVector) ( void *vector ),
HYPRE_Int (*DestroyVector) ( void *vector ),
void * (*MatvecCreate) ( void *A, void *x ),
HYPRE_Int (*Matvec) ( void *matvec_data, double alpha, void *A,
void *x, double beta, void *y ),
HYPRE_Int (*MatvecT) ( void *matvec_data, double alpha, void *A,
void *x, double beta, void *y ),
HYPRE_Int (*MatvecDestroy) ( void *matvec_data ),
double (*InnerProd) ( void *x, void *y ),
HYPRE_Int (*CopyVector) ( void *x, void *y ),
HYPRE_Int (*ClearVector) ( void *x ),
HYPRE_Int (*ScaleVector) ( double alpha, void *x ),
HYPRE_Int (*Axpy) ( double alpha, void *x, void *y ),
HYPRE_Int (*PrecondSetup) ( void *vdata, void *A, void *b, void *x ),
HYPRE_Int (*Precond) ( void *vdata, void *A, void *b, void *x ),
HYPRE_Int (*PrecondT) ( void *vdata, void *A, void *b, void *x )
);
/**
* Description...
*
* @param param [IN] ...
**/
void *
hypre_CGNRCreate( hypre_CGNRFunctions *cgnr_functions );
#ifdef __cplusplus
}
#endif
#endif