Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85058856
volume_potential.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Sep 26, 12:19
Size
3 KB
Mime Type
text/x-c++
Expires
Sat, Sep 28, 12:19 (2 d)
Engine
blob
Format
Raw Data
Handle
21123664
Attached To
rTAMAAS tamaas
volume_potential.cpp
View Options
/**
* @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 <https://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "volume_potential.hh"
#include "model.hh"
#include <algorithm>
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
template <model_type type>
VolumePotential<type>::VolumePotential(Model* model) : IntegralOperator(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
auto system_size = model->getBoundarySystemSize();
VectorProxy<const Real, trait::boundary_dimension> boundary_domain{
system_size[0]};
wavevectors *= 2 * M_PI;
wavevectors /= boundary_domain;
wavevectors *= -1.; // < this is important for the convolution computation
}
/* -------------------------------------------------------------------------- */
template <model_type type>
model_type VolumePotential<type>::getType() const {
return this->model->getType();
}
/* -------------------------------------------------------------------------- */
template <model_type type>
void VolumePotential<type>::initialize(UInt source_components,
UInt out_components) {
auto hermitian_sizes =
GridHermitian<Real, trait::boundary_dimension>::hermitianDimensions(
this->model->getBoundaryDiscretization());
// Initializing buffers
this->source_buffer.resize(this->model->getDiscretization()[0]);
this->disp_buffer.resize(this->model->getDiscretization()[0]);
// 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->disp_buffer.begin(), this->disp_buffer.end(),
[&](auto& buffer) {
buffer.setNbComponents(out_components);
buffer.resize(hermitian_sizes);
});
}
/* -------------------------------------------------------------------------- */
/* Template instanciation */
/* -------------------------------------------------------------------------- */
template class VolumePotential<model_type::volume_1d>;
template class VolumePotential<model_type::volume_2d>;
__END_TAMAAS__
Event Timeline
Log In to Comment