added ClearVector to bicgstab

This commit is contained in:
ulrikey 2008-07-31 23:11:23 +00:00
parent 0245982d81
commit 5daffe8cad
8 changed files with 81 additions and 7 deletions

View File

@ -36,6 +36,7 @@ hypre_BiCGSTABFunctionsCreate(
int (*MatvecDestroy)( void *matvec_data ), int (*MatvecDestroy)( void *matvec_data ),
double (*InnerProd)( void *x , void *y ), double (*InnerProd)( void *x , void *y ),
int (*CopyVector)( void *x , void *y ), int (*CopyVector)( void *x , void *y ),
int (*ClearVector)( void *x ),
int (*ScaleVector)( double alpha , void *x ), int (*ScaleVector)( double alpha , void *x ),
int (*Axpy)( double alpha , void *x , void *y ), int (*Axpy)( double alpha , void *x , void *y ),
int (*CommInfo)( void *A , int *my_id , int *num_procs ), int (*CommInfo)( void *A , int *my_id , int *num_procs ),
@ -54,6 +55,7 @@ hypre_BiCGSTABFunctionsCreate(
bicgstab_functions->MatvecDestroy = MatvecDestroy; bicgstab_functions->MatvecDestroy = MatvecDestroy;
bicgstab_functions->InnerProd = InnerProd; bicgstab_functions->InnerProd = InnerProd;
bicgstab_functions->CopyVector = CopyVector; bicgstab_functions->CopyVector = CopyVector;
bicgstab_functions->ClearVector = ClearVector;
bicgstab_functions->ScaleVector = ScaleVector; bicgstab_functions->ScaleVector = ScaleVector;
bicgstab_functions->Axpy = Axpy; bicgstab_functions->Axpy = Axpy;
bicgstab_functions->CommInfo = CommInfo; bicgstab_functions->CommInfo = CommInfo;
@ -437,7 +439,7 @@ hypre_BiCGSTABSolve(void *bicgstab_vdata,
iter++; iter++;
(*(bicgstab_functions->Axpy))(-1.0,v,v); (*(bicgstab_functions->ClearVector))(v);
precond(precond_data, A, p, v); precond(precond_data, A, p, v);
(*(bicgstab_functions->Matvec))(matvec_data,1.0,A,v,0.0,q); (*(bicgstab_functions->Matvec))(matvec_data,1.0,A,v,0.0,q);
temp = (*(bicgstab_functions->InnerProd))(r0,q); temp = (*(bicgstab_functions->InnerProd))(r0,q);
@ -450,7 +452,7 @@ hypre_BiCGSTABSolve(void *bicgstab_vdata,
} }
(*(bicgstab_functions->Axpy))(alpha,v,x); (*(bicgstab_functions->Axpy))(alpha,v,x);
(*(bicgstab_functions->Axpy))(-alpha,q,r); (*(bicgstab_functions->Axpy))(-alpha,q,r);
(*(bicgstab_functions->Axpy))(-1.0,v,v); (*(bicgstab_functions->ClearVector))(v);
precond(precond_data, A, r, v); precond(precond_data, A, r, v);
(*(bicgstab_functions->Matvec))(matvec_data,1.0,A,v,0.0,s); (*(bicgstab_functions->Matvec))(matvec_data,1.0,A,v,0.0,s);
gamma = (*(bicgstab_functions->InnerProd))(r,s) / gamma = (*(bicgstab_functions->InnerProd))(r,s) /

View File

@ -60,7 +60,6 @@ char *hypre_ParKrylovCAlloc( int count , int elt_size );
int hypre_ParKrylovFree( char *ptr ); int hypre_ParKrylovFree( char *ptr );
void *hypre_ParKrylovCreateVectorArray( int n , void *vvector ); void *hypre_ParKrylovCreateVectorArray( int n , void *vvector );
int hypre_ParKrylovMatvecT( void *matvec_data , double alpha , void *A , void *x , double beta , void *y ); int hypre_ParKrylovMatvecT( void *matvec_data , double alpha , void *A , void *x , double beta , void *y );
int hypre_ParKrylovClearVector( void *x );
*/ */
/* functions in pcg_struct.c which are used here: /* functions in pcg_struct.c which are used here:
void *hypre_ParKrylovCreateVector( void *vvector ); void *hypre_ParKrylovCreateVector( void *vvector );
@ -70,6 +69,7 @@ int hypre_ParKrylovClearVector( void *x );
int hypre_ParKrylovMatvecDestroy( void *matvec_data ); int hypre_ParKrylovMatvecDestroy( void *matvec_data );
double hypre_ParKrylovInnerProd( void *x , void *y ); double hypre_ParKrylovInnerProd( void *x , void *y );
int hypre_ParKrylovCopyVector( void *x , void *y ); int hypre_ParKrylovCopyVector( void *x , void *y );
int hypre_ParKrylovClearVector( void *x );
int hypre_ParKrylovScaleVector( double alpha , void *x ); int hypre_ParKrylovScaleVector( double alpha , void *x );
int hypre_ParKrylovAxpy( double alpha , void *x , void *y ); int hypre_ParKrylovAxpy( double alpha , void *x , void *y );
int hypre_ParKrylovCommInfo( void *A , int *my_id , int *num_procs ); int hypre_ParKrylovCommInfo( void *A , int *my_id , int *num_procs );
@ -86,6 +86,7 @@ typedef struct
int (*MatvecDestroy)( void *matvec_data ); int (*MatvecDestroy)( void *matvec_data );
double (*InnerProd)( void *x , void *y ); double (*InnerProd)( void *x , void *y );
int (*CopyVector)( void *x , void *y ); int (*CopyVector)( void *x , void *y );
int (*ClearVector)( void *x );
int (*ScaleVector)( double alpha , void *x ); int (*ScaleVector)( double alpha , void *x );
int (*Axpy)( double alpha , void *x , void *y ); int (*Axpy)( double alpha , void *x , void *y );
int (*CommInfo)( void *A , int *my_id , int *num_procs ); int (*CommInfo)( void *A , int *my_id , int *num_procs );
@ -160,6 +161,7 @@ extern "C" {
int (*MatvecDestroy)( void *matvec_data ), int (*MatvecDestroy)( void *matvec_data ),
double (*InnerProd)( void *x , void *y ), double (*InnerProd)( void *x , void *y ),
int (*CopyVector)( void *x , void *y ), int (*CopyVector)( void *x , void *y ),
int (*ClearVector)( void *x ),
int (*ScaleVector)( double alpha , void *x ), int (*ScaleVector)( double alpha , void *x ),
int (*Axpy)( double alpha , void *x , void *y ), int (*Axpy)( double alpha , void *x , void *y ),
int (*CommInfo)( void *A , int *my_id , int *num_procs ), int (*CommInfo)( void *A , int *my_id , int *num_procs ),

View File

@ -91,7 +91,6 @@ char *hypre_ParKrylovCAlloc( int count , int elt_size );
int hypre_ParKrylovFree( char *ptr ); int hypre_ParKrylovFree( char *ptr );
void *hypre_ParKrylovCreateVectorArray( int n , void *vvector ); void *hypre_ParKrylovCreateVectorArray( int n , void *vvector );
int hypre_ParKrylovMatvecT( void *matvec_data , double alpha , void *A , void *x , double beta , void *y ); int hypre_ParKrylovMatvecT( void *matvec_data , double alpha , void *A , void *x , double beta , void *y );
int hypre_ParKrylovClearVector( void *x );
*/ */
/* functions in pcg_struct.c which are used here: /* functions in pcg_struct.c which are used here:
void *hypre_ParKrylovCreateVector( void *vvector ); void *hypre_ParKrylovCreateVector( void *vvector );
@ -101,6 +100,7 @@ int hypre_ParKrylovClearVector( void *x );
int hypre_ParKrylovMatvecDestroy( void *matvec_data ); int hypre_ParKrylovMatvecDestroy( void *matvec_data );
double hypre_ParKrylovInnerProd( void *x , void *y ); double hypre_ParKrylovInnerProd( void *x , void *y );
int hypre_ParKrylovCopyVector( void *x , void *y ); int hypre_ParKrylovCopyVector( void *x , void *y );
int hypre_ParKrylovClearVector( void *x );
int hypre_ParKrylovScaleVector( double alpha , void *x ); int hypre_ParKrylovScaleVector( double alpha , void *x );
int hypre_ParKrylovAxpy( double alpha , void *x , void *y ); int hypre_ParKrylovAxpy( double alpha , void *x , void *y );
int hypre_ParKrylovCommInfo( void *A , int *my_id , int *num_procs ); int hypre_ParKrylovCommInfo( void *A , int *my_id , int *num_procs );
@ -117,6 +117,7 @@ typedef struct
int (*MatvecDestroy)( void *matvec_data ); int (*MatvecDestroy)( void *matvec_data );
double (*InnerProd)( void *x , void *y ); double (*InnerProd)( void *x , void *y );
int (*CopyVector)( void *x , void *y ); int (*CopyVector)( void *x , void *y );
int (*ClearVector)( void *x );
int (*ScaleVector)( double alpha , void *x ); int (*ScaleVector)( double alpha , void *x );
int (*Axpy)( double alpha , void *x , void *y ); int (*Axpy)( double alpha , void *x , void *y );
int (*CommInfo)( void *A , int *my_id , int *num_procs ); int (*CommInfo)( void *A , int *my_id , int *num_procs );
@ -191,6 +192,7 @@ extern "C" {
int (*MatvecDestroy)( void *matvec_data ), int (*MatvecDestroy)( void *matvec_data ),
double (*InnerProd)( void *x , void *y ), double (*InnerProd)( void *x , void *y ),
int (*CopyVector)( void *x , void *y ), int (*CopyVector)( void *x , void *y ),
int (*ClearVector)( void *x ),
int (*ScaleVector)( double alpha , void *x ), int (*ScaleVector)( double alpha , void *x ),
int (*Axpy)( double alpha , void *x , void *y ), int (*Axpy)( double alpha , void *x , void *y ),
int (*CommInfo)( void *A , int *my_id , int *num_procs ), int (*CommInfo)( void *A , int *my_id , int *num_procs ),
@ -1102,7 +1104,7 @@ hypre_PCGCreate( hypre_PCGFunctions *pcg_functions );
#endif #endif
/* bicgstab.c */ /* bicgstab.c */
hypre_BiCGSTABFunctions *hypre_BiCGSTABFunctionsCreate ( void *(*CreateVector )(void *vvector ), int (*DestroyVector )(void *vvector ), void *(*MatvecCreate )(void *A ,void *x ), int (*Matvec )(void *matvec_data ,double alpha ,void *A ,void *x ,double beta ,void *y ), int (*MatvecDestroy )(void *matvec_data ), double (*InnerProd )(void *x ,void *y ), int (*CopyVector )(void *x ,void *y ), int (*ScaleVector )(double alpha ,void *x ), int (*Axpy )(double alpha ,void *x ,void *y ), int (*CommInfo )(void *A ,int *my_id ,int *num_procs ), int (*PrecondSetup )(void *vdata ,void *A ,void *b ,void *x ), int (*Precond )(void *vdata ,void *A ,void *b ,void *x )); hypre_BiCGSTABFunctions *hypre_BiCGSTABFunctionsCreate ( void *(*CreateVector )(void *vvector ), int (*DestroyVector )(void *vvector ), void *(*MatvecCreate )(void *A ,void *x ), int (*Matvec )(void *matvec_data ,double alpha ,void *A ,void *x ,double beta ,void *y ), int (*MatvecDestroy )(void *matvec_data ), double (*InnerProd )(void *x ,void *y ), int (*CopyVector )(void *x ,void *y ), int (*ClearVector )(void *x ), int (*ScaleVector )(double alpha ,void *x ), int (*Axpy )(double alpha ,void *x ,void *y ), int (*CommInfo )(void *A ,int *my_id ,int *num_procs ), int (*PrecondSetup )(void *vdata ,void *A ,void *b ,void *x ), int (*Precond )(void *vdata ,void *A ,void *b ,void *x ));
void *hypre_BiCGSTABCreate ( hypre_BiCGSTABFunctions *bicgstab_functions ); void *hypre_BiCGSTABCreate ( hypre_BiCGSTABFunctions *bicgstab_functions );
int hypre_BiCGSTABDestroy ( void *bicgstab_vdata ); int hypre_BiCGSTABDestroy ( void *bicgstab_vdata );
int hypre_BiCGSTABSetup ( void *bicgstab_vdata , void *A , void *b , void *x ); int hypre_BiCGSTABSetup ( void *bicgstab_vdata , void *A , void *b , void *x );

View File

@ -36,6 +36,7 @@ HYPRE_SStructBiCGSTABCreate( MPI_Comm comm,
hypre_SStructKrylovDestroyVector, hypre_SStructKrylovMatvecCreate, hypre_SStructKrylovDestroyVector, hypre_SStructKrylovMatvecCreate,
hypre_SStructKrylovMatvec, hypre_SStructKrylovMatvecDestroy, hypre_SStructKrylovMatvec, hypre_SStructKrylovMatvecDestroy,
hypre_SStructKrylovInnerProd, hypre_SStructKrylovCopyVector, hypre_SStructKrylovInnerProd, hypre_SStructKrylovCopyVector,
hypre_SStructKrylovClearVector,
hypre_SStructKrylovScaleVector, hypre_SStructKrylovAxpy, hypre_SStructKrylovScaleVector, hypre_SStructKrylovAxpy,
hypre_SStructKrylovCommInfo, hypre_SStructKrylovCommInfo,
hypre_SStructKrylovIdentitySetup, hypre_SStructKrylovIdentity ); hypre_SStructKrylovIdentitySetup, hypre_SStructKrylovIdentity );

View File

@ -10,7 +10,6 @@
* $Revision$ * $Revision$
***********************************************************************EHEADER*/ ***********************************************************************EHEADER*/
#include <HYPRE_config.h> #include <HYPRE_config.h>
#include "HYPRE_sstruct_ls.h" #include "HYPRE_sstruct_ls.h"
@ -29,6 +28,17 @@
extern "C" { extern "C" {
#endif #endif
/*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*/
@ -70,6 +80,17 @@ typedef struct
((own_data) -> own_composite_size) ((own_data) -> own_composite_size)
#endif #endif
/*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*/
@ -91,6 +112,17 @@ typedef struct
} hypre_SStructRecvInfoData; } hypre_SStructRecvInfoData;
#endif #endif
/*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*/
@ -113,6 +145,17 @@ typedef struct
} hypre_SStructSendInfoData; } hypre_SStructSendInfoData;
#endif #endif
/*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*/
@ -128,6 +171,17 @@ typedef struct
} hypre_PTopology; } hypre_PTopology;
/*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*/
@ -231,6 +285,17 @@ typedef struct
} hypre_MaxwellData; } hypre_MaxwellData;
#endif #endif
/*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*/

