CG_SOLVER.h

00001 
00002 // File : CG_SOLVER.h
00004 //
00005 // Copyright 2006
00006 // The University of North Carolina at Chapel Hill
00007 // 
00009 //
00010 // Permission to use, copy, modify, distribute and sell this software and its 
00011 // documentation for any purpose is hereby granted without fee, provided that 
00012 // the above copyright notice appear in all copies and that both that copyright 
00013 // notice and this permission notice appear in supporting documentation. 
00014 // Binaries may be compiled with this software without any royalties or 
00015 // restrictions. 
00016 //
00017 // The University of North Carolina at Chapel Hill makes no representations 
00018 // about the suitability of this software for any purpose. It is provided 
00019 // "as is" without express or implied warranty.
00020 //
00021 
00022 #ifndef CG_SOLVER_H
00023 #define CG_SOLVER_H
00024 
00025 #include "CELL.h"
00026 #include <cmath>
00027 #include <list>
00028 
00029 using namespace std;
00030 
00034 class CG_SOLVER
00035 {
00036 public:
00038         CG_SOLVER(int maxDepth, int iterations = 10, int digits = 8);
00040         virtual ~CG_SOLVER();
00041 
00043   virtual int solve(list<CELL*> cells);
00044 
00046   float calcResidual(list<CELL*> cells);
00047 
00049   int& iterations() { return _iterations; };
00050 
00051 protected:  
00052   int _iterations;  
00053   int _digits;      
00054 
00056   // conjugate gradient arrays
00058   float* _direction;  
00059   float* _potential;  
00060   float* _residual;   
00061   float* _q;          
00062   
00063   int _arraySize;     
00064   int _listSize;      
00065 
00067   void calcStencils(list<CELL*> cells);
00068 
00070   virtual void reallocate();
00071 
00073   float* _dx;
00074 };
00075 
00076 #endif

Generated on Wed Oct 25 03:19:42 2006 for Lumos by  doxygen 1.4.6