@@ -9,51 +9,145 @@ parent: Functions & Validation Rules
9
9
10
10
## Is Valid
11
11
12
- - $$ \text{isValid}: \text{system} \rightarrow \text{Bool} $$
12
+ $$ \text{isValid}: \text{system} \rightarrow \text{Bool} $$
13
+
14
+ ### Description
15
+
16
+ - A function which checks the following is true of the system:
17
+ - All inputs follow the schemas supplied
18
+ - All references (through IDs) are present
19
+ - There is one and only one wire into every port [ NOTE: This means that systems which are part of composite processors are NOT valid outide of that context]
20
+ - All blocks are connected to at least one other block
21
+
22
+
23
+ ### Python Implementation
13
24
14
25
## Is Directed
15
26
16
- - $$ \text{isDirected}: \text{system} \rightarrow \text{Bool} $$
27
+ $$ \text{isDirected}: \text{system} \rightarrow \text{Bool} $$
28
+
29
+ ### Description
30
+
31
+ - A function which checks that there are no loops in the system
32
+
33
+ ### Python Implementation
17
34
18
35
## Is Connected
19
36
20
- - $$ \text{isConnected}: \text{system} \rightarrow \text{Bool} $$
37
+ $$ \text{isConnected}: \text{system} \rightarrow \text{Bool} $$
38
+
39
+ ### Description
40
+ - A function which determines if there is a path between any two nodes
41
+ - [ NOTE] Do we want it to be that direction matters, i.e. there has to be looping behavior for this to be true (and everything needs to be reached by that loop even if downstream) or have it be that it just means that you couldn't partition the system into two subsystems without breaking a wiring?
42
+
43
+ ### Python Implementation
21
44
22
45
## Is Dynamical
23
46
24
- - $$ \text{isDynamical}: \text{system} \rightarrow \text{Bool} $$
47
+ $$ \text{isDynamical}: \text{system} \rightarrow \text{Bool} $$
48
+
49
+ ### Description
50
+
51
+ - [ NOTE] : Is this just the opposite of is directed?
52
+
53
+ ### Python Implementation
25
54
26
55
## Get Open Ports
27
56
28
- - $$ \text{getOpenPorts}: \text{system} \rightarrow \text{List[Terminal]} = \text{List}[\{\text{Processor, Index, Type}\}] $$
57
+ $$ \text{getOpenPorts}: \text{system} \rightarrow \text{List[Port]} = \text{List}[\{\text{Processor, Index, Space}\}] $$
58
+
59
+ ### Description
60
+
61
+ - Returns a list of open ports which are defined as any ports in a system which have no wire going into them
62
+ - The data type has a reference to the processor, the index of the port that is open and the space which that port is a type of
63
+
64
+ ### Python Implementation
29
65
30
66
## Get Available Terminals
31
67
32
- - $$ \text{getAvailableTerminals}: \text{system} \rightarrow \text{List[Terminal]} = \text{List}[\{\text{Processor, Index, Type}\}] $$
68
+ $$ \text{getAvailableTerminals}: \text{system} \rightarrow \text{List[Terminal]} = \text{List}[\{\text{Processor, Index, Space}\}] $$
69
+
70
+
71
+ ### Description
72
+
73
+ - Returns a list of open or available terminals based on a default parameter of "open_only = True"
74
+ - If open_only is true this will only return the list of terminals which have no wiring coming out of them
75
+ - If false, it will return every single terminal in the system given terminals can be used more than once
76
+ - The data type has a reference to the processor, the index of the terminal that is open and the space which that port is a type of
77
+
78
+ ### Python Implementation
33
79
34
80
## Get Connected Components
35
81
36
- - $$ \text{getConnectedComponents}: \text{system} \rightarrow \text{List[System]} $$
82
+ $$ \text{getConnectedComponents}: \text{system} \rightarrow \text{List[Processor]} $$
83
+
84
+ ### Description
85
+
86
+ - Returns a list of all processors which have at least one connection
87
+ - [ NOTE] : Is this supposed to be something else?
88
+
89
+ ### Python Implementation
37
90
38
91
## Get Subsystems
39
92
40
- - $$ \text{getSubsystems}: \text{system} \rightarrow \text{List[Processor]} $$
41
- (subset of the processor list which isSubsystem)
93
+ $$ \text{getSubsystems}: \text{system} \rightarrow \text{List[Processor]} $$
94
+
95
+
96
+ ### Description
97
+
98
+ - This function will return the processors of the system which are also subsystems (meaning the isPrimitive function is false)
99
+ - It will only return the top level, i.e. nested subsystems will not be returned, but the getHierachy function can achieve that
100
+
101
+ ### Python Implementation
102
+
42
103
43
104
## Get Hierarchy
44
105
45
- - $$ \text{getHierarchy}: \text{system} \rightarrow \text{NestedDict} $$
46
- (primitive processors are leaves in this tree)
106
+ $$ \text{getHierarchy}: \text{system} \rightarrow \text{NestedDict} $$
107
+
108
+
109
+ ### Description
110
+
111
+ - This function will recursively look through a system defining out branches where there are subsystems and leaves where there are processors to show the hierachy of nested subsystems
112
+
113
+ ### Python Implementation
47
114
48
115
## Get Spaces
49
116
50
- - $$ \text{getSpaces}: \text{system} \rightarrow \text{List[Space]} $$
117
+ $$ \text{getSpaces}: \text{system} \rightarrow \text{List[Space]} $$
118
+
119
+ ### Description
120
+
121
+ - A function which returns all the spaces used by processors in a system
122
+ - If the argument nested=True, then it will also return all spaces which are used in subsystems of the system as well
123
+
124
+ ### Python Implementation
51
125
52
126
## Make Processor
53
127
54
- - $$ \text{makeProcessor}: \text{system} \times \text{block} \times \text{List[wires]} \rightarrow \text{Processor} $$
128
+ $$ \text{makeProcessor}: \text{system} \times \text{block} \times \text{List[wires]} \rightarrow \text{Processor} $$
129
+
130
+ ### Description
131
+
132
+ - A function which takes a system, a block it should represent, and the wires necessary to link up the composite processor and then turns it into a composite processor
133
+
134
+ ### Python Implementation
55
135
56
136
## Lazy Make Processor
57
137
58
- - $$ \text{Imp}: \text{system} \rightarrow \text{Processor} $$
59
- (aka "lazy make processor")
138
+ $$ \text{Imp}: \text{system} \rightarrow \text{Processor} $$
139
+
140
+ ### Description
141
+
142
+ - A function which lazily makes the composite processor following these steps:
143
+
144
+ 1 . get the ports using getOpenPorts(system)
145
+ 2 . assign open ports to the new processors ports (inner wiring)
146
+ 3 . get the terminals using getAvailableTerminals(system)
147
+ 4 . assign the available terminals to the new processors terminals (inner wiring)
148
+ 5 . create a block_id for a block which has these domains and codomains
149
+ 6 . write the new block to the local toolbox
150
+ 7 . create a new processor record with the above
151
+ 8 . write the new processor record to the local workbench
152
+
153
+ ### Python Implementation
0 commit comments