OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
OpalSample.h
Go to the documentation of this file.
1 //
2 // Class OpalSample
3 // The SAMPLING definition.
4 // A SAMPLING definition is used to run the optimizer in sample mode.
5 //
6 // Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
7 // All rights reserved
8 //
9 // Implemented as part of the PhD thesis
10 // "Precise Simulations of Multibunches in High Intensity Cyclotrons"
11 //
12 // This file is part of OPAL.
13 //
14 // OPAL is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
21 //
22 #ifndef OPAL_SAMPLE_H
23 #define OPAL_SAMPLE_H
24 
25 #include <string>
26 #include <memory>
28 
29 #include "Sample/SamplingMethod.h"
30 
31 class OpalSample: public Definition {
32 
33 public:
34 
36  OpalSample();
37 
38  virtual ~OpalSample() {};
39 
41  virtual OpalSample *clone(const std::string &name);
42 
44  virtual void execute();
45 
47  static OpalSample *find(const std::string &name);
48 
49  void initialize(const std::string &dvarName,
50  double lower,
51  double upper,
52  size_t modulo = 1,
53  bool sequence = false);
54 
55  std::string getVariable() const;
56 
57  unsigned int getSize() const;
58 
59  std::shared_ptr<SamplingMethod> sampleMethod_m;
60 
61 private:
62 
64  OpalSample (const OpalSample &) = delete;
65  void operator=(const OpalSample &) = delete;
68  OpalSample(const std::string &name, OpalSample *parent);
69 
70  unsigned int size_m;
71 };
72 
73 inline
74 unsigned int OpalSample::getSize() const{
75  return size_m;
76 }
77 #endif
const std::string name
The base class for all OPAL definitions.
Definition: Definition.h:30
static OpalSample * find(const std::string &name)
Find sampling method.
Definition: OpalSample.cpp:97
void initialize(const std::string &dvarName, double lower, double upper, size_t modulo=1, bool sequence=false)
Definition: OpalSample.cpp:108
void operator=(const OpalSample &)=delete
unsigned int getSize() const
Definition: OpalSample.h:74
std::shared_ptr< SamplingMethod > sampleMethod_m
Definition: OpalSample.h:59
unsigned int size_m
Definition: OpalSample.h:70
virtual void execute()
Check the OpalSample data.
Definition: OpalSample.cpp:92
virtual OpalSample * clone(const std::string &name)
Make clone.
Definition: OpalSample.cpp:87
virtual ~OpalSample()
Definition: OpalSample.h:38
OpalSample(const OpalSample &)=delete
Not implemented.
std::string getVariable() const
Definition: OpalSample.cpp:192
OpalSample()
Exemplar constructor.
Definition: OpalSample.cpp:52