SampleGenerator.hpp 4.1 KB
Newer Older
1
2
#ifndef SAMPLEGENERATOR_HPP
#define SAMPLEGENERATOR_HPP
3

niklas.baumgarten's avatar
niklas.baumgarten committed
4
#include "utility/Config.hpp"
5
#include "basics/Sample.hpp"
niklas.baumgarten's avatar
niklas.baumgarten committed
6
#include "mesh/Meshes.hpp"
7

niklas.baumgarten's avatar
niklas.baumgarten committed
8

9
10
typedef std::complex<double> Complex;

11
typedef std::vector<Scalar> ScalarSequence1D;
12

13
typedef std::vector<Complex> ComplexSequence1D;
14

15
typedef std::vector<std::vector<Complex>> ComplexSequence2D;
16

17
typedef std::vector<std::vector<Scalar>> ScalarSequence2D;
18
19

template<typename T>
20
class SampleGenerator {
21
22
protected:
    int plotting = 0;
23
24

    int verbose = 0;
25

26
    virtual void drawSample(const SampleID &id) = 0;
27

28
public:
29
    Meshes &meshes;
30

niklas.baumgarten's avatar
niklas.baumgarten committed
31
    explicit SampleGenerator(Meshes &meshes) : meshes(meshes) {
32
        config.get("GeneratorPlotting", plotting);
33
        config.get("GeneratorVerbose", verbose);
34
    }
35

niklas.baumgarten's avatar
niklas.baumgarten committed
36
37
    virtual ~SampleGenerator() {}

38
    void DrawSample(const SampleID &id) {
39
        mout.StartBlock(Name());
40
        vout(1) << id.Str() << endl;
niklas.baumgarten's avatar
niklas.baumgarten committed
41
        drawSample(id);
niklas.baumgarten's avatar
niklas.baumgarten committed
42
        mout.EndBlock(verbose == 0);
43
    }
niklas.baumgarten's avatar
niklas.baumgarten committed
44
45
46

    virtual string Name() const = 0;

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
    virtual T EvalSample() {
        Exit("Not implemented")
    }

    virtual T EvalSample(const Point &) {
        Exit("Not implemented")
    }

    virtual T EvalSample(int, const Point &) {
        Exit("Not implemented")
    }

    virtual T EvalSample(double, const Point &) {
        Exit("Not implemented")
    }

    virtual T EvalSample(const cell &) {
        Exit("Not implemented")
    }

    virtual T EvalSample(int, const cell &) {
        Exit("Not implemented")
    }

    virtual T EvalSample(double, const cell &) {
        Exit("Not implemented")
    }
74
};
75

76
77
78
class ScalarDummy : public SampleGenerator<Scalar> {
public:
    ScalarDummy(Meshes &meshes) : SampleGenerator(meshes) {}
79

80
81
82
    void drawSample(const SampleID &id) override {
        vout(1) << "Dummy Generator" << endl;
    };
83

84
85
    virtual string Name() const override { return "DummyGenerator"; };
};
86

87
88
89
class ComplexDummy : public SampleGenerator<Complex> {
public:
    ComplexDummy(Meshes &meshes) : SampleGenerator(meshes) {}
90

91
92
93
    void drawSample(const SampleID &id) override {
        vout(1) << "Dummy Generator" << endl;
    };
94

95
96
    virtual string Name() const override { return "DummyGenerator"; };
};
97

98
99
100
class VectorFieldDummy : public SampleGenerator<VectorField> {
public:
    VectorFieldDummy(Meshes &meshes) : SampleGenerator(meshes) {}
101

102
103
104
    void drawSample(const SampleID &id) override {
        vout(1) << "Dummy Generator" << endl;
    };
105

106
107
    virtual string Name() const override { return "DummyGenerator"; };
};
108

109
110
111
class TensorDummy : public SampleGenerator<Tensor> {
public:
    TensorDummy(Meshes &meshes) : SampleGenerator(meshes) {}
112

113
114
115
    void drawSample(const SampleID &id) override {
        vout(1) << "Dummy Generator" << endl;
    };
116

117
118
    virtual string Name() const override { return "DummyGenerator"; };
};
119

120
121
122
class ScalarSequence1DDummy : public SampleGenerator<ScalarSequence1D> {
public:
    ScalarSequence1DDummy(Meshes &meshes) : SampleGenerator(meshes) {}
123

124
125
126
    void drawSample(const SampleID &id) override {
        vout(1) << "Dummy Generator" << endl;
    };
127

128
129
    virtual string Name() const override { return "DummyGenerator"; };
};
130

131
132
133
class ComplexSequence1DDummy : public SampleGenerator<ComplexSequence1D> {
public:
    ComplexSequence1DDummy(Meshes &meshes) : SampleGenerator(meshes) {}
134

135
136
137
    void drawSample(const SampleID &id) override {
        vout(1) << "Dummy Generator" << endl;
    };
138

139
140
    virtual string Name() const override { return "DummyGenerator"; };
};
141

142
143
144
class ScalarSequence2DGenerator : public SampleGenerator<ScalarSequence2D> {
public:
    ScalarSequence2DGenerator(Meshes &meshes) : SampleGenerator(meshes) {}
145

146
147
148
    void drawSample(const SampleID &id) override {
        vout(1) << "Dummy Generator" << endl;
    };
149

150
    virtual string Name() const override { return "DummyGenerator"; };
151
152
};

153
class ComplexSequence2DGenerator : public SampleGenerator<ComplexSequence2D> {
niklas.baumgarten's avatar
niklas.baumgarten committed
154
public:
155
    ComplexSequence2DGenerator(Meshes &meshes) : SampleGenerator(meshes) {}
niklas.baumgarten's avatar
niklas.baumgarten committed
156

157
    void drawSample(const SampleID &id) override {
niklas.baumgarten's avatar
niklas.baumgarten committed
158
159
160
161
162
163
        vout(1) << "Dummy Generator" << endl;
    };

    virtual string Name() const override { return "DummyGenerator"; };
};

164
#endif //SAMPLEGENERATOR_HPP