@@ -218,20 +218,33 @@ class MovingWindow
218218 Window getWindow (uint32_t currentStep)
219219 {
220220 const SubGrid<simDim>& subGrid = Environment<simDim>::get ().SubGrid ();
221- Window window;
222221
223- window.localDimensions = Selection<simDim>(subGrid.getLocalDomain ().size );
222+ /* Without moving window, the selected window spans the whole global domain.
223+ * \see https://github.com/ComputationalRadiationPhysics/picongpu/wiki/PIConGPU-domain-definitions
224+ *
225+ * The window's global offset is therefore zero inside the global domain.
226+ * The window's global and local size are equal to the SubGrid quantities.
227+ * The local window offset is the offset within the global window which
228+ * is equal to the local domain offset of the GPU.
229+ */
230+ Window window;
231+ window.localDimensions = subGrid.getLocalDomain ();
224232 window.globalDimensions = Selection<simDim>(subGrid.getGlobalDomain ().size );
225233
226- /* If sliding is inactive, moving window is the same as global domain (substract 0)*/
227- window.globalDimensions .size .y () -= subGrid.getLocalDomain ().size .y () * slidingWindowActive;
228-
234+ /* moving window can only slide in y direction */
229235 if (slidingWindowActive)
230236 {
237+ /* the moving window is smaller than the global domain by exactly one
238+ * GPU (local domain size) in moving (y) direction
239+ */
240+ window.globalDimensions .size .y () -= subGrid.getLocalDomain ().size .y ();
241+
231242 float_64 offsetFirstGPU = 0.0 ;
232243 getCurrentSlideInfo (currentStep, NULL , &offsetFirstGPU);
233244
234- /* global offset is all 0 except for y dimension */
245+ /* while moving, the windows global offset within the global domain is between 0
246+ * and smaller than the local domain's size in y.
247+ */
235248 window.globalDimensions .offset .y () = offsetFirstGPU;
236249
237250 /* set top/bottom if there are no communication partners
@@ -242,8 +255,9 @@ class MovingWindow
242255
243256 if (isTopGpu)
244257 {
245- /* local window offset is relative to global window start */
246- window.localDimensions .offset .y () = 0 ;
258+ /* the windows local offset within the global window is reduced
259+ * by the global window offset within the global domain
260+ */
247261 window.localDimensions .size .y () -= offsetFirstGPU;
248262 }
249263 else
0 commit comments