Changeset 4571da for src/grid/grid.cpp
- Timestamp:
- Apr 27, 2012, 11:34:57 PM (14 years ago)
- Children:
- 1a92cf
- Parents:
- b2154a3
- File:
-
- 1 edited
-
src/grid/grid.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/grid/grid.cpp
rb2154a3 r4571da 25 25 using namespace VMG; 26 26 27 vmg_float Grid::correction;28 29 27 void Grid::InitGrid() 30 28 { … … 112 110 avg += GetVal(*iter); 113 111 114 avg /= Local().Size().Product(); 112 avg = MG::GetComm()->GlobalSum(avg); 113 avg /= Global().GlobalSize().Product(); 114 115 #ifdef DEBUG_OUTPUT 116 MG::GetComm()->PrintStringOnce("Global constraint enforcement: %e", avg); 117 #endif 115 118 116 119 for (iter = Iterators().Local().Begin(); iter != Iterators().Local().End(); ++iter) … … 126 129 val += GetVal(*iter); 127 130 128 val = MG::GetComm()->GlobalSum(val) ;129 130 if ( fabs(val) > Global().GlobalSize().Product() *std::numeric_limits<vmg_float>::epsilon()) {131 val = MG::GetComm()->GlobalSum(val) / Global().GlobalSize().Product(); 132 133 if (std::abs(val) > std::numeric_limits<vmg_float>::epsilon()) { 131 134 132 135 #ifdef DEBUG_OUTPUT … … 134 137 #endif 135 138 136 val *= Helper::pow_2(this->Extent().MeshWidth().Max());137 139 for (iter = Iterators().Local().Begin(); iter != Iterators().Local().End(); ++iter) 138 140 (*this)(*iter) -= val; … … 155 157 #endif 156 158 157 for (Grid::iterator iter = Iterators().CompleteGrid().Begin(); iter != Iterators().CompleteGrid().End(); ++iter) 158 (*this)(*iter) = rhs.GetVal(*iter); 159 std::memcpy(grid, rhs.grid, local.SizeTotal().Product()*sizeof(vmg_float)); 159 160 } 160 161
Note:
See TracChangeset
for help on using the changeset viewer.
