Page MenuHomec4science

ve_engine.cpp
No OneTemporary

File Metadata

Created
Thu, Sep 26, 14:16

ve_engine.cpp

/**
* @file
*
* @author Lucas Frérot <lucas.frerot@epfl.ch>
*
* @section LICENSE
*
* Copyright (©) 2017 EPFL (Ecole Polytechnique Fédérale de
* Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des
* Solides)
*
* Tamaas is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Tamaas 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 Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Tamaas. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "ve_engine.hh"
#include "model.hh"
#include <algorithm>
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
template <model_type type>
VEEngineTmpl<type>::VEEngineTmpl(Model * model): VEEngine(model) {
// Copy horizontal sizes
std::array<UInt, trait::boundary_dimension> sizes;
std::copy(model->getDiscretization().begin() + 1,
model->getDiscretization().end(), sizes.begin());
auto hermitian_sizes =
GridHermitian<Real, trait::boundary_dimension>::hermitianDimensions(
sizes);
wavevectors = FFTransform<Real, trait::boundary_dimension>::
template computeFrequencies<true>(hermitian_sizes);
// Normalize wavevectors
StaticVector<const Real, trait::boundary_dimension> boundary_domain(
model->getSystemSize()[1]);
Loop::stridedLoop(
[&boundary_domain](StaticVector<Real, trait::boundary_dimension>&& q) {
q *= 2 * M_PI;
q /= boundary_domain;
},
wavevectors);
/// Initializing buffers
auto initialize = [this, &hermitian_sizes](std::vector<BufferType> & buffers) {
buffers.resize(this->model->getDiscretization()[0]);
std::for_each(buffers.begin(), buffers.end(),
[&hermitian_sizes](BufferType& buffer) {
buffer.setNbComponents(trait::components);
buffer.resize(hermitian_sizes);
});
};
initialize(source_buffers);
initialize(disp_buffers);
}
/* ------------------------------------------------------------------------ */
/* Template instanciation */
/* ------------------------------------------------------------------------ */
template class VEEngineTmpl<model_type::volume_1d>;
template class VEEngineTmpl<model_type::volume_2d>;
__END_TAMAAS__

Event Timeline