OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
SamplingMethod.h
Go to the documentation of this file.
1 //
2 // Class SamplingMethod
3 // Base class for all sampling methods.
4 //
5 // Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
6 // All rights reserved
7 //
8 // Implemented as part of the PhD thesis
9 // "Precise Simulations of Multibunches in High Intensity Cyclotrons"
10 //
11 // This file is part of OPAL.
12 //
13 // OPAL is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20 //
21 #ifndef OPAL_SAMPLING_METHOD_H
22 #define OPAL_SAMPLING_METHOD_H
23 
24 
26 
27 #include <boost/smart_ptr.hpp>
28 
29 #include "Comm/types.h"
30 #include "Util/CmdArguments.h"
31 
33 {
34 
35 public:
36  virtual ~SamplingMethod() {};
37  virtual void create(boost::shared_ptr<SampleIndividual>& ind, size_t i) = 0;
38 
49  virtual void allocate(const CmdArguments_t& /*args*/, const Comm::Bundle_t& /*comm*/) {
50  /* Some sampling methods require a container.
51  * In order to reduce memory only samplers should allocate
52  * the memory
53  */
54  }
55 };
56 
57 #endif
boost::shared_ptr< CmdArguments > CmdArguments_t
Definition: CmdArguments.h:176
virtual ~SamplingMethod()
virtual void create(boost::shared_ptr< SampleIndividual > &ind, size_t i)=0
virtual void allocate(const CmdArguments_t &, const Comm::Bundle_t &)
bundles all communicators for a specific role/pid
Definition: types.h:32