diff --git a/src/model/integration/accumulator.hh b/src/model/integration/accumulator.hh
index 111dad7..071971c 100644
--- a/src/model/integration/accumulator.hh
+++ b/src/model/integration/accumulator.hh
@@ -1,213 +1,224 @@
/**
* @file
* @section LICENSE
*
* Copyright (©) 2016-19 EPFL (École Polytechnique Fédérale de Lausanne),
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*
*/
/* -------------------------------------------------------------------------- */
#ifndef ACCUMULATOR_HH
#define ACCUMULATOR_HH
/* -------------------------------------------------------------------------- */
#include "grid_hermitian.hh"
#include "integrator.hh"
#include "model_type.hh"
#include "static_types.hh"
+#include
#include
#include
/* -------------------------------------------------------------------------- */
namespace tamaas {
/// Accumulation integral manager
template ::value>>
class Accumulator {
using trait = model_type_traits;
using BufferType = GridHermitian;
public:
/// Constructor
Accumulator() {
// Resizing accumulators (with source)
for (auto&& acc : accumulator)
acc.setNbComponents(Source::size);
}
/// Initialize uniform mesh
void makeUniformMesh(UInt N, Real domain_size) {
Real dx = domain_size / (N - 1);
Real x = 0;
node_positions.resize(N);
for (UInt i = 0; i < N; ++i, x += dx) {
node_positions[i] = x;
}
}
const std::vector& nodePositions() const { return node_positions; }
/// Direction flag
enum class direction { forward, backward };
/// Forward/Backward iterator for integration passes
template
struct iterator {
using integ = Integrator<1>;
/// Constructor
iterator(Accumulator& acc, Int k) : acc(acc), k(k) {
l = (dir != direction::forward) ? k + 1 : k;
}
/// Copy constructor
iterator(const iterator& o)
: acc(o.acc), k(o.k), l(o.l), r(o.r), xc(o.xc) {}
static constexpr bool upper = dir == direction::backward;
/// Compare
bool operator!=(const iterator& o) const { return k != o.k; }
/// Increment
iterator& operator++() {
// update current layer and element. skip last operation
if (not setup()) {
next();
return *this;
}
Loop::loop(
[&](auto qv, auto wk0, auto wk1, auto acc_g0, auto acc_g1) {
Real q = qv.l2norm();
acc_g0 += wk0 * integ::template G0(q, r, xc);
acc_g0 += wk1 * integ::template G0(q, r, xc);
acc_g1 += wk0 * integ::template G1(q, r, xc);
acc_g1 += wk1 * integ::template G1(q, r, xc);
},
range>(
acc.waveVectors())
.headless(),
range