OPALX (Object Oriented Parallel Accelerator Library for Exascale) MINIorX
OPALX
FM3DH5Block_nonscale.cpp
Go to the documentation of this file.
1//
2// Class FM3DH5Block_nonscale
3// Class for dynamic non-scaled 3D field-maps stored in H5hut files.
4//
5// Copyright (c) 2020, Achim Gsell, Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved.
7//
8// This file is part of OPAL.
9//
10// OPAL is free software: you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// You should have received a copy of the GNU General Public License
16// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17//
18
20#include "Physics/Physics.h"
21#include "Physics/Units.h"
23
25 : Fieldmap(aFilename), FM3DH5BlockBase() {
27
28 openFileMPIOCollective(aFilename);
29 getFieldInfo("Efield");
31 closeFile();
32}
33
35 freeMap();
36}
37
39 if (!FieldstrengthEz_m.empty()) {
40 return;
41 }
43 long long last_step = getNumSteps() - 1;
44 setStep(last_step);
45
46 size_t field_size = num_gridpx_m * num_gridpy_m * num_gridpz_m;
47 FieldstrengthEx_m.resize(field_size);
48 FieldstrengthEy_m.resize(field_size);
49 FieldstrengthEz_m.resize(field_size);
50 FieldstrengthHx_m.resize(field_size);
51 FieldstrengthHy_m.resize(field_size);
52 FieldstrengthHz_m.resize(field_size);
53
56
57 closeFile();
58
59 for (long long i = 0; i < num_gridpx_m * num_gridpy_m * num_gridpz_m; i++) {
63 FieldstrengthHx_m[i] *= 1.0e6 * Physics::mu_0;
64 FieldstrengthHy_m[i] *= 1.0e6 * Physics::mu_0;
65 FieldstrengthHz_m[i] *= 1.0e6 * Physics::mu_0;
66 }
68 << typeset_msg(
69 "3d dynamic (non-scaled) fieldmap '" + Filename_m + "' (H5hut format) read",
70 "info")
71 << endl;
72}
73
75 if (FieldstrengthEz_m.empty()) {
76 return;
77 }
78 FieldstrengthEx_m.clear();
79 FieldstrengthEy_m.clear();
80 FieldstrengthEz_m.clear();
81 FieldstrengthHx_m.clear();
82 FieldstrengthHy_m.clear();
83 FieldstrengthHz_m.clear();
84
85 *ippl::Info << level3 << typeset_msg("freed fieldmap '" + Filename_m + "'", "info") << endl;
86}
87
90 if (!isInside(R)) {
91 return true;
92 }
95
96 return false;
97}
@ T3DDynamicH5Block
Definition: Fieldmap.h:36
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
Inform & level3(Inform &inf)
Definition: Inform.cpp:54
constexpr double mu_0
The permeability of vacuum in Vs/Am.
Definition: Physics.h:48
constexpr double MVpm2Vpm
Definition: Units.h:128
std::unique_ptr< Inform > Info
Definition: Ippl.h:29
MapType Type
Definition: Fieldmap.h:117
static std::string typeset_msg(const std::string &msg, const std::string &title)
Definition: Fieldmap.cpp:607
std::string Filename_m
Definition: Fieldmap.h:120
FM3DH5Block_nonscale(std::string aFilename)
std::vector< double > FieldstrengthHx_m
3D array with Hx
std::vector< double > FieldstrengthHy_m
3D array with Hy
virtual bool getFieldstrength(const Vector_t< double, 3 > &R, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B) const
std::vector< double > FieldstrengthHz_m
3D array with Hz
void getFieldInfo(const char *)
long long getNumSteps(void)
void openFileMPIOCollective(const std::string aFilename)
std::vector< double > FieldstrengthEz_m
3D array with Ez
void setStep(const long long)
virtual bool isInside(const Vector_t< double, 3 > &r) const
double num_gridpy_m
number of points after 0(not counted here) in grid, y-direction
void getResonanceFrequency(void)
std::vector< double > FieldstrengthEx_m
3D array with Ex
void readField(const char *name, double *x, double *y, double *z)
Vector_t< double, 3 > interpolateTrilinearly(const std::vector< double > &, const std::vector< double > &, const std::vector< double > &, const Vector_t< double, 3 > &X) const
double num_gridpx_m
number of points after 0(not counted here) in grid, x-direction
std::vector< double > FieldstrengthEy_m
3D array with Ey
double num_gridpz_m
number of points after 0(not counted here) in grid, z-direction