Changeset dfed1c for src/solver/solver.hpp
- Timestamp:
- Nov 22, 2011, 9:22:10 PM (14 years ago)
- Children:
- facba0
- Parents:
- 66f24d
- File:
-
- 1 edited
-
src/solver/solver.hpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/solver/solver.hpp
r66f24d rdfed1c 10 10 #ifndef SOLVER_HPP_ 11 11 #define SOLVER_HPP_ 12 13 #include <vector> 12 14 13 15 #include "base/discretization.hpp" … … 33 35 Solver() 34 36 { 35 max_size = 0; 36 vec_size = 0; 37 b = NULL; 38 x = NULL; 39 A = NULL; 37 size = 0; 40 38 } 41 39 42 40 virtual ~Solver() 43 41 { 44 delete [] b;45 delete [] x;46 for (int i=0; i<max_size; i++)47 delete [] A[i];48 delete [] A;49 42 } 50 43 51 void Run(Grid& sol, Grid& rhs) 52 { 53 #ifdef DEBUG 54 sol.IsConsistent(); 55 rhs.IsConsistent(); 56 sol.IsCompatible(rhs); 57 #endif 58 59 Grid *rhsGlobal = MG::GetComm()->CommMergeGrids(rhs); 60 61 this->Realloc(*rhsGlobal); 62 this->AssembleMatrix(*rhsGlobal); 63 this->Compute(); 64 this->ExportSol(sol, rhs); 65 } 44 void Run(Grid& sol, Grid& rhs); 66 45 67 46 private: … … 71 50 virtual void ExportSol(Grid& sol, Grid& rhs) = 0; ///< Exports the solution back to a given mesh. 72 51 73 vmg_float **A, *b, *x;74 int max_size, vec_size;52 std::vector<vmg_float> A, b, x; 53 int size; 75 54 76 55 protected: … … 80 59 vmg_float& Mat(int i, int j) 81 60 { 82 return A[ i][j];61 return A[j+size*i]; 83 62 } 84 63 … … 93 72 } 94 73 95 const int& Size() const {return vec_size;} 96 const int& MemSize() const {return max_size;} 74 const int& Size() const {return size;} 97 75 }; 98 76
Note:
See TracChangeset
for help on using the changeset viewer.
