Boundary.h 2.12 KB
Newer Older
JasonPries's avatar
JasonPries committed
1 2 3
#ifndef OERSTED_BOUNDARY_H
#define OERSTED_BOUNDARY_H

4 5 6
#include <vector>
#include <cstddef>

7 8
#include <Sketch.hpp>

JasonPries's avatar
JasonPries committed
9 10 11 12 13
template<size_t Dimension>
class Boundary {
};

template<>
14
class Boundary<2> { // TODO: Rename DiscreteBoundary
JasonPries's avatar
JasonPries committed
15
public:
16 17
    Boundary() {};

18 19 20
    Boundary(std::vector<size_t> &&nodes) : CurvePtr{nullptr}, Nodes{nodes} {};

    Boundary(std::shared_ptr<Curve const> cptr, std::vector<size_t> &&nodes) : CurvePtr{cptr}, Nodes{nodes} {};
JasonPries's avatar
JasonPries committed
21

JasonPries's avatar
JasonPries committed
22 23
    size_t size() const { return Nodes.size(); };

24
    auto &nodes() { return Nodes; };
JasonPries's avatar
JasonPries committed
25

26
    auto const &nodes() const { return Nodes; };
JasonPries's avatar
JasonPries committed
27

28
    auto &node(size_t i) { return Nodes[i]; };
JasonPries's avatar
JasonPries committed
29

30
    auto const &node(size_t i) const { return Nodes[i]; };
JasonPries's avatar
JasonPries committed
31

32 33
    auto curve() const { return CurvePtr; };

JasonPries's avatar
JasonPries committed
34
protected:
35
    std::shared_ptr<Curve const> CurvePtr;
JasonPries's avatar
JasonPries committed
36 37 38
    std::vector<size_t> Nodes;
};

JasonPries's avatar
JasonPries committed
39
/*
JasonPries's avatar
JasonPries committed
40
template <size_t Dimension>
JasonPries's avatar
JasonPries committed
41
class BoundaryPair {};
JasonPries's avatar
JasonPries committed
42

JasonPries's avatar
JasonPries committed
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
template <>
class BoundaryPair<2> {
public:
    BoundaryPair(std::shared_ptr<Boundary<2>> first, std::shared_ptr<Boundary<2>> second) : First{first}, Second{second} {};

    std::shared_ptr<Boundary<2>> const &first() { return First; };

    std::shared_ptr<Boundary<2>> const &second() { return Second; };

protected:
    std::shared_ptr<Boundary<2>> First;
    std::shared_ptr<Boundary<2>> Second;
};
*/

class VariableMap {
public:
    VariableMap(size_t first, size_t second, double value) : First{first}, Second{second}, Value{value} {};

    size_t first() const { return First; };

    size_t second() const { return Second; };

    double value() const { return Value; };

protected:
    size_t First;
    size_t Second;
    double Value;
};

class BoundaryMap {
public:
    BoundaryMap(std::vector<VariableMap> map) : Map{map} {};

    size_t size() const { return Map.size(); };

    VariableMap const &map(size_t i) const { return Map[i]; };

    std::vector<VariableMap> const &map() const { return Map; };

    size_t first(size_t i) const { return Map[i].first(); };

    size_t second(size_t i) const { return Map[i].second(); };

    double value(size_t i) const { return Map[i].value(); };

protected:
    std::vector<VariableMap> Map;
JasonPries's avatar
JasonPries committed
92 93
};

JasonPries's avatar
JasonPries committed
94
#endif //OERSTED_BOUNDARY_H