| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * @file solver.cpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Mon Apr 18 13:10:55 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief VMG::Solver
|
|---|
| 7 | *
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | #ifdef HAVE_CONFIG_H
|
|---|
| 11 | #include <config.h>
|
|---|
| 12 | #endif
|
|---|
| 13 |
|
|---|
| 14 | #include "solver/solver.hpp"
|
|---|
| 15 |
|
|---|
| 16 | using namespace VMG;
|
|---|
| 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 |
|
|---|
| 39 | void Solver::Realloc(int n)
|
|---|
| 40 | {
|
|---|
| 41 | //Reallocate memory if necessary
|
|---|
| 42 | this->size = n;
|
|---|
| 43 |
|
|---|
| 44 | if (static_cast<int>(A.size()) < n*n)
|
|---|
| 45 | A.resize(n*n);
|
|---|
| 46 |
|
|---|
| 47 | if (static_cast<int>(b.size()) < n)
|
|---|
| 48 | b.resize(n);
|
|---|
| 49 |
|
|---|
| 50 | if (static_cast<int>(x.size()) < n)
|
|---|
| 51 | x.resize(n);
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | void Solver::Realloc(Grid& sol)
|
|---|
| 55 | {
|
|---|
| 56 | this->Realloc(sol.Global().SizeGlobal().Product());
|
|---|
| 57 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.