| [b123a5] | 1 | /*
 | 
|---|
 | 2 |  * Project: MoleCuilder
 | 
|---|
 | 3 |  * Description: creates and alters molecular systems
 | 
|---|
 | 4 |  * Copyright (C)  2012 University of Bonn. All rights reserved.
 | 
|---|
| [5aaa43] | 5 |  * Copyright (C)  2013 Frederik Heber. All rights reserved.
 | 
|---|
| [b123a5] | 6 |  * Please see the COPYING file or "Copyright notice" in builder.cpp for details.
 | 
|---|
 | 7 |  * 
 | 
|---|
 | 8 |  *
 | 
|---|
 | 9 |  *   This file is part of MoleCuilder.
 | 
|---|
 | 10 |  *
 | 
|---|
 | 11 |  *    MoleCuilder is free software: you can redistribute it and/or modify
 | 
|---|
 | 12 |  *    it under the terms of the GNU General Public License as published by
 | 
|---|
 | 13 |  *    the Free Software Foundation, either version 2 of the License, or
 | 
|---|
 | 14 |  *    (at your option) any later version.
 | 
|---|
 | 15 |  *
 | 
|---|
 | 16 |  *    MoleCuilder is distributed in the hope that it will be useful,
 | 
|---|
 | 17 |  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
 | 18 |  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
 | 19 |  *    GNU General Public License for more details.
 | 
|---|
 | 20 |  *
 | 
|---|
 | 21 |  *    You should have received a copy of the GNU General Public License
 | 
|---|
 | 22 |  *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>. 
 | 
|---|
 | 23 |  */
 | 
|---|
 | 24 | 
 | 
|---|
 | 25 | /*
 | 
|---|
 | 26 |  * WindowGrid_converter.cpp
 | 
|---|
 | 27 |  *
 | 
|---|
 | 28 |  *  Created on: Dec 20, 2012
 | 
|---|
 | 29 |  *      Author: heber
 | 
|---|
 | 30 |  */
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 | // include config.h
 | 
|---|
 | 34 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 35 | #include <config.h>
 | 
|---|
 | 36 | #endif
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | #include "grid/grid.hpp"
 | 
|---|
 | 39 | 
 | 
|---|
 | 40 | #include "WindowGrid_converter.hpp"
 | 
|---|
 | 41 | 
 | 
|---|
 | 42 | #include "CodePatterns/MemDebug.hpp"
 | 
|---|
 | 43 | 
 | 
|---|
 | 44 | #include <iostream>
 | 
|---|
 | 45 | #include <iterator>
 | 
|---|
 | 46 | #include <limits>
 | 
|---|
 | 47 | 
 | 
|---|
 | 48 | #include "CodePatterns/Assert.hpp"
 | 
|---|
 | 49 | #include "CodePatterns/Log.hpp"
 | 
|---|
 | 50 | 
 | 
|---|
| [fbf143] | 51 | #include "Fragmentation/Summation/SetValues/SamplingGrid.hpp"
 | 
|---|
| [b123a5] | 52 | 
 | 
|---|
 | 53 | void WindowGrid_converter::addGridOntoWindow(
 | 
|---|
 | 54 |     VMG::Grid &grid,
 | 
|---|
 | 55 |     SamplingGrid &window,
 | 
|---|
| [d9d028] | 56 |     const double prefactor,
 | 
|---|
 | 57 |     const bool OpenBoundaryConditions)
 | 
