-
Notifications
You must be signed in to change notification settings - Fork 0
/
bem.h
91 lines (83 loc) · 2.51 KB
/
bem.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#pragma once
#ifndef BEM_H
#define BEM_H
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327950288
#endif // !M_PI
#include <Eigen/Core>
#include "spline.h"
#include "element.h"
#include <vector>
class Bem {
private:
typedef struct Node {
Eigen::MatrixX3d r, z;
} Node;
public:
Bem() {};
void initialize(const Eigen::MatrixX2d &xy);
const std::vector<Element> &e() const { return _e; };
const Spline &sp() const { return _sp; };
//const Eigen::MatrixX3d &r() const { return _r; };
//const Eigen::MatrixX3d &z() const { return _z; };
const Node &node() const { return _node; };
const std::vector<double > regular (double rp, double zp, int idElement) const;
const std::vector<double > axis (double zp, int idElement) const;
const std::vector<double > singular (double tau, int idElement) const;
static void assembly(const Bem &source, const Bem &reciever, Eigen::MatrixXd &S, Eigen::MatrixXd &D);
private:
// the real data
std::vector<Element> _e;
Node _node;
Spline _sp;
// under the hood
static const double eps;
void setrz();
static void abm(double rp, double zp, double r, double z, double &a, double &b, double &m );
static double RKE(double P, double Q, double m, double t, double tau);
static void fKE(
double rp, double zp, double r, double z, double dr, double dz, double J, double a, double b,
double &f_single_K, double &f_double_K, double &f_double_E
);
static int checkBounbdaryPosition(const Bem &bem0, const Bem &bem1);
public:
struct Properties {
struct bc {
struct _bc {
Spline::BC type = Spline::BC::Odd;
double a = 0.0, b = 0.0;
_bc() {};
void set(Spline::BC tmp, double aa, double bb) { type = tmp; a = aa; b = bb; };
void print() const;
};
_bc begin, end;
};
Properties() {
xBC.begin.set(Spline::BC::Odd,0,0);
xBC.end.set(Spline::BC::Odd, 0, 0);
yBC.begin.set(Spline::BC::Even, 0, 0);
yBC.end.set(Spline::BC::Even, 0, 0);
};
bc xBC , yBC;
const int &nElm() const{ return _nElm; };
const int &order() const { return _order; };
const int &qdOrder() const { return _qdOrder; };
const int &indexShift() const { return _indexShift; };
void indexShift(int i) { _indexShift = i; };
void qdOrder(int i) { _qdOrder = i; };
void order(int i) { _order = i; };
void nElm(int i) { _nElm = i; };
void print() const;
static void tic();
static void toc();
private:
int _nElm = 0;
//default
int _order = 2;
int _indexShift = 0;
int _qdOrder = 6;
static double _timer;
};
Properties settings;
};
#endif