Index: src/Fragmentation/Summation/SetValues/SamplingGrid.cpp
===================================================================
--- src/Fragmentation/Summation/SetValues/SamplingGrid.cpp	(revision c1948cb9ade8dfb874db487da9a669d67a386881)
+++ src/Fragmentation/Summation/SetValues/SamplingGrid.cpp	(revision 336da86f429a228bb3d95475bdea130ef26bbe67)
@@ -452,4 +452,37 @@
     ASSERT( (_wend[index] - _wbegin[index]) == _wlength[index],
         "SamplingGrid::getDiscreteWindowCopyIndices() - end - begin is not equal to length for "
+        +toString(index)+"th component.");
+  }
+}
+
+void SamplingGrid::getDiscreteWindowOffsets(
+    size_t _pre_offset[NDIM],
+    size_t _post_offset[NDIM],
+    size_t _length[NDIM],
+    size_t _total[NDIM]) const
+{
+  const double round_offset =
+      (std::numeric_limits<size_t>::round_style == std::round_toward_zero) ?
+          0.5 : 0.; // need offset to get to round_toward_nearest behavior
+  for(size_t index=0;index<NDIM;++index) {
+    if (fabs(end[index] - begin[index]) > std::numeric_limits<double>::epsilon()*1e4) {
+      // we refrain from using floor/ceil as the window's starts and ends,
+      // the grids have to be compatible (equal level), should always be on
+      // discrete grid point locations.
+      const double delta = getDeltaPerAxis(index);
+      // delta is conversion factor from box length to discrete length, i.e. number of points
+      _pre_offset[index] = (begin_window[index] - begin[index])/delta+round_offset;
+      _post_offset[index] = (end[index] - end_window[index])/delta+round_offset;
+      _length[index] = (end_window[index] - begin_window[index])/delta+round_offset;
+      _total[index] = (end[index] - begin[index])/delta+round_offset;
+    } else {
+      _pre_offset[index] = 0;
+      _post_offset[index] = 0;
+      _length[index] = 0;
+      _total[index] = 0;
+    }
+    // total is used as safe-guard against loss due to discrete conversion
+    ASSERT( (_pre_offset[index] + _post_offset[index]) + _length[index] == _total[index],
+        "SamplingGrid::getDiscreteWindowCopyIndices() - pre, length, post are not equal to total for "
         +toString(index)+"th component.");
   }
Index: src/Fragmentation/Summation/SetValues/SamplingGrid.hpp
===================================================================
--- src/Fragmentation/Summation/SetValues/SamplingGrid.hpp	(revision c1948cb9ade8dfb874db487da9a669d67a386881)
+++ src/Fragmentation/Summation/SetValues/SamplingGrid.hpp	(revision 336da86f429a228bb3d95475bdea130ef26bbe67)
@@ -253,4 +253,18 @@
       size_t _wend[NDIM]) const;
 
