/** * @file solver.cpp * @author Julian Iseringhausen * @date Mon Apr 18 13:10:55 2011 * * @brief VMG::Solver * */ #ifdef HAVE_CONFIG_H #include #endif #include "solver/solver.hpp" using namespace VMG; void Solver::Run(Grid& sol, Grid& rhs) { #ifdef DEBUG_MATRIX_CHECKS sol.IsConsistent(); rhs.IsConsistent(); #endif #ifdef DEBUG sol.IsCompatible(rhs); #endif if (rhs.Global().LocalSize().Product() > 0) { this->Realloc(rhs); this->AssembleMatrix(rhs); this->Compute(); this->ExportSol(sol, rhs); } } void Solver::Realloc(int n) { //Reallocate memory if necessary this->size = n; if (static_cast(A.size()) < n*n) A.resize(n*n); if (static_cast(b.size()) < n) b.resize(n); if (static_cast(x.size()) < n) x.resize(n); } void Solver::Realloc(Grid& sol) { this->Realloc(sol.Global().GlobalSize().Product()); }