| Rev | Line | |
|---|
| [48b662] | 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 |
|
|---|
| [dfed1c] | 18 | void Solver::Run(Grid& sol, Grid& rhs)
|
|---|
| [48b662] | 19 | {
|
|---|
| [dfed1c] | 20 | #ifdef DEBUG_MATRIX_CHECKS
|
|---|
| 21 | sol.IsConsistent();
|
|---|
| 22 | rhs.IsConsistent();
|
|---|
| 23 | #endif
|
|---|
| 24 |
|
|---|
| 25 | #ifdef DEBUG
|
|---|
| 26 | sol.IsCompatible(rhs);
|
|---|
| 27 | #endif
|
|---|
| 28 |
|
|---|
| [ac6d04] | 29 | if (rhs.Global().LocalSize().Product() > 0) {
|
|---|
| 30 | this->Realloc(rhs);
|
|---|
| 31 | this->AssembleMatrix(rhs);
|
|---|
| 32 | this->Compute();
|
|---|
| 33 | this->ExportSol(sol, rhs);
|
|---|
| 34 | }
|
|---|
| [dfed1c] | 35 | }
|
|---|
| 36 |
|
|---|
| 37 | void Solver::Realloc(int n)
|
|---|
| 38 | {
|
|---|
| 39 | //Reallocate memory if necessary
|
|---|
| 40 | this->size = n;
|
|---|
| [48b662] | 41 |
|
|---|
| [dfed1c] | 42 | if (static_cast<int>(A.size()) < n*n)
|
|---|
| 43 | A.resize(n*n);
|
|---|
| [48b662] | 44 |
|
|---|
| [dfed1c] | 45 | if (static_cast<int>(b.size()) < n)
|
|---|
| 46 | b.resize(n);
|
|---|
| [48b662] | 47 |
|
|---|
| [dfed1c] | 48 | if (static_cast<int>(x.size()) < n)
|
|---|
| 49 | x.resize(n);
|
|---|
| [48b662] | 50 | }
|
|---|
| 51 |
|
|---|
| 52 | void Solver::Realloc(Grid& sol)
|
|---|
| 53 | {
|
|---|
| [ac6d04] | 54 | this->Realloc(sol.Global().GlobalSize().Product());
|
|---|
| [48b662] | 55 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.