| 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::Realloc(int n)
|
|---|
| 19 | {
|
|---|
| 20 | //Reallocate memory if necessary
|
|---|
| 21 | this->vec_size = n;
|
|---|
| 22 |
|
|---|
| 23 | if (n > this->max_size) {
|
|---|
| 24 |
|
|---|
| 25 | delete [] b;
|
|---|
| 26 | delete [] x;
|
|---|
| 27 | for (int i=0; i<this->max_size; i++)
|
|---|
| 28 | delete [] A[i];
|
|---|
| 29 | delete [] A;
|
|---|
| 30 |
|
|---|
| 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 | }
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | void Solver::Realloc(Grid& sol)
|
|---|
| 43 | {
|
|---|
| 44 | this->Realloc(sol.Global().Size().Product());
|
|---|
| 45 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.