Nektar++
Loading...
Searching...
No Matches
solvers
IncNavierStokesSolver
Utilities
HybridPerformanceModel
Code
class_topology_unit_test.py
Go to the documentation of this file.
1
# Andrew Gloster
2
# Summer 2016
3
# Python Version of Communication Model Implementation
4
# Unit Testing of Topology Class
5
6
#------------------------------------
7
# Import relevant modules
8
#------------------------------------
9
10
import
unittest
11
12
#------------------------------------
13
# Import relevant classes
14
#------------------------------------
15
16
from
class_topology
import
Topology
17
18
#------------------------------------
19
# Test Cases
20
#------------------------------------
21
22
class
Testing
(unittest.TestCase):
23
24
# Check we get the correct total processes
25
def
test0
(self):
26
test_case =
Topology
(5, 4, 10, 2)
27
self.assertEqual(test_case.PROC_TOT, 20)
28
29
# Check for correct basic core labeling
30
def
test1
(self):
31
test_case =
Topology
(2, 5, 10, 2)
32
self.assertEqual(test_case.Core, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
33
34
# Check for basic socket labeling
35
def
test2
(self):
36
test_case =
Topology
(2, 5, 5, 1)
37
self.assertEqual(test_case.Socket, [0, 0, 0, 0, 0, 1, 1, 1, 1, 1])
38
39
# Check for basic node labeling
40
def
test3
(self):
41
test_case =
Topology
(2, 5, 2, 1)
42
self.assertEqual(test_case.Node, [0, 0, 1, 1, 2, 2, 3, 3, 4, 4])
43
44
# Check neighbours that are identical
45
def
test4
(self):
46
test_case =
Topology
(2, 5, 5, 1)
47
self.assertEqual(test_case.Check_Neighbour(0, 0), 0)
48
49
# Check neighbours that are on same socket
50
def
test5
(self):
51
test_case =
Topology
(2, 5, 5, 2)
52
self.assertEqual(test_case.Check_Neighbour(0, 1), 1)
53
54
# Check neighbours that are on same node
55
def
test6
(self):
56
test_case =
Topology
(2, 5, 5, 2)
57
self.assertEqual(test_case.Check_Neighbour(0, 8), 2)
58
59
# Check neighbours that are on different nodes
60
def
test8
(self):
61
test_case =
Topology
(4, 5, 2, 2)
62
self.assertEqual(test_case.Check_Neighbour(0, 9), 3)
63
64
class_topology.Topology
Definition
class_topology.py:22
class_topology_unit_test.Testing
Definition
class_topology_unit_test.py:22
class_topology_unit_test.Testing.test1
test1(self)
Definition
class_topology_unit_test.py:30
class_topology_unit_test.Testing.test5
test5(self)
Definition
class_topology_unit_test.py:50
class_topology_unit_test.Testing.test0
test0(self)
Definition
class_topology_unit_test.py:25
class_topology_unit_test.Testing.test6
test6(self)
Definition
class_topology_unit_test.py:55
class_topology_unit_test.Testing.test3
test3(self)
Definition
class_topology_unit_test.py:40
class_topology_unit_test.Testing.test2
test2(self)
Definition
class_topology_unit_test.py:35
class_topology_unit_test.Testing.test4
test4(self)
Definition
class_topology_unit_test.py:45
class_topology_unit_test.Testing.test8
test8(self)
Definition
class_topology_unit_test.py:60
Generated on Sun Nov 9 2025 20:17:01 for Nektar++ by
1.9.8