OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
DumpEMFields.h
Go to the documentation of this file.
1//
2// Class DumpEMFields
3// DumpEMFields dumps the dynamically changing fields of a Ring in a user-
4// defined grid.
5//
6// Copyright (c) 2017, Chris Rogers
7// All rights reserved
8//
9// This file is part of OPAL.
10//
11// OPAL is free software: you can redistribute it and/or modify
12// it under the terms of the GNU General Public License as published by
13// the Free Software Foundation, either version 3 of the License, or
14// (at your option) any later version.
15//
16// You should have received a copy of the GNU General Public License
17// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
18//
19#ifndef OPAL_BASICACTIONS_DUMPEMFIELDS_HH
20#define OPAL_BASICACTIONS_DUMPEMFIELDS_HH
21
24
25#include <string>
26#include <unordered_set>
27#include <vector>
28
29namespace interpolation {
30 class NDGrid;
31}
32class Component;
33
54class DumpEMFields: public Action {
55
56public:
58 enum {
79 SIZE
80 };
81
84
86 DumpEMFields(const std::string& name, DumpEMFields* parent);
87
89 virtual ~DumpEMFields();
90
96 virtual DumpEMFields* clone(const std::string& name);
97
104 virtual void execute();
105
121 static void writeFields(Component* field);
122
124 void print(std::ostream& os) const;
125
126private:
127
128 enum class CoordinateSystem: unsigned short {
129 CARTESIAN,
130 CYLINDRICAL
131 };
132
133 virtual void writeFieldThis(Component* field);
134 virtual void buildGrid();
136 static void checkInt(double value, std::string name, double tolerance = 1e-9);
137 void writeHeader(std::ofstream& fout) const;
138 void writeFieldLine(Component* field,
139 const Vector_t& point,
140 const double& time,
141 std::ofstream& fout) const;
142
144 std::string filename_m;
145
147
148 static std::unordered_set<DumpEMFields*> dumpsSet_m;
149
150 DumpEMFields(const DumpEMFields& dump); // disabled
151 DumpEMFields& operator=(const DumpEMFields& dump); // disabled
152};
153
154inline std::ostream& operator<<(std::ostream& os, const DumpEMFields& b) {
155 b.print(os);
156 return os;
157}
158
159#endif // ifdef OPAL_DUMPFIELDS_HH
std::ostream & operator<<(std::ostream &os, const DumpEMFields &b)
Definition: DumpEMFields.h:154
const std::string name
constexpr double e
The value of.
Definition: Physics.h:39
The base class for all OPAL actions.
Definition: Action.h:30
virtual void writeFieldThis(Component *field)
virtual void buildGrid()
void print(std::ostream &os) const
static std::unordered_set< DumpEMFields * > dumpsSet_m
Definition: DumpEMFields.h:148
void parseCoordinateSystem()
std::string filename_m
Definition: DumpEMFields.h:144
static void writeFields(Component *field)
DumpEMFields & operator=(const DumpEMFields &dump)
interpolation::NDGrid * grid_m
Definition: DumpEMFields.h:143
CoordinateSystem coordinates_m
Definition: DumpEMFields.h:146
void writeHeader(std::ofstream &fout) const
virtual void execute()
static void checkInt(double value, std::string name, double tolerance=1e-9)
virtual DumpEMFields * clone(const std::string &name)
void writeFieldLine(Component *field, const Vector_t &point, const double &time, std::ofstream &fout) const
virtual ~DumpEMFields()
DumpEMFields(const DumpEMFields &dump)
Interface for a single beam element.
Definition: Component.h:50