PIC Solver 0.1.0
Электромагнитный Particle-in-Cell солвер (1D/2D/3D)
Загрузка...
Поиск...
Не найдено
particle_container.cpp
См. документацию.
2
3size_t ParticleContainer::size() const {
4 return x.size();
5}
6
7void ParticleContainer::reserve(size_t capacity) {
8 x.reserve(capacity);
9 y.reserve(capacity);
10 z.reserve(capacity);
11 px.reserve(capacity);
12 py.reserve(capacity);
13 pz.reserve(capacity);
14 weight.reserve(capacity);
15}
16
17void ParticleContainer::add_particle(double new_x, double new_y, double new_z,
18 double new_px, double new_py, double new_pz,
19 double new_w) {
20 x.push_back(new_x);
21 y.push_back(new_y);
22 z.push_back(new_z);
23 px.push_back(new_px);
24 py.push_back(new_py);
25 pz.push_back(new_pz);
26 weight.push_back(new_w);
27}
28
29void ParticleContainer::add_particles_batch(const std::vector<double>& batch_x,
30 const std::vector<double>& batch_y,
31 const std::vector<double>& batch_z,
32 const std::vector<double>& batch_px,
33 const std::vector<double>& batch_py,
34 const std::vector<double>& batch_pz,
35 const std::vector<double>& batch_w) {
36 size_t n = batch_x.size();
37 reserve(size() + n);
38
39 x.insert(x.end(), batch_x.begin(), batch_x.end());
40 y.insert(y.end(), batch_y.begin(), batch_y.end());
41 z.insert(z.end(), batch_z.begin(), batch_z.end());
42
43 px.insert(px.end(), batch_px.begin(), batch_px.end());
44 py.insert(py.end(), batch_py.begin(), batch_py.end());
45 pz.insert(pz.end(), batch_pz.begin(), batch_pz.end());
46
47 weight.insert(weight.end(), batch_w.begin(), batch_w.end());
48}
std::vector< double > x
Определения particle_container.hpp:18
std::vector< double > z
Определения particle_container.hpp:18
std::vector< double > py
Определения particle_container.hpp:19
std::vector< double > weight
Определения particle_container.hpp:20
std::vector< double > px
Определения particle_container.hpp:19
size_t size() const
Возвращает текущее количество макрочастиц в контейнере.
Определения particle_container.cpp:3
std::vector< double > pz
Определения particle_container.hpp:19
void add_particles_batch(const std::vector< double > &batch_x, const std::vector< double > &batch_y, const std::vector< double > &batch_z, const std::vector< double > &batch_px, const std::vector< double > &batch_py, const std::vector< double > &batch_pz, const std::vector< double > &batch_w)
Массовое добавление пучка частиц (Batch insert).
Определения particle_container.cpp:29
void reserve(size_t capacity)
Резервирует память для заданного количества частиц.
Определения particle_container.cpp:7
void add_particle(double new_x, double new_y, double new_z, double new_px, double new_py, double new_pz, double new_w)
Добавляет одну новую макрочастицу в конец контейнера.
Определения particle_container.cpp:17
std::vector< double > y
Определения particle_container.hpp:18