-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomScheme.h
72 lines (59 loc) · 1.96 KB
/
CustomScheme.h
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
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
#ifndef CUSTOMSCHEME_H
#define CUSTOMSCHEME_H
#include <vector>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
enum CustomSchemeMeshType {Tri, Quad};
enum CustomSchemeRefinementType {Approx, Interp};
enum CustomSchemeOddWeightType {Edge, Face};
class OddWeight {
public:
OddWeight(){}
OddWeight(int level, CustomSchemeOddWeightType type, double value): level(level), type(type), value(value){}
int level;
CustomSchemeOddWeightType type;
double value;
};
void to_json(json& j, const OddWeight& ow);
void from_json(const json& j, OddWeight& ow);
std::ostream& operator<<(std::ostream& os, const OddWeight& ow);
class EvenWeights {
public:
EvenWeights(){}
EvenWeights(double alfa, double beta): alfa(alfa), beta(beta){}
double alfa;
double beta;
};
void to_json(json& j, const EvenWeights& ew);
void from_json(const nlohmann::json& j, EvenWeights& ew);
std::ostream& operator<<(std::ostream& os, const EvenWeights& ew);
class Weights {
public:
Weights(){}
Weights(std::vector<OddWeight> odd, EvenWeights even): odd(odd), even(even){}
std::vector<OddWeight> odd;
EvenWeights even;
};
void to_json(json& j, const Weights& w);
void from_json(const json& j, Weights& w);
std::ostream& operator<<(std::ostream& os, const Weights& w);
class CustomScheme
{
public:
CustomScheme(){}
CustomScheme(std::string name, CustomSchemeMeshType mesh_type, CustomSchemeRefinementType refinement_type, int neighbour_level, Weights weights):
name(name),
mesh_type(mesh_type),
refinement_type(refinement_type),
neighbour_level(neighbour_level),
weights(weights){}
std::string name;
CustomSchemeMeshType mesh_type;
CustomSchemeRefinementType refinement_type;
int neighbour_level;
Weights weights;
};
std::ostream& operator<<(std::ostream& os, const CustomScheme& s);
void to_json(json& j, const CustomScheme& s);
void from_json(const json& j, CustomScheme& s);
#endif // CUSTOMSCHEME_H