Ignore:
Timestamp:
Apr 9, 2013, 9:45:13 AM (13 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
0bd47e
Parents:
4a709e
Message:

Work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/grid/grid_index_translations.cpp

    r4a709e re85cfd  
    3636#include "grid/grid.hpp"
    3737#include "grid/multigrid.hpp"
     38#include "mg.hpp"
    3839
    3940using namespace VMG;
     
    4142bool GridIndexTranslations::IsGridPointOf(const Grid& grid, const Index& index_finest)
    4243{
    43   assert(grid.Father() != NULL);
    44   return index_finest[0] % Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level()) == 0 &&
    45          index_finest[1] % Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level()) == 0 &&
    46          index_finest[2] % Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level()) == 0;
     44  const int max_level = MG::GetSol()->MaxLevel();
     45  return index_finest[0] % Helper::intpow(2, max_level - grid.Level()) == 0 &&
     46         index_finest[1] % Helper::intpow(2, max_level - grid.Level()) == 0 &&
     47         index_finest[2] % Helper::intpow(2, max_level - grid.Level()) == 0;
    4748}
    4849
     
    6465Index GridIndexTranslations::GlobalToGlobalFinest(const Grid& grid, const Index& index_global)
    6566{
    66   assert(grid.Father() != NULL);
    67   return Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level()) * index_global;
     67  return Helper::intpow(2, MG::GetSol()->MaxLevel() - grid.Level()) * index_global;
    6868}
    6969
     
    7575Index GridIndexTranslations::GlobalFinestToGlobal(const Grid& grid, const Index& index_finest)
    7676{
    77   assert(grid.Father() != NULL);
    7877  assert(IsGridPointOf(grid, index_finest));
    79   return index_finest / Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level());
     78  return index_finest / Helper::intpow(2, MG::GetSol()->MaxLevel() - grid.Level());
    8079}
    8180
     
    9796
    9897void GridIndexTranslations::GetGridAlignment(const Grid& grid_1, GridIteratorSet& bounds_1,
    99                       const Grid& grid_2, GridIteratorSet& bounds_2)
     98                                             const Grid& grid_2, GridIteratorSet& bounds_2)
    10099{
    101   assert(grid_1.Father() != NULL);
    102   assert(grid_2.Father() != NULL);
    103 
    104100  if (grid_1.Level() == grid_2.Level()) {
    105101    const Index begin_global = grid_1.Global()
     
    117113
    118114    const Grid& grid_c = (grid_1.Level() < grid_2.Level() ? grid_1 : grid_2);
    119     const int global_mult = Helper::intpow(2, grid_c.Father()->MaxLevel() - grid_c.Level());
     115    const int global_mult = Helper::intpow(2, MG::GetSol()->MaxLevel() - grid_c.Level());
    120116
    121117    Index begin_finest = GlobalToGlobalFinest(grid_1, grid_1.Global().LocalBegin())
Note: See TracChangeset for help on using the changeset viewer.