OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
BinningCmd.h
Go to the documentation of this file.
1//
2// Class BinningCmd
3// The class for the OPAL BINNING command.
4// A BINNING definition is used to configure adaptive
5// binning parameters that can later be attached to a
6// field solver.
7//
8// Copyright (c) 200x - 2026, Paul Scherrer Institut,
9// Villigen PSI, Switzerland
10//
11// All rights reserved
12//
13// This file is part of OPAL.
14//
15// OPAL is free software: you can redistribute it and/or modify
16// it under the terms of the GNU General Public License as published by
17// the Free Software Foundation, either version 3 of the License, or
18// (at your option) any later version.
19//
20// You should have received a copy of the GNU General Public License
21// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
22//
23
24#ifndef OPALX_BinningCmd_HH
25#define OPALX_BinningCmd_HH
26
27#include <string>
28
31
32class Inform;
33
35enum class BinningParameter : short { VELOCITYZ = 0, POSITIONZ = 1, PZ = 2, GAMMAZ = 3 };
36
37// The attributes of class BinningCmd.
38namespace BINNING {
39 enum {
40 MAXBINS, // Maximum number of bins for adaptive binning
41 DESIREDWIDTH, // Target / bias for bin width
42 BINNINGALPHA, // Aggressiveness of bin-number reduction
43 BINNINGBETA, // Aggressiveness of using wider bins
44 PARAMETER, // Which bunch attribute is used for binning
45 ADAPTIVEBINNING, // Enable adaptive bin merging after uniform rebinning
46 DUMPBINSFILE, // File name for dumping bins
47 DUMPBINSFREQ, // Frequency of dumping bins to a file (only used if DUMPBINSFILE is set)
48 TABLEPRINTFREQ, // Frequency of printing bin stats table to console (binned mode only)
49 SIZE
50 };
51}
52
53class BinningCmd : public Definition {
54public:
56 BinningCmd();
57
58 virtual ~BinningCmd();
59
61 virtual BinningCmd* clone(const std::string& name);
62
64 static BinningCmd* find(const std::string& name);
65
66 int getMaxBins() const;
67 double getDesiredWidth() const;
68 double getBinningAlpha() const;
69 double getBinningBeta() const;
70 bool getAdaptiveBinning() const;
71
72 std::string getParameter();
74
76 std::string getDumpBinsFileName() const;
77
79 int getDumpBinsFrequency() const;
80
83 int getTablePrintFrequency() const;
84
86 bool dumpBinsToFile() const;
87
89 virtual void update();
90
92 virtual void execute();
93
94 Inform& printInfo(Inform& os) const;
95
96private:
97 // Not implemented.
99 void operator=(const BinningCmd&);
100
101 // Clone constructor.
102 BinningCmd(const std::string& name, BinningCmd* parent);
103
105 void setParameterType();
106
107 std::string parameterName_m;
109};
110
111inline Inform& operator<<(Inform& os, const BinningCmd& bc) { return bc.printInfo(os); }
112
113#endif // OPALX_BinningCmd_HH
Inform & operator<<(Inform &os, const BinningCmd &bc)
Definition BinningCmd.h:111
BinningParameter
The parameter that is used for binning.
Definition BinningCmd.h:35
BinningCmd(const BinningCmd &)
double getDesiredWidth() const
void setParameterType()
Recompute the enum-valued parameter from the string attribute.
int getDumpBinsFrequency() const
Get the frequency of dumping bins to a file.
double getBinningAlpha() const
virtual void update()
Update the binning data (internal cache of attributes).
int getTablePrintFrequency() const
int getMaxBins() const
bool getAdaptiveBinning() const
BinningParameter getParameterType() const
void operator=(const BinningCmd &)
bool dumpBinsToFile() const
Check if dumping bins to a file is enabled.
virtual void execute()
Execute the BINNING command (currently a thin wrapper around update()).
std::string getParameter()
BinningParameter parameterType_m
Definition BinningCmd.h:108
virtual BinningCmd * clone(const std::string &name)
Make clone.
static BinningCmd * find(const std::string &name)
Find named BINNING command.
std::string getDumpBinsFileName() const
Get the file name for dumping bins to a file.
std::string parameterName_m
Definition BinningCmd.h:107
double getBinningBeta() const
Inform & printInfo(Inform &os) const
virtual ~BinningCmd()
BinningCmd()
Exemplar constructor.
Definition BinningCmd.cpp:9
The base class for all OPAL definitions.
Definition Definition.h:29
@ DESIREDWIDTH
Definition BinningCmd.h:41
@ BINNINGBETA
Definition BinningCmd.h:43
@ ADAPTIVEBINNING
Definition BinningCmd.h:45
@ BINNINGALPHA
Definition BinningCmd.h:42
@ DUMPBINSFILE
Definition BinningCmd.h:46
@ TABLEPRINTFREQ
Definition BinningCmd.h:48
@ PARAMETER
Definition BinningCmd.h:44
@ DUMPBINSFREQ
Definition BinningCmd.h:47