Boundary.h 1.86 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>

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

template<>
class Boundary<2> {
public:
14
    Boundary(std::vector<size_t> &&nodes) : Nodes{nodes} {};
JasonPries's avatar
JasonPries committed
15

JasonPries's avatar
JasonPries committed
16 17 18 19
    size_t size() const { return Nodes.size(); };

    std::vector<size_t> &nodes() { return Nodes; };

JasonPries's avatar
JasonPries committed
20 21
    std::vector<size_t> const &nodes() const { return Nodes; };

JasonPries's avatar
JasonPries committed
22 23
    size_t node(size_t i) { return Nodes[i]; };

JasonPries's avatar
JasonPries committed
24 25
    size_t const &node(size_t i) const { return Nodes[i]; };

JasonPries's avatar
JasonPries committed
26

JasonPries's avatar
JasonPries committed
27 28 29 30
protected:
    std::vector<size_t> Nodes;
};

JasonPries's avatar
JasonPries committed
31
/*
JasonPries's avatar
JasonPries committed
32
template <size_t Dimension>
JasonPries's avatar
JasonPries committed
33
class BoundaryPair {};
JasonPries's avatar
JasonPries committed
34

JasonPries's avatar
JasonPries committed
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
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
84 85
};

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