DiscreteRegion.h 1.35 KB
Newer Older
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
#ifndef OERSTED_REGION_H
#define OERSTED_REGION_H

#include <vector>

#include "Mesh.hpp"

#include "MaterialProperties.h"

template<size_t Dimension>
class DiscreteRegion {
};

template<>
class DiscreteRegion<2> {
public:
    DiscreteRegion() : Region(nullptr), Material{Air()} {};

    DiscreteRegion(std::vector<size_t> elements) : Region(nullptr), Elements{elements}, Material{Air()} {};

    DiscreteRegion(std::vector<size_t> elements, MaterialProperties material) : Region(nullptr), Elements{elements}, Material{material} {};

    DiscreteRegion(std::shared_ptr<Contour const> region) : Region{region}, Material{Air()} {};

    DiscreteRegion(std::shared_ptr<Contour const> region, MaterialProperties material) : Region{region}, Material{material} {};

    std::vector<size_t> const &elements() const { return Elements; };

    size_t const &element(size_t i) const { return Elements[i]; };

    MaterialProperties &material() { return Material; }; // non-const because internal state of the material may be altered

    void material(MaterialProperties mat) { Material = mat; };

    void push_back(size_t element) { Elements.push_back(element); };

    std::shared_ptr<Contour const> region() const { return Region; };

protected:
    std::shared_ptr<Contour const> Region;

    std::vector<size_t> Elements;

    MaterialProperties Material;
};

#endif //OERSTED_REGION_H