File: ProfileItems.h

package info (click to toggle)
bornagain 23.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,936 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (144 lines) | stat: -rw-r--r-- 4,006 bytes parent folder | download | duplicates (2)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file      GUI/Model/Sample/ProfileItems.h
//! @brief     Defines classes Profile1DItem, Profile2DItem, and subclasses.
//!
//! @homepage  http://www.bornagainproject.org
//! @license   GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
//  ************************************************************************************************

#ifndef BORNAGAIN_GUI_MODEL_SAMPLE_PROFILEITEMS_H
#define BORNAGAIN_GUI_MODEL_SAMPLE_PROFILEITEMS_H

#include "GUI/Model/Descriptor/DoubleProperty.h"
#include "Sample/Correlation/Profiles1D.h"
#include "Sample/Correlation/Profiles2D.h"
#include <memory>

class Profile1DItem {

public:
    virtual std::unique_ptr<IProfile1D> createProfile() const = 0;
    virtual ~Profile1DItem() = default;

    virtual void writeTo(QXmlStreamWriter* w) const;
    virtual void readFrom(QXmlStreamReader* r);

    double omega() const { return m_omega.dVal(); }
    void setOmega(double v) { m_omega.setDVal(v); }

    virtual DoubleProperties profileProperties();

protected:
    Profile1DItem();

    DoubleProperty m_omega;
};

class Profile1DCauchyItem : public Profile1DItem {
public:
    std::unique_ptr<IProfile1D> createProfile() const override;
};

class Profile1DGaussItem : public Profile1DItem {
public:
    std::unique_ptr<IProfile1D> createProfile() const override;
};

class Profile1DGateItem : public Profile1DItem {
public:
    std::unique_ptr<IProfile1D> createProfile() const override;
};

class Profile1DTriangleItem : public Profile1DItem {
public:
    std::unique_ptr<IProfile1D> createProfile() const override;
};

class Profile1DCosineItem : public Profile1DItem {
public:
    std::unique_ptr<IProfile1D> createProfile() const override;
};

class Profile1DVoigtItem : public Profile1DItem {
public:
    Profile1DVoigtItem();
    std::unique_ptr<IProfile1D> createProfile() const override;

    void writeTo(QXmlStreamWriter* w) const override;
    void readFrom(QXmlStreamReader* r) override;

    void setEta(double v) { m_eta.setDVal(v); }

    DoubleProperties profileProperties() override;

private:
    DoubleProperty m_eta;
};

// --------------------------------------------------------------------------------------------- //

class Profile2DItem {
public:
    virtual ~Profile2DItem() = default;
    virtual std::unique_ptr<IProfile2D> createProfile() const = 0;

    virtual void writeTo(QXmlStreamWriter* w) const;
    virtual void readFrom(QXmlStreamReader* r);

    void setOmegaX(double v) { m_omegaX.setDVal(v); }
    void setOmegaY(double v) { m_omegaY.setDVal(v); }
    void setGamma(double v) { m_gamma.setDVal(v); }

    virtual DoubleProperties profileProperties();

protected:
    Profile2DItem();

    DoubleProperty m_omegaX;
    DoubleProperty m_omegaY;
    DoubleProperty m_gamma;
};

class Profile2DCauchyItem : public Profile2DItem {
public:
    std::unique_ptr<IProfile2D> createProfile() const override;
};

class Profile2DGaussItem : public Profile2DItem {
public:
    std::unique_ptr<IProfile2D> createProfile() const override;
};

class Profile2DGateItem : public Profile2DItem {
public:
    std::unique_ptr<IProfile2D> createProfile() const override;
};

class Profile2DConeItem : public Profile2DItem {
public:
    std::unique_ptr<IProfile2D> createProfile() const override;
};

class Profile2DVoigtItem : public Profile2DItem {
public:
    Profile2DVoigtItem();
    std::unique_ptr<IProfile2D> createProfile() const override;

    void writeTo(QXmlStreamWriter* w) const override;
    void readFrom(QXmlStreamReader* r) override;

    void setEta(double v) { m_eta.setDVal(v); }

    DoubleProperties profileProperties() override;

private:
    DoubleProperty m_eta;
};

#endif // BORNAGAIN_GUI_MODEL_SAMPLE_PROFILEITEMS_H