diff --git a/src/model/volume_potential.cpp b/src/model/volume_potential.cpp
index 49267f3..5566dd7 100644
--- a/src/model/volume_potential.cpp
+++ b/src/model/volume_potential.cpp
@@ -1,112 +1,115 @@
/**
* @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 .
*
*/
/* -------------------------------------------------------------------------- */
#include "volume_potential.hh"
#include "model.hh"
#include
/* -------------------------------------------------------------------------- */
namespace tamaas {
template
VolumePotential::VolumePotential(Model* model) : IntegralOperator(model) {
// Copy horizontal sizes
std::array sizes;
std::copy(model->getDiscretization().begin() + 1,
model->getDiscretization().end(), sizes.begin());
auto hermitian_sizes =
GridHermitian::hermitianDimensions(
sizes);
wavevectors =
FFTransform::template computeFrequencies<
true>(hermitian_sizes);
// Normalize wavevectors
auto system_size = model->getBoundarySystemSize();
VectorProxy boundary_domain{
system_size[0]};
wavevectors *= 2 * M_PI;
wavevectors /= boundary_domain;
wavevectors *= -1.; // < this is important for the convolution computation
}
/* -------------------------------------------------------------------------- */
template
model_type VolumePotential::getType() const {
return this->model->getType();
}
/* -------------------------------------------------------------------------- */
template
void VolumePotential::initialize(UInt source_components,
UInt out_components,
UInt out_buffer_size) {
auto hermitian_sizes =
GridHermitian::hermitianDimensions(
this->model->getBoundaryDiscretization());
// Initializing buffers
this->source_buffer.resize(this->model->getDiscretization()[0]);
this->out_buffer.resize(out_buffer_size);
// Resizing source buffer
std::for_each(this->source_buffer.begin(), this->source_buffer.end(),
[&](auto& buffer) {
buffer.setNbComponents(source_components);
buffer.resize(hermitian_sizes);
});
// Resizing output buffer
std::for_each(this->out_buffer.begin(), this->out_buffer.end(),
[&](auto& buffer) {
buffer.setNbComponents(out_components);
buffer.resize(hermitian_sizes);
});
}
/* -------------------------------------------------------------------------- */
template
void VolumePotential::transformSource(GridBase& in,
filter_t pred) const {
constexpr UInt dim = trait::dimension;
auto& i = dynamic_cast&>(in);
// Transforming source
for (UInt layer : Loop::range(i.sizes().front())) {
if (not pred(layer))
continue;
auto in_layer = make_view(i, layer);
FFTPlanManager::get()
.createPlan(in_layer, source_buffer[layer])
.forwardTransform();
}
+
+ for (auto && layer : out_buffer)
+ layer = 0;
}
/* -------------------------------------------------------------------------- */
/* Template instanciation */
/* -------------------------------------------------------------------------- */
template class VolumePotential;
template class VolumePotential;
} // namespace tamaas