Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
readfields.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This file is part of Vlasiator.
4 * Copyright 2010-2016 Finnish Meteorological Institute
5 *
6 * For details of usage, see the COPYING file and read the "Rules of the Road"
7 * at http://www.physics.helsinki.fi/vlasiator/
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23
24#include "vlsv_reader.h"
25#include "vlsvreaderinterface.h"
26#include "field.h"
27#include <fsgrid.hpp>
28#include <algorithm>
29#include <vector>
30#include <string>
31#include <set>
32#include <cstring>
33
34#define DEBUG
35
36extern std::string B_field_name;
37extern std::string E_field_name;
38extern std::string V_field_name;
39extern bool do_divide_by_rho;
40
41/* Read the cellIDs into an array */
42std::vector<uint64_t> readCellIds(vlsvinterface::Reader& r);
43
44template <class Reader>
45static void detect_field_names(Reader& r) {
46
47#ifdef DEBUG
48 std::cerr << "Checking for volume-averaged fields... " << std::endl;
49#endif
50 std::list<std::string> variableNames;
51 std::string gridname("SpatialGrid");
52
53 r.getVariableNames(gridname,variableNames);
54 if (find(variableNames.begin(), variableNames.end(), std::string("fg_b"))!=variableNames.end()) {
55 #ifdef DEBUG
56 #endif
57 B_field_name = "fg_b";
58 } else if (find(variableNames.begin(), variableNames.end(), std::string("B"))!=variableNames.end()) {
59 #ifdef DEBUG
60 #endif
61 B_field_name = "B";
62 } else if (find(variableNames.begin(), variableNames.end(), std::string("fg_b_background")) != variableNames.end() &&
63 find(variableNames.begin(), variableNames.end(), std::string("fg_b_perturbed")) != variableNames.end()) {
64 B_field_name = "fg_b_background";
65 } else if (find(variableNames.begin(), variableNames.end(), std::string("B_vol"))!=variableNames.end()) {
66 #ifdef DEBUG
67 #endif
68 B_field_name = "B_vol";
69 } else if (find(variableNames.begin(), variableNames.end(), std::string("vg_b_vol"))!=variableNames.end()) {
70 #ifdef DEBUG
71 #endif
72 B_field_name = "vg_b_vol";
73 } else if (find(variableNames.begin(), variableNames.end(), std::string("vg_b_background_vol")) != variableNames.end() &&
74 find(variableNames.begin(), variableNames.end(), std::string("vg_b_perturbed_vol")) != variableNames.end()) {
75 B_field_name = "vg_b_background_vol";
76 } else {
77 std::cerr << "No B-fields found! Strange file format?" << std::endl;
78 exit(1);
79 }
80
81 if (find(variableNames.begin(), variableNames.end(), std::string("fg_e"))!=variableNames.end()) {
82 #ifdef DEBUG
83 #endif
84 E_field_name = "fg_e";
85 } else if (find(variableNames.begin(), variableNames.end(), std::string("E"))!=variableNames.end()) {
86 #ifdef DEBUG
87 #endif
88 E_field_name = "E";
89 } else if (find(variableNames.begin(), variableNames.end(), std::string("E_vol"))!=variableNames.end()) {
90 #ifdef DEBUG
91 #endif
92 E_field_name = "E_vol";
93 } else if (find(variableNames.begin(), variableNames.end(), std::string("vg_e_vol"))!=variableNames.end()) {
94 #ifdef DEBUG
95 #endif
96 E_field_name = "vg_e_vol";
97 } else {
98 std::cerr << "No E-fields found! Strange file format?" << std::endl;
99 exit(1);
100 }
101
102 std::cerr << B_field_name << std::endl;
103 std::cerr << E_field_name << std::endl;
104}
105
106/* Read the "raw" field data in file order */
107template <class Reader>
108std::vector<double> readFieldData(Reader& r, std::string& name, unsigned int numcomponents) {
109
110 uint64_t arraySize=0;
111 uint64_t vectorSize=0;
112 uint64_t byteSize=0;
113 vlsv::datatype::type dataType;
114 std::list<std::pair<std::string,std::string> > attribs;
115 attribs.push_back(std::pair<std::string,std::string>("name",name));
116 if( r.getArrayInfo("VARIABLE",attribs, arraySize,vectorSize,dataType,byteSize) == false ) {
117 std::cerr << "getArrayInfo returned false when trying to read VARIABLE \""
118 << name << "\"." << std::endl;
119 exit(1);
120 }
121
122 if(byteSize == 8) {
123 /* Allocate memory for the data */
124 std::vector<double> buffer(arraySize*vectorSize);
125
126 if( r.readArray("VARIABLE",attribs,0,arraySize,(char*) buffer.data()) == false) {
127 std::cerr << "readArray failed when trying to read VARIABLE \"" << name << "\"." << std::endl;
128 exit(1);
129 }
130
131 return buffer;
132 } else if(byteSize == 4) {
133 /* Allocate memory for the data */
134 std::vector<double> buffer;
135 std::vector<float> fbuffer(arraySize*vectorSize);
136
137 if( r.readArray("VARIABLE",attribs,0,arraySize,(char*) fbuffer.data()) == false) {
138 std::cerr << "readArray faied when trying to read VARIABLE \"" << name << "\"." << std::endl;
139 exit(1);
140 }
141
142 for(float value : fbuffer) {
143 buffer.push_back((double)value);
144 }
145
146 return buffer;
147 } else {
148 std::cerr << "Datatype of VARIABLE \"" << name << "\" entries is not double." << std::endl;
149 exit(1);
150 }
151
152 return {0};
153}
154
155/* Read the "raw" FsGrid data in file order */
156template <class Reader>
157std::vector<double> readFsGridData(Reader& r, std::string& name, unsigned int numcomponents) {
158
159 uint64_t arraySize;
160 uint64_t vectorSize;
161 vlsv::datatype::type dataType;
162 uint64_t byteSize;
163 std::list<std::pair<std::string,std::string> > attribs;
164
165 attribs.push_back(std::make_pair("name",name));
166 attribs.push_back(std::make_pair("mesh","fsgrid"));
167
168 if (r.getArrayInfo("VARIABLE",attribs,arraySize,vectorSize,dataType,byteSize) == false) {
169 std::cerr << "getArrayInfo returned false when trying to read VARIABLE \""
170 << name << "\"." << std::endl;
171 exit(1);
172 }
173
174 if(dataType != vlsv::datatype::type::FLOAT || byteSize != 8 || vectorSize != numcomponents) {
175 std::cerr << "Datatype of VARIABLE \"" << name << "\" entries is not double." << std::endl;
176 exit(1);
177 }
178
179 int numWritingRanks=0;
180 if(r.readParameter("numWritingRanks",numWritingRanks) == false) {
181 std::cerr << "FSGrid writing rank number not found";
182 exit(1);
183 }
184
185 // Are we restarting from the same number of tasks, or a different number?
186 std::array<uint, 3> size;
187 r.readParameter("xcells_ini",size[0]);
188 r.readParameter("ycells_ini",size[1]);
189 r.readParameter("zcells_ini",size[2]);
190
191
192 // Determine our tasks storage size
193 size_t storageSize = size[0]*size[1]*size[2];
194 std::vector<Real> buffer(storageSize*numcomponents);
195 std::vector<Real> readBuffer(storageSize*numcomponents);
196
197 if(r.readArray("VARIABLE",attribs,0,arraySize,(char*) readBuffer.data()) == false) {
198 std::cerr << "readArray faied when trying to read VARIABLE \"" << name << "\"." << std::endl;
199 exit(1);
200 }
201
202
203 // More difficult case: different number of tasks.
204 // In this case, our own fsgrid domain overlaps (potentially many) domains in the file.
205 // We read the whole source rank into a temporary buffer, and transfer the overlapping
206 // part.
207 //
208 // +------------+----------------+
209 // | | |
210 // | . . . . . . . . . . . . |
211 // | .<----->|<----------->. |
212 // | .<----->|<----------->. |
213 // | .<----->|<----------->. |
214 // +----+-------+-------------+--|
215 // | .<----->|<----------->. |
216 // | .<----->|<----------->. |
217 // | .<----->|<----------->. |
218 // | . . . . . . . . . . . . |
219 // | | |
220 // +------------+----------------+
221
222 const std::array<int, 3> fileDecomposition = fsgrid::computeDomainDecomposition(size, numWritingRanks);
223
224 // Iterate through tasks and find their overlap with our domain.
225 size_t fileOffset = 0;
226 for(int task = 0; task < numWritingRanks; task++) {
227 std::array<int,3> overlapStart,overlapEnd,overlapSize;
228
229 overlapStart[0] = fsgrid::calcLocalStart(size[0], fileDecomposition[0], task/fileDecomposition[2]/fileDecomposition[1]);
230 overlapStart[1] = fsgrid::calcLocalStart(size[1], fileDecomposition[1], (task/fileDecomposition[2])%fileDecomposition[1]);
231 overlapStart[2] = fsgrid::calcLocalStart(size[2], fileDecomposition[2], task%fileDecomposition[2]);
232
233 overlapSize[0] = fsgrid::calcLocalSize(size[0], fileDecomposition[0], task/fileDecomposition[2]/fileDecomposition[1]);
234 overlapSize[1] = fsgrid::calcLocalSize(size[1], fileDecomposition[1], (task/fileDecomposition[2])%fileDecomposition[1]);
235 overlapSize[2] = fsgrid::calcLocalSize(size[2], fileDecomposition[2], task%fileDecomposition[2]);
236
237 overlapEnd[0] = overlapStart[0]+overlapSize[0];
238 overlapEnd[1] = overlapStart[1]+overlapSize[1];
239 overlapEnd[2] = overlapStart[2]+overlapSize[2];
240
241 // r.startMultiread("VARIABLE", attribs);
242 // // Read every source rank that we have an overlap with.
243 // if(r.addMultireadUnit((char*)readBuffer.data(), overlapSize[0]*overlapSize[1]*overlapSize[2])==false) {
244 // std::cerr << "ERROR: Failed to read fsgrid variable " << name << std::endl;
245 // exit(1);
246 // }
247 // r.endMultiread(fileOffset);
248
249 // Copy continuous stripes in x direction.
250 for(int z=overlapStart[2]; z<overlapEnd[2]; z++) {
251 for(int y=overlapStart[1]; y<overlapEnd[1]; y++) {
252 for(int x=overlapStart[0]; x<overlapEnd[0]; x++) {
253 int index = (z - overlapStart[2]) * overlapSize[0]*overlapSize[1]
254 + (y - overlapStart[1]) * overlapSize[0]
255 + (x - overlapStart[0]);
256
257 std::memcpy(&buffer[(size[0]*size[1]*z + size[0]*y + x)*numcomponents], &readBuffer[(fileOffset + index)*numcomponents], numcomponents*sizeof(Real));
258 }
259 }
260 }
261 fileOffset += overlapSize[0] * overlapSize[1] * overlapSize[2];
262 }
263 return buffer;
264}
265
266/* Read the next logical input file. Depending on sign of dt,
267 * this may be a numerically larger or smaller file.
268 * Return value: true if a new file was read, otherwise false.
269 * TODO: might need some DRY
270 */
271template <class Reader>
272bool readNextTimestep(const std::string& filename_pattern, double t, int step, Field& E0, Field& E1,
273 Field& B0, Field& B1, Field& V, bool doV, int& input_file_counter) {
274
275 char filename_buffer[256];
276 bool retval = false;
277
278 while(t < E0.time || t>= E1.time) {
279 input_file_counter += step;
280
281 E0=E1;
282 B0=B1;
283 snprintf(filename_buffer,256,filename_pattern.c_str(),input_file_counter);
284
285 /* Open next file */
286 Reader r;
287 r.open(filename_buffer);
288 double t;
289 if(!r.readParameter("time",t)) {
290 if(!r.readParameter("t",t)) {
291 std::cerr << "Time parameter in file " << filename_buffer << " is neither 't' nor 'time'. Bad file format?"
292 << std::endl;
293 exit(1);
294 }
295 }
296
297 E1.time = t;
298 B1.time = t;
299
300 uint64_t cells[3];
301 r.readParameter("xcells_ini",cells[0]);
302 r.readParameter("ycells_ini",cells[1]);
303 r.readParameter("zcells_ini",cells[2]);
304
305 /* Read CellIDs and Field data */
306 std::vector<uint64_t> cellIds = readCellIds(r);
307 std::string name(B_field_name);
308 std::vector<double> Bbuffer;
309 std::vector<double> Ebuffer;
310 if (B_field_name == "fg_b" || B_field_name == "fg_b_background") {
311 Bbuffer = readFsGridData(r,name,3u);
312 if (B_field_name == "fg_b_background") {
313 name = "fg_b_perturbed";
314 std::vector<double> perturbedBbuffer = readFsGridData(r,name,3u);
315 for (unsigned int i = 0; i < Bbuffer.size(); ++i) {
316 Bbuffer[i] += perturbedBbuffer[i];
317 }
318 }
319 name = E_field_name;
320 Ebuffer = readFsGridData(r,name,3u);
321 for (unsigned int i = 0; i < cellIds.size(); ++i) {
322 cellIds[i] = i+1;
323 }
324 } else {
325 Bbuffer = readFieldData(r,name,3u);
326 if (B_field_name == "vg_b_background_vol") {
327 name = "vg_b_perturbed_vol";
328 std::vector<double> perturbedBbuffer = readFieldData(r,name,3u);
329 for (unsigned int i = 0; i < Bbuffer.size(); ++i) {
330 Bbuffer[i] += perturbedBbuffer[i];
331 }
332 }
333 name = E_field_name;
334 Ebuffer = readFieldData(r,name,3u);
335 }
336 std::vector<double> Vbuffer;
337 if(doV) {
339 std::vector<double> rho_v_buffer = readFieldData(r,name,3u);
342 std::vector<double> rho_buffer = readFieldData(r,name,1u);
343 for(unsigned int i=0; i<rho_buffer.size(); i++) {
344 Vbuffer.push_back(rho_v_buffer[3*i] / rho_buffer[i]);
345 Vbuffer.push_back(rho_v_buffer[3*i+1] / rho_buffer[i]);
346 Vbuffer.push_back(rho_v_buffer[3*i+2] / rho_buffer[i]);
347 }
348 }
349 }
350
351 /* Assign them, without sanity checking */
352 /* TODO: Is this actually a good idea? */
353 for(uint i=0; i< cellIds.size(); i++) {
354 uint64_t c = cellIds[i];
355 int64_t x = c % cells[0];
356 int64_t y = (c /cells[0]) % cells[1];
357 int64_t z = c /(cells[0]*cells[1]);
358
359 double* Etgt = E1.getCellRef(x,y,z);
360 double* Btgt = B1.getCellRef(x,y,z);
361 Etgt[0] = Ebuffer[3*i];
362 Etgt[1] = Ebuffer[3*i+1];
363 Etgt[2] = Ebuffer[3*i+2];
364 Btgt[0] = Bbuffer[3*i];
365 Btgt[1] = Bbuffer[3*i+1];
366 Btgt[2] = Bbuffer[3*i+2];
367
368 if(doV) {
369 double* Vtgt = V.getCellRef(x,y,z);
370 Vtgt[0] = Vbuffer[3*i];
371 Vtgt[1] = Vbuffer[3*i+1];
372 Vtgt[2] = Vbuffer[3*i+2];
373 }
374 }
375
376 r.close();
377 retval = true;
378 }
379
380 return retval;
381}
382
383/* Non-template version, autodetecting the reader type */
384static bool readNextTimestep(const std::string& filename_pattern, double t, int step, Field& E0, Field& E1,
385 Field& B0, Field& B1, Field& V, bool doV, int& input_file_counter) {
386
387 char filename_buffer[256];
388 snprintf(filename_buffer,256,filename_pattern.c_str(),input_file_counter);
389
390 return readNextTimestep<vlsvinterface::Reader>(filename_pattern, t,
391 step,E0,E1,B0,B1,V,doV,input_file_counter);
392}
393
394/* Read E- and B-Fields as well as velocity field from a vlsv file */
395template <class Reader>
396void readfields(const char* filename, Field& E, Field& B, Field& V, bool doV=true) {
397 Reader r;
398
399#ifdef DEBUG
400 std::cerr << "Opening " << filename << "...";
401#endif
402 r.open(filename);
403#ifdef DEBUG
404 std::cerr <<"ok." << std::endl;
405#endif
406
407 /* Check whethere we got volume-centered fields */
409
410 /* Read the MESH, yielding the CellIDs */
411 std::vector<uint64_t> cellIds = readCellIds(r);
412
413 /* Also read the raw field data */
414 std::vector<double> Bbuffer;
415 std::vector<double> Ebuffer;
416 std::string name = B_field_name;
417 if (B_field_name == "fg_b" || B_field_name == "fg_b_background") {
418 Bbuffer = readFsGridData(r,name,3u);
419 if (B_field_name == "fg_b_background") {
420 name = "fg_b_perturbed";
421 std::vector<double> perturbedBbuffer = readFsGridData(r,name,3u);
422 for (unsigned int i = 0; i < Bbuffer.size(); ++i) {
423 Bbuffer[i] += perturbedBbuffer[i];
424 }
425 }
426 name = E_field_name;
427 Ebuffer = readFsGridData(r,name,3u);
428 for (unsigned int i = 0; i < cellIds.size(); ++i) {
429 cellIds[i] = i+1;
430 }
431 } else {
432 Bbuffer = readFieldData(r,name,3u);
433 if (B_field_name == "vg_b_background_vol") {
434 name = "vg_b_perturbed_vol";
435 std::vector<double> perturbedBbuffer = readFieldData(r,name,3u);
436 for (unsigned int i = 0; i < Bbuffer.size(); ++i) {
437 Bbuffer[i] += perturbedBbuffer[i];
438 }
439 }
440 name = E_field_name;
441 Ebuffer = readFieldData(r,name,3u);
442 }
443 std::vector<double> rho_v_buffer,rho_buffer;
444 if(doV) {
446 rho_v_buffer = readFieldData(r,name,3u);
449 rho_buffer = readFieldData(r,name,1u);
450 }
451 }
452
453 /* Coordinate Boundaries */
454 double min[3], max[3], time;
455 uint64_t cells[3];
456 r.readParameter("xmin",min[0]);
457 r.readParameter("ymin",min[1]);
458 r.readParameter("zmin",min[2]);
459 r.readParameter("xmax",max[0]);
460 r.readParameter("ymax",max[1]);
461 r.readParameter("zmax",max[2]);
462 r.readParameter("xcells_ini",cells[0]);
463 r.readParameter("ycells_ini",cells[1]);
464 r.readParameter("zcells_ini",cells[2]);
465 if(!r.readParameter("t",time)) {
466 r.readParameter("time",time);
467 }
468
469 //std::cerr << "Grid is " << cells[0] << " x " << cells[1] << " x " << cells[2] << " Cells, " << std::endl
470 // << " with dx = " << ((max[0]-min[0])/cells[0]) << ", dy = " << ((max[1]-min[1])/cells[1])
471 // << ", dz = " << ((max[2]-min[2])/cells[2]) << "." << std::endl;
472
473 /* Allocate space for the actual field structures */
474 E.data.resize(4*cells[0]*cells[1]*cells[2]);
475 B.data.resize(4*cells[0]*cells[1]*cells[2]);
476 if(doV) {
477 V.data.resize(4*cells[0]*cells[1]*cells[2]);
478 }
479
480 /* Sanity-check stored data sizes */
481 if(3*cellIds.size() != Bbuffer.size()) {
482 std::cerr << "3 * cellIDs.size (" << cellIds.size() << ") != Bbuffer.size (" << Bbuffer.size() << ")!"
483 << std::endl;
484 exit(1);
485 }
486 if(3*cellIds.size() != Ebuffer.size()) {
487 std::cerr << "3 * cellIDs.size (" << cellIds.size() << ") != Ebuffer.size (" << Ebuffer.size() << ")!"
488 << std::endl;
489 exit(1);
490 }
491 if(doV) {
492 if(3*cellIds.size() != rho_v_buffer.size()) {
493 std::cerr << "3 * cellIDs.size (" << cellIds.size() << ") != rho_v_buffer.size (" << Ebuffer.size() << ")!"
494 << std::endl;
495 exit(1);
496 }
497 if(ParticleParameters::divide_rhov_by_rho && cellIds.size() != rho_buffer.size()) {
498 std::cerr << "cellIDs.size (" << cellIds.size() << ") != rho_buffer.size (" << Ebuffer.size() << ")!"
499 << std::endl;
500 exit(1);
501 }
502 }
503
504 // Make sure the target fields have boundary data.
505 if(E.dimension[0] == nullptr || E.dimension[1] == nullptr || E.dimension[2] == nullptr) {
506 std::cerr << "Warning: Field boundary pointers uninitialized!" << std::endl;
507 E.dimension[0] = B.dimension[0] = V.dimension[0] = createBoundary<OpenBoundary>(0);
508 E.dimension[1] = B.dimension[1] = V.dimension[1] = createBoundary<OpenBoundary>(1);
509 E.dimension[2] = B.dimension[2] = V.dimension[2] = createBoundary<OpenBoundary>(2);
510 }
511 /* Set field sizes */
512 for(int i=0; i<3;i++) {
513 /* Volume-centered values -> shift by half a cell in all directions*/
514 E.dx[i] = B.dx[i] = V.dx[i] = (max[i]-min[i])/cells[i];
515 double shift = E.dx[i]/2;
516 E.dimension[i]->min = B.dimension[i]->min = V.dimension[i]->min = min[i]+shift;
517 E.dimension[i]->max = B.dimension[i]->max = V.dimension[i]->max = max[i]+shift;
518 E.dimension[i]->cells = B.dimension[i]->cells = V.dimension[i]->cells = cells[i];
519 }
520 E.time = B.time = V.time = time;
521
522 /* So, now we've got the cellIDs, the mesh size and the field values,
523 * we can sort them into place */
524 for(uint i=0; i< cellIds.size(); i++) {
525 uint64_t c = cellIds[i]-1;
526 int64_t x = c % cells[0];
527 int64_t y = (c /cells[0]) % cells[1];
528 int64_t z = c /(cells[0]*cells[1]);
529
530 double* Etgt = E.getCellRef(x,y,z);
531 double* Btgt = B.getCellRef(x,y,z);
532 Etgt[0] = Ebuffer[3*i];
533 Etgt[1] = Ebuffer[3*i+1];
534 Etgt[2] = Ebuffer[3*i+2];
535 Btgt[0] = Bbuffer[3*i];
536 Btgt[1] = Bbuffer[3*i+1];
537 Btgt[2] = Bbuffer[3*i+2];
538
539 if(doV) {
540 double* Vtgt = V.getCellRef(x,y,z);
542 Vtgt[0] = rho_v_buffer[3*i] / rho_buffer[i];
543 Vtgt[1] = rho_v_buffer[3*i+1] / rho_buffer[i];
544 Vtgt[2] = rho_v_buffer[3*i+2] / rho_buffer[i];
545 } else {
546 Vtgt[0] = rho_v_buffer[3*i];
547 Vtgt[1] = rho_v_buffer[3*i+1];
548 Vtgt[2] = rho_v_buffer[3*i+2];
549 }
550 }
551 }
552
553 r.close();
554}
555
556/* Non-template version, autodetecting the reader type */
557static void readfields(const char* filename, Field& E, Field& B, Field& V, bool doV=true) {
558 readfields<vlsvinterface::Reader>(filename,E,B,V,doV);
559}
560
561/* For debugging purposes - dump a field into a png file */
562void debug_output(Field& F, const char* filename);
for i
Definition Dispersion.m:24
Numerical propagation V
Definition Dispersion.m:98
B0
Definition Dispersion.m:41
Constants c
Definition Dispersion.m:45
Boundary * createBoundary(int dimension)
Definition boundaries.h:181
float Real
Definition definitions.h:41
#define index(i, j, k)
std::string B_field_name
std::string E_field_name
static void detect_field_names(Reader &r)
Definition readfields.h:45
bool readNextTimestep(const std::string &filename_pattern, double t, int step, Field &E0, Field &E1, Field &B0, Field &B1, Field &V, bool doV, int &input_file_counter)
Definition readfields.h:272
void readfields(const char *filename, Field &E, Field &B, Field &V, bool doV=true)
Definition readfields.h:396
bool do_divide_by_rho
std::vector< uint64_t > readCellIds(vlsvinterface::Reader &r)
std::vector< double > readFieldData(Reader &r, std::string &name, unsigned int numcomponents)
Definition readfields.h:108
std::string V_field_name
void debug_output(Field &F, const char *filename)
std::vector< double > readFsGridData(Reader &r, std::string &name, unsigned int numcomponents)
Definition readfields.h:157
double min
Definition boundaries.h:50
double max
Definition boundaries.h:50
int cells
Definition boundaries.h:53
Definition field.h:34
double dx[3]
Definition field.h:39
std::vector< double > data
Definition field.h:45
double * getCellRef(int x, int y, int z)
Definition field.h:54
Boundary * dimension[3]
Definition field.h:42
double time
Definition field.h:36
static std::string rho_field_name
static bool divide_rhov_by_rho
static std::string V_field_name
static ARCH_HOSTDEV VecSimple< T > min(VecSimple< T > const &l, VecSimple< T > const &r)
static ARCH_HOSTDEV VecSimple< T > max(VecSimple< T > const &l, VecSimple< T > const &r)