|---|
| [b123a5] | 58 | {
 | 
|---|
 | 59 | #ifndef NDEBUG
 | 
|---|
 | 60 |   for(size_t index=0;index<3;++index) {
 | 
|---|
 | 61 |     ASSERT( window.begin[index] >= window.begin_window[index],
 | 
|---|
 | 62 |         "InterfaceVMGJob::addGridOntoWindow() - given grid starts earlier than window in component "
 | 
|---|
 | 63 |         +toString(index)+".");
 | 
|---|
 | 64 |     ASSERT( window.end[index] <= window.end_window[index],
 | 
|---|
 | 65 |         "InterfaceVMGJob::addGridOntoWindow() - given grid ends later than window in component "
 | 
|---|
 | 66 |         +toString(index)+".");
 | 
|---|
 | 67 |   }
 | 
|---|
 | 68 | #endif
 | 
|---|
 | 69 |   // the only issue are indices
 | 
|---|
 | 70 |   const size_t gridpoints_axis = window.getGridPointsPerAxis();
 | 
|---|
 | 71 |   size_t pre_offset[3];
 | 
|---|
 | 72 |   size_t post_offset[3];
 | 
|---|
 | 73 |   size_t length[3];
 | 
|---|
 | 74 |   size_t total[3];
 | 
|---|
 | 75 |   const double round_offset =
 | 
|---|
 | 76 |       (std::numeric_limits<size_t>::round_style == std::round_toward_zero) ?
 | 
|---|
 | 77 |           0.5 : 0.; // need offset to get to round_toward_nearest behavior
 | 
|---|
 | 78 |   for(size_t index=0;index<3;++index) {
 | 
|---|
 | 79 |     const double delta = (double)gridpoints_axis/(window.end[index] - window.begin[index]);
 | 
|---|
 | 80 |     // delta is conversion factor from box length to discrete length, i.e. number of points
 | 
|---|
 | 81 |     pre_offset[index] = delta*(window.begin[index] - window.begin_window[index])+round_offset;
 | 
|---|
 | 82 |     length[index] = delta*(window.end[index] - window.begin[index])+round_offset;
 | 
|---|
 | 83 |     post_offset[index] = delta*(window.end_window[index] - window.end[index])+round_offset;
 | 
|---|
 | 84 |     total[index] = delta*(window.end_window[index] - window.begin_window[index])+round_offset;
 | 
|---|
 | 85 |     // total is used as safe-guard against loss due to discrete conversion
 | 
|---|
 | 86 |     ASSERT( pre_offset[index]+post_offset[index]+length[index] == total[index],
 | 
|---|
 | 87 |         "InterfaceVMGJob::addGridOntoWindow() - pre, post, and length don't sum up to total for "
 | 
|---|
 | 88 |         +toString(index)+"th component.");
 | 
|---|
 | 89 |   }
 | 
|---|
 | 90 | #ifndef NDEBUG
 | 
|---|
 | 91 |   const size_t calculated_size = length[0]*length[1]*length[2];
 | 
|---|
 | 92 | //  const size_t given_size = std::distance(grid_begin, grid_end);
 | 
|---|
 | 93 | //  ASSERT( calculated_size == given_size,
 | 
|---|
 | 94 | //      "InterfaceVMGJob::addGridOntoWindow() - not enough sampled values given: "
 | 
|---|
 | 95 | //      +toString(calculated_size)+" != "+toString(given_size)+".");
 | 
|---|
 | 96 |   ASSERT( calculated_size <=  window.sampled_grid.size(),
 | 
|---|
 | 97 |       "InterfaceVMGJob::addGridOntoWindow() - not enough sampled values available: "
 | 
|---|
 | 98 |       +toString(calculated_size)+" <= "+toString(window.sampled_grid.size())+".");
 | 
|---|
 | 99 |   const size_t total_size = total[0]*total[1]*total[2];
 | 
|---|
 | 100 |   ASSERT( total_size == window.sampled_grid.size(),
 | 
|---|
 | 101 |       "InterfaceVMGJob::addGridOntoWindow() - total size is not equal to number of present points: "
 | 
|---|
 | 102 |       +toString(total_size)+" != "+toString(window.sampled_grid.size())+".");
 | 
|---|
 | 103 | #endif
 | 
|---|
 | 104 |   size_t N[3];
 | 
|---|
 | 105 |   SamplingGrid::sampledvalues_t::iterator griditer = window.sampled_grid.begin();
 | 
|---|
 | 106 |   std::advance(griditer, pre_offset[0]*total[1]*total[2]);
 | 
|---|
| [d9d028] | 107 | 
 | 
|---|
| [b123a5] | 108 |   VMG::Grid::iterator copyiter = grid.Iterators().Local().Begin();
 | 
|---|
| [d9d028] | 109 |   const VMG::Index size = grid.Local().Size();
 | 
|---|
 | 110 |   if (OpenBoundaryConditions)
 | 
|---|
| [a2a2f7] | 111 |     for(N[0]=(size_t)0; N[0] < (size_t)size[0]/(size_t)4; ++N[0])
 | 
|---|
 | 112 |       for(N[1]=(size_t)0; N[1] < (size_t)size[1]; ++N[1])
 | 
|---|
 | 113 |         for(N[2]=(size_t)0; N[2] < (size_t)size[2]; ++N[2]) {
 | 
|---|
| [d9d028] | 114 |           ASSERT( copyiter != grid.Iterators().Local().End(),
 | 
|---|
 | 115 |               "InterfaceVMGJob::addGridOntoWindow() - copyiter is already at end of window.");
 | 
|---|
 | 116 |           ++copyiter;
 | 
|---|
 | 117 |         }
 | 
|---|
| [a2a2f7] | 118 |   for(N[0]=(size_t)0; N[0] < length[0]; ++N[0]) {
 | 
|---|
| [b123a5] | 119 |     std::advance(griditer, pre_offset[1]*total[2]);
 | 
|---|
| [d9d028] | 120 |     if (OpenBoundaryConditions)
 | 
|---|
| [a2a2f7] | 121 |       for(N[1]=(size_t)0; N[1] < (size_t)size[1]/(size_t)4; ++N[1])
 | 
|---|
 | 122 |         for(N[2]=(size_t)0; N[2] < (size_t)size[2]; ++N[2]) {
 | 
|---|
| [d9d028] | 123 |           ASSERT( copyiter != grid.Iterators().Local().End(),
 | 
|---|
 | 124 |               "InterfaceVMGJob::addGridOntoWindow() - copyiter is already at end of window.");
 | 
|---|
 | 125 |           ++copyiter;
 | 
|---|
 | 126 |         }
 | 
|---|
| [a2a2f7] | 127 |     for(N[1]=(size_t)0; N[1] < length[1]; ++N[1]) {
 | 
|---|
| [b123a5] | 128 |       std::advance(griditer, pre_offset[2]);
 | 
|---|
| [d9d028] | 129 |       if (OpenBoundaryConditions)
 | 
|---|
| [a2a2f7] | 130 |         for(N[2]=(size_t)0; N[2] < (size_t)size[2]/(size_t)4; ++N[2]) {
 | 
|---|
| [d9d028] | 131 |           ASSERT( copyiter != grid.Iterators().Local().End(),
 | 
|---|
 | 132 |               "InterfaceVMGJob::addGridOntoWindow() - copyiter is already at end of window.");
 | 
|---|
 | 133 |           ++copyiter;
 | 
|---|
 | 134 |         }
 | 
|---|
| [a2a2f7] | 135 |       for(N[2]=(size_t)0; N[2] < length[2]; ++N[2]) {
 | 
|---|
| [b123a5] | 136 |         ASSERT( griditer != window.sampled_grid.end(),
 | 
|---|
 | 137 |             "InterfaceVMGJob::addGridOntoWindow() - griditer is already at end of window.");
 | 
|---|
 | 138 |         ASSERT( copyiter != grid.Iterators().Local().End(),
 | 
|---|
| [d9d028] | 139 |             "InterfaceVMGJob::addGridOntoWindow() - copyiter is already at end of window.");
 | 
|---|
| [b123a5] | 140 |         *griditer++ += prefactor*grid(*copyiter++);
 | 
|---|
 | 141 |       }
 | 
|---|
 | 142 |       std::advance(griditer, post_offset[2]);
 | 
|---|
| [d9d028] | 143 |       if (OpenBoundaryConditions)
 | 
|---|
| [a2a2f7] | 144 |         for(N[2]=(size_t)0; N[2] < (size_t)size[2] - (size_t)size[2]/(size_t)4 - length[2]; ++N[2]) {
 | 
|---|
| [d9d028] | 145 |           ASSERT( copyiter != grid.Iterators().Local().End(),
 | 
|---|
 | 146 |               "InterfaceVMGJob::addGridOntoWindow() - copyiter is already at end of window.");
 | 
|---|
 | 147 |           ++copyiter;
 | 
|---|
 | 148 |         }
 | 
|---|
| [b123a5] | 149 |     }
 | 
|---|
 | 150 |     std::advance(griditer, post_offset[1]*total[2]);
 | 
|---|
| [d9d028] | 151 |     if (OpenBoundaryConditions)
 | 
|---|
| [a2a2f7] | 152 |       for(N[1]=(size_t)0; N[1] < (size_t)size[1] - (size_t)size[1]/(size_t)4 - length[1]; ++N[1])
 | 
|---|
 | 153 |         for(N[2]=(size_t)0; N[2] < (size_t)size[2]; ++N[2]) {
 | 
|---|
| [d9d028] | 154 |           ASSERT( copyiter != grid.Iterators().Local().End(),
 | 
|---|
 | 155 |               "InterfaceVMGJob::addGridOntoWindow() - copyiter is already at end of window.");
 | 
|---|
 | 156 |           ++copyiter;
 | 
|---|
 | 157 |         }
 | 
|---|
| [b123a5] | 158 |   }
 | 
|---|
| [d9d028] | 159 |   if (OpenBoundaryConditions)
 | 
|---|
| [a2a2f7] | 160 |     for(N[0]=(size_t)0; N[0] < (size_t)size[0] - (size_t)size[0]/(size_t)4 - length[0]; ++N[0])
 | 
|---|
 | 161 |       for(N[1]=(size_t)0; N[1] < (size_t)size[1]; ++N[1])
 | 
|---|
 | 162 |         for(N[2]=(size_t)0; N[2] < (size_t)size[2]; ++N[2]) {
 | 
|---|
| [d9d028] | 163 |           ASSERT( copyiter != grid.Iterators().Local().End(),
 | 
|---|
 | 164 |               "InterfaceVMGJob::addGridOntoWindow() - copyiter is already at end of window.");
 | 
|---|
 | 165 |           ++copyiter;
 | 
|---|
 | 166 |         }
 | 
|---|
| [b123a5] | 167 | #ifndef NDEBUG
 | 
|---|
 | 168 |   std::advance(griditer, post_offset[0]*total[1]*total[2]);
 | 
|---|
 | 169 |   ASSERT( griditer == window.sampled_grid.end(),
 | 
|---|
 | 170 |       "InterfaceVMGJob::addGridOntoWindow() - griditer is not at end of window.");
 | 
|---|
 | 171 |   ASSERT( copyiter == grid.Iterators().Local().End(),
 | 
|---|
 | 172 |       "InterfaceVMGJob::addGridOntoWindow() - copyiter is not at end of window.");
 | 
|---|
 | 173 | #endif
 | 
|---|
 | 174 | }
 | 
