Page MenuHomec4science

be_engine.cpp
No OneTemporary

File Metadata

Created
Tue, May 21, 03:06

be_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 "be_engine.hh"
#include "model.hh"
/* -------------------------------------------------------------------------- */
namespace tamaas {
/* -------------------------------------------------------------------------- */
void solve(IntegralOperator::kind kind,
const std::map<IntegralOperator::kind, IntegralOperator*>& operators,
GridBase<Real>& input, GridBase<Real>& output) try {
operators.at(kind)->apply(input, output);
} catch (std::out_of_range& e) {
std::cerr << "Operator (" << "Westergaard::" << kind << ") not registered\n";
throw e;
}
template <model_type mtype, IntegralOperator::kind otype>
void registerWestergaardOperator(
std::map<IntegralOperator::kind, IntegralOperator*>& operators,
Model& model) {
std::stringstream sstr;
sstr << "Westergaard::" << otype;
if (operators.find(otype) == operators.end())
operators[otype] =
model.template registerIntegralOperator<Westergaard<mtype, otype>>(
sstr.str());
}
template <model_type type>
void BEEngineTmpl<type>::solveNeumann(GridBase<Real>& neumann,
GridBase<Real>& dirichlet) const {
solve(IntegralOperator::neumann, this->operators, neumann, dirichlet);
}
template <model_type type>
void BEEngineTmpl<type>::solveDirichlet(GridBase<Real>& dirichlet,
GridBase<Real>& neumann) const {
solve(IntegralOperator::dirichlet, this->operators, dirichlet, neumann);
}
template <model_type type>
void BEEngineTmpl<type>::registerNeumann() {
registerWestergaardOperator<type, IntegralOperator::neumann>(this->operators,
*this->model);
}
/// Register dirichlet operator
template <model_type type>
void BEEngineTmpl<type>::registerDirichlet() {
registerWestergaardOperator<type, IntegralOperator::dirichlet>(
this->operators, *this->model);
}
template class BEEngineTmpl<model_type::basic_1d>;
template class BEEngineTmpl<model_type::basic_2d>;
template class BEEngineTmpl<model_type::surface_1d>;
template class BEEngineTmpl<model_type::surface_2d>;
template class BEEngineTmpl<model_type::volume_1d>;
template class BEEngineTmpl<model_type::volume_2d>;
/* -------------------------------------------------------------------------- */
} // namespace tamaas

Event Timeline