Changeset dfed1c for src/solver/solver.cpp
- Timestamp:
- Nov 22, 2011, 9:22:10 PM (14 years ago)
- Children:
- facba0
- Parents:
- 66f24d
- File:
-
- 1 edited
-
src/solver/solver.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/solver/solver.cpp
r66f24d rdfed1c 16 16 using namespace VMG; 17 17 18 void Solver::Run(Grid& sol, Grid& rhs) 19 { 20 #ifdef DEBUG_MATRIX_CHECKS 21 sol.IsConsistent(); 22 rhs.IsConsistent(); 23 #endif 24 25 #ifdef DEBUG 26 sol.IsCompatible(rhs); 27 #endif 28 29 Comm* comm = MG::GetComm(); 30 31 Grid& rhsGlobal = comm->GetGlobalCoarseGrid(*rhs.Father()); 32 33 this->Realloc(rhsGlobal); 34 this->AssembleMatrix(rhsGlobal); 35 this->Compute(); 36 this->ExportSol(sol, rhs); 37 } 38 18 39 void Solver::Realloc(int n) 19 40 { 20 41 //Reallocate memory if necessary 21 this-> vec_size = n;42 this->size = n; 22 43 23 if (n > this->max_size) { 44 if (static_cast<int>(A.size()) < n*n) 45 A.resize(n*n); 24 46 25 delete [] b; 26 delete [] x; 27 for (int i=0; i<this->max_size; i++) 28 delete [] A[i]; 29 delete [] A; 47 if (static_cast<int>(b.size()) < n) 48 b.resize(n); 30 49 31 b = new vmg_float[n]; 32 x = new vmg_float[n]; 33 A = new vmg_float*[n]; 34 for (int i=0; i<n; i++) 35 A[i] = new vmg_float[n]; 36 37 this->max_size = n; 38 39 } 50 if (static_cast<int>(x.size()) < n) 51 x.resize(n); 40 52 } 41 53 42 54 void Solver::Realloc(Grid& sol) 43 55 { 44 this->Realloc(sol.Global().Size ().Product());56 this->Realloc(sol.Global().SizeGlobal().Product()); 45 57 }
Note:
See TracChangeset
for help on using the changeset viewer.