|---|
 | 175 | 
 | 
|---|
 | 176 | void WindowGrid_converter::addWindowOntoGrid(
 | 
|---|
 | 177 |     VMG::Grid& window,
 | 
|---|
 | 178 |     const SamplingGrid &grid,
 | 
|---|
| [27ef5c] | 179 |     const double prefactor,
 | 
|---|
 | 180 |     const bool OpenBoundaryConditions)
 | 
|---|
| [b123a5] | 181 | {
 | 
|---|
 | 182 | #ifndef NDEBUG
 | 
|---|
 | 183 |   for(size_t index=0;index<3;++index) {
 | 
|---|
 | 184 |     ASSERT( grid.begin_window[index] >= grid.begin[index],
 | 
|---|
 | 185 |         "InterfaceVMGJob::addWindowOntoGrid() - given window starts earlier than grid in component "
 | 
|---|
 | 186 |         +toString(index)+".");
 | 
|---|
 | 187 |     ASSERT( grid.end_window[index] <= grid.end[index],
 | 
|---|
 | 188 |         "InterfaceVMGJob::addWindowOntoGrid() - given window ends later than grid in component "
 | 
|---|
 | 189 |         +toString(index)+".");
 | 
|---|
 | 190 |   }
 | 
|---|
 | 191 | #endif
 | 
|---|
 | 192 |   // the only issue are indices
 | 
|---|
 | 193 |   const size_t gridpoints_axis = grid.getGridPointsPerAxis();
 | 
|---|
 | 194 |   size_t pre_offset[3];
 | 
|---|
 | 195 |   size_t post_offset[3];
 | 
|---|
 | 196 |   size_t length[3];
 | 
|---|
 | 197 |   size_t total[3];
 | 
|---|
 | 198 |   const double round_offset =
 | 
|---|
 | 199 |       (std::numeric_limits<size_t>::round_style == std::round_toward_zero) ?
 | 
|---|
 | 200 |           0.5 : 0.; // need offset to get to round_toward_nearest behavior
 | 
|---|
 | 201 |   for(size_t index=0;index<3;++index) {
 | 
|---|
 | 202 |     const double delta = (double)gridpoints_axis/(grid.end[index] - grid.begin[index]);
 | 
|---|
 | 203 |     // delta is conversion factor from box length to discrete length, i.e. number of points
 | 
|---|
 | 204 |     pre_offset[index] = delta*(grid.begin_window[index] - grid.begin[index])+round_offset;
 | 
|---|
 | 205 |     length[index] = delta*(grid.end_window[index] - grid.begin_window[index])+round_offset;
 | 
|---|
 | 206 |     post_offset[index] = delta*(grid.end[index] - grid.end_window[index])+round_offset;
 | 
|---|
 | 207 |     total[index] = delta*(grid.end[index] - grid.begin[index])+round_offset;
 | 
|---|
 | 208 |     // total is used as safe-guard against loss due to discrete conversion
 | 
|---|
 | 209 |     ASSERT( pre_offset[index]+post_offset[index]+length[index] == total[index],
 | 
|---|
 | 210 |         "InterfaceVMGJob::addWindowOntoGrid() - pre, post, and length don't sum up to total for "
 | 
|---|
 | 211 |         +toString(index)+"th component.");
 | 
|---|
 | 212 |   }
 | 
|---|
 | 213 | #ifndef NDEBUG
 | 
|---|
 | 214 |   const size_t calculated_size = length[0]*length[1]*length[2];
 | 
|---|
 | 215 |   ASSERT( calculated_size == grid.sampled_grid.size(),
 | 
|---|
 | 216 |       "InterfaceVMGJob::addWindowOntoGrid() - not enough sampled values given: "
 | 
|---|
 | 217 |       +toString(calculated_size)+" != "+toString(grid.sampled_grid.size())+".");
 | 
|---|
 | 218 | //  ASSERT( calculated_size <=  given_size,
 | 
|---|
 | 219 | //      "InterfaceVMGJob::addWindowOntoGrid() - not enough sampled values available: "
 | 
|---|
 | 220 | //      +toString(calculated_size)+" <= "+toString(given_size)+".");
 | 
|---|
 | 221 | //  const size_t total_size = total[0]*total[1]*total[2];
 | 
|---|
 | 222 | //  ASSERT( total_size == given_size,
 | 
|---|
 | 223 | //      "InterfaceVMGJob::addWindowOntoGrid() - total size is not equal to number of present points: "
 | 
|---|
 | 224 | //      +toString(total_size)+" != "+toString(given_size)+".");
 | 
|---|
 | 225 | #endif
 | 
|---|
 | 226 |   size_t N[3];
 | 
|---|
| [27ef5c] | 227 |   // in open boundary case grid.Local() contains more than just the inner area. The grid
 | 
|---|
 | 228 |   // is actually twice as large to allow for the FV discretization to work. Hence, we first
 | 
|---|
 | 229 |   // have to seek our starting point ... see VMG::Grid::GetSpatialPos()
 | 
|---|
 | 230 |   if (OpenBoundaryConditions) {
 | 
|---|
 | 231 |     const VMG::Index size = window.Local().Size();
 | 
|---|
| [a2a2f7] | 232 | //    const VMG::Index boundary1size = window.Local().BoundarySize1();
 | 
|---|
 | 233 | //    const VMG::Index boundary2size = window.Local().BoundarySize2();
 | 
|---|
 | 234 | //    const VMG::Index halo1size = window.Local().HaloSize1();
 | 
|---|
 | 235 | //    const VMG::Index halo2size = window.Local().HaloSize2();
 | 
|---|
| [b47f9c] | 236 |     // this mimicks VMG::GridIndexTranslations::EndOffset()
 | 
|---|
 | 237 |     const size_t off = OpenBoundaryConditions ? 1 : 0;
 | 
|---|
| [27ef5c] | 238 |     for (size_t i=0;i<3;++i)
 | 
|---|
| [a2a2f7] | 239 |       pre_offset[i] += ((size_t)size[i] - off) / 4;
 | 
|---|
| [27ef5c] | 240 |     for (size_t i=0;i<3;++i)
 | 
|---|
| [a2a2f7] | 241 |       total[i] = ((size_t)size[i]);
 | 
|---|
| [27ef5c] | 242 |     for (size_t i=0;i<3;++i)
 | 
|---|
| [a2a2f7] | 243 |       post_offset[i] = ((size_t)size[i]) - pre_offset[i] - length[i];
 | 
|---|
| [27ef5c] | 244 |   }
 | 
|---|
 | 245 | 
 | 
|---|
| [b123a5] | 246 |   VMG::Grid::iterator griditer = window.Iterators().Local().Begin();
 | 
|---|
 | 247 | //  griditer.advance(pre_offset[0]*total[1]*total[2]);
 | 
|---|
 | 248 |   for(N[0]=0; N[0] < pre_offset[0]; ++N[0])
 | 
|---|
 | 249 |     for(N[1]=0; N[1] < total[1]; ++N[1])
 | 
|---|
 | 250 |       for(N[2]=0; N[2] < total[2]; ++N[2]) {
 | 
|---|
 | 251 |         ASSERT( griditer != window.Iterators().Local().End(),
 | 
|---|
 | 252 |             "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
 | 
|---|
 | 253 |         window(*griditer++) = 0.;
 | 
|---|
 | 254 |       }
 | 
|---|
 | 255 |   SamplingGrid::sampledvalues_t::const_iterator copyiter = grid.sampled_grid.begin();
 | 
|---|
 | 256 |   for(N[0]=0; N[0] < length[0]; ++N[0]) {
 | 
|---|
 | 257 | //    griditer.advance(pre_offset[1]*total[2]);
 | 
|---|
 | 258 |       for(N[1]=0; N[1] < pre_offset[1]; ++N[1])
 | 
|---|
 | 259 |         for(N[2]=0; N[2] < total[2]; ++N[2]) {
 | 
|---|
 | 260 |           ASSERT( griditer != window.Iterators().Local().End(),
 | 
|---|
 | 261 |               "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
 | 
|---|
 | 262 |           window(*griditer++) = 0.;
 | 
|---|
 | 263 |         }
 | 
|---|
 | 264 |     for(N[1]=0; N[1] < length[1]; ++N[1]) {
 | 
|---|
 | 265 | //      griditer.advance(pre_offset[2]);
 | 
|---|
| [27ef5c] | 266 |       for(N[2]=0; N[2] < pre_offset[2]; ++N[2])
 | 
|---|
 | 267 |         window(*griditer++) = 0.;
 | 
|---|
| [b123a5] | 268 |       for(N[2]=0; N[2] < length[2]; ++N[2]) {
 | 
|---|
 | 269 |         ASSERT( griditer != window.Iterators().Local().End(),
 | 
|---|
 | 270 |             "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
 | 
|---|
 | 271 |         ASSERT( copyiter != grid.sampled_grid.end(),
 | 
|---|
 | 272 |             "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
 | 
|---|
 | 273 |         window(*griditer++) += prefactor*(*copyiter++);
 | 
|---|
 | 274 |       }
 | 
|---|
 | 275 | //      griditer.advance(post_offset[2]);
 | 
|---|
 | 276 |       for(N[2]=0; N[2] < post_offset[2]; ++N[2]) {
 | 
|---|
 | 277 |         ASSERT( griditer != window.Iterators().Local().End(),
 | 
|---|
 | 278 |             "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
 | 
|---|
 | 279 |         window(*griditer++) = 0.;
 | 
|---|
 | 280 |       }
 | 
|---|
 | 281 |     }
 | 
|---|
 | 282 | //    griditer.advance(post_offset[1]*total[2]);
 | 
|---|
 | 283 |     for(N[1]=0; N[1] < post_offset[1]; ++N[1])
 | 
|---|
 | 284 |       for(N[2]=0; N[2] < total[2]; ++N[2]) {
 | 
|---|
 | 285 |         ASSERT( griditer != window.Iterators().Local().End(),
 | 
|---|
 | 286 |             "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
 | 
|---|
 | 287 |         window(*griditer++) = 0.;
 | 
|---|
 | 288 |       }
 | 
|---|
 | 289 |   }
 | 
|---|
| [27ef5c] | 290 |   //  griditer.advance(post_offset[0]*total[1]*total[2]);
 | 
|---|
| [b123a5] | 291 |   for(N[0]=0; N[0] < post_offset[0]; ++N[0])
 | 
|---|
 | 292 |     for(N[1]=0; N[1] < total[1]; ++N[1])
 | 
|---|
 | 293 |       for(N[2]=0; N[2] < total[2]; ++N[2]) {
 | 
|---|
 | 294 |         ASSERT( griditer != window.Iterators().Local().End(),
 | 
|---|
 | 295 |             "InterfaceVMGJob::addWindowOntoGrid() - griditer is already at end of window.");
 | 
|---|
 | 296 |         window(*griditer++) = 0.;
 | 
|---|
 | 297 |       }
 | 
|---|
 | 298 | #ifndef NDEBUG
 | 
|---|
 | 299 |   ASSERT( griditer == window.Iterators().Local().End(),
 | 
|---|
 | 300 |       "InterfaceVMGJob::addWindowOntoGrid() - griditer is not at end of window.");
 | 
|---|
 | 301 |   ASSERT( copyiter == grid.sampled_grid.end(),
 | 
|---|
 | 302 |       "InterfaceVMGJob::addWindowOntoGrid() - copyiter is not at end of window.");
 | 
|---|
 | 303 | #endif
 | 
|---|
 | 304 | //  LOG(2, "DEBUG: Grid after adding other is " << grid << ".");
 | 
|---|
 | 305 | }
 | 
|---|