88import numpy as np
99
1010
11- @pytest .mark .skip
1211@pytest .mark .MeshSol
1312class unittest_interface (TestCase ):
14- """unittest for elements and nodes getter methods """
13+ """unittest for interface method """
1514
1615 @classmethod
1716 def setUp (self ):
1817 self .mesh = MeshMat ()
1918 self .mesh .cell ["triangle" ] = CellMat (nb_pt_per_cell = 3 )
20- self .mesh .cell ["segment " ] = CellMat (nb_pt_per_cell = 2 )
19+ self .mesh .cell ["line " ] = CellMat (nb_pt_per_cell = 2 )
2120 self .mesh .point = PointMat ()
2221
2322 self .other_mesh = MeshMat ()
2423 self .other_mesh .cell ["triangle" ] = CellMat (nb_pt_per_cell = 3 )
25- self .other_mesh .cell ["segment " ] = CellMat (nb_pt_per_cell = 2 )
24+ self .other_mesh .cell ["line " ] = CellMat (nb_pt_per_cell = 2 )
2625 self .other_mesh .point = self .mesh .point
2726
2827 def test_MeshMat_flat (self ):
29- """unittest with ElementDict and PointMat objects """
28+ """unittest with a flat interface """
3029
3130 self .mesh .add_cell ([0 , 1 , 2 ], "triangle" )
3231 self .mesh .add_cell ([2 , 3 , 4 ], "triangle" )
@@ -43,8 +42,8 @@ def test_MeshMat_flat(self):
4342 self .other_mesh .add_cell ([4 , 6 , 2 ], "triangle" )
4443
4544 new_seg_mesh = self .mesh .interface (self .other_mesh )
46- solution = np .array ([[0 , 2 ], [2 , 4 ]])
47- resultat = new_seg_mesh .cell ["segment " ].connectivity
45+ solution = np .array ([[0 , 2 ], [4 , 2 ]])
46+ resultat = new_seg_mesh .cell ["line " ].connectivity
4847 testA = np .sum (abs (resultat - solution ))
4948 msg = (
5049 "Wrong projection: returned "
@@ -56,7 +55,7 @@ def test_MeshMat_flat(self):
5655 self .assertAlmostEqual (testA , 0 , msg = msg , delta = DELTA )
5756
5857 def test_CellMat_PointMat_corner_ext (self ):
59- """unittest with CellMat and PointMat objects, extract interface from the external mesh point of view """
58+ """unittest with an external corner interface """
6059 self .mesh .add_cell ([0 , 1 , 2 ], "triangle" )
6160 self .mesh .add_cell ([1 , 2 , 3 ], "triangle" )
6261 self .mesh .add_cell ([1 , 5 , 4 ], "triangle" )
@@ -67,22 +66,24 @@ def test_CellMat_PointMat_corner_ext(self):
6766 self .mesh .point .add_point ([4 , 0 ])
6867 self .mesh .point .add_point ([3.5 , 1 ])
6968 self .mesh .point .add_point ([3 , - 1 ])
69+ self .mesh .point .add_point ([10 , 10 ])
7070
7171 self .other_mesh .add_cell ([0 , 1 , 5 ], "triangle" )
72+ self .other_mesh .add_cell ([0 , 5 , 6 ], "triangle" )
7273
7374 # Method test 1
7475 new_seg_mesh = self .mesh .interface (self .other_mesh )
7576
7677 # Check result
7778 solution = np .array ([[0 , 1 ], [1 , 5 ]])
78- result = new_seg_mesh .cell ["segment " ].connectivity
79+ result = new_seg_mesh .cell ["line " ].connectivity
7980 testA = np .sum (abs (result - solution ))
8081 msg = "Wrong result: returned " + str (result ) + ", expected: " + str (solution )
8182 DELTA = 1e-10
8283 self .assertAlmostEqual (testA , 0 , msg = msg , delta = DELTA )
8384
8485 def test_CellMat_PointMat_corner_int (self ):
85- """unittest with CellMat and PointMat objects, extract interface from the internal mesh point of view """
86+ """unittest with an internal corner interface """
8687 self .mesh .add_cell ([0 , 1 , 2 ], "triangle" )
8788 self .mesh .add_cell ([1 , 2 , 3 ], "triangle" )
8889 self .mesh .add_cell ([1 , 5 , 4 ], "triangle" )
@@ -93,39 +94,38 @@ def test_CellMat_PointMat_corner_int(self):
9394 self .mesh .point .add_point ([4 , 0 ])
9495 self .mesh .point .add_point ([3.5 , 1 ])
9596 self .mesh .point .add_point ([3 , - 1 ])
97+ self .mesh .point .add_point ([10 , 10 ])
9698
9799 self .other_mesh .add_cell ([0 , 1 , 5 ], "triangle" )
100+ self .other_mesh .add_cell ([0 , 5 , 6 ], "triangle" )
98101
99102 # Method test 1
100103 new_seg_mesh = self .other_mesh .interface (self .mesh )
101104
102105 # Check result
103106 solution = np .array ([[0 , 1 ], [1 , 5 ]])
104- result = new_seg_mesh .cell ["segment " ].connectivity
107+ result = new_seg_mesh .cell ["line " ].connectivity
105108 testA = np .sum (abs (result - solution ))
106109 msg = "Wrong result: returned " + str (result ) + ", expected: " + str (solution )
107110 DELTA = 1e-10
108111 self .assertAlmostEqual (testA , 0 , msg = msg , delta = DELTA )
109112
110113 def test_CellMat_PointMat_self (self ):
111- """unittest with CellMat and PointMat objects, extract interface on itself"""
114+ """unittest with interface of a mesh on itself"""
112115 self .mesh .add_cell ([0 , 1 , 2 ], "triangle" )
113116 self .mesh .add_cell ([0 , 2 , 3 ], "triangle" )
114- self .mesh .add_cell ([0 , 3 , 4 ], "triangle" )
115- self .mesh .add_cell ([0 , 4 , 1 ], "triangle" )
116117
117118 self .mesh .point .add_point ([0 , 0 ])
118119 self .mesh .point .add_point ([0 , 1 ])
119120 self .mesh .point .add_point ([1 , 0 ])
120121 self .mesh .point .add_point ([- 1 , 0 ])
121- self .mesh .point .add_point ([0 , - 1 ])
122122
123123 # Method test 1
124124 new_seg_mesh = self .mesh .interface (self .mesh )
125125
126126 # Check result
127- solution = np .array ([])
128- result = new_seg_mesh .cell ["segment " ].connectivity
127+ solution = np .array ([[ 0 , 1 ], [ 0 , 2 ], [ 0 , 3 ], [ 1 , 2 ], [ 2 , 3 ] ])
128+ result = new_seg_mesh .cell ["line " ].connectivity
129129 testA = np .sum (abs (result - solution ))
130130 msg = "Wrong result: returned " + str (result ) + ", expected: " + str (solution )
131131 DELTA = 1e-10
0 commit comments