StochasticField.h 2.17 KB
Newer Older
1
2
3
#ifndef STOCHASTICFIELD_H
#define STOCHASTICFIELD_H

4
5
#include <utility>

6
#include "CirculantEmbedding.h"
7
#include "HybridFluxGenerator.h"
8
9
10


class StochasticField {
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
public:
    string generatorName = "";
    map<int, SampleGenerator *> generators;
    Meshes &meshes;

    explicit StochasticField(Meshes &meshes, string generatorName) :
        meshes(meshes), generatorName(std::move(generatorName)) {
        for (int l = meshes.pLevel(); l <= meshes.Level(); l++)
            generators[l] = getGenerator(l);
    }

    void GetFineSample(int l, Vector &fineField) {
        generators[l]->GetFineSample(fineField);
    }

    void GetCoarseSample(int l, const Vector &fineField, Vector &coarseField) {
        generators[l]->GetCoarseSample(fineField, coarseField);
    }

    void SetSampleDir(int l, const string &sampleDirName) {
        generators[l]->SetSampleDir(sampleDirName);
    }

    void SetPlot(int l, Plot *plot) {
        generators[l]->SetPlot(plot);
    }

38
private:
39
40
41
42
43
44
45
    SampleGenerator *getGenerator(int l) {
        if (generatorName == "CirculantEmbedding") {
            if (meshes.dim() == 1)
                return new CirculantEmbedding1D(l, meshes);
            if (meshes.dim() == 2)
                return new CirculantEmbedding2D(l, meshes);
        }
niklas.baumgarten's avatar
niklas.baumgarten committed
46
47
48
49
50
51
        if (generatorName == "DeterministicPermeabilityGenerator") {
//            if (meshes.dim() == 1)
//                return new DeterministicPermeabilityGenerator1D(l, meshes);
//            if (meshes.dim() == 2)
//                return new DeterministicPermeabilityGenerator2D(l, meshes);
        }
52
53
54
55
56
57
        if (generatorName == "HybridFluxGenerator") {
            if (meshes.dim() == 1)
                return new HybridFluxGenerator1D(l, meshes);
            if (meshes.dim() == 2)
                return new HybridFluxGenerator2D(l, meshes);
        }
58
59
60
61
62
63
        if (generatorName == "DeterministicHybridFluxGenerator") {
            if (meshes.dim() == 1)
                return new DeterministicHybridFluxGenerator1D(l, meshes);
            if (meshes.dim() == 2)
                return new DeterministicHybridFluxGenerator2D(l, meshes);
        }
64
        Exit("Generator does not exist")
65
66
67
68
    }
};

#endif //STOCHASTICFIELD_H