Changeset e85cfd for src/grid/grid_index_translations.cpp
- Timestamp:
- Apr 9, 2013, 9:45:13 AM (13 years ago)
- Children:
- 0bd47e
- Parents:
- 4a709e
- File:
-
- 1 edited
-
src/grid/grid_index_translations.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/grid/grid_index_translations.cpp
r4a709e re85cfd 36 36 #include "grid/grid.hpp" 37 37 #include "grid/multigrid.hpp" 38 #include "mg.hpp" 38 39 39 40 using namespace VMG; … … 41 42 bool GridIndexTranslations::IsGridPointOf(const Grid& grid, const Index& index_finest) 42 43 { 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; 47 48 } 48 49 … … 64 65 Index GridIndexTranslations::GlobalToGlobalFinest(const Grid& grid, const Index& index_global) 65 66 { 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; 68 68 } 69 69 … … 75 75 Index GridIndexTranslations::GlobalFinestToGlobal(const Grid& grid, const Index& index_finest) 76 76 { 77 assert(grid.Father() != NULL);78 77 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()); 80 79 } 81 80 … … 97 96 98 97 void 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) 100 99 { 101 assert(grid_1.Father() != NULL);102 assert(grid_2.Father() != NULL);103 104 100 if (grid_1.Level() == grid_2.Level()) { 105 101 const Index begin_global = grid_1.Global() … … 117 113 118 114 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()); 120 116 121 117 Index begin_finest = GlobalToGlobalFinest(grid_1, grid_1.Global().LocalBegin())
Note:
See TracChangeset
for help on using the changeset viewer.
