KIDS  ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
Loading...
Searching...
No Matches
Kernel_Update_p.cpp
Go to the documentation of this file.
2
3#include "kids/debug_utils.h"
4#include "kids/hash_fnv1a.h"
5#include "kids/macro_utils.h"
6#include "kids/vars_list.h"
7
8namespace PROJECT_NS {
9
10const std::string Kernel_Update_p::getName() { return "Kernel_Update_p"; }
11
13
14void Kernel_Update_p::setInputDataSet_impl(std::shared_ptr<DataSet>& DS) {
15 dt_ptr = DS->def(DATA::iter::dt);
16 f = DS->def(DATA::integrator::f);
17 p = DS->def(DATA::integrator::p);
20 frez_ptr = DS->def(DATA::iter::frez);
21}
22
24 for (int iP = 0; iP < Dimension::P; ++iP) {
25 kids_real* p = this->p + iP * Dimension::N;
26 kids_real* minv = this->minv + iP * Dimension::N;
27 kids_real* Ekin = this->Ekin + iP;
29 Ekin[0] = 0.0e0;
30 for (int i = 0; i < Dimension::N; ++i) Ekin[0] += 0.5e0 * p[i] * p[i] * minv[i];
31 }
32 return stat;
33}
34
36 if (frez_ptr[0]) return stat;
37
38 for (int iP = 0; iP < Dimension::P; ++iP) {
39 kids_real* f = this->f + iP * Dimension::N;
40 kids_real* p = this->p + iP * Dimension::N;
41 kids_real* minv = this->minv + iP * Dimension::N;
42 kids_real* Ekin = this->Ekin + iP;
43
45 Ekin[0] = 0.0e0;
46 for (int i = 0; i < Dimension::N; ++i) {
47 p[i] -= f[i] * scale * dt_ptr[0];
48 Ekin[0] += 0.5e0 * p[i] * p[i] * minv[i];
49 }
50 }
51 return stat;
52}
53
54}; // namespace PROJECT_NS
virtual void setInputDataSet_impl(std::shared_ptr< DataSet > &DS)
Virtual function to set input data set for the kernel implementation.
virtual const std::string getName()
Get the name of the kernel.
virtual int getType() const
Get the type of the kernel.
virtual Status & initializeKernel_impl(Status &stat)
Virtual function to initialize the kernel implementation.
virtual Status & executeKernel_impl(Status &stat)
Virtual function to execute the kernel implementation.
provide utils for debugging the code
#define FUNCTION_NAME
Definition macro_utils.h:9
VARIABLE< kids_real > f
VARIABLE< kids_real > p
VARIABLE< kids_real > minv
VARIABLE< kids_real > Ekin
VARIABLE< kids_real > dt
VARIABLE< kids_bint > frez
std::size_t N
Number of nuclear degrees of freedom.
Definition vars_list.cpp:10
std::size_t P
Number of parallel trajectories (swarms of trajectories) in each Monte Carlo run.
Definition vars_list.cpp:9
< http://warp.povusers.org/FunctionParser/fparser.html
Definition Context.h:39
double kids_real
Alias for real number type.
Definition Types.h:59
constexpr uint32_t hash(const char *str)
Definition hash_fnv1a.h:12
declaration of variables used in the program.