Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
OPAL
src
Commits
87082c70
Commit
87082c70
authored
Apr 04, 2020
by
frey_m
Browse files
file headers for sampler classes
parent
790192aa
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
402 additions
and
78 deletions
+402
-78
src/Sample/FromFile.h
src/Sample/FromFile.h
+24
-7
src/Sample/LatinHyperCube.h
src/Sample/LatinHyperCube.h
+20
-0
src/Sample/Normal.h
src/Sample/Normal.h
+17
-0
src/Sample/OpalSample.cpp
src/Sample/OpalSample.cpp
+21
-3
src/Sample/OpalSample.h
src/Sample/OpalSample.h
+21
-5
src/Sample/RNGStream.cpp
src/Sample/RNGStream.cpp
+17
-0
src/Sample/RNGStream.h
src/Sample/RNGStream.h
+17
-0
src/Sample/SampleCmd.cpp
src/Sample/SampleCmd.cpp
+20
-0
src/Sample/SampleCmd.h
src/Sample/SampleCmd.h
+20
-4
src/Sample/SampleGaussianSequence.h
src/Sample/SampleGaussianSequence.h
+24
-8
src/Sample/SampleIndividual.h
src/Sample/SampleIndividual.h
+20
-7
src/Sample/SamplePilot.h
src/Sample/SamplePilot.h
+31
-19
src/Sample/SampleRandomizedSequence.h
src/Sample/SampleRandomizedSequence.h
+21
-0
src/Sample/SampleSequence.h
src/Sample/SampleSequence.h
+21
-5
src/Sample/SampleWorker.h
src/Sample/SampleWorker.h
+28
-13
src/Sample/Sampler.cpp
src/Sample/Sampler.cpp
+20
-0
src/Sample/Sampler.h
src/Sample/Sampler.h
+20
-7
src/Sample/SamplingMethod.h
src/Sample/SamplingMethod.h
+20
-0
src/Sample/Uniform.h
src/Sample/Uniform.h
+20
-0
No files found.
src/Sample/FromFile.h
View file @
87082c70
//
// Class FromFile
// This class parses a file that contains design variable values.
// Each column belongs to a design variable.
// The first line is considered as header and consists of the
// design variable name. The name has to agree with the string
// in the input file.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SEQUENCE_H
#define OPAL_SEQUENCE_H
...
...
@@ -11,13 +35,6 @@
#include <vector>
/**
* Parse file that contains design variable values.
* Each column belongs to a design variable.
* The first line is considered as header and consists of the
* design variable name. The name has to agree with the string
* in the input file.
*/
class
FromFile
:
public
SamplingMethod
{
...
...
src/Sample/LatinHyperCube.h
View file @
87082c70
//
// Class LatinHyperCube
// This class does Latin hypercube sampling.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_LATIN_HYPERCUBE_H
#define OPAL_LATIN_HYPERCUBE_H
...
...
src/Sample/Normal.h
View file @
87082c70
//
// Class Normal
// This class provides normally distributed samples.
//
// Copyright (c) 2018, Christof Metzger-Kraus, Open Sourcerer
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_NORMAL_RANDOM_SAMPLING_H
#define OPAL_NORMAL_RANDOM_SAMPLING_H
...
...
src/Sample/OpalSample.cpp
View file @
87082c70
//
// Class OpalSample
// The SAMPLING definition.
// A SAMPLING definition is used to run the optimizer in sample mode.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include "Sample/OpalSample.h"
#include "AbstractObjects/OpalData.h"
...
...
@@ -14,9 +35,6 @@
#include "Sample/SampleRandomizedSequence.h"
// Class OpalSample
// ------------------------------------------------------------------------
// The attributes of class OpalSample.
namespace
{
enum
{
...
...
src/Sample/OpalSample.h
View file @
87082c70
//
// Class OpalSample
// The SAMPLING definition.
// A SAMPLING definition is used to run the optimizer in sample mode.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SAMPLE_H
#define OPAL_SAMPLE_H
...
...
@@ -7,11 +28,6 @@
#include "Sample/SamplingMethod.h"
// Class OpalSample
// ------------------------------------------------------------------------
/// The SAMPLING definition.
// A SAMPLING definition is used run the optimizer in sample mode.
class
OpalSample
:
public
Definition
{
public:
...
...
src/Sample/RNGStream.cpp
View file @
87082c70
//
// Class RNGStream
// This class takes care of RNG generator instances.
//
// Copyright (c) 2018, Christof Metzger-Kraus, Open Sourcerer
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include "Sample/RNGStream.h"
#include <iostream>
...
...
src/Sample/RNGStream.h
View file @
87082c70
//
// Class RNGStream
// This class takes care of RNG generator instances.
//
// Copyright (c) 2018, Christof Metzger-Kraus, Open Sourcerer
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef RNGSTREAM_H
#define RNGSTREAM_H
...
...
src/Sample/SampleCmd.cpp
View file @
87082c70
//
// Class SampleCmd
// This class defines the SAMPLE command.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include "Sample/SampleCmd.h"
#include "Sample/Sampler.h"
#include "Sample/OpalSample.h"
...
...
src/Sample/SampleCmd.h
View file @
87082c70
//
// Class SampleCmd
// This class defines the SAMPLE command.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SampleCmd_HH
#define OPAL_SampleCmd_HH
...
...
@@ -5,10 +25,6 @@
#include <string>
// Class SampleCmd
// ------------------------------------------------------------------------
/// The SAMPLE command.
class
SampleCmd
:
public
Action
{
public:
...
...
src/Sample/SampleGaussianSequence.h
View file @
87082c70
//
// Class SampleGaussianSequence
// This class provides a sequence of sampling points that have a Gaussian distribution
// with
// mean = 0.5 * (upper + lower)
// sigma = (upper - lower) / 10
// This can be achieved if the integral of the Gaussian between the sampling
// points are all equal. The sampling points are therefore computed using
// the inverse error function at equally distributed arguments between
// -1 and 1.
//
// Copyright (c) 2018, Christof Metzger-Kraus, Open Sourcerer
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SAMPLE_GAUSSIAN_SEQUENCE_H
#define OPAL_SAMPLE_GAUSSIAN_SEQUENCE_H
...
...
@@ -10,14 +34,6 @@
class
SampleGaussianSequence
:
public
SamplingMethod
{
// provides a sequence of sampling points that have a Gaussian distribution
// with
// mean = 0.5 * (upper + lower)
// sigma = (upper - lower) / 10
// This can be achieved if the integral of the Gaussian between the sampling
// points are all equal. The sampling points are therefore computed using
// the inverse error function at equally distributed arguments between
// -1 and 1.
public:
...
...
src/Sample/SampleIndividual.h
View file @
87082c70
//
// Class SampleIndividual
// Structure for an individual in the population holding genes values.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef __SAMPLE_INDIVIDUAL_H__
#define __SAMPLE_INDIVIDUAL_H__
...
...
@@ -13,13 +33,6 @@
#include "boost/smart_ptr.hpp"
/**
* \class SampleIndividual
* Structure for an individual in the population holding genes
* values.
*
* @see Types.h
*/
class
SampleIndividual
{
public:
...
...
src/Sample/SamplePilot.h
View file @
87082c70
//
// Class SamplePilot
// The sample Pilot (Master): Coordinates requests by sampler to workers.
// Every worker thread notifies the master here if idle or not. When
// available the master dispatches one of the pending simulations to the
// worker who will run the specified simulation and report results back to
// the master.
// @see SampleWorker
// @see Sampler
// @tparam Opt_t type of the sampler
// @tparam Sim_t type of the simulation
// @tparam SolPropagationGraph_t strategy to distribute solution between
// master islands
// @tparam Comm_t comm splitter strategy
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef __SAMPLE_PILOT_H__
#define __SAMPLE_PILOT_H__
...
...
@@ -5,25 +36,6 @@
#include "Sample/SampleWorker.h"
#include "Expression/Parser/function.hpp"
/**
* \class SamplePilot
* \brief The sample Pilot (Master): Coordinates requests by sampler
* to workers.
*
* Every worker thread notifies the master here if idle or not. When
* available the master dispatches one of the pending simulations to the
* worker who will run the specified simulation and report results back to
* the master.
*
* @see SampleWorker
* @see Sampler
*
* @tparam Opt_t type of the sampler
* @tparam Sim_t type of the simulation
* @tparam SolPropagationGraph_t strategy to distribute solution between
* master islands
* @tparam Comm_t comm splitter strategy
*/
template
<
class
Opt_t
,
class
Sim_t
...
...
src/Sample/SampleRandomizedSequence.h
View file @
87082c70
//
// Class SampleRandomizedSequence
// This class creates randomized sequences, i.e., it randomly picks values from
// a sequence.
//
// Copyright (c) 2019, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SAMPLE_WEIGHTED_SEQUENCE_H
#define OPAL_SAMPLE_WEIGHTED_SEQUENCE_H
...
...
src/Sample/SampleSequence.h
View file @
87082c70
//
// Class SampleSequence
// This class provides a sequence of equidistant sampling points. It
// can't be garanteed that the sampling is equidistant if
// an integer type is chosen and the difference between
// the upper and lower limit isn't divisible by the number
// of sampling points.
//
// Copyright (c) 2018, Christof Metzger-Kraus, Open Sourcerer
// All rights reserved
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SAMPLE_SEQUENCE_H
#define OPAL_SAMPLE_SEQUENCE_H
...
...
@@ -6,11 +27,6 @@
template
<
typename
T
>
class
SampleSequence
:
public
SamplingMethod
{
// provides a sequence of equidistant sampling points. It
// can't be garanteed that the sampling is equidistant if
// an integer type is chosen and the difference between
// the upper and lower limit isn't divisible by the number
// of sampling points.
public:
...
...
src/Sample/SampleWorker.h
View file @
87082c70
//
// Class SampleWorker
// A worker MPI entity consists of a processor group that runs a
// simulation of type Sim_t. The main loop in run() accepts new jobs from the
// master process runs the simulation and reports back the results.
//
// @see SamplePilot
// @see Worker
// @see MPIHelper.h
//
// @tparam Sim_T type of simulation to run
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef __SAMPLE_WORKER_H__
#define __SAMPLE_WORKER_H__
#include "Pilot/Worker.h"
/**
* \class SampleWorker
* \brief A worker MPI entity consists of a processor group that runs a
* simulation of type Sim_t. The main loop in run() accepts new jobs from the
* master process runs the simulation and reports back the results.
*
* @see SamplePilot
* @see Worker
* @see MPIHelper.h
*
* @tparam Sim_T type of simulation to run
*/
template
<
class
Sim_t
>
class
SampleWorker
:
protected
Worker
<
Sim_t
>
{
...
...
src/Sample/Sampler.cpp
View file @
87082c70
//
// Class Sampler
// This class creates, dispatches and dumps new individuals.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#include <iostream>
#include <string>
#include <limits>
...
...
src/Sample/Sampler.h
View file @
87082c70
//
// Class Sampler
// This class creates, dispatches and dumps new individuals.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef __OPAL_SAMPLER_H__
#define __OPAL_SAMPLER_H__
...
...
@@ -31,13 +51,6 @@
#include <boost/property_tree/ptree.hpp>
/**
* \class Sampler
* \brief Implementing sampling
*/
// template<
// template <class> class SamplingOperator
// >
class
Sampler
:
public
Optimizer
{
public:
...
...
src/Sample/SamplingMethod.h
View file @
87082c70
//
// Class SamplingMethod
// Base class for all sampling methods.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_SAMPLING_METHOD_H
#define OPAL_SAMPLING_METHOD_H
...
...
src/Sample/Uniform.h
View file @
87082c70
//
// Class Uniform
// This class creates uniformly distributed samples.
//
// Copyright (c) 2018, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
//
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_UNIFORM_H
#define OPAL_UNIFORM_H
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment