[28c025] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
| 4 | * Copyright (C) 2012 University of Bonn. All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | *
|
---|
| 7 | * This file is part of MoleCuilder.
|
---|
| 8 | *
|
---|
| 9 | * MoleCuilder is free software: you can redistribute it and/or modify
|
---|
| 10 | * it under the terms of the GNU General Public License as published by
|
---|
| 11 | * the Free Software Foundation, either version 2 of the License, or
|
---|
| 12 | * (at your option) any later version.
|
---|
| 13 | *
|
---|
| 14 | * MoleCuilder is distributed in the hope that it will be useful,
|
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 17 | * GNU General Public License for more details.
|
---|
| 18 | *
|
---|
| 19 | * You should have received a copy of the GNU General Public License
|
---|
| 20 | * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | /*
|
---|
| 24 | * SamplingGrid.cpp
|
---|
| 25 | *
|
---|
| 26 | * Created on: 25.07.2012
|
---|
| 27 | * Author: heber
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | // include config.h
|
---|
| 31 | #ifdef HAVE_CONFIG_H
|
---|
| 32 | #include <config.h>
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
| 35 | // include headers that implement a archive in simple text format
|
---|
| 36 | // otherwise BOOST_CLASS_EXPORT_IMPLEMENT has no effect
|
---|
| 37 | #include <boost/archive/text_oarchive.hpp>
|
---|
| 38 | #include <boost/archive/text_iarchive.hpp>
|
---|
| 39 |
|
---|
| 40 | #include "CodePatterns/MemDebug.hpp"
|
---|
| 41 |
|
---|
| 42 | #include "Jobs/Grid/SamplingGrid.hpp"
|
---|
| 43 |
|
---|
[98f8fe] | 44 | #include <limits>
|
---|
| 45 |
|
---|
[c889b7] | 46 | #include "CodePatterns/Assert.hpp"
|
---|
[cb3363] | 47 | #include "CodePatterns/Log.hpp"
|
---|
[28c025] | 48 |
|
---|
[1a00bb] | 49 | // static instances
|
---|
| 50 | const double SamplingGrid::zeroOffset[3] = { 0., 0., 0. };
|
---|
| 51 |
|
---|
| 52 | SamplingGrid::SamplingGrid() :
|
---|
| 53 | SamplingGridProperties()
|
---|
| 54 | {
|
---|
| 55 | setWindowSize(zeroOffset, zeroOffset);
|
---|
| 56 | ASSERT( getWindowGridPoints() == (size_t)0,
|
---|
| 57 | "SamplingGrid::SamplingGrid() - incorrect number of samples given for the window.");
|
---|
| 58 | }
|
---|
| 59 |
|
---|
[c6355f] | 60 | SamplingGrid::SamplingGrid(const double _begin[3],
|
---|
| 61 | const double _end[3],
|
---|
| 62 | const int _level) :
|
---|
| 63 | SamplingGridProperties(_begin, _end, _level)
|
---|
| 64 | {
|
---|
| 65 | setWindowSize(zeroOffset, zeroOffset);
|
---|
| 66 | ASSERT( getWindowGridPoints() == (size_t)0,
|
---|
| 67 | "SamplingGrid::SamplingGrid() - incorrect number of samples given for the window.");
|
---|
| 68 | }
|
---|
| 69 |
|
---|
[28c025] | 70 | SamplingGrid::SamplingGrid(const double _begin[3],
|
---|
[3d9a8d] | 71 | const double _end[3],
|
---|
[28c025] | 72 | const int _level,
|
---|
[c889b7] | 73 | const sampledvalues_t &_sampled_grid) :
|
---|
[3d9a8d] | 74 | SamplingGridProperties(_begin, _end, _level),
|
---|
[28c025] | 75 | sampled_grid(_sampled_grid)
|
---|
[1a00bb] | 76 | {
|
---|
| 77 | setWindowSize(_begin, _end);
|
---|
| 78 | ASSERT( getWindowGridPoints() == (size_t)_sampled_grid.size(),
|
---|
| 79 | "SamplingGrid::SamplingGrid() - incorrect number of samples given for the window.");
|
---|
| 80 | }
|
---|
[28c025] | 81 |
|
---|
| 82 | SamplingGrid::SamplingGrid(const SamplingGrid &_grid) :
|
---|
| 83 | SamplingGridProperties(_grid),
|
---|
| 84 | sampled_grid(_grid.sampled_grid)
|
---|
[1a00bb] | 85 | {
|
---|
[c6355f] | 86 | setWindowSize(_grid.begin_window, _grid.end_window);
|
---|
| 87 | ASSERT( getWindowGridPoints() == _grid.getWindowGridPoints(),
|
---|
| 88 | "SamplingGrid::SamplingGrid() - incorrect number of samples given for the window.");
|
---|
[1a00bb] | 89 | }
|
---|
[28c025] | 90 |
|
---|
| 91 | SamplingGrid::SamplingGrid(const SamplingGridProperties &_props) :
|
---|
| 92 | SamplingGridProperties(_props)
|
---|
[1a00bb] | 93 | {
|
---|
[c6355f] | 94 | setWindowSize(zeroOffset, zeroOffset);
|
---|
| 95 | ASSERT( getWindowGridPoints() == (size_t)0,
|
---|
| 96 | "SamplingGrid::SamplingGrid() - incorrect number of samples given for the window.");
|
---|
[1a00bb] | 97 | }
|
---|
[28c025] | 98 |
|
---|
[c889b7] | 99 | SamplingGrid::SamplingGrid(
|
---|
| 100 | const SamplingGridProperties &_props,
|
---|
| 101 | const sampledvalues_t &_sampled_grid) :
|
---|
| 102 | SamplingGridProperties(_props),
|
---|
| 103 | sampled_grid(_sampled_grid)
|
---|
[1a00bb] | 104 | {
|
---|
| 105 | setWindowSize(_props.begin, _props.end);
|
---|
| 106 | ASSERT( getWindowGridPoints() == (size_t)_sampled_grid.size(),
|
---|
| 107 | "SamplingGrid::SamplingGrid() - incorrect number of samples given for the window.");
|
---|
| 108 | }
|
---|
[c889b7] | 109 |
|
---|
[28c025] | 110 | SamplingGrid::~SamplingGrid()
|
---|
| 111 | {}
|
---|
| 112 |
|
---|
[c889b7] | 113 | SamplingGrid& SamplingGrid::operator=(const SamplingGrid& other)
|
---|
| 114 | {
|
---|
| 115 | // check for self-assignment
|
---|
| 116 | if (this != &other) {
|
---|
| 117 | static_cast<SamplingGridProperties &>(*this) = other;
|
---|
[e2404f] | 118 | setWindowSize(other.begin_window, other.end_window);
|
---|
[c889b7] | 119 | sampled_grid = other.sampled_grid;
|
---|
| 120 | }
|
---|
| 121 | return *this;
|
---|
| 122 | }
|
---|
| 123 |
|
---|
[a1fcc6] | 124 | SamplingGrid& SamplingGrid::operator*=(const SamplingGrid& other)
|
---|
| 125 | {
|
---|
| 126 | // check that grids are compatible
|
---|
| 127 | if (isCompatible(other)) {
|
---|
| 128 | sampledvalues_t::iterator iter = sampled_grid.begin();
|
---|
| 129 | sampledvalues_t::const_iterator otheriter = other.sampled_grid.begin();
|
---|
| 130 | for(; iter != sampled_grid.end(); ++iter, ++otheriter )
|
---|
| 131 | *iter *= (*otheriter);
|
---|
| 132 | } else {
|
---|
| 133 | ASSERT(0, "SamplingGrid::operator*=() - superposing incompatible grids is so far not in the cards.");
|
---|
| 134 | }
|
---|
| 135 | return *this;
|
---|
| 136 | }
|
---|
| 137 |
|
---|
[c889b7] | 138 | void SamplingGrid::superposeOtherGrids(const SamplingGrid &other, const double prefactor)
|
---|
| 139 | {
|
---|
[1a00bb] | 140 | /// check that grids are compatible
|
---|
[c889b7] | 141 | if (isCompatible(other)) {
|
---|
[1a00bb] | 142 | /// get maximum of window
|
---|
| 143 | double max_begin_window[3];
|
---|
| 144 | double max_end_window[3];
|
---|
| 145 | bool doExtend = false;
|
---|
| 146 | for (size_t index=0; index<3;++index) {
|
---|
| 147 | if (begin_window[index] >= other.begin_window[index]) {
|
---|
| 148 | max_begin_window[index] = other.begin_window[index];
|
---|
| 149 | doExtend = true;
|
---|
| 150 | } else {
|
---|
| 151 | max_begin_window[index] = begin_window[index];
|
---|
| 152 | }
|
---|
| 153 | if (end_window[index] >= other.end_window[index]) {
|
---|
| 154 | max_end_window[index] = end_window[index];
|
---|
| 155 | } else {
|
---|
| 156 | max_end_window[index] = other.end_window[index];
|
---|
| 157 | doExtend = true;
|
---|
| 158 | }
|
---|
| 159 | }
|
---|
[de6dfb] | 160 | LOG(2, "DEBUG: max begin is " << max_begin_window[0] << "," << max_begin_window[1] << "," << max_begin_window[2] << ".");
|
---|
| 161 | LOG(2, "DEBUG: max end is " << max_end_window[0] << "," << max_end_window[1] << "," << max_end_window[2] << ".");
|
---|
[1a00bb] | 162 | if (doExtend)
|
---|
| 163 | extendWindow(max_begin_window, max_end_window);
|
---|
| 164 | /// and copy other into larger window, too
|
---|
[de6dfb] | 165 | addOntoWindow(other.begin_window, other.end_window, other.sampled_grid, prefactor);
|
---|
[c889b7] | 166 | } else {
|
---|
| 167 | ASSERT(0, "SamplingGrid::superposeOtherGrids() - superposing incompatible grids is so far not in the cards.");
|
---|
| 168 | }
|
---|
| 169 | }
|
---|
| 170 |
|
---|
[1a00bb] | 171 | const double SamplingGrid::getVolume() const
|
---|
[3d9a8d] | 172 | {
|
---|
| 173 | double volume = 1.;
|
---|
| 174 | for (size_t i=0;i<3;++i)
|
---|
| 175 | volume *= end[i]-begin[i];
|
---|
| 176 | return volume;
|
---|
| 177 | }
|
---|
| 178 |
|
---|
[1a00bb] | 179 | const double SamplingGrid::getWindowVolume() const
|
---|
| 180 | {
|
---|
| 181 | double volume = 1.;
|
---|
| 182 | for (size_t i=0;i<3;++i)
|
---|
| 183 | volume *= end_window[i]-begin_window[i];
|
---|
| 184 | return volume;
|
---|
| 185 | }
|
---|
| 186 |
|
---|
[98f8fe] | 187 | const size_t SamplingGrid::getTotalGridPoints() const
|
---|
| 188 | {
|
---|
| 189 | return pow(getGridPointsPerAxis(),3);
|
---|
| 190 | }
|
---|
| 191 |
|
---|
| 192 | const size_t SamplingGrid::getGridPointsPerAxis() const
|
---|
| 193 | {
|
---|
| 194 | return pow(2, level);
|
---|
| 195 | }
|
---|
| 196 |
|
---|
[1a00bb] | 197 | const size_t SamplingGrid::getWindowGridPoints() const
|
---|
| 198 | {
|
---|
| 199 | const double volume = getVolume();
|
---|
| 200 | if (fabs(volume) < std::numeric_limits<double>::epsilon())
|
---|
| 201 | return 0;
|
---|
| 202 | else
|
---|
| 203 | return (getWindowVolume()*getTotalGridPoints())/volume;
|
---|
| 204 | }
|
---|
| 205 |
|
---|
[cb3363] | 206 | double SamplingGrid::integral() const
|
---|
| 207 | {
|
---|
[98f8fe] | 208 | const double volume_element = getVolume()/(double)getTotalGridPoints();
|
---|
[cb3363] | 209 | double int_value = 0.;
|
---|
| 210 | for (sampledvalues_t::const_iterator iter = sampled_grid.begin();
|
---|
| 211 | iter != sampled_grid.end();
|
---|
| 212 | ++iter)
|
---|
| 213 | int_value += *iter;
|
---|
| 214 | int_value *= volume_element;
|
---|
| 215 | LOG(2, "DEBUG: SamplingGrid::integral() is " << scientific << setprecision(13) << int_value << ".");
|
---|
| 216 | return int_value;
|
---|
| 217 | }
|
---|
| 218 |
|
---|
[e72c61] | 219 | double SamplingGrid::integral(const SamplingGrid &weight) const
|
---|
| 220 | {
|
---|
| 221 | if (isCompatible(weight)) {
|
---|
[98f8fe] | 222 | const double volume_element = getVolume()/(double)getTotalGridPoints();
|
---|
[e72c61] | 223 | double int_value = 0.;
|
---|
| 224 | sampledvalues_t::const_iterator iter = sampled_grid.begin();
|
---|
| 225 | sampledvalues_t::const_iterator weightiter = weight.sampled_grid.begin();
|
---|
| 226 | for (;iter != sampled_grid.end();++iter,++weightiter)
|
---|
| 227 | int_value += (*weightiter) * (*iter);
|
---|
| 228 | int_value *= volume_element;
|
---|
| 229 | //LOG(2, "DEBUG: SamplingGrid::integral() is " << scientific << setprecision(13) << int_value << ".");
|
---|
| 230 | return int_value;
|
---|
| 231 | } else
|
---|
| 232 | return 0.;
|
---|
| 233 | }
|
---|
| 234 |
|
---|
[1a00bb] | 235 | void SamplingGrid::setWindowSize(
|
---|
| 236 | const double _begin_window[3],
|
---|
| 237 | const double _end_window[3])
|
---|
| 238 | {
|
---|
| 239 | for (size_t index=0;index<3;++index) {
|
---|
[e2404f] | 240 | ASSERT( _begin_window[index] >= begin[index],
|
---|
| 241 | "SamplingGrid::setWindowSize() - window starts earlier than domain on "
|
---|
| 242 | +toString(index)+"th component.");
|
---|
[1a00bb] | 243 | begin_window[index] = _begin_window[index];
|
---|
[e2404f] | 244 | ASSERT( _end_window[index] <= end[index],
|
---|
| 245 | "SamplingGrid::setWindowSize() - window ends later than domain on "
|
---|
| 246 | +toString(index)+"th component.");
|
---|
[1a00bb] | 247 | end_window[index] = _end_window[index];
|
---|
| 248 | }
|
---|
| 249 | }
|
---|
| 250 |
|
---|
| 251 | void SamplingGrid::setWindow(
|
---|
| 252 | const double _begin_window[3],
|
---|
| 253 | const double _end_window[3])
|
---|
| 254 | {
|
---|
| 255 | setWindowSize(_begin_window, _end_window);
|
---|
| 256 | const size_t gridpoints_window = getWindowGridPoints();
|
---|
[c6355f] | 257 | sampled_grid.clear();
|
---|
[1a00bb] | 258 | sampled_grid.resize(gridpoints_window, 0.);
|
---|
| 259 | }
|
---|
| 260 |
|
---|
[e2404f] | 261 | void SamplingGrid::setDomainSize(
|
---|
| 262 | const double _begin[3],
|
---|
| 263 | const double _end[3])
|
---|
[1a00bb] | 264 | {
|
---|
| 265 | for (size_t index=0;index<3;++index) {
|
---|
[e2404f] | 266 | begin[index] = _begin[index];
|
---|
| 267 | end[index] = _end[index];
|
---|
[1a00bb] | 268 | }
|
---|
| 269 | }
|
---|
| 270 |
|
---|
[e2404f] | 271 | void SamplingGrid::setDomain(
|
---|
| 272 | const double _begin[3],
|
---|
| 273 | const double _end[3])
|
---|
| 274 | {
|
---|
| 275 | setDomainSize(_begin, _end);
|
---|
| 276 | setWindowSize(_begin, _end);
|
---|
| 277 | const size_t gridpoints = getTotalGridPoints();
|
---|
| 278 | sampled_grid.resize(gridpoints, 0.);
|
---|
| 279 | }
|
---|
| 280 |
|
---|
[1a00bb] | 281 | void SamplingGrid::extendWindow(
|
---|
| 282 | const double _begin_window[3],
|
---|
| 283 | const double _end_window[3])
|
---|
| 284 | {
|
---|
| 285 | #ifndef NDEBUG
|
---|
| 286 | for(size_t index=0;index < 3; ++index) {
|
---|
[c6355f] | 287 | // check that we truly have to extend the window
|
---|
[1a00bb] | 288 | ASSERT ( begin_window[index] >= _begin_window[index],
|
---|
| 289 | "SamplingGrid::extendWindow() - component "+toString(index)+
|
---|
| 290 | " of window start is greater than old value.");
|
---|
| 291 | ASSERT ( end_window[index] <= _end_window[index],
|
---|
| 292 | "SamplingGrid::extendWindow() - component "+toString(index)+
|
---|
| 293 | " of window end is less than old value.");
|
---|
[c6355f] | 294 |
|
---|
| 295 | // check that we are still less than domain
|
---|
| 296 | ASSERT ( _begin_window[index] >= begin[index],
|
---|
| 297 | "SamplingGrid::extendWindow() - component "+toString(index)+
|
---|
| 298 | " of window start is less than domain start.");
|
---|
| 299 | ASSERT ( _end_window[index] <= end[index],
|
---|
| 300 | "SamplingGrid::extendWindow() - component "+toString(index)+
|
---|
| 301 | " of window end is greater than domain end.");
|
---|
[1a00bb] | 302 | }
|
---|
| 303 | #endif
|
---|
| 304 | // copy old window size and values
|
---|
| 305 | double old_begin_window[3];
|
---|
| 306 | double old_end_window[3];
|
---|
| 307 | for(size_t index=0;index<3;++index) {
|
---|
| 308 | old_begin_window[index] = begin_window[index];
|
---|
| 309 | old_end_window[index] = end_window[index];
|
---|
| 310 | }
|
---|
| 311 | sampledvalues_t old_values(sampled_grid);
|
---|
[de6dfb] | 312 | // set new window
|
---|
| 313 | setWindow(_begin_window,_end_window);
|
---|
[1a00bb] | 314 | // now extend it ...
|
---|
[de6dfb] | 315 | addOntoWindow(old_begin_window, old_end_window, old_values, +1.);
|
---|
| 316 | LOG(2, "DEBUG: Grid after extension is " << sampled_grid << ".");
|
---|
[1a00bb] | 317 | }
|
---|
| 318 |
|
---|
| 319 | void SamplingGrid::addOntoWindow(
|
---|
| 320 | const double _begin_window[3],
|
---|
| 321 | const double _end_window[3],
|
---|
[de6dfb] | 322 | const sampledvalues_t &_sampled_grid,
|
---|
| 323 | const double prefactor)
|
---|
[1a00bb] | 324 | {
|
---|
| 325 | #ifndef NDEBUG
|
---|
| 326 | for(size_t index=0;index<3;++index) {
|
---|
| 327 | ASSERT( _begin_window[index] >= begin_window[index],
|
---|
| 328 | "SamplingGrid::addOntoWindow() - given window starts earlier in component "
|
---|
| 329 | +toString(index)+".");
|
---|
| 330 | ASSERT( _end_window[index] <= end_window[index],
|
---|
| 331 | "SamplingGrid::addOntoWindow() - given window ends later in component "
|
---|
| 332 | +toString(index)+".");
|
---|
| 333 | }
|
---|
| 334 | #endif
|
---|
| 335 | // the only issue are indices
|
---|
[c6355f] | 336 | const size_t gridpoints_axis = getGridPointsPerAxis();
|
---|
[de6dfb] | 337 | size_t pre_offset[3];
|
---|
| 338 | size_t post_offset[3];
|
---|
[1a00bb] | 339 | size_t length[3];
|
---|
[de6dfb] | 340 | size_t total[3];
|
---|
[1a00bb] | 341 | for(size_t index=0;index<3;++index) {
|
---|
[de6dfb] | 342 | pre_offset[index] = (_begin_window[index] - begin_window[index])*gridpoints_axis;
|
---|
| 343 | length[index] = (_end_window[index] - _begin_window[index])*gridpoints_axis;
|
---|
[c6355f] | 344 | post_offset[index] = (end_window[index] - _end_window[index])*gridpoints_axis;
|
---|
[de6dfb] | 345 | total[index] = (end_window[index] - begin_window[index])*gridpoints_axis;
|
---|
| 346 | ASSERT( pre_offset[index]+post_offset[index]+length[index] == total[index],
|
---|
[c6355f] | 347 | "SamplingGrid::addOntoWindow() - pre, post, and length don't sum up to total for "
|
---|
[de6dfb] | 348 | +toString(index)+"th component.");
|
---|
[1a00bb] | 349 | }
|
---|
[c6355f] | 350 | #ifndef NDEBUG
|
---|
| 351 | const size_t calculated_size = length[0]*length[1]*length[2];
|
---|
| 352 | ASSERT( calculated_size == _sampled_grid.size(),
|
---|
| 353 | "SamplingGrid::addOntoWindow() - not enough sampled values given: "
|
---|
| 354 | +toString(calculated_size)+" != "+toString(_sampled_grid.size())+".");
|
---|
| 355 | ASSERT( calculated_size <= sampled_grid.size(),
|
---|
| 356 | "SamplingGrid::addOntoWindow() - not enough sampled values available: "
|
---|
| 357 | +toString(calculated_size)+" <= "+toString(sampled_grid.size())+".");
|
---|
| 358 | const size_t total_size = total[0]*total[1]*total[2];
|
---|
| 359 | ASSERT( total_size == sampled_grid.size(),
|
---|
| 360 | "SamplingGrid::addOntoWindow() - total size is not equal to number of present points: "
|
---|
| 361 | +toString(total_size)+" != "+toString(sampled_grid.size())+".");
|
---|
| 362 | #endif
|
---|
[1a00bb] | 363 | size_t N[3];
|
---|
[c6355f] | 364 | size_t counter = 0;
|
---|
[de6dfb] | 365 | sampledvalues_t::iterator griditer = sampled_grid.begin();
|
---|
| 366 | std::advance(griditer, pre_offset[0]*total[1]*total[2]);
|
---|
[1a00bb] | 367 | sampledvalues_t::const_iterator copyiter = _sampled_grid.begin();
|
---|
[de6dfb] | 368 | for(N[0]=0; N[0] < length[0]; ++N[0]) {
|
---|
| 369 | std::advance(griditer, pre_offset[1]*total[2]);
|
---|
| 370 | for(N[1]=0; N[1] < length[1]; ++N[1]) {
|
---|
| 371 | std::advance(griditer, pre_offset[2]);
|
---|
| 372 | for(N[2]=0; N[2] < length[2]; ++N[2]) {
|
---|
[c6355f] | 373 | ASSERT( griditer != sampled_grid.end(),
|
---|
| 374 | "SamplingGrid::addOntoWindow() - griditer is already at end of window.");
|
---|
| 375 | ASSERT( copyiter != _sampled_grid.end(),
|
---|
| 376 | "SamplingGrid::addOntoWindow() - griditer is already at end of window.");
|
---|
[de6dfb] | 377 | *griditer++ += prefactor*(*copyiter++);
|
---|
[1a00bb] | 378 | }
|
---|
[de6dfb] | 379 | std::advance(griditer, post_offset[2]);
|
---|
[1a00bb] | 380 | }
|
---|
[de6dfb] | 381 | std::advance(griditer, post_offset[1]*total[2]);
|
---|
[1a00bb] | 382 | }
|
---|
[c6355f] | 383 | #ifndef NDEBUG
|
---|
| 384 | std::advance(griditer, post_offset[0]*total[1]*total[2]);
|
---|
| 385 | ASSERT( griditer == sampled_grid.end(),
|
---|
| 386 | "SamplingGrid::addOntoWindow() - griditer is not at end of window.");
|
---|
| 387 | ASSERT( copyiter == _sampled_grid.end(),
|
---|
| 388 | "SamplingGrid::addOntoWindow() - copyiter is not at end of window.");
|
---|
| 389 | #endif
|
---|
[de6dfb] | 390 | LOG(2, "DEBUG: Grid after adding other is " << sampled_grid << ".");
|
---|
[1a00bb] | 391 | }
|
---|
| 392 |
|
---|
[c889b7] | 393 | std::ostream & operator<<(std::ostream &ost, const SamplingGrid& other)
|
---|
| 394 | {
|
---|
[1a00bb] | 395 | ost << "SamplingGrid";
|
---|
| 396 | ost << " starting at " << other.begin[0] << "," << other.begin[1] << "," << other.begin[2];
|
---|
| 397 | ost << " ending at " << other.end[0] << "," << other.end[1] << "," << other.end[2];
|
---|
| 398 | ost << ", window starting at " << other.begin_window[0] << "," << other.begin_window[1] << "," << other.begin_window[2];
|
---|
| 399 | ost << ", window ending at " << other.end_window[0] << "," << other.end_window[1] << "," << other.end_window[2];
|
---|
[80959a1] | 400 | ost << ", level of " << other.level;
|
---|
| 401 | ost << " and integrated value of " << other.integral();
|
---|
[c889b7] | 402 | return ost;
|
---|
| 403 | }
|
---|
| 404 |
|
---|
[beb16e] | 405 | template<> SamplingGrid ZeroInstance<SamplingGrid>()
|
---|
| 406 | {
|
---|
| 407 | SamplingGrid returnvalue;
|
---|
| 408 | return returnvalue;
|
---|
| 409 | }
|
---|
| 410 |
|
---|
[28c025] | 411 | // we need to explicitly instantiate the serialization functions as
|
---|
| 412 | // its is only serialized through its base class FragmentJob
|
---|
| 413 | BOOST_CLASS_EXPORT_IMPLEMENT(SamplingGrid)
|
---|