View File

@ -41,6 +41,7 @@ HYPRE_StructBiCGSTABCreate( MPI_Comm comm, HYPRE_StructSolver *solver )
hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate,
hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy,
hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector,
hypre_StructKrylovClearVector,
hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy,
hypre_StructKrylovCommInfo, hypre_StructKrylovCommInfo,
hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity );

View File

@ -10,7 +10,6 @@
* $Revision$ * $Revision$
***********************************************************************EHEADER*/ ***********************************************************************EHEADER*/
#include "_hypre_utilities.h" #include "_hypre_utilities.h"
#include "HYPRE_struct_ls.h" #include "HYPRE_struct_ls.h"

View File

@ -590,6 +590,7 @@ hypre_HybridSolve( void *hybrid_vdata,
hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate,
hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy,
hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector,
hypre_StructKrylovClearVector,
hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy,
hypre_StructKrylovCommInfo, hypre_StructKrylovCommInfo,
hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity );
@ -715,6 +716,7 @@ hypre_HybridSolve( void *hybrid_vdata,
hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate, hypre_StructKrylovDestroyVector, hypre_StructKrylovMatvecCreate,
hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy, hypre_StructKrylovMatvec, hypre_StructKrylovMatvecDestroy,
hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector, hypre_StructKrylovInnerProd, hypre_StructKrylovCopyVector,
hypre_StructKrylovClearVector,
hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy, hypre_StructKrylovScaleVector, hypre_StructKrylovAxpy,
hypre_StructKrylovCommInfo, hypre_StructKrylovCommInfo,
hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity ); hypre_StructKrylovIdentitySetup, hypre_StructKrylovIdentity );