OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
FM3DH5Block.cpp
Go to the documentation of this file.
1//
2// Class FM3DH5Block
3// Class for dynamic 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
19#include "Fields/FM3DH5Block.h"
20
21FM3DH5Block::FM3DH5Block(std::string aFilename) : Fieldmap(aFilename) {
23
24 openFileMPIOCollective(aFilename);
25 getFieldInfo("Efield");
27 closeFile();
28}
29
33
35 if (!FieldstrengthEz_m.empty()) {
36 return;
37 }
39 long long last_step = getNumSteps() - 1;
40 setStep(last_step);
41
42 size_t field_size = num_gridpx_m * num_gridpy_m * num_gridpz_m;
43 FieldstrengthEx_m.resize(field_size);
44 FieldstrengthEy_m.resize(field_size);
45 FieldstrengthEz_m.resize(field_size);
46 FieldstrengthHx_m.resize(field_size);
47 FieldstrengthHy_m.resize(field_size);
48 FieldstrengthHz_m.resize(field_size);
49
52
53 closeFile();
54 *ippl::Info << level3
55 << typeset_msg(
56 "3d dynamic fieldmap '" + Filename_m + "' (H5hut format) read", "info")
57 << endl;
58}
59
61 if (FieldstrengthEz_m.empty()) {
62 return;
63 }
64 FieldstrengthEx_m.clear();
65 FieldstrengthEy_m.clear();
66 FieldstrengthEz_m.clear();
67 FieldstrengthHx_m.clear();
68 FieldstrengthHy_m.clear();
69 FieldstrengthHz_m.clear();
70
71 *ippl::Info << level3 << typeset_msg("freed fieldmap '" + Filename_m + "'", "info") << endl;
72}
73
ippl::Vector< T, Dim > Vector_t
@ T3DDynamicH5Block
Definition Fieldmap.h:36
MapType Type
Definition Fieldmap.h:118
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
std::vector< double > FieldstrengthHy_m
Definition FM3DH5Block.h:47
friend class Fieldmap
Definition FM3DH5Block.h:49
virtual bool getFieldstrength(const Vector_t< double, 3 > &R, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B) const
std::vector< double > FieldstrengthHx_m
Definition FM3DH5Block.h:46
virtual ~FM3DH5Block()
virtual void readMap()
FM3DH5Block(std::string aFilename)
virtual void freeMap()
std::vector< double > FieldstrengthHz_m
Definition FM3DH5Block.h:45
void getFieldInfo(const char *)
long long getNumSteps(void)
void openFileMPIOCollective(const std::string aFilename)
std::vector< double > FieldstrengthEz_m
void setStep(const long long)
virtual bool isInside(const Vector_t< double, 3 > &r) const
void getResonanceFrequency(void)
std::vector< double > FieldstrengthEx_m
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
std::vector< double > FieldstrengthEy_m