Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
compression_tools.cpp
Go to the documentation of this file.
1/*
2 * This file is part of Vlasiator.
3 * Copyright 2010-2024 Finnish Meteorological Institute
4 *
5 * For details of usage, see the COPYING file and read the "Rules of the Road"
6 * at http://www.physics.helsinki.fi/vlasiator/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#include "compression_tools.h"
24#include <concepts>
25#include <stdexcept>
26#include <sys/types.h>
27#include <unordered_set>
28#include <vector>
29
30/*
31Extracts VDF from spatial cell
32 */
34 assert(sc && "Invalid Pointer to Spatial Cell !");
35 auto blockContainer = sc->get_velocity_blocks(popID);
36 const size_t total_blocks = blockContainer->size();
37 const Real* max_v_lims = sc->get_population(popID).vmesh->getMeshMaxLimits();
38 const Real* min_v_lims = sc->get_population(popID).vmesh->getMeshMinLimits();;
39 const Real* blockParams = sc->get_block_parameters(popID);
40 Realf* data = blockContainer->getData();
41 assert(max_v_lims && "Invalid Pointre to max_v_limits");
42 assert(min_v_lims && "Invalid Pointre to min_v_limits");
43 assert(data && "Invalid Pointre block container data");
44 auto vcoords = std::vector<std::array<Real, 3>>(blockContainer->size() * WID3, {Real(0), Real(0), Real(0)});
45 auto vspace = std::vector<Realf>(blockContainer->size() * WID3, Realf(0));
46
47 // xmin,ymin,zmin,xmax,ymax,zmax;
48 std::array<Real, 6> vlims{std::numeric_limits<Real>::max(), std::numeric_limits<Real>::max(),
49 std::numeric_limits<Real>::max(), std::numeric_limits<Real>::lowest(),
50 std::numeric_limits<Real>::lowest(), std::numeric_limits<Real>::lowest()};
51
52 std::size_t cnt = 0;
53 for (std::size_t n = 0; n < total_blocks; ++n) {
54 auto bp = blockParams + n * BlockParams::N_VELOCITY_BLOCK_PARAMS;
55 const Realf* vdf_data = &data[n * WID3];
56 for (uint k = 0; k < WID; ++k) {
57 for (uint j = 0; j < WID; ++j) {
58 for (uint i = 0; i < WID; ++i) {
59 const Real vx = bp[BlockParams::VXCRD] + (i + 0.5) * bp[BlockParams::DVX];
60 const Real vy = bp[BlockParams::VYCRD] + (j + 0.5) * bp[BlockParams::DVY];
61 const Real vz = bp[BlockParams::VZCRD] + (k + 0.5) * bp[BlockParams::DVZ];
62 vlims[0] = std::min(vlims[0], vx);
63 vlims[1] = std::min(vlims[1], vy);
64 vlims[2] = std::min(vlims[2], vz);
65 vlims[3] = std::max(vlims[3], vx);
66 vlims[4] = std::max(vlims[4], vy);
67 vlims[5] = std::max(vlims[5], vz);
68 Realf vdf_val = vdf_data[cellIndex(i, j, k)];
69 vcoords[cnt] = {vx, vy, vz};
70 vspace[cnt] = vdf_val;
71 cnt++;
72 }
73 }
74 }
75 } // over blocks
76 return UnorderedVDF{.vdf_vals = vspace, .vdf_coords = vcoords, .v_limits = vlims};
77}
78
79// Simply overwrites the VDF of this population for the give spatial cell with a
80// new vspace
81void ASTERIX::overwrite_pop_spatial_cell_vdf(spatial_cell::SpatialCell* sc, uint popID, const std::vector<Realf>& new_vspace) {
82 assert(sc && "Invalid Pointer to Spatial Cell !");
83 auto blockContainer = sc->get_velocity_blocks(popID);
84 const size_t total_blocks = blockContainer->size();
85 const Real* max_v_lims = sc->get_population(popID).vmesh->getMeshMaxLimits();
86 const Real* min_v_lims = sc->get_population(popID).vmesh->getMeshMinLimits();
87 const Real* blockParams = sc->get_block_parameters(popID);
88 Realf* data = blockContainer->getData();
89 assert(max_v_lims && "Invalid Pointre to max_v_limits");
90 assert(min_v_lims && "Invalid Pointre to min_v_limits");
91 assert(data && "Invalid Pointre block container data");
92
93 std::size_t cnt = 0;
94 for (std::size_t n = 0; n < total_blocks; ++n) {
95 auto bp = blockParams + n * BlockParams::N_VELOCITY_BLOCK_PARAMS;
96 Realf* vdf_data = &data[n * WID3];
97 for (uint k = 0; k < WID; ++k) {
98 for (uint j = 0; j < WID; ++j) {
99 for (uint i = 0; i < WID; ++i) {
100 vdf_data[cellIndex(i, j, k)] = new_vspace[cnt];
101 cnt++;
102 }
103 }
104 }
105 } // over blocks
106 return;
107}
108
110 assert(sc && "Invalid Pointer to Spatial Cell !");
111 auto blockContainer = sc->get_velocity_blocks(popID);
112 const size_t total_blocks = blockContainer->size();
113 const Real* blockParams = sc->get_block_parameters(popID);
114 Realf* data = blockContainer->getData();
115
116 for (std::size_t n = 0; n < total_blocks; ++n) {
117 auto bp = blockParams + n * BlockParams::N_VELOCITY_BLOCK_PARAMS;
118 Realf* vdf_data = &data[n * WID3];
119 for (uint k = 0; k < WID; ++k) {
120 for (uint j = 0; j < WID; ++j) {
121 for (uint i = 0; i < WID; ++i) {
125 const std::size_t nx = std::ceil((vdf.v_limits[3] - vdf.v_limits[0]) / dvx);
126 const std::size_t ny = std::ceil((vdf.v_limits[4] - vdf.v_limits[1]) / dvy);
127 const std::size_t nz = std::ceil((vdf.v_limits[5] - vdf.v_limits[2]) / dvz);
128 const Real vx = bp[BlockParams::VXCRD] + (i + 0.5) * bp[BlockParams::DVX];
129 const Real vy = bp[BlockParams::VYCRD] + (j + 0.5) * bp[BlockParams::DVY];
130 const Real vz = bp[BlockParams::VZCRD] + (k + 0.5) * bp[BlockParams::DVZ];
131 const size_t bbox_i = std::min(static_cast<size_t>(std::floor((vx - vdf.v_limits[0]) / dvx)), nx - 1);
132 const size_t bbox_j = std::min(static_cast<size_t>(std::floor((vy - vdf.v_limits[1]) / dvy)), ny - 1);
133 const size_t bbox_k = std::min(static_cast<size_t>(std::floor((vz - vdf.v_limits[2]) / dvz)), nz - 1);
134 const size_t index = bbox_i * (ny * nz) + bbox_j * nz + bbox_k;
135 // vspace.at(index) += vdf_data[cellIndex(i, j, k)] / ratio;
136
137
138 vdf_data[cellIndex(i, j, k)] = vdf.vdf_vals.at(index);
139
140 }
141 }
142 }
143 } // over blocks
144 return;
145}
146
147// Extracts VDF in a cartesian C ordered mesh in a minimum BBOX and with a zoom level used for upsampling/downsampling
149 int zoom) {
150 assert(sc && "Invalid Pointer to Spatial Cell !");
151 if (zoom != 1) {
152 throw std::runtime_error("Zoom is not supported yet!");
153 }
154 auto blockContainer = sc->get_velocity_blocks(popID);
155 const size_t total_blocks = blockContainer->size();
156 const Real* blockParams = sc->get_block_parameters(popID);
157
158 // xmin,ymin,zmin,xmax,ymax,zmax;
159 std::array<Real, 6> vlims{std::numeric_limits<Real>::max(), std::numeric_limits<Real>::max(),
160 std::numeric_limits<Real>::max(), std::numeric_limits<Real>::lowest(),
161 std::numeric_limits<Real>::lowest(), std::numeric_limits<Real>::lowest()};
162
163 // This pass is computing the active vmesh limits
164 // Store dvx,dvy,dvz here
168 for (std::size_t n = 0; n < total_blocks; ++n) {
169 const auto bp = blockParams + n * BlockParams::N_VELOCITY_BLOCK_PARAMS;
170 for (uint k = 0; k < WID; ++k) {
171 for (uint j = 0; j < WID; ++j) {
172 for (uint i = 0; i < WID; ++i) {
173 const Real vx = bp[BlockParams::VXCRD] + (i + 0.5) * bp[BlockParams::DVX];
174 const Real vy = bp[BlockParams::VYCRD] + (j + 0.5) * bp[BlockParams::DVY];
175 const Real vz = bp[BlockParams::VZCRD] + (k + 0.5) * bp[BlockParams::DVZ];
176 vlims[0] = std::min(vlims[0], vx);
177 vlims[1] = std::min(vlims[1], vy);
178 vlims[2] = std::min(vlims[2], vz);
179 vlims[3] = std::max(vlims[3], vx);
180 vlims[4] = std::max(vlims[4], vy);
181 vlims[5] = std::max(vlims[5], vz);
182 }
183 }
184 }
185 } // over blocks
186
187 assert(isPow2(static_cast<size_t>(std::abs(zoom))));
188 float ratio = (zoom > 0) ? static_cast<float>(std::abs(zoom)) : 1.0 / static_cast<float>(std::abs(zoom));
189 assert(ratio > 0);
190
191 const Real target_dvx = dvx * ratio;
192 const Real target_dvy = dvy * ratio;
193 const Real target_dvz = dvz * ratio;
194 std::size_t nx = std::ceil((vlims[3] - vlims[0]) / target_dvx);
195 std::size_t ny = std::ceil((vlims[4] - vlims[1]) / target_dvy);
196 std::size_t nz = std::ceil((vlims[5] - vlims[2]) / target_dvz);
197 // printf("VDF min box is %zu , %zu %zu \n ", nx, ny, nz);
198
199 std::unordered_set<vmesh::GlobalID> ignore_list;
200 for (std::size_t k = 0; k < nz; ++k) {
201 for (std::size_t j = 0; j < ny; ++j) {
202 for (std::size_t i = 0; i < nx; ++i) {
203 const Real vx = vlims[0] + (i + 0.5) * dvx;
204 const Real vy = vlims[1] + (j + 0.5) * dvy;
205 const Real vz = vlims[2] + (k + 0.5) * dvz;
206 const std::array<Real,3>coords={vx,vy,vz};
207 const auto gid=sc->get_velocity_block(popID, &coords[0]);
208 ignore_list.insert(gid);
209 }
210 }
211 }
212
213 Realf* data = blockContainer->getData();
214 std::vector<Realf> vspace(nx * ny * nz, Realf(0));
215 for (std::size_t n = 0; n < total_blocks; ++n) {
216 const auto bp = blockParams + n * BlockParams::N_VELOCITY_BLOCK_PARAMS;
217 const Realf* vdf_data = &data[n * WID3];
218 const vmesh::GlobalID gid = sc->get_velocity_block_global_id(n, popID);
219 (void)ignore_list.erase(gid);
220 for (uint k = 0; k < WID; ++k) {
221 for (uint j = 0; j < WID; ++j) {
222 for (uint i = 0; i < WID; ++i) {
223 const Real vx = bp[BlockParams::VXCRD] + (i + 0.5) * bp[BlockParams::DVX];
224 const Real vy = bp[BlockParams::VYCRD] + (j + 0.5) * bp[BlockParams::DVY];
225 const Real vz = bp[BlockParams::VZCRD] + (k + 0.5) * bp[BlockParams::DVZ];
226 const size_t bbox_i = std::min(static_cast<size_t>(std::floor((vx - vlims[0]) / target_dvx)), nx - 1);
227 const size_t bbox_j = std::min(static_cast<size_t>(std::floor((vy - vlims[1]) / target_dvy)), ny - 1);
228 const size_t bbox_k = std::min(static_cast<size_t>(std::floor((vz - vlims[2]) / target_dvz)), nz - 1);
229
230 // Averaging
231 if (ratio >= 1.0) {
232 const size_t index = bbox_i * (ny * nz) + bbox_j * nz + bbox_k;
233 vspace.at(index) += vdf_data[cellIndex(i, j, k)] / ratio;
234 } else {
235 // Same value in all bins
236 int max_off = 1 / ratio;
237 for (int off_z = 0; off_z <= max_off; off_z++) {
238 for (int off_y = 0; off_y <= max_off; off_y++) {
239 for (int off_x = 0; off_x <= max_off; off_x++) {
240 const size_t index = (bbox_i + off_x) * (ny * nz) + (bbox_j + off_y) * nz + (bbox_k + off_z);
241 if (index < vspace.size()) {
242 vspace.at(index) = vdf_data[cellIndex(i, j, k)];
243 }
244 }
245 }
246 }
247 }
248 }
249 }
250 }
251 } // over blocks
252
253 std::vector<vmesh::GlobalID >ignored;
254 ignored.reserve(ignore_list.size());
255 for (auto it = ignore_list.begin(); it != ignore_list.end(); ) {
256 ignored.push_back(std::move(ignore_list.extract(it++).value()));
257 }
258
259 return ASTERIX::OrderedVDF{.blocks_to_ignore=ignored,.sparse_vdf_bytes=total_blocks*WID*WID*WID*sizeof(Realf),.vdf_vals = vspace, .v_limits = vlims, .shape = {nx, ny, nz}};
260}
261
262void ASTERIX::overwrite_cellids_vdfs(const std::span<const CellID> cids, uint popID,
263 dccrg::Dccrg<spatial_cell::SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid,
264 const std::vector<std::array<Real, 3>>& vcoords,
265 const std::vector<Realf>& vspace_union,
266 const std::unordered_map<vmesh::LocalID, std::size_t>& map_exists_id) {
267 const std::size_t nrows = vcoords.size();
268 const std::size_t ncols = cids.size();
269 // This will be used further down for indexing into the vspace_union
270 auto index_2d = [nrows, ncols](std::size_t row, std::size_t col) -> std::size_t { return row * ncols + col; };
271
272 for (std::size_t cc = 0; cc < cids.size(); ++cc) {
273 const auto& cid = cids[cc];
274 spatial_cell::SpatialCell* sc = mpiGrid[cid];
275 auto blockContainer = sc->get_velocity_blocks(popID);
276 const size_t total_blocks = blockContainer->size();
277 Realf* data = blockContainer->getData();
278 const Real* blockParams = sc->get_block_parameters(popID);
279 for (std::size_t n = 0; n < total_blocks; ++n) {
280 const auto bp = blockParams + n * BlockParams::N_VELOCITY_BLOCK_PARAMS;
281 const vmesh::GlobalID gid = sc->get_velocity_block_global_id(n, popID);
282 const auto it = map_exists_id.find(gid);
283 const bool exists = it != map_exists_id.end();
284 if (!exists){
285 std::cerr<<"This should not happen!"<<std::endl;
286 abort();
287 }
288 assert(exists && "Someone has a buuuug!");
289 const auto index = it->second;
290 Realf* vdf_data = &data[n * WID3];
291 size_t cnt = 0;
292 for (uint k = 0; k < WID; ++k) {
293 for (uint j = 0; j < WID; ++j) {
294 for (uint i = 0; i < WID; ++i) {
295 const std::size_t index = it->second;
296 vdf_data[cellIndex(i, j, k)] = vspace_union[index_2d(index + cnt, cc)];
297 cnt++;
298 }
299 }
300 }
301 }
302 }
303 return;
304}
305
306
307void ASTERIX::dump_vdf_to_binary_file(const char* filename, CellID cid,
308 dccrg::Dccrg<spatial_cell::SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid) {
309
310 spatial_cell::SpatialCell* sc = mpiGrid[cid];
311 assert(sc && "Invalid Pointer to Spatial Cell !");
313 vdf.save_to_file(filename);
314}
315
316// Taken from DataReducers
318 Real rho;
319 Real V0[3];
320 Real b_par[3];
321 Real b_perp1[3];
322 Real b_perp2[3];
323 Real T_par;
324 Real T_perp;
325 Real epsilon;
326 // calculate here rho, v, T
327 epsilon = 0.0;
328
329 // get rho and bulk speed
330 rho = cell->get_population(popID).RHO;
331 V0[0] = cell->get_population(popID).V[0];
332 V0[1] = cell->get_population(popID).V[1];
333 V0[2] = cell->get_population(popID).V[2];
334
335 // calculate temperature from the pressure tensor
336 Real PTensor[3] = {};
337
338 // parallel unit vector (B)
342 Real norm_par = sqrt(BX * BX + BY * BY + BZ * BZ);
343 b_par[0] = BX / norm_par;
344 b_par[1] = BY / norm_par;
345 b_par[2] = BZ / norm_par;
346
347 // perpendicular unit vector 1 (bulk velocity perpendicular to b)
348 Real BV0 = sqrt(b_par[0] * V0[0] + b_par[1] * V0[1] + b_par[2] * V0[2]);
349 b_perp1[0] = V0[0] - BV0 * b_par[0];
350 b_perp1[1] = V0[1] - BV0 * b_par[1];
351 b_perp1[2] = V0[2] - BV0 * b_par[2];
352 Real norm_perp1 = sqrt(b_perp1[0] * b_perp1[0] + b_perp1[1] * b_perp1[1] + b_perp1[2] * b_perp1[2]);
353 if (!(norm_perp1 > 0.0)) {
354 // if V0 is aligned with b, take arbitrary perpendicular vector
355 b_perp1[0] = +b_par[1] + b_par[2];
356 b_perp1[1] = +b_par[2] - b_par[0];
357 b_perp1[2] = -b_par[0] - b_par[1];
358 norm_perp1 = sqrt(b_perp1[0] * b_perp1[0] + b_perp1[1] * b_perp1[1] + b_perp1[2] * b_perp1[2]);
359 }
360 b_perp1[0] /= norm_perp1;
361 b_perp1[1] /= norm_perp1;
362 b_perp1[2] /= norm_perp1;
363
364 // perpendicular unit vector 2 (b_par x b_perp1)
365 b_perp2[0] = b_par[1] * b_perp1[2] - b_par[2] * b_perp1[1];
366 b_perp2[1] = b_par[2] * b_perp1[0] - b_par[0] * b_perp1[2];
367 b_perp2[2] = b_par[0] * b_perp1[1] - b_par[1] * b_perp1[0];
368 Real norm_perp2 = sqrt(b_perp2[0] * b_perp2[0] + b_perp2[1] * b_perp2[1] + b_perp2[2] * b_perp2[2]);
369 b_perp2[0] /= norm_perp2;
370 b_perp2[1] /= norm_perp2;
371 b_perp2[2] /= norm_perp2;
372
373 // below calculation is modified from VariablePTensorDiagonal
374 constexpr Real HALF = 0.5;
375#pragma omp parallel
376 {
377 Real thread_nvxvx_sum = 0.0;
378 Real thread_nvyvy_sum = 0.0;
379 Real thread_nvzvz_sum = 0.0;
380
381 const Real* parameters = cell->get_block_parameters(popID);
382 const Realf* block_data = cell->get_data(popID);
383
384#pragma omp for
385 for (vmesh::LocalID n = 0; n < cell->get_number_of_velocity_blocks(popID); n++) {
386 for (uint k = 0; k < WID; ++k)
387 for (uint j = 0; j < WID; ++j)
388 for (uint i = 0; i < WID; ++i) {
395 const Real DV3 = parameters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVX] *
398
399 const Real V_par = (VX - V0[0]) * b_par[0] + (VY - V0[1]) * b_par[1] + (VZ - V0[2]) * b_par[2];
400 const Real V_perp1 =
401 (VX - V0[0]) * b_perp1[0] + (VY - V0[1]) * b_perp1[1] + (VZ - V0[2]) * b_perp1[2];
402 const Real V_perp2 =
403 (VX - V0[0]) * b_perp2[0] + (VY - V0[1]) * b_perp2[1] + (VZ - V0[2]) * b_perp2[2];
404
405 thread_nvxvx_sum += block_data[n * SIZE_VELBLOCK + cellIndex(i, j, k)] * V_par * V_par * DV3;
406 thread_nvyvy_sum += block_data[n * SIZE_VELBLOCK + cellIndex(i, j, k)] * V_perp1 * V_perp1 * DV3;
407 thread_nvzvz_sum += block_data[n * SIZE_VELBLOCK + cellIndex(i, j, k)] * V_perp2 * V_perp2 * DV3;
408 }
409 }
410 thread_nvxvx_sum *= getObjectWrapper().particleSpecies[popID].mass;
411 thread_nvyvy_sum *= getObjectWrapper().particleSpecies[popID].mass;
412 thread_nvzvz_sum *= getObjectWrapper().particleSpecies[popID].mass;
413
414 // Accumulate contributions coming from this velocity block to the
415 // spatial cell velocity moments. If multithreading / OpenMP is used,
416 // these updates need to be atomic:
417#pragma omp critical
418 {
419 PTensor[0] += thread_nvxvx_sum;
420 PTensor[1] += thread_nvyvy_sum;
421 PTensor[2] += thread_nvzvz_sum;
422 }
423 }
424 T_par = (PTensor[0]) / (rho * physicalconstants::K_B);
425 T_perp = (PTensor[1] + PTensor[2]) / (2.0 * rho * physicalconstants::K_B);
426
427 // thermal speed in parallel direction
428 const Real V_par_th_sq = 2.0 * physicalconstants::K_B * T_par / getObjectWrapper().particleSpecies[popID].mass;
429
430#pragma omp parallel
431 {
432 Real thread_epsilon_sum = 0.0;
433
434 const Real* parameters = cell->get_block_parameters(popID);
435 const Realf* block_data = cell->get_data(popID);
436
437#pragma omp for
438 for (vmesh::LocalID n = 0; n < cell->get_number_of_velocity_blocks(popID); n++) {
439 for (uint k = 0; k < WID; ++k)
440 for (uint j = 0; j < WID; ++j)
441 for (uint i = 0; i < WID; ++i) {
448 const Real DV3 = parameters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVX] *
451
452 const Real V_par = (VX - V0[0]) * b_par[0] + (VY - V0[1]) * b_par[1] + (VZ - V0[2]) * b_par[2];
453 const Real V_perp1 =
454 (VX - V0[0]) * b_perp1[0] + (VY - V0[1]) * b_perp1[1] + (VZ - V0[2]) * b_perp1[2];
455 const Real V_perp2 =
456 (VX - V0[0]) * b_perp2[0] + (VY - V0[1]) * b_perp2[1] + (VZ - V0[2]) * b_perp2[2];
457
458 const Real bimaxwellian =
459 rho / sqrt(M_PI * M_PI * M_PI * V_par_th_sq * V_par_th_sq * V_par_th_sq) * (T_par / T_perp) *
460 exp(-(V_par * V_par) / V_par_th_sq -
461 (V_perp1 * V_perp1 + V_perp2 * V_perp2) / (V_par_th_sq * T_perp / T_par));
462
463 thread_epsilon_sum +=
464 (abs(block_data[n * SIZE_VELBLOCK + cellIndex(i, j, k)] - bimaxwellian) - bimaxwellian) * DV3;
465 }
466 }
467
468 // Accumulate contributions coming from this velocity block to the
469 // spatial cell velocity moments. If multithreading / OpenMP is used,
470 // these updates need to be atomic:
471#pragma omp critical
472 { epsilon += thread_epsilon_sum; }
473 }
474 epsilon *= HALF / rho;
475 epsilon += HALF;
476 return epsilon;
477}
for i
Definition Dispersion.m:24
sqrt(1.0+vA *vA/(c *c))) % Ion-acoustic wave cS
vmesh::LocalID get_number_of_velocity_blocks(const uint popID) const
Real * get_block_parameters(const uint popID)
vmesh::GlobalID get_velocity_block_global_id(const vmesh::LocalID &blockLID, const uint popID) const
vmesh::VelocityBlockContainer * get_velocity_blocks(const size_t &popID)
Realf * get_data(const uint popID)
Population & get_population(const uint popID)
std::array< Real, CellParams::N_SPATIAL_CELL_PARAMS > parameters
vmesh::GlobalID get_velocity_block(const uint popID, vmesh::GlobalID blockIndices[3]) const
ARCH_HOSTDEV vmesh::LocalID size() const
const Real * getMeshMaxLimits() const
const Real * getMeshMinLimits() const
#define WID
Definition common.h:514
const int WID3
Definition common.h:517
const int SIZE_VELBLOCK
Definition common.h:526
float Real
Definition definitions.h:41
uint64_t CellID
Definition definitions.h:54
float Realf
Definition definitions.h:33
const Real HALF
Definition fs_common.h:49
const Real VY
const Real VZ
const int j
const Real VX
const int k
const Realf dvz
ObjectWrapper & getObjectWrapper()
Definition main.cpp:33
#define index(i, j, k)
auto overwrite_pop_spatial_cell_vdf(spatial_cell::SpatialCell *sc, uint popID, const std::vector< Realf > &new_vspace) -> void
auto extract_pop_vdf_from_spatial_cell(spatial_cell::SpatialCell *sc, uint popID) -> UnorderedVDF
auto overwrite_cellids_vdfs(const std::span< const CellID > cids, uint popID, dccrg::Dccrg< spatial_cell::SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const std::vector< std::array< Real, 3 > > &vcoords, const std::vector< Realf > &vspace_union, const std::unordered_map< vmesh::LocalID, std::size_t > &map_exists_id) -> void
auto extract_pop_vdf_from_spatial_cell_ordered_min_bbox_zoomed(spatial_cell::SpatialCell *sc, uint popID, int zoom) -> OrderedVDF
auto dump_vdf_to_binary_file(const char *filename, CellID cid) -> void
constexpr auto isPow2(std::unsigned_integral auto val) -> bool
Real get_Non_MaxWellianity(const spatial_cell::SpatialCell *cell, uint popID)
@ N_VELOCITY_BLOCK_PARAMS
Definition common.h:115
const Real K_B
Definition common.h:571
uint32_t LocalID
Definition definitions.h:60
uint32_t GlobalID
Definition definitions.h:59
std::vector< species::Species > particleSpecies
vmesh::VelocityMesh * vmesh
static ARCH_HOSTDEV VecSimple< T > abs(const VecSimple< T > &l)