- Timestamp:
- Apr 9, 2013, 9:45:13 AM (13 years ago)
- Children:
- 0bd47e
- Parents:
- 4a709e
- Location:
- src/grid
- Files:
-
- 2 edited
-
grid_index_translations.cpp (modified) (6 diffs)
-
tempgrid.cpp (modified) (2 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()) -
src/grid/tempgrid.cpp
r4a709e re85cfd 104 104 105 105 const Grid& grid_finer = (*grid.Father())(grid.Level()+1); 106 const Index off = GridIndexTranslations::EndOffset(boundary);107 106 108 107 /* … … 123 122 124 123 global.LocalBegin() = (2*grid.Global().LocalBegin()).Clamp(global.GlobalBegin(), global.GlobalEnd()); 125 global.LocalEnd() = (2* (grid.Global().LocalEnd()-off)+off).Clamp(global.GlobalBegin(), global.GlobalEnd());124 global.LocalEnd() = (2*grid.Global().LocalEnd()).Clamp(global.GlobalBegin(), global.GlobalEnd()); 126 125 global.LocalSize() = global.LocalEnd() - global.LocalBegin(); 127 126
Note:
See TracChangeset
for help on using the changeset viewer.
