-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsimulation.h
More file actions
97 lines (87 loc) · 3.49 KB
/
Copy pathsimulation.h
File metadata and controls
97 lines (87 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*----------------------------------------------------------------------------
*
* Copyright (C) 2018-2019 Andrea Contu e Angelo Loi
*
* This file is part of TCode software.
*
* TCode is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TCode 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TCode. If not, see <http://www.gnu.org/licenses/>.
*
*---------------------------------------------------------------------------*/
/*
* simulation.h
*
* Created on: 13/01/2019
* Author: Andrea Contu
*/
#ifndef __SIMULATION_H__
#define __SIMULATION_H__
#include <simulation/Evolve.h>
#include <deposits/deposit.h>
using namespace hydra::placeholders;
namespace sim{
//class implementing single simulation
class simulation{
private:
size_t _bunchsize;
size_t _nparticles;
size_t _nsteps;
std::string _path;
std::string _nickname;
bool _plot;
bool _extrainfo;
double _temperature;
double _timestep;
double _xshift;
double _yshift;
double _zshift;
double _sig;
double _amp;
double _length;
// RunningStateHost_t _data_dinit;
bool _prepared;
RunningState_t _data;
ReducedDataDev_t _currents;
CurrentVec_t _tp_currs;
public:
//constructors
simulation(singleconf cf){
_bunchsize = std::get<size_t>(cf.get("bunchsize"));
_nparticles = std::get<size_t>(cf.get("nparticles"));
_nsteps = std::get<size_t>(cf.get("nsteps"));
_path = std::get<std::string>(cf.get("path"));
_nickname = std::get<std::string>(cf.get("nickname"));
_plot = std::get<bool>(cf.get("plot"));
_extrainfo = std::get<bool>(cf.get("extrainfo"));
_temperature = std::get<double>(cf.get("temperature"));
_timestep = std::get<double>(cf.get("timestep"));
_xshift = std::get<double>(cf.get("xshift"));
_yshift = std::get<double>(cf.get("yshift"));
_zshift = std::get<double>(cf.get("zshift"));
_sig = std::get<double>(cf.get("sig"));
_amp = std::get<double>(cf.get("amp"));
_length = std::get<double>(cf.get("length"));
_prepared = false;
}
//prepare simulation
void prepare(){
deposit::owndeposit mydep(_path,_nparticles,_length);
// if(_nparticles==0 || _nparticles> mydep.getnparticles()) _nparticles = mydep.getnparticles();
// // _data.resize(_nparticles);
// hydra::copy(hydra::make_range(mydep.getdata().begin(),mydep.getdata().begin() + _nparticles),_data); // copy deposit to device
// _prepared = true;
// hydra::for_each(_data, loaddata::Translate(xshift,yshift,zshift,_xmin,_xmax,_ymin,_ymax,_zmin,_zmax));
}
};
}
#endif