OpalTrimCoil.h 2.4 KB
Newer Older
frey_m's avatar
frey_m committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
//
// Class OpalTrimCoil
//   A TRIMCOIL definition is used to define a trim coil which can be applied
//   to a Cyclotron.
//
// Copyright (c) 2018 - 2019, Matthias Frey and Jochem Snuverink,
//                            Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// Implemented as part of the PhD thesis
// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
// and the paper
// "Matching of turn pattern measurements for cyclotronsusing multiobjective optimization"
// (https://doi.org/10.1103/PhysRevAccelBeams.22.064602)
//
// 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/>.
//
frey_m's avatar
frey_m committed
26 27 28
#ifndef OPAL_TRIM_COIL_H
#define OPAL_TRIM_COIL_H

snuverink_j's avatar
snuverink_j committed
29
#include <string>
kraus's avatar
kraus committed
30
#include <memory>
frey_m's avatar
frey_m committed
31
#include "AbstractObjects/Definition.h"
snuverink_j's avatar
snuverink_j committed
32

33
class Attribute;
snuverink_j's avatar
snuverink_j committed
34
class TrimCoil;
frey_m's avatar
frey_m committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

class OpalTrimCoil: public Definition {

public:
    /// Exemplar constructor.
    OpalTrimCoil();

    virtual ~OpalTrimCoil();

    /// Test if replacement is allowed.
    //  Can replace only by another OpalTrimCoil
    virtual bool canReplaceBy(Object *object);

    /// Make clone.
    virtual OpalTrimCoil *clone(const std::string &name);

    /// Check the OpalTrimCoil data.
    virtual void execute();

snuverink_j's avatar
snuverink_j committed
54
    /// Find named trim coil.
frey_m's avatar
frey_m committed
55 56 57 58 59
    static OpalTrimCoil *find(const std::string &name);

    /// Update the OpalTrimCoil data.
    virtual void update();

60
    /// Print method, called at initialisation
gsell's avatar
gsell committed
61
    using Definition::print;
frey_m's avatar
frey_m committed
62 63
    Inform& print(Inform& os) const;

64
    /// Initialise implementation
frey_m's avatar
frey_m committed
65 66
    void initOpalTrimCoil();

67
    /// Actual implementation
frey_m's avatar
frey_m committed
68
    std::unique_ptr<TrimCoil> trimcoil_m;
kraus's avatar
kraus committed
69

frey_m's avatar
frey_m committed
70 71
private:

72
    ///@{ Not implemented.
snuverink_j's avatar
snuverink_j committed
73 74
    OpalTrimCoil  (const OpalTrimCoil &) = delete;
    void operator=(const OpalTrimCoil &) = delete;
75 76
    ///@}
    /// Private copy constructor, called by clone
frey_m's avatar
frey_m committed
77 78
    OpalTrimCoil(const std::string &name, OpalTrimCoil *parent);

79 80
    /// Helper method for printing
    void printPolynom(Inform& os, const Attribute& attr) const;
frey_m's avatar
frey_m committed
81 82 83 84 85 86
};

inline Inform &operator<<(Inform &os, const OpalTrimCoil &b) {
    return b.print(os);
}

87
#endif // OPAL_TRIM_COIL_H