Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F75802975
stimulation_raz.cc
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
Sun, Aug 4, 09:21
Size
4 KB
Mime Type
text/x-c++
Expires
Tue, Aug 6, 09:21 (2 d)
Engine
blob
Format
Raw Data
Handle
19613014
Attached To
rLIBMULTISCALE LibMultiScale
stimulation_raz.cc
View Options
/**
* @file stimulation_raz.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Till Junge <till.junge@epfl.ch>
*
* @date Wed Jul 09 21:59:47 2014
*
* @brief Remise a zero (reset to zero) stimulator
*
* @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 "lm_common.hh"
#include "stimulation_raz.hh"
#include "lib_md.hh"
#include "lib_dd.hh"
#include "lib_continuum.hh"
#include "filter.hh"
#include <iomanip>
#include "ref_point_data.hh"
#include "communicator.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template
<
typename
Cont
>
void
StimulationRAZ
<
Cont
>::
stimulate
(
Cont
&
cont
,
UInt
stage
)
{
static
const
UInt
Dim
=
Cont
::
Dim
;
std
::
vector
<
UInt
>
directions
;
if
(
this
->
direction
<
0
)
{
for
(
UInt
i
=
0
;
i
<
Dim
;
++
i
)
{
directions
.
push_back
(
i
);
}
}
else
{
directions
.
push_back
(
this
->
direction
);
}
typedef
std
::
vector
<
UInt
>::
iterator
iter
;
DUMP
(
"Stimulation RAZ fields "
<<
" COEF : "
<<
COEF
<<
" pointer this "
<<
this
,
DBG_INFO
);
typedef
typename
Cont
::
Ref
RefDof
;
typename
Cont
::
iterator
it
=
cont
.
getIterator
();
for
(
UInt
i
=
0
;
i
<
field
.
size
()
;
++
i
)
{
FieldType
f
=
field
[
i
];
RefDof
first
=
it
.
getFirst
();
for
(
RefDof
at
=
it
.
getFirst
()
;
!
it
.
end
()
;
at
=
it
.
getNext
())
{
if
(
f
==
_velocity
)
{
for
(
iter
i
=
directions
.
begin
();
i
!=
directions
.
end
();
++
i
)
{
at
.
velocity
(
*
i
)
+=
(
COEF
-
1
)
*
at
.
velocity
(
*
i
);
}
}
else
if
(
f
==
_displacement
)
{
for
(
iter
i
=
directions
.
begin
();
i
!=
directions
.
end
();
++
i
)
{
at
.
displacement
(
*
i
)
+=
(
COEF
-
1
)
*
at
.
displacement
(
*
i
);
}
}
else
if
(
f
==
_force
)
{
for
(
iter
i
=
directions
.
begin
();
i
!=
directions
.
end
();
++
i
)
{
at
.
force
(
*
i
)
+=
(
COEF
-
1
)
*
at
.
force
(
*
i
);
}
}
else
if
(
f
==
_position0
)
{
for
(
iter
i
=
directions
.
begin
();
i
!=
directions
.
end
();
++
i
)
{
at
.
position0
(
*
i
)
=
at
.
position
(
*
i
);
}
}
}
}
}
/* -------------------------------------------------------------------------- */
/* LMDESC RAZ
Remise a zero (reset to zero) stimulator\\
This stimulator reset some fields to zero or even rescale them according
to the options provided.
*/
/* LMEXAMPLE STIMULATION reset RAZ INPUT md FIELD displacement FIELD velocity */
/* LMHERITANCE action_interface */
template
<
typename
_Input
>
void
StimulationRAZ
<
_Input
>::
declareParams
(){
Stimulation
<
_Input
>::
declareParams
();
/* LMKEYWORD FIELD
Set the fields that should be altered.
The value selected can be:
\begin{itemize}
\item displacement : selects the displacement field
\item velocity : selects the velocity field
\item force : selects the force field
\item position0 : selects the initial position field. Actually it is relevant for
atomic systems assigning the initial positions to the current one. \\
This is useful when a restart file needs to be generated with current positions
and a zero displacement field.
\end{itemize}
This command can be called several times for each field that need to be altered.
*/
this
->
parseKeyword
(
"FIELD"
,
field
);
/* LMKEYWORD COEF
This is effective only for displacement, velocity or force field.
Instead of reset to zero it multiplies by the provided coefficient.
It enables, for instance to perform velocity damping.
*/
this
->
parseKeyword
(
"COEF"
,
COEF
,
0.
);
/* LMKEYWORD COMPONENT
Just apply stimulation in direction COMPONENT. By default all directions
are stimulated.
*/
this
->
parseKeyword
(
"COMPONENT"
,
direction
,
-
1
);
};
/* -------------------------------------------------------------------------- */
DECLARE_STIMULATION
(
StimulationRAZ
,
LIST_ATOM_MODEL
)
DECLARE_STIMULATION
(
StimulationRAZ
,
LIST_CONTINUUM_MODEL
)
DECLARE_STIMULATION
(
StimulationRAZ
,
LIST_DD_MODEL
)
DECLARE_STIMULATION_REFPOINT
(
StimulationRAZ
)
DECLARE_STIMULATION_GENERIC_MESH
(
StimulationRAZ
)
__END_LIBMULTISCALE__
Event Timeline
Log In to Comment