- Timestamp:
- Apr 5, 2013, 12:39:30 PM (13 years ago)
- Children:
- 4a709e
- Parents:
- f57182
- Location:
- src/grid
- Files:
-
- 1 added
- 9 edited
-
global_grid_partitioning.hpp (modified) (2 diffs)
-
grid.cpp (modified) (4 diffs)
-
grid.hpp (modified) (8 diffs)
-
grid_double_iterator.hpp (added)
-
grid_index_translations.cpp (modified) (2 diffs)
-
grid_index_translations.hpp (modified) (1 diff)
-
grid_properties.hpp (modified) (8 diffs)
-
is_grid.hpp (modified) (3 diffs)
-
multigrid.cpp (modified) (3 diffs)
-
tempgrid.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/grid/global_grid_partitioning.hpp
rf57182 r8180d8 44 44 const Index& Procs() const {return procs;} 45 45 const Index& Size() const {return size;} 46 const int& PointsMin() const {return points_min;}47 46 48 47 const Index& GlobalBegin(const Index& pos) const; … … 52 51 std::map<Index, Index> begin, end; 53 52 Index pos, procs, size; 54 int points_min;55 56 53 }; 57 54 -
src/grid/grid.cpp
rf57182 r8180d8 62 62 iterators = rhs.Iterators(); 63 63 father = rhs.Father(); 64 65 index_translations = rhs.Indexing();66 64 level = rhs.Level(); 67 65 … … 128 126 avg += GetVal(*iter); 129 127 130 avg = MG::GetComm()->GlobalSum(avg); 131 avg /= Global().GlobalSize().Product(); 128 avg = MG::GetComm()->GlobalSum(avg) / Global().GlobalSizeNew().Product(); 132 129 133 130 MG::GetComm()->PrintOnce(Info, "Global constraint enforcement: %e", avg); … … 146 143 val += GetVal(*iter); 147 144 148 val = MG::GetComm()->GlobalSum(val) / Global().GlobalSize ().Product();145 val = MG::GetComm()->GlobalSum(val) / Global().GlobalSizeNew().Product(); 149 146 150 147 if (std::abs(val) > std::numeric_limits<vmg_float>::epsilon()) { … … 248 245 eq &= Helper::IsEq(Global().LocalBegin(), rhs.Global().LocalBegin(), "Global().LocalBegin"); 249 246 eq &= Helper::IsEq(Global().LocalEnd(), rhs.Global().LocalEnd(), "Global().LocalEnd"); 250 eq &= Helper::IsEq(Global().GlobalSize(), rhs.Global().GlobalSize(), "Global().GlobalSize");251 247 eq &= Helper::IsEq(Global().LocalSize(), rhs.Global().LocalSize(), "Global().LocalSize"); 248 eq &= Helper::IsEq(Global().GlobalSizeFinest(), rhs.Global().GlobalSizeFinest(), "Global().GlobalSizeFinest"); 249 252 250 253 251 eq &= Helper::IsEq(Local().HaloBegin1(), rhs.Local().HaloBegin1(), "Local().HaloBegin1"); -
src/grid/grid.hpp
rf57182 r8180d8 30 30 31 31 #include "base/object.hpp" 32 #include "grid/grid_index_translations.hpp"33 32 #include "grid/grid_iterator.hpp" 34 33 #include "grid/grid_iterator_suite.hpp" … … 48 47 49 48 Grid(int level_ = 0, Multigrid* father_ = NULL) : 50 index_translations(this),51 49 level(level_), 52 50 father(father_) … … 60 58 int level_ = 0, 61 59 Multigrid* father_ = NULL) : 62 index_translations(this),63 60 level(level_), 64 61 global(global_), … … 72 69 73 70 Grid(const Grid& rhs) : 74 index_translations(rhs.Indexing()),75 71 level(rhs.Level()), 76 72 global(rhs.Global()), … … 124 120 void ApplyStencil(const Stencil& stencil); ///< Apply stencil to grid 125 121 126 int GlobalLinearIndex( int x, int y, intz) const; ///< Compute a unique 1-dimensional global index122 int GlobalLinearIndex(const int& x, const int& y, const int& z) const; ///< Compute a unique 1-dimensional global index 127 123 int GlobalLinearIndex(const Index& index) const; 128 124 … … 131 127 132 128 Multigrid* Father() const {return father;} 133 134 virtual vmg_float DebugKnownSolution(Vector x) const {return 0.0;}135 vmg_float DebugKnownSolution(Index i) const {return DebugKnownSolution(extent.Begin() + i * extent.MeshWidth());}136 137 const GridIndexTranslations& Indexing() const {return index_translations;}138 129 139 130 const int& Level() const {return level;} … … 146 137 private: 147 138 void InitGrid(); 148 149 GridIndexTranslations index_translations;150 139 151 140 protected: … … 193 182 } 194 183 195 inline int Grid::GlobalLinearIndex( int x, int y, intz) const184 inline int Grid::GlobalLinearIndex(const int& x, const int& y, const int& z) const 196 185 { 197 return z + global.GlobalSize().Z() * (y + global.GlobalSize().Y() * x); 186 return z - global.GlobalBegin().X() 187 + global.GlobalSizeNew().Z() * (y - global.GlobalBegin().Y() 188 + global.GlobalSizeNew().Y() * (x - global.GlobalBegin().X())); 198 189 } 199 190 -
src/grid/grid_index_translations.cpp
rf57182 r8180d8 31 31 #endif 32 32 33 #include <cassert>34 35 33 #include "base/helper.hpp" 34 #include "grid/grid_double_iterator.hpp" 36 35 #include "grid/grid_index_translations.hpp" 37 36 #include "grid/grid.hpp" … … 40 39 using namespace VMG; 41 40 42 Index GridIndexTranslations::GlobalToLocal(const Index& index_global) const 41 bool GridIndexTranslations::IsGridPointOf(const Grid& grid, const Index& index_finest) 43 42 { 44 const Index index_local = index_global - Father()->Global().LocalBegin() + Father()->Local().Begin(); 45 return index_local; 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; 46 47 } 47 48 48 Index GridIndexTranslations:: GlobalToFiner(const Index& index_global)49 Index GridIndexTranslations::LocalToGlobal(const Grid& grid, const Index& index_local) 49 50 { 50 const Index index_finer = 2 * index_global; 51 return index_finer; 51 return index_local - grid.Local().Begin() + grid.Global().LocalBegin(); 52 52 } 53 53 54 Index GridIndexTranslations:: GlobalToCoarser(const Index& index_global)54 Index GridIndexTranslations::LocalToGlobalFinest(const Grid& grid, const Index& index_local) 55 55 { 56 assert(index_global % 2 == 0); 57 const Index index_coarser = index_global / 2; 58 return index_coarser; 56 return GlobalToGlobalFinest(grid, LocalToGlobal(grid, index_local)); 59 57 } 60 58 61 Index GridIndexTranslations::GlobalTo Finer(const Index& index_global, const int& num_levels)59 Index GridIndexTranslations::GlobalToLocal(const Grid& grid, const Index& index_global) 62 60 { 63 const Index index_finer = Helper::intpow(2, num_levels) * index_global; 64 return index_finer; 61 return index_global - grid.Global().LocalBegin() + grid.Local().Begin(); 65 62 } 66 63 67 Index GridIndexTranslations::GlobalTo Coarser(const Index& index_global, const int& num_levels)64 Index GridIndexTranslations::GlobalToGlobalFinest(const Grid& grid, const Index& index_global) 68 65 { 69 int quotient = Helper::intpow(2, num_levels); 70 assert(index_global % quotient == 0); 71 const Index index_coarser = index_global / quotient; 72 return index_coarser; 66 assert(grid.Father() != NULL); 67 return Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level()) * index_global; 73 68 } 74 69 75 Index GridIndexTranslations:: LocalToGlobal(const Index& index_local) const70 Index GridIndexTranslations::GlobalFinestToLocal(const Grid& grid, const Index& index_finest) 76 71 { 77 const Index index_global = index_local - Father()->Local().Begin() + Father()->Global().LocalBegin(); 78 return index_global; 72 return GlobalToLocal(grid, GlobalFinestToGlobal(grid, index_finest)); 79 73 } 80 74 81 Index GridIndexTranslations:: LocalToFiner(const Index& index_local) const75 Index GridIndexTranslations::GlobalFinestToGlobal(const Grid& grid, const Index& index_finest) 82 76 { 83 assert(Father() != NULL); 84 assert(Father()->Father() != NULL); 85 86 const Multigrid& multigrid = *(Father()->Father()); 87 88 assert(Father()->Level() < multigrid.MaxLevel()); 89 90 const Index index_global_fine = GlobalToFiner(LocalToGlobal(index_local)); 91 const Index index_local_fine = multigrid(Father()->Level()+1).Indexing().GlobalToLocal(index_global_fine); 92 93 return index_local_fine; 77 assert(grid.Father() != NULL); 78 assert(IsGridPointOf(grid, index_finest)); 79 return index_finest / Helper::intpow(2, grid.Father()->MaxLevel() - grid.Level()); 94 80 } 95 81 96 Index GridIndexTranslations::LocalToCoarser(const Index& index_local) const 82 void GridIndexTranslations::GlobalCoarseToFine(Index& begin, Index& end) 97 83 { 98 assert(Father() != NULL); 99 assert(Father()->Father() != NULL); 100 101 const Multigrid& multigrid = *(Father()->Father()); 102 103 assert(Father()->Level() > multigrid.MinLevel()); 104 105 const Index index_global_coarse = GlobalToCoarser(LocalToGlobal(index_local)); 106 const Index index_local_coarse = multigrid(Father()->Level()-1).Indexing().GlobalToLocal(index_global_coarse); 107 108 return index_local_coarse; 84 for (int j=0; j<3; ++j) { 85 begin[j] = 2 * begin[j]; 86 end[j] = 2 * (end[j]-1) + 1; 87 } 109 88 } 110 89 111 Index GridIndexTranslations::FinestGlobalToLocal(const Index& index_finest) const 90 void GridIndexTranslations::GlobalFineToCoarse(Index& begin, Index& end) 112 91 { 113 const Index index_local = GlobalToLocal(FinestGlobalToGlobal(index_finest)); 114 return index_local; 92 for (int j=0; j<3; ++j) { 93 begin[j] = Helper::RoundUpToNextMultiple(begin[j], 2) / 2; 94 end[j] = Helper::RoundDownToNextMultiple(end[j]-1, 2) / 2 + 1; 95 } 115 96 } 116 97 117 Index GridIndexTranslations::FinestGlobalToGlobal(const Index& index_finest) const 98 void GridIndexTranslations::GetGridAlignment(const Grid& grid_1, GridIteratorSet& bounds_1, 99 const Grid& grid_2, GridIteratorSet& bounds_2) 118 100 { 119 const int quotient = Helper::intpow(2, Father()->Father()->MaxLevel() - Father()->Level()); 120 assert(index_finest % quotient == 0); 121 const Index index_global = index_finest / quotient; 122 return index_global; 123 } 101 assert(grid_1.Father() != NULL); 102 assert(grid_2.Father() != NULL); 124 103 125 void GridIndexTranslations::FineToCoarse(Index& begin, Index& end) 126 { 127 Index last_point = end - 1; 104 if (grid_1.Level() == grid_2.Level()) { 105 const Index begin_global = grid_1.Global() 106 .LocalBegin() 107 .Clamp(grid_2.Global().LocalBegin(), grid_2.Global().LocalEnd()); 128 108 129 for (int j=0; j<3; ++j) { 109 const Index end_global = grid_1.Global() 110 .LocalEnd() 111 .Clamp(grid_2.Global().LocalBegin(), grid_2.Global().LocalEnd()); 130 112 131 if (begin[j] % 2 == 0) 132 begin[j] /= 2; 133 else 134 begin[j] = (begin[j]+1) / 2; 113 bounds_1 = GridIteratorSet(GlobalToLocal(grid_1, begin_global), GlobalToLocal(grid_2, end_global)); 114 bounds_2 = GridIteratorSet(GlobalToLocal(grid_2, begin_global), GlobalToLocal(grid_2, end_global)); 135 115 136 if (last_point[j] % 2 == 0) 137 last_point[j] /= 2; 138 else 139 last_point[j] = (last_point[j]-1) / 2; 116 } else { 117 118 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()); 120 121 Index begin_finest = GlobalToGlobalFinest(grid_1, grid_1.Global().LocalBegin()) 122 .Clamp(GlobalToGlobalFinest(grid_2, grid_2.Global().LocalBegin()), 123 GlobalToGlobalFinest(grid_2, grid_2.Global().LocalEnd()-1)); 124 125 Index end_finest = GlobalToGlobalFinest(grid_1, grid_1.Global().LocalEnd()-1) 126 .Clamp(GlobalToGlobalFinest(grid_2, grid_2.Global().LocalBegin()), 127 GlobalToGlobalFinest(grid_2, grid_2.Global().LocalEnd()-1)); 128 129 for (int j=0; j<3; ++j) { 130 begin_finest[j] = Helper::RoundUpToNextMultiple(begin_finest[j], global_mult); 131 end_finest[j] = Helper::RoundDownToNextMultiple(end_finest[j], global_mult); 132 } 133 134 bounds_1 = GridIteratorSet(GlobalFinestToLocal(grid_1, begin_finest), GlobalFinestToLocal(grid_1, end_finest)+1); 135 bounds_2 = GridIteratorSet(GlobalFinestToLocal(grid_2, begin_finest), GlobalFinestToLocal(grid_2, end_finest)+1); 140 136 141 137 } 142 143 144 end = last_point + 1;145 138 } 146 147 void GridIndexTranslations::CoarseToFine(Index& begin, Index& end, const Index& size_global)148 {149 for (int i=0; i<3; ++i) {150 151 if (size_global[i] % 2 == 0) {152 153 begin[i] = 2*begin[i];154 end[i] = 2*end[i];155 156 }else {157 158 if (begin[i] > 0)159 begin[i] = 2*begin[i] - 1;160 end[i] = std::max(2*end[i] - 1, begin[i]);161 162 }163 }164 } -
src/grid/grid_index_translations.hpp
rf57182 r8180d8 38 38 class Comm; 39 39 class Grid; 40 class GridIteratorSet; 40 41 41 42 class GridIndexTranslations 42 43 { 43 44 public: 44 GridIndexTranslations(const Grid* father_) : 45 father(father_) 46 {} 45 GridIndexTranslations() {} 47 46 48 Index GlobalToLocal(const Index& index_global) const; 49 static Index GlobalToFiner(const Index& index_global); 50 static Index GlobalToCoarser(const Index& index_global); 47 static bool IsGridPointOf(const Grid& grid, const Index& index_finest); 51 48 52 static Index GlobalToFiner(const Index& index_global, const int& num_levels);53 static Index GlobalToCoarser(const Index& index_global, const int& num_levels);49 static Index LocalToGlobal(const Grid& grid, const Index& index_local); 50 static Index LocalToGlobalFinest(const Grid& grid, const Index& index_local); 54 51 55 Index LocalToGlobal(const Index& index_local) const; 56 Index LocalToFiner(const Index& index_local) const; 57 Index LocalToCoarser(const Index& index_local) const; 52 static Index GlobalToLocal(const Grid& grid, const Index& index_global); 53 static Index GlobalToGlobalFinest(const Grid& grid, const Index& index_global); 58 54 59 Index FinestGlobalToLocal(const Index& index_finest) const;60 Index FinestGlobalToGlobal(const Index& index_finest) const;55 static Index GlobalFinestToLocal(const Grid& grid, const Index& index_finest); 56 static Index GlobalFinestToGlobal(const Grid& grid, const Index& index_finest); 61 57 62 static void FineToCoarse(Index& begin, Index& end); 63 static void CoarseToFine(Index& begin, Index& end, const Index& size_global); 58 static void GlobalCoarseToFine(Index& begin, Index& end); 59 static void GlobalFineToCoarse(Index& begin, Index& end); 60 61 static void GetGridAlignment(const Grid& grid_1, GridIteratorSet& bounds_1, 62 const Grid& grid_2, GridIteratorSet& bounds_2); 63 64 static void GetInnerBoundary(const Grid& grid_coarse, Index& b1_c, Index& b2_c, 65 const Grid& grid_fine, Index& b1_f, Index& b2_f); 66 67 68 69 64 70 65 71 static Index EndOffset(const Boundary& boundary) 66 72 { 67 Index offset; 68 69 for (int i=0; i<3; ++i) 70 offset[i] = (boundary[i] == Open || boundary[i] == Dirichlet ? 1 : 0); 71 72 return offset; 73 return Index(boundary[0] == Periodic ? 0 : 1, 74 boundary[1] == Periodic ? 0 : 1, 75 boundary[2] == Periodic ? 0 : 1); 73 76 } 74 75 protected:76 const Grid* Father() const {return father;}77 78 private:79 const Grid* father;80 77 }; 81 78 -
src/grid/grid_properties.hpp
rf57182 r8180d8 41 41 GlobalIndices() : 42 42 local_begin(0), local_end(0), local_size(0), 43 global_finer_begin(0), global_finer_end(0), global_finer_size(0), 44 local_finer_begin(0), local_finer_end(0), local_finer_size(0), 45 global_size(0), 43 global_begin(0), global_end(0), global_size(0), 44 global_begin_finest(0), global_end_finest(0), global_size_finest(0), 46 45 boundary(EmptyGrid) 47 46 {} … … 49 48 GlobalIndices(const GlobalIndices& other) : 50 49 local_begin(other.local_begin), local_end(other.local_end), local_size(other.local_size), 51 global_finer_begin(other.global_finer_begin), global_finer_end(other.global_finer_end), global_finer_size(other.global_finer_size), 52 local_finer_begin(other.local_finer_begin), local_finer_end(other.local_finer_end), local_finer_size(other.local_finer_size), 53 global_size(other.global_size), 50 global_begin(other.global_begin), global_end(other.global_end), global_size(other.global_size), 51 global_begin_finest(other.global_begin_finest), global_end_finest(other.global_end_finest), global_size_finest(other.global_size_finest), 54 52 boundary(other.boundary) 55 53 {} … … 63 61 const Index& LocalSize() const {return local_size;} 64 62 65 Index& Global FinerBegin() {return global_finer_begin;}66 Index& Global FinerEnd() {return global_finer_end;}67 Index& Global FinerSize() {return global_finer_size;}63 Index& GlobalBegin() {return global_begin;} 64 Index& GlobalEnd() {return global_end;} 65 Index& GlobalSizeNew() {return global_size;} 68 66 69 const Index& Global FinerBegin() const {return global_finer_begin;}70 const Index& Global FinerEnd() const {return global_finer_end;}71 const Index& Global FinerSize() const {return global_finer_size;}67 const Index& GlobalBegin() const {return global_begin;} 68 const Index& GlobalEnd() const {return global_end;} 69 const Index& GlobalSizeNew() const {return global_size;} 72 70 73 Index& LocalFinerBegin() {return local_finer_begin;}74 Index& LocalFinerEnd() {return local_finer_end;}75 Index& LocalFinerSize() {return local_finer_size;}71 Index& GlobalBeginFinest() {return global_begin_finest;} 72 Index& GlobalEndFinest() {return global_end_finest;} 73 Index& GlobalSizeFinest() {return global_size_finest;} 76 74 77 const Index& LocalFinerBegin() const {return local_finer_begin;} 78 const Index& LocalFinerEnd() const {return local_finer_end;} 79 const Index& LocalFinerSize() const {return local_finer_size;} 80 81 Index& GlobalSize() {return global_size;} 82 const Index& GlobalSize() const {return global_size;} 75 const Index& GlobalBeginFinest() const {return global_begin_finest;} 76 const Index& GlobalEndFinest() const {return global_end_finest;} 77 const Index& GlobalSizeFinest() const {return global_size_finest;} 83 78 84 79 BT& BoundaryType() {return boundary;} … … 87 82 private: 88 83 Index local_begin, local_end, local_size; 89 Index global_finer_begin, global_finer_end, global_finer_size; 90 Index local_finer_begin, local_finer_end, local_finer_size; 91 Index global_size; 84 Index global_begin, global_end, global_size; 85 Index global_begin_finest, global_end_finest, global_size_finest; 92 86 BT boundary; 93 87 }; … … 101 95 halo_begin_2(0), halo_end_2(0), halo_size_2(0), 102 96 boundary_begin_1(0), boundary_end_1(0), boundary_size_1(0), 103 boundary_begin_2(0), boundary_end_2(0), boundary_size_2(0), 104 finer_begin(0), finer_end(0), finer_size(0) 97 boundary_begin_2(0), boundary_end_2(0), boundary_size_2(0) 105 98 {} 106 99 … … 110 103 halo_begin_2(other.halo_begin_2), halo_end_2(other.halo_end_2), halo_size_2(other.halo_size_2), 111 104 boundary_begin_1(other.boundary_begin_1), boundary_end_1(other.boundary_end_1), boundary_size_1(other.boundary_size_1), 112 boundary_begin_2(other.boundary_begin_2), boundary_end_2(other.boundary_end_2), boundary_size_2(other.boundary_size_2), 113 finer_begin(other.finer_begin), finer_end(other.finer_end), finer_size(other.finer_size) 105 boundary_begin_2(other.boundary_begin_2), boundary_end_2(other.boundary_end_2), boundary_size_2(other.boundary_size_2) 114 106 {} 115 107 … … 156 148 const Index& BoundarySize2() const {return boundary_size_2;} ///< Size of boundary 157 149 158 Index& FinerBegin() {return finer_begin;}159 Index& FinerEnd() {return finer_end;}160 Index& FinerSize() {return finer_size;}161 162 const Index& FinerBegin() const {return finer_begin;}163 const Index& FinerEnd() const {return finer_end;}164 const Index& FinerSize() const {return finer_size;}165 166 bool HasFinerGrid() const {return static_cast<bool>(finer_size.Product());}167 168 150 private: 169 151 Index begin, end, size, size_total; … … 172 154 Index boundary_begin_1, boundary_end_1, boundary_size_1; 173 155 Index boundary_begin_2, boundary_end_2, boundary_size_2; 174 Index finer_begin, finer_end, finer_size;175 156 }; 176 157 -
src/grid/is_grid.hpp
rf57182 r8180d8 31 31 #include "base/object.hpp" 32 32 #include "grid/grid.hpp" 33 #include "grid/grid_index_translations.hpp"34 33 #include "grid/grid_iterator.hpp" 35 34 #include "grid/grid_iterator_suite.hpp" … … 172 171 inline int IsGrid<T>::GlobalLinearIndex(int x, int y, int z) const 173 172 { 174 return z + global.GlobalSize ().Z() * (y + global.GlobalSize().Y() * x);173 return z + global.GlobalSizeNew().Z() * (y + global.GlobalSizeNew().Y() * x); 175 174 } 176 175 … … 178 177 inline int IsGrid<T>::GlobalLinearIndex(const Index& index) const 179 178 { 180 return index.Z() + global.GlobalSize ().Z() * (index.Y() + global.GlobalSize().Y() * index.X());179 return index.Z() + global.GlobalSizeNew().Z() * (index.Y() + global.GlobalSizeNew().Y() * index.X()); 181 180 } 182 181 -
src/grid/multigrid.cpp
rf57182 r8180d8 100 100 } 101 101 102 if (global_separated[i].LocalEnd()[j] == global_separated[i].Global Size()[j]) {102 if (global_separated[i].LocalEnd()[j] == global_separated[i].GlobalEnd()[j]) { 103 103 local_l.BoundaryBegin2()[j] = local_l.SizeTotal()[j] - 1; 104 104 local_l.BoundaryEnd2()[j] = local_l.SizeTotal()[j]; … … 139 139 local_l.BoundarySize1() = local_l.BoundaryEnd1() - local_l.BoundaryBegin1(); 140 140 local_l.BoundarySize2() = local_l.BoundaryEnd2() - local_l.BoundaryBegin2(); 141 142 local_l.FinerSize() = global_separated[i].LocalFinerSize();143 local_l.FinerBegin() = global_separated[i].LocalFinerBegin() - global_separated[i].LocalBegin() + local_l.HaloSize1();144 local_l.FinerEnd() = local_l.FinerBegin() + local_l.FinerSize();145 146 141 147 142 }else { … … 163 158 local_l.BoundaryEnd2() = 0; 164 159 local_l.BoundarySize2() = 0; 165 local_l.FinerBegin() = 0;166 local_l.FinerEnd() = 0;167 local_l.FinerSize() = 0;168 160 169 161 } -
src/grid/tempgrid.cpp
rf57182 r8180d8 65 65 global.LocalEnd() = size; 66 66 global.LocalSize() = size; 67 global.GlobalFinerBegin() = 0; 68 global.GlobalFinerEnd() = 0; 69 global.GlobalFinerSize() = 0; 70 global.LocalFinerBegin() = 0; 71 global.LocalFinerEnd() = 0; 72 global.LocalFinerSize() = 0; 73 global.GlobalSize() = size; 67 global.GlobalBegin() = 0; 68 global.GlobalEnd() = size; 69 global.GlobalSizeNew() = size; 70 global.GlobalBeginFinest() = 0; 71 global.GlobalEndFinest() = size; 72 global.GlobalSizeFinest() = size; 74 73 global.BoundaryType() = BTUndefined; 75 74 … … 90 89 local.BoundaryEnd2() = 0; 91 90 local.BoundarySize2() = 0; 92 local.FinerBegin() = 0;93 local.FinerEnd() = 0;94 local.FinerSize() = 0;95 91 96 92 extent.Begin() = spatial_begin; … … 116 112 level = grid.Level() + 1; 117 113 114 global.GlobalBegin() = grid_finer.Global().GlobalBegin(); 115 global.GlobalEnd() = grid_finer.Global().GlobalEnd(); 116 global.GlobalSizeNew() = grid_finer.Global().GlobalSizeNew(); 117 118 global.GlobalBeginFinest() = grid_finer.Global().GlobalBeginFinest(); 119 global.GlobalEndFinest() = grid_finer.Global().GlobalEndFinest(); 120 global.GlobalSizeFinest() = grid_finer.Global().GlobalSizeFinest(); 121 118 122 global.BoundaryType() = grid_finer.Global().BoundaryType(); 119 123 120 global.GlobalFinerBegin() = 0; 121 global.GlobalFinerEnd() = 0; 122 global.GlobalFinerSize() = 0; 123 124 global.LocalFinerBegin() = 0; 125 global.LocalFinerEnd() = 0; 126 global.LocalFinerSize() = 0; 127 128 global.LocalBegin() = 2 * (grid.Global().LocalFinerBegin() - grid.Global().GlobalFinerBegin()); 129 global.LocalEnd() = 2 * (grid.Global().LocalFinerEnd() - grid.Global().GlobalFinerBegin() - off) + off; 124 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()); 130 126 global.LocalSize() = global.LocalEnd() - global.LocalBegin(); 131 127 132 global.GlobalSize() = 2 * (grid.Global().GlobalFinerSize() - off) + off;133 134 for (int j=0; j<3; ++j) {135 136 if (boundary[j] == Dirichlet ||137 boundary[j] == Open) {138 139 if (grid.Global().BoundaryType() == LocallyRefined) {140 141 global.GlobalSize()[j] += 2;142 global.LocalBegin()[j] += 1;143 global.LocalEnd()[j] +=1;144 145 } else if (grid.Global().BoundaryType() == GlobalMax) {146 147 global.GlobalSize()[j] += 2;148 global.LocalBegin()[j] += 1;149 global.LocalEnd()[j] +=1;150 151 }152 153 } else {154 155 }156 157 }158 159 global.LocalSize() = global.LocalEnd() - global.LocalBegin();160 128 if (global.LocalSize().Product() == 0) { 161 129 global.LocalBegin() = 0; … … 164 132 global.BoundaryType() = EmptyGrid; 165 133 } 166 167 local.FinerBegin() = 0;168 local.FinerEnd() = 0;169 local.FinerSize() = 0;170 134 171 135 local.Begin() = 0; … … 234 198 235 199 const Grid& grid_coarser = (*grid.Father())(grid.Level()-1); 236 const Index off = GridIndexTranslations::EndOffset(boundary);237 200 238 201 level = grid.Level() - 1; 239 202 240 global.GlobalFinerBegin() = grid_coarser.Global().GlobalFinerBegin(); 241 global.GlobalFinerEnd() = grid_coarser.Global().GlobalFinerEnd(); 242 global.GlobalFinerSize() = grid_coarser.Global().GlobalFinerSize(); 243 244 global.GlobalSize() = (grid.Global().GlobalSize() - off)/2 + off; 203 global.GlobalBegin() = grid.Global().GlobalBegin(); 204 global.GlobalEnd() = grid.Global().GlobalEnd(); 205 global.GlobalSizeNew() = grid.Global().GlobalSizeNew(); 206 207 global.GlobalBeginFinest() = grid.Global().GlobalBeginFinest(); 208 global.GlobalEndFinest() = grid.Global().GlobalEndFinest(); 209 global.GlobalSizeFinest() = grid.Global().GlobalSizeFinest(); 210 245 211 global.BoundaryType() = grid_coarser.Global().BoundaryType(); 246 212 247 213 global.LocalBegin() = grid.Global().LocalBegin(); 248 214 global.LocalEnd() = grid.Global().LocalEnd(); 249 GridIndexTranslations::FineToCoarse(global.LocalBegin(), global.LocalEnd()); 250 251 global.LocalBegin() += grid_coarser.Global().GlobalFinerBegin(); 252 global.LocalEnd() += grid_coarser.Global().GlobalFinerBegin(); 253 215 GridIndexTranslations::GlobalFineToCoarse(global.LocalBegin(), global.LocalEnd()); 254 216 global.LocalSize() = global.LocalEnd() - global.LocalBegin(); 255 217 … … 260 222 global.BoundaryType() = EmptyGrid; 261 223 } 262 263 global.LocalFinerBegin() = global.LocalBegin();264 global.LocalFinerEnd() = global.LocalEnd();265 global.LocalFinerSize() = global.LocalSize();266 224 267 225 local.SizeTotal() = global.LocalSize(); … … 319 277 local.BoundarySize2() = local.BoundaryEnd2() - local.BoundaryBegin2(); 320 278 321 local.FinerBegin() = local.Begin();322 local.FinerEnd() = local.End();323 local.FinerSize() = local.Size();324 325 279 Extent().Size() = grid.Extent().Size(); 326 280 Extent().Begin() = grid.Extent().Begin();
Note:
See TracChangeset
for help on using the changeset viewer.
