-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeometry_triangle.h
70 lines (47 loc) · 1.32 KB
/
geometry_triangle.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
/*
* Quadrature and discretization for triangle in 2D.
*
* copyright@ Yimin Zhong <[email protected]>. All Rights Reserved.
*
*
* 1. volumetric discretization with triangle cells.
* 2. high order quadrature rules. (Rokhlin or Gimbatus).
*
*/
#ifndef GEOMETRY_TRIANGLE_H
#define GEOMETRY_TRIANGLE_H
#include <iostream>
#include <cassert>
#include <cstring>
#include <unordered_map>
#include "utils.h"
extern "C" {
#include "triangle.h"
}
class geometry_triangle {
public:
geometry_triangle(const geometry_triangle &) = delete;
geometry_triangle();
~geometry_triangle();
void set_points(Array<double> &_points);
void set_facets(Array<int> &_facets);
void build(std::string, geometry_triangle &out);
void refine(std::string, geometry_triangle &out);
scalar_t getX(int index);
scalar_t getY(int index);
void getAllArea();
scalar_t getDistance(int fromIndex, int toIndex);
void getNearField(vector<vector<int>> &near);
int getTriangle(int index);
int numberofpoints;
int numberoftriangles;
vector<scalar_t> arealist;
struct triangulateio _meta;
private:
scalar_t getArea(int index);
void setProperty() {
numberofpoints = _meta.numberofpoints;
numberoftriangles = _meta.numberoftriangles;
}
};
#endif //GEOMETRY_TRIANGLE_H