+  /** Returns number of grid points before the window, during the window, and
+   * after the window including the total length of the domain for check.
+   *
+   * \param _pre_offset grid points before start of window
+   * \param _post_offset grid points after end of window
+   * \param _length grid points in window
+   * \param _total grid points in domain
+   */
+  void getDiscreteWindowOffsets(
+      size_t _pre_offset[NDIM],
+      size_t _post_offset[NDIM],
+      size_t _length[NDIM],
+      size_t _total[NDIM]) const;
+
   /** Equality operator.
    *
Index: src/Jobs/WindowGrid_converter.cpp
===================================================================
--- src/Jobs/WindowGrid_converter.cpp	(revision c1948cb9ade8dfb874db487da9a669d67a386881)
+++ src/Jobs/WindowGrid_converter.cpp	(revision 336da86f429a228bb3d95475bdea130ef26bbe67)
@@ -59,5 +59,5 @@
 {
 #ifndef NDEBUG
-  for(size_t index=0;index<3;++index) {
+  for(size_t index=0;index<NDIM;++index) {
     ASSERT( window.begin[index] >= window.begin_window[index],
         "InterfaceVMGJob::addGridOntoWindow() - given grid starts earlier than window in component "
@@ -69,30 +69,11 @@
 #endif
   // the only issue are indices
-  const size_t gridpoints_axis = window.getGridPointsPerAxis();
-  size_t pre_offset[3];
-  size_t post_offset[3];
-  size_t length[3];
-  size_t total[3];
-  const double round_offset =
-      (std::numeric_limits<size_t>::round_style == std::round_toward_zero) ?
-          0.5 : 0.; // need offset to get to round_toward_nearest behavior
-  for(size_t index=0;index<3;++index) {
-    const double delta = (double)gridpoints_axis/(window.end[index] - window.begin[index]);
-    // delta is conversion factor from box length to discrete length, i.e. number of points
-    pre_offset[index] = delta*(window.begin[index] - window.begin_window[index])+round_offset;
-    length[index] = delta*(window.end[index] - window.begin[index])+round_offset;
-    post_offset[index] = delta*(window.end_window[index] - window.end[index])+round_offset;
-    total[index] = delta*(window.end_window[index] - window.begin_window[index])+round_offset;
-    // total is used as safe-guard against loss due to discrete conversion
-    ASSERT( pre_offset[index]+post_offset[index]+length[index] == total[index],
-        "InterfaceVMGJob::addGridOntoWindow() - pre, post, and length don't sum up to total for "
-        +toString(index)+"th component.");
-  }
+  size_t pre_offset[NDIM];
+  size_t post_offset[NDIM];
+  size_t length[NDIM];
+  size_t total[NDIM];
+  window.getDiscreteWindowOffsets(pre_offset, post_offset, length, total);
 #ifndef NDEBUG
   const size_t calculated_size = length[0]*length[1]*length[2];
-//  const size_t given_size = std::distance(grid_begin, grid_end);
-//  ASSERT( calculated_size == given_size,
-//      "InterfaceVMGJob::addGridOntoWindow() - not enough sampled values given: "
-//      +toString(calculated_size)+" != "+toString(given_size)+".");
   ASSERT( calculated_size <=  window.sampled_grid.size(),
       "InterfaceVMGJob::addGridOntoWindow() - not enough sampled values available: "
@@ -103,5 +84,5 @@
       +toString(total_size)+" != "+toString(window.sampled_grid.size())+".");
 #endif
-  size_t N[3];
+  size_t N[NDIM];
   SamplingGrid::sampledvalues_t::iterator griditer = window.sampled_grid.begin();
   std::advance(griditer, pre_offset[0]*total[1]*total[2]);
@@ -183,5 +164,5 @@
 {
 #ifndef NDEBUG
-  for(size_t index=0;index<3;++index) {
+  for(size_t index=0;index<NDIM;++index) {
     ASSERT( grid.begin_window[index] >= grid.begin[index],
         "InterfaceVMGJob::addWindowOntoGrid() - given window starts earlier than grid in component "
@@ -193,24 +174,9 @@
 #endif
   // the only issue are indices
-  const size_t gridpoints_axis = grid.getGridPointsPerAxis();
-  size_t pre_offset[3];
-  size_t post_offset[3];
-  size_t length[3];
-  size_t total[3];
-  const double round_offset =
-      (std::numeric_limits<size_t>::round_style == std::round_toward_zero) ?
-          0.5 : 0.; // need offset to get to round_toward_nearest behavior
-  for(size_t index=0;index<3;++index) {
-    const double delta = (double)gridpoints_axis/(grid.end[index] - grid.begin[index]);
-    // delta is conversion factor from box length to discrete length, i.e. number of points
-    pre_offset[index] = delta*(grid.begin_window[index] - grid.begin[index])+round_offset;
-    length[index] = delta*(grid.end_window[index] - grid.begin_window[index])+round_offset;
-    post_offset[index] = delta*(grid.end[index] - grid.end_window[index])+round_offset;
-    total[index] = delta*(grid.end[index] - grid.begin[index])+round_offset;
-    // total is used as safe-guard against loss due to discrete conversion
-    ASSERT( pre_offset[index]+post_offset[index]+length[index] == total[index],
-        "InterfaceVMGJob::addWindowOntoGrid() - pre, post, and length don't sum up to total for "
-        +toString(index)+"th component.");
-  }
+  size_t pre_offset[NDIM];
+  size_t post_offset[NDIM];
+  size_t length[NDIM];
+  size_t total[NDIM];
+  grid.getDiscreteWindowOffsets(pre_offset, post_offset, length, total);
 #ifndef NDEBUG
   const size_t calculated_size = length[0]*length[1]*length[2];
@@ -218,13 +184,6 @@
       "InterfaceVMGJob::addWindowOntoGrid() - not enough sampled values given: "
       +toString(calculated_size)+" != "+toString(grid.sampled_grid.size())+".");
-//  ASSERT( calculated_size <=  given_size,
-//      "InterfaceVMGJob::addWindowOntoGrid() - not enough sampled values available: "
-//      +toString(calculated_size)+" <= "+toString(given_size)+".");
-//  const size_t total_size = total[0]*total[1]*total[2];
-//  ASSERT( total_size == given_size,
-//      "InterfaceVMGJob::addWindowOntoGrid() - total size is not equal to number of present points: "
-//      +toString(total_size)+" != "+toString(given_size)+".");
-#endif
-  size_t N[3];
+#endif
+  size_t N[NDIM];
   // in open boundary case grid.Local() contains more than just the inner area. The grid
   // is actually twice as large to allow for the FV discretization to work. Hence, we first
@@ -238,9 +197,9 @@
     // this mimicks VMG::GridIndexTranslations::EndOffset()
     const size_t off = OpenBoundaryConditions ? 1 : 0;
-    for (size_t i=0;i<3;++i)
+    for (size_t i=0;i<NDIM;++i)
       pre_offset[i] += ((size_t)size[i] - off) / 4;
-    for (size_t i=0;i<3;++i)
+    for (size_t i=0;i<NDIM;++i)
       total[i] = ((size_t)size[i]);
-    for (size_t i=0;i<3;++i)
+    for (size_t i=0;i<NDIM;++i)
       post_offset[i] = ((size_t)size[i]) - pre_offset[i] - length[i];
   }
