Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions meshes/cube_quadrilateral.msh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
$MeshFormat
4.1 0 8
$EndMeshFormat
$Nodes
1 8 1 8
2 1 0 8
1
2
3
4
5
6
7
8
0 0 0
1 0 0
0 1 0
1 1 0
0 0 1
1 0 1
0 1 1
1 1 1
$EndNodes
$Elements
1 6 1 6
2 1 3 6
1 1 3 4 2
2 1 2 6 5
3 1 5 7 3
4 2 4 8 6
5 3 7 8 4
6 5 6 8 7
$EndElements
33 changes: 33 additions & 0 deletions meshes/cube_tetrahedron.msh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
$MeshFormat
4.1 0 8
$EndMeshFormat
$Nodes
1 8 1 8
3 1 0 8
1
2
3
4
5
6
7
8
0 0 0
1 0 0
0 1 0
1 1 0
0 0 1
1 0 1
0 1 1
1 1 1
$EndNodes
$Elements
1 6 1 6
3 1 4 6
1 1 2 6 8
2 1 3 7 8
3 1 5 6 8
4 1 2 4 8
5 1 3 4 8
6 1 5 7 8
$EndElements
271 changes: 271 additions & 0 deletions meshes/sphere_triangle.msh
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
$MeshFormat
4.1 0 8
$EndMeshFormat
$Nodes
1 66 1 66
2 1 0 66
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
0 0 1
1 0 0
0 1 0
-1 0 0
0 -1 0
0 0 -1
0.7071067811865475 0.7071067811865475 0
0 0.7071067811865475 0.7071067811865475
0.7071067811865475 0 0.7071067811865475
-0.7071067811865475 0.7071067811865475 0
-0.7071067811865475 0 0.7071067811865475
-0.7071067811865475 -0.7071067811865475 0
0 -0.7071067811865475 0.7071067811865475
0.7071067811865475 -0.7071067811865475 0
0.7071067811865475 0 -0.7071067811865475
0 0.7071067811865475 -0.7071067811865475
-0.7071067811865475 0 -0.7071067811865475
0 -0.7071067811865475 -0.7071067811865475
0.4082482904638631 0.4082482904638631 0.8164965809277261
0 0.3826834323650897 0.9238795325112867
0.3826834323650897 0 0.9238795325112867
0.816496580927726 0.408248290463863 0.408248290463863
0.9238795325112867 0 0.3826834323650897
0.9238795325112867 0.3826834323650897 0
0.408248290463863 0.816496580927726 0.408248290463863
0.3826834323650897 0.9238795325112867 0
0 0.9238795325112867 0.3826834323650897
-0.4082482904638631 0.4082482904638631 0.8164965809277261
-0.3826834323650897 0 0.9238795325112867
-0.408248290463863 0.816496580927726 0.408248290463863
-0.3826834323650897 0.9238795325112867 0
-0.816496580927726 0.408248290463863 0.408248290463863
-0.9238795325112867 0.3826834323650897 0
-0.9238795325112867 0 0.3826834323650897
-0.4082482904638631 -0.4082482904638631 0.8164965809277261
0 -0.3826834323650897 0.9238795325112867
-0.816496580927726 -0.408248290463863 0.408248290463863
-0.9238795325112867 -0.3826834323650897 0
-0.408248290463863 -0.816496580927726 0.408248290463863
-0.3826834323650897 -0.9238795325112867 0
0 -0.9238795325112867 0.3826834323650897
0.4082482904638631 -0.4082482904638631 0.8164965809277261
0.408248290463863 -0.816496580927726 0.408248290463863
0.3826834323650897 -0.9238795325112867 0
0.816496580927726 -0.408248290463863 0.408248290463863
0.9238795325112867 -0.3826834323650897 0
0.4082482904638631 0.4082482904638631 -0.8164965809277261
0.3826834323650897 0 -0.9238795325112867
0 0.3826834323650897 -0.9238795325112867
0.408248290463863 0.816496580927726 -0.408248290463863
0 0.9238795325112867 -0.3826834323650897
0.816496580927726 0.408248290463863 -0.408248290463863
0.9238795325112867 0 -0.3826834323650897
-0.4082482904638631 0.4082482904638631 -0.8164965809277261
-0.3826834323650897 0 -0.9238795325112867
-0.816496580927726 0.408248290463863 -0.408248290463863
-0.9238795325112867 0 -0.3826834323650897
-0.408248290463863 0.816496580927726 -0.408248290463863
-0.4082482904638631 -0.4082482904638631 -0.8164965809277261
0 -0.3826834323650897 -0.9238795325112867
-0.408248290463863 -0.816496580927726 -0.408248290463863
0 -0.9238795325112867 -0.3826834323650897
-0.816496580927726 -0.408248290463863 -0.408248290463863
0.4082482904638631 -0.4082482904638631 -0.8164965809277261
0.816496580927726 -0.408248290463863 -0.408248290463863
0.408248290463863 -0.816496580927726 -0.408248290463863
$EndNodes
$Elements
1 128 1 128
2 1 2 128
1 1 21 20
2 9 19 21
3 8 20 19
4 19 20 21
5 2 24 23
6 7 22 24
7 9 23 22
8 22 23 24
9 3 27 26
10 8 25 27
11 7 26 25
12 25 26 27
13 7 25 22
14 8 19 25
15 9 22 19
16 19 22 25
17 1 20 29
18 8 28 20
19 11 29 28
20 28 29 20
21 3 31 27
22 10 30 31
23 8 27 30
24 30 27 31
25 4 34 33
26 11 32 34
27 10 33 32
28 32 33 34
29 10 32 30
30 11 28 32
31 8 30 28
32 28 30 32
33 1 29 36
34 11 35 29
35 13 36 35
36 35 36 29
37 4 38 34
38 12 37 38
39 11 34 37
40 37 34 38
41 5 41 40
42 13 39 41
43 12 40 39
44 39 40 41
45 12 39 37
46 13 35 39
47 11 37 35
48 35 37 39
49 1 36 21
50 13 42 36
51 9 21 42
52 42 21 36
53 5 44 41
54 14 43 44
55 13 41 43
56 43 41 44
57 2 23 46
58 9 45 23
59 14 46 45
60 45 46 23
61 14 45 43
62 9 42 45
63 13 43 42
64 42 43 45
65 6 49 48
66 16 47 49
67 15 48 47
68 47 48 49
69 3 26 51
70 7 50 26
71 16 51 50
72 50 51 26
73 2 53 24
74 15 52 53
75 7 24 52
76 52 24 53
77 7 52 50
78 15 47 52
79 16 50 47
80 47 50 52
81 6 55 49
82 17 54 55
83 16 49 54
84 54 49 55
85 4 33 57
86 10 56 33
87 17 57 56
88 56 57 33
89 3 51 31
90 16 58 51
91 10 31 58
92 58 31 51
93 10 58 56
94 16 54 58
95 17 56 54
96 54 56 58
97 6 60 55
98 18 59 60
99 17 55 59
100 59 55 60
101 5 40 62
102 12 61 40
103 18 62 61
104 61 62 40
105 4 57 38
106 17 63 57
107 12 38 63
108 63 38 57
109 12 63 61
110 17 59 63
111 18 61 59
112 59 61 63
113 6 48 60
114 15 64 48
115 18 60 64
116 64 60 48
117 2 46 53
118 14 65 46
119 15 53 65
120 65 53 46
121 5 62 44
122 18 66 62
123 14 44 66
124 66 44 62
125 14 66 65
126 18 64 66
127 15 65 64
128 64 65 66
$EndElements
18 changes: 13 additions & 5 deletions src/geometry/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ use crate::{traits::Point as PointTrait, types::RealScalar};
/// A points
#[derive(Debug, Clone, Copy)]
pub struct Point<'a, T: RealScalar> {
index: usize,
coordinates: &'a [T],
}

