OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
FM3DMagnetoStaticH5Block.cpp
Go to the documentation of this file.
1//
2// Class FM3DMagnetoStaticH5Block
3// Class for magneto-static 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
21
23 : _Fieldmap(filename)
24 , _FM3DH5BlockBase () {
26
27 openFileMPIOCollective (filename);
28 getFieldInfo ("Efield");
30 closeFile ();
31}
32
36
41
43 ) {
44 if (!FieldstrengthEz_m.empty()) {
45 return;
46 }
48 long long last_step = getNumSteps () - 1;
49 setStep (last_step);
50
51 size_t field_size = num_gridpx_m * num_gridpy_m * num_gridpz_m;
52 FieldstrengthEx_m.resize (field_size);
53 FieldstrengthEy_m.resize (field_size);
54 FieldstrengthEz_m.resize (field_size);
55 FieldstrengthBx_m.resize (field_size);
56 FieldstrengthBy_m.resize (field_size);
57 FieldstrengthBz_m.resize (field_size);
58
59 readField (
60 "Efield",
63 &(FieldstrengthEz_m[0]));
64 readField (
65 "Bfield",
68 &(FieldstrengthBz_m[0]));
69
70 closeFile ();
72 << typeset_msg("3d magneto static fieldmap '"
73 + Filename_m + "' (H5hut format) read", "info")
74 << endl);
75}
77 ) {
78 if(FieldstrengthEz_m.empty()) {
79 return;
80 }
81 FieldstrengthEx_m.clear();
82 FieldstrengthEy_m.clear();
83 FieldstrengthEz_m.clear();
84 FieldstrengthBx_m.clear();
85 FieldstrengthBy_m.clear();
86 FieldstrengthBz_m.clear();
87}
88
90 const Vector_t& R,
91 Vector_t& E,
92 Vector_t& B
93 ) const {
94 if (!isInside(R)) {
95 return true;
96 }
101
102 return false;
103}
104
106 ) const {
107 return 0.0;
108}
std::shared_ptr< _FM3DMagnetoStaticH5Block > FM3DMagnetoStaticH5Block
@ T3DMagnetoStaticH5Block
Definition Fieldmap.h:35
Inform & endl(Inform &inf)
Definition Inform.cpp:42
Inform & level3(Inform &inf)
Definition Inform.cpp:47
#define INFOMSG(msg)
Definition IpplInfo.h:348
static std::string typeset_msg(const std::string &msg, const std::string &title)
Definition Fieldmap.cpp:649
std::string Filename_m
Definition Fieldmap.h:118
MapType Type
Definition Fieldmap.h:116
std::vector< double > FieldstrengthEz_m
virtual bool isInside(const Vector_t &r) const
void setStep(const long long)
Vector_t interpolateTrilinearly(const std::vector< double > &, const std::vector< double > &, const std::vector< double > &, const Vector_t &X) const
void getResonanceFrequency(void)
unsigned int num_gridpx_m
void getFieldInfo(const char *)
void readField(const char *name, double *x, double *y, double *z)
void openFileMPIOCollective(const std::string &filename)
long long getNumSteps(void)
unsigned int num_gridpz_m
unsigned int num_gridpy_m
std::vector< double > FieldstrengthEy_m
std::vector< double > FieldstrengthEx_m
std::vector< double > FieldstrengthBz_m
_FM3DMagnetoStaticH5Block(const std::string &filename)
std::vector< double > FieldstrengthBy_m
std::vector< double > FieldstrengthBx_m
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const
static FM3DMagnetoStaticH5Block create(const std::string &filename)
Vektor< double, 3 > Vector_t