Ignore:
Timestamp:
Nov 22, 2011, 9:22:10 PM (14 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
facba0
Parents:
66f24d
Message:

Major vmg update.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1136 5161e1c8-67bf-11de-9fd5-51895aff932f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/solver/solver.cpp

    r66f24d rdfed1c  
    1616using namespace VMG;
    1717
     18void 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
    1839void Solver::Realloc(int n)
    1940{
    2041  //Reallocate memory if necessary
    21   this->vec_size = n;
     42  this->size = n;
    2243
    23   if (n > this->max_size) {
     44  if (static_cast<int>(A.size()) < n*n)
     45    A.resize(n*n);
    2446
    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);
    3049
    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);
    4052}
    4153
    4254void Solver::Realloc(Grid& sol)
    4355{
    44   this->Realloc(sol.Global().Size().Product());
     56  this->Realloc(sol.Global().SizeGlobal().Product());
    4557}
Note: See TracChangeset for help on using the changeset viewer.