00001 /* 00002 * Copyright (c) 2001 The AUTHORS 00003 * Romeu Andre' Pieritz, Ph.D. - romeu_pieritz@hotmail.com 00004 * Rafael Mendes, Eng. – mendes_rafael@yahoo.com 00005 * Rodrigo Ferraz de Andrade, Eng. – rferraz@iname.com 00006 * All rights reserved. 00007 * 00008 * Permission to use, copy and distribute this software and its 00009 * documentation for educational and personal use, without fee is hereby granted, 00010 * provided that the above copyright notice and the following 00011 * two paragraphs appear in all copies of this software. 00012 * 00013 * IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR 00014 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT 00015 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS 00016 * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00017 * 00018 * THE AUTHORS SPECIFICALLY DISCLAIMS ANY WARRANTIES, 00019 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 00020 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HERE UNDER IS 00021 * ON AN "AS IS" BASIS, AND THE AUTHORS HAVE NO OBLIGATION TO 00022 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 00023 * 00024 * SINMEC Lab. - CFD Sinflow Project - http://www.sinmec.ufsc.br/cfd 00025 */ 00026 00027 00028 // File Define 00029 #ifndef __CSFL_MATH_SOLVER_CG__ 00030 #define __CSFL_MATH_SOLVER_CG__ 00031 00032 00033 // Include 00034 #include <csfl/math/solver/itsolver.h> 00035 00036 00037 // Namespace 00038 namespace csfl { 00039 00040 00041 class ISolverConjugateGradient : 00042 public ISolverIteract 00043 00048 { 00049 00050 public: 00051 ISolverConjugateGradient( 00052 ILinearSystem * = NULL, 00053 double = 0.00001, 00054 int = 10000, 00055 IContainerParameter * = NULL ); 00056 ISolverConjugateGradient( ISolverConjugateGradient * ); 00057 ~ISolverConjugateGradient(); 00058 00059 void Solve(); 00060 void Solve( ILinearSystem *_lsys ); 00061 00062 bool Transpose() { return isTranspose; } 00063 void SetTranspose( bool _b ) { isTranspose = _b; } 00064 00065 void SetToleranceLevel( int _t ) { level = _t; } 00066 int ToleranceLevel() { return level; } 00067 00068 double SolverError(); 00069 00070 protected: 00071 double *sa; 00072 double *vx, *vb; 00073 unsigned long *ija; 00074 bool mem, isTranspose; 00075 int nmax, level; 00076 double serror; 00077 00078 void Sprsin( int, double, unsigned long, double [], unsigned long [] ); 00079 void Dsprsax( double [], unsigned long [], double [], double [], unsigned long ); 00080 void Dsprstx( double [], unsigned long [], double [], double [], unsigned long ); 00081 void Atimes( unsigned long, double [], double [], int ); 00082 void Asolve( unsigned long, double [], double [], int ); 00083 void Linbcg( unsigned long, double [], double [], int, double, int, int *, double * ); 00084 00085 double Snrm( unsigned long, double [], int ); 00086 00087 void CG(); 00088 00089 void NewMemory(); 00090 void DeleteMemory(); 00091 00092 00093 }; 00094 00095 } // csfl namespace 00096 00097 #endif // __CSFL_MATH_SOLVER_CG__
CFD Project
|
Documents |
Downloads |
Contact us |
Use Terms |
|
|||
© SINMEC/EMC/UFSC,
2001. |
All rights
reserved. |
Last Update: Jan. 18, 2002 |
|