/** * set water height h in all interior grid cells (i.e. except ghost layer) * to values specified by parameter function _h */ void SWE_Block::setWaterHeight(float (*_h)(float, float)) { for(int i=nghosts; i<nx+nghosts; i++) for(int j=nghosts; j<ny+nghosts; j++) { h[i][j] = _h(offsetX + (i-nghosts+0.5f)*dx, offsetY + (j-nghosts+0.5f)*dy); }; synchWaterHeightAfterWrite(); }
/** * set water height h in all interior grid cells (i.e. except ghost layer) * to values specified by parameter function _h */ void SWE_Block::setWaterHeight(float (*_h)(float, float)) { for(int i=1; i<=nx; i++) for(int j=1; j<=ny; j++) { h[i][j] = _h(offsetX + (i-0.5f)*dx, offsetY + (j-0.5f)*dy); }; synchWaterHeightAfterWrite(); }
/** * set water height h in all interior grid cells (i.e. except ghost layer) * to a uniform value */ void SWE_Block::setWaterHeight(float _h) { for(int i=nghosts; i<nx+nghosts; i++) for(int j=nghosts; j<ny+nghosts; j++) { h[i][j] = _h; }; synchWaterHeightAfterWrite(); }
/** * set water height h in all interior grid cells (i.e. except ghost layer) * to a uniform value */ void SWE_Block::setWaterHeight(float _h) { for(int i=1; i<=nx; i++) for(int j=1; j<=ny; j++) { h[i][j] = _h; }; synchWaterHeightAfterWrite(); }
/** * Update all temporary and non-local (for heterogeneous computing) variables * after an external update of the main variables h, hu, hv, and b. */ void SWE_Block::synchAfterWrite() { synchWaterHeightAfterWrite(); synchDischargeAfterWrite(); synchBathymetryAfterWrite(); }