impl<'a, T: RealScalar> Point<'a, T> {
/// Create new
pub fn new(coordinates: &'a [T]) -> Self {
Self { coordinates }
pub fn new(index: usize, coordinates: &'a [T]) -> Self {
Self { index, coordinates }
}
}
impl<T: RealScalar> PointTrait for Point<'_, T> {
type T = T;

fn index(&self) -> usize {
self.index
}

fn dim(&self) -> usize {
self.coordinates.len()
}
Expand All @@ -28,12 +33,12 @@ impl<T: RealScalar> PointTrait for Point<'_, T> {
/// Iterator over points
#[derive(Debug)]
pub struct PointIter<'a, T: RealScalar> {
points: Vec<&'a [T]>,
points: Vec<(usize, &'a [T])>,
index: usize,
}
impl<'a, T: RealScalar> PointIter<'a, T> {
/// Create new
pub fn new(points: Vec<&'a [T]>) -> Self {
pub fn new(points: Vec<(usize, &'a [T])>) -> Self {
Self { points, index: 0 }
}
}
Expand All @@ -43,7 +48,10 @@ impl<'a, T: RealScalar> Iterator for PointIter<'a, T> {
fn next(&mut self) -> Option<Point<'a, T>> {
self.index += 1;
if self.index <= self.points.len() {
Some(Point::new(self.points[self.index - 1]))
Some(Point::new(
self.points[self.index - 1].0,
self.points[self.index - 1].1,
))
} else {
None
}
Expand Down
Loading