-
Notifications
You must be signed in to change notification settings - Fork 0
/
MeshRegion.h
62 lines (61 loc) · 2.42 KB
/
MeshRegion.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
#ifndef MESHREGION_H
#define MESHREGION_H
#include <map>
#include <set>
#include <string>
#include <vector>
#define TRIGELEMENT 2
#define QUADELEMENT 3
#define LINEBUFFERSIZE 1000
// only topology structures
// no physics
class MeshRegion {
public:
MeshRegion(std::string name, double tolerance = 1.E-6);
MeshRegion(std::string name, std::vector<std::vector<double>> &p,
bool sort = true, double tolerance = 1.E-6);
double m_tolerance;
std::string m_name;
std::vector<std::vector<double>> m_pts;
std::set<int> m_bndPts;
std::vector<std::vector<int>> m_edges;
std::vector<std::vector<int>> m_cells;
int getCellsNumber();
void transformation(double AoA, double x0, double y0);
void sortCellFromQtoT();
int loadFromMsh(std::string filename,
double maxInnerAngle = 2.35619449019234);
int AddElement(std::vector<std::vector<double>> pts);
std::vector<std::vector<int>> extractBoundaryPoints();
int pointIsExist(std::vector<double> p, int &pId);
void rebuildEdgesIndex();
std::vector<std::vector<int>> m_unSharedPts;
std::vector<std::set<int>> m_unSharedPtsSet;
std::map<std::set<int>, int> m_edgesIndex;
bool consistancyCheck(MeshRegion m);
bool consistancyCheck(std::vector<std::vector<double>> &pts);
void transform(std::vector<double> &p, double AoA, double x0, double y0);
std::vector<double> getLineFromVertex(std::vector<double> A,
std::vector<double> B);
std::vector<double> intersection(std::vector<double> l0,
std::vector<double> l1);
int ResetBndPts();
void CheckMesh(double angle = 75. / 180. * 3.1415926);
void FixMesh();
void GetBoundBox(std::vector<double> &box);
int RemoveElements(void *ptsFunc);
std::vector<std::vector<int>> splitBoundaryPts(double angle);
private:
int loadNode(std::ifstream &inxml, int N, char buffer[]);
int loadElements(std::ifstream &inxml, int N, char buffer[],
std::set<int> types, double maxInnerAngle);
int AddSplitElemens(std::vector<int> pts, double maxInnerAngle);
void CalculateCosAngle(std::vector<int> pts, std::vector<double> &cangle,
int &maxc, int &minabs);
void GetFacePts(int index, std::vector<int> &pts);
double ElementArea(int index);
std::vector<std::vector<int>>
splitBoundaryPts(std::vector<std::vector<int>> &allbndpts, double angle);
std::map<int, int> m_pIDf2s;
};
#endif // MESHREGION_H