Page MenuHomec4science

stimulation_impulse.cc
No OneTemporary

File Metadata

Created
Mon, Aug 19, 20:15

stimulation_impulse.cc

/**
* @file stimulation_impulse.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Wed Jul 09 21:59:47 2014
*
* @brief This stimulator sets an initial impulse displacement field generating
* a wave
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale 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.
*
* LibMultiScale 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 LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "stimulation_impulse.hh"
#include "lib_continuum.hh"
#include "lib_dd.hh"
#include "lib_md.hh"
#include "lm_common.hh"
#include "ref_point_data.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
StimulationImpulse::StimulationImpulse(const std::string &name)
: LMObject(name), compute("computeImpulse:" + name){};
/* -------------------------------------------------------------------------- */
StimulationImpulse::~StimulationImpulse(){};
/* -------------------------------------------------------------------------- */
void StimulationImpulse::init() { compute.init(); }
/* -------------------------------------------------------------------------- */
template <typename Cont>
void StimulationImpulse::stimulate(Cont &cont) {
constexpr UInt Dim = Cont::Dim;
compute.build(cont);
UInt index = 0;
for (auto &&at : cont) {
Vector<Dim> disp;
for (UInt i = 0; i < Dim; ++i)
disp[i] = compute[index * Dim + i];
at.displacement() = disp;
++index;
}
}
/* -------------------------------------------------------------------------- */
/* LMDESC IMPULSE
This stimulator sets an initial impulse displacement field that will generate
a wave. It uses the IMPULSE compute to generate a displacement field.
*/
/* LMHERITANCE compute_impulse */
/* LMEXAMPLE STIMULATION impulse IMPULSE INPUT central_md LWAVE WaveLength*r0
* DIRECTION 0 INTENSITY 1.1e-3 ONESHOT 0 */
void StimulationImpulse::declareParams() {
StimulationInterface::declareParams();
this->addSubParsableObject(compute);
}
/* -------------------------------------------------------------------------- */
DECLARE_STIMULATION_MAKE_CALL(StimulationImpulse)
__END_LIBMULTISCALE__

Event Timeline