Skip to content

Commit

Permalink
Merge pull request ComputationalRadiationPhysics#1273 from psychocode…
Browse files Browse the repository at this point in the history
…rHPC/fix-movingWindowBug

Fix MovingWindow localDimension
  • Loading branch information
ax3l committed Jan 7, 2016
2 parents 52813be + c2692ff commit abffb22
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/picongpu/include/simulationControl/MovingWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,33 @@ class MovingWindow
Window getWindow(uint32_t currentStep)
{
const SubGrid<simDim>& subGrid = Environment<simDim>::get().SubGrid();
Window window;

window.localDimensions = Selection<simDim>(subGrid.getLocalDomain().size);
/* Without moving window, the selected window spans the whole global domain.
* \see https://github.com/ComputationalRadiationPhysics/picongpu/wiki/PIConGPU-domain-definitions
*
* The window's global offset is therefore zero inside the global domain.
* The window's global and local size are equal to the SubGrid quantities.
* The local window offset is the offset within the global window which
* is equal to the local domain offset of the GPU.
*/
Window window;
window.localDimensions = subGrid.getLocalDomain();
window.globalDimensions = Selection<simDim>(subGrid.getGlobalDomain().size);

/* If sliding is inactive, moving window is the same as global domain (substract 0)*/
window.globalDimensions.size.y() -= subGrid.getLocalDomain().size.y() * slidingWindowActive;

/* moving window can only slide in y direction */
if (slidingWindowActive)
{
/* the moving window is smaller than the global domain by exactly one
* GPU (local domain size) in moving (y) direction
*/
window.globalDimensions.size.y() -= subGrid.getLocalDomain().size.y();

float_64 offsetFirstGPU = 0.0;
getCurrentSlideInfo(currentStep, NULL, &offsetFirstGPU);

/* global offset is all 0 except for y dimension */
/* while moving, the windows global offset within the global domain is between 0
* and smaller than the local domain's size in y.
*/
window.globalDimensions.offset.y() = offsetFirstGPU;

/* set top/bottom if there are no communication partners
Expand All @@ -242,8 +255,9 @@ class MovingWindow

if (isTopGpu)
{
/* local window offset is relative to global window start */
window.localDimensions.offset.y() = 0;
/* the windows local offset within the global window is reduced
* by the global window offset within the global domain
*/
window.localDimensions.size.y() -= offsetFirstGPU;
}
else
Expand Down

0 comments on commit abffb22

Please sign in to comment.