Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scalability banks #875

Merged
merged 200 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from 191 commits
Commits
Show all changes
200 commits
Select commit Hold shift + click to select a range
d258aca
Rough starting point at refactoring to make banks scalable. Doesn't c…
edwardalee Nov 18, 2021
f70aee3
Create array for self structs.
edwardalee Nov 18, 2021
a0538ab
Aligned reactor-c submodule with master (again).
edwardalee Nov 18, 2021
a33cd66
Intermediate checkin
edwardalee Nov 19, 2021
e5a73db
Compiles now and simple examples run.
edwardalee Nov 19, 2021
68cc1ce
Begin factoring out utility functions into CUtil.java
edwardalee Nov 19, 2021
aecf66d
Separated out methods that generate code that has to be executed afte…
edwardalee Nov 20, 2021
60f0a7d
Port pr, indent, etc. to Java.
petervdonovan Nov 20, 2021
48e31be
Organized imports and removed obsolete comment.
edwardalee Nov 20, 2021
24bbeaa
First step towards iterations over bank members while constructing an…
edwardalee Nov 20, 2021
7cddef1
One more iteration over bank indices.
edwardalee Nov 20, 2021
32f77c3
More refactoring to CUtil to use sourceRef more uniformly
edwardalee Nov 21, 2021
218f859
Begin to factor out and port GeneratorBase methods to Java.
petervdonovan Nov 21, 2021
fe3b285
Add file that should have been in previous commit.
petervdonovan Nov 21, 2021
71cc780
More factoring out of GeneratorBase.
petervdonovan Nov 22, 2021
3b5964a
More factoring out of GeneratorBase.
petervdonovan Nov 22, 2021
b37898b
Shorten oddly written methods.
petervdonovan Nov 22, 2021
02ca78e
A bit more iterating over bank members.
edwardalee Nov 22, 2021
9efc38d
Reversed order of startScopedBlock and getSelfStruct.
edwardalee Nov 22, 2021
b995189
Merged
edwardalee Nov 22, 2021
cbb02b3
Applied Peter's fix for benchmark failures in scalability-banks
edwardalee Nov 22, 2021
a1675e8
Updated the PingPong implementations
Soroosh129 Nov 9, 2021
9c94553
Changed the default number of pings in the LF benchmark to match the …
Soroosh129 Nov 9, 2021
9c1c418
Resurrected the benchmark runner reactor
Soroosh129 Nov 12, 2021
61f02dc
Updated RecMatMul to use the BenchmarkRunner reactor
Soroosh129 Nov 12, 2021
9d58a46
Update benchmark/C/Savina/src/parallelism/MatMul.lf
Soroosh129 Nov 12, 2021
61e5dda
Transpose B matrix for C, C++ versions.
petervdonovan Nov 16, 2021
b94de8f
Add the original benchmark alongside this version.
petervdonovan Nov 16, 2021
379e0ff
clean up in the benchmark directory
cmnrd Nov 22, 2021
8cd4309
Merge scalability in (again).
edwardalee Nov 22, 2021
94aed83
Added isParentOf method.
edwardalee Nov 23, 2021
4008565
Renamed and refined defineSelfStruct method
edwardalee Nov 23, 2021
a5a4711
Merge branch 'scalability' into scalability-banks
edwardalee Nov 23, 2021
e648a71
Merge branch 'scalability' into scalability-banks
edwardalee Nov 23, 2021
0cf19b5
Added test of nested banks.
edwardalee Nov 23, 2021
28a3b60
Checkpoint where basic models work.
edwardalee Nov 23, 2021
9834eee
Refactor scope block generation.
edwardalee Nov 23, 2021
fbb04e4
Got banked code to compile. Doesn't work yet.
edwardalee Nov 24, 2021
ec0dde0
Prefer composition + parameterization by strategies over inheritance …
petervdonovan Nov 24, 2021
5351569
Eliminated unnecessary extra array on the stack for banks.
edwardalee Nov 24, 2021
2530232
Factor more out of GeneratorBase.
petervdonovan Nov 24, 2021
9e40c4b
Delete unused method.
petervdonovan Nov 25, 2021
4268d17
Factor out runBuildCommand.
petervdonovan Nov 25, 2021
9aea8a0
Factor refreshProject out of GeneratorBase.
petervdonovan Nov 26, 2021
289a886
Fix a bug that was introduced by 218f859.
petervdonovan Nov 27, 2021
2e30bee
Trimmed unnecessary scoping
edwardalee Nov 25, 2021
4f98b6e
Removes unnecessary start input and associated reaction
jhaye Nov 16, 2021
d2bc104
updated reacto-cpp
cmnrd Nov 24, 2021
4255013
fix default paramters in PingPong benchmark
cmnrd Nov 24, 2021
eeebfc0
cpp: explicitly check the cmake version
cmnrd Nov 24, 2021
ac45bba
cpp: avoid --parallel for cmake versions below 3.12
cmnrd Nov 24, 2021
6d625d5
Major refactoring, got everything to compile, got diagrams working ag…
edwardalee Nov 27, 2021
6948a72
Get diagrams working even with nested banks.
edwardalee Nov 28, 2021
0977172
Composition instead of inheritance for TargetTypes.
petervdonovan Nov 28, 2021
759eb75
Merge branch 'scalability-banks' of https://github.com/lf-lang/lingua…
petervdonovan Nov 28, 2021
b7e9b29
First working bank written to by a reaction of a container.
edwardalee Nov 28, 2021
ab7e0dc
Removed unnecessary broadcast.
edwardalee Nov 28, 2021
c9e62ba
Fix a few issues caused by refactoring.
petervdonovan Nov 29, 2021
dc31d12
Merge branch 'scalability-banks' of https://github.com/lf-lang/lingua…
petervdonovan Nov 29, 2021
f3e5fb1
Address banks in one more place (reactions sending to contained banks).
edwardalee Nov 30, 2021
0db8c5a
Checkpoint before significant refactoring of utility functions.
edwardalee Dec 1, 2021
ce7cc8a
Merge branch 'master' into scalability-banks
edwardalee Dec 1, 2021
65bbdea
Consolidated some functions for getting port references and gave them…
edwardalee Dec 1, 2021
5bcc8a2
A bit of refactoring of CUtil to organize methods better.
edwardalee Dec 1, 2021
7d274df
Comments only.
petervdonovan Dec 3, 2021
8029cd5
Interrim checkin
edwardalee Dec 6, 2021
4c6fa97
Bank-savy ranges now work for basic models.
edwardalee Dec 6, 2021
7ffaf0e
Interrim checkin
edwardalee Dec 7, 2021
65c24da
Interrim checkin
edwardalee Dec 7, 2021
43ad017
Simplyfying refactoring and removing dependence on adjacent self stru…
edwardalee Dec 7, 2021
6f447a5
Interrim checkin
edwardalee Dec 7, 2021
e087355
Reaction to contained bank working
edwardalee Dec 7, 2021
65c7a17
Getting closer
edwardalee Dec 7, 2021
90a083f
Finally got reactions sending and receiving from contained banks.
edwardalee Dec 8, 2021
53eb7f9
Interrim checkin
edwardalee Dec 11, 2021
8406754
Interrim checkin
edwardalee Dec 11, 2021
7233de7
Interrim checkin before work on interleaving.
edwardalee Dec 11, 2021
6009257
Interrim checkin
edwardalee Dec 12, 2021
45d6c93
Interrim checking towards supporting deeply nested banks. Problem now…
edwardalee Dec 14, 2021
b0734e1
Checkpoint checkin with nested banks and everything compiling.
edwardalee Dec 14, 2021
85b6e16
Checkpoint checkin. Interleaving works on the right, not left. Levels…
edwardalee Dec 14, 2021
1921977
Deleted obsolete file and minor tuning
edwardalee Dec 15, 2021
09f334f
Start towards porting ReactionInstanceGraph to Java
edwardalee Dec 15, 2021
083c841
Added MixedRadixInt class plus tests, used in Range class to provide …
edwardalee Dec 18, 2021
ed61b49
Converted ReactionInstanceGraph to java, made it self destructive, up…
edwardalee Dec 18, 2021
718eada
Removed spurious level calculations no longer needed (nor correct).
edwardalee Dec 18, 2021
16e272a
Fixed calculation of levels
edwardalee Dec 19, 2021
9db58d4
Temporary conservative solution for dominating reaction optimization
edwardalee Dec 19, 2021
18f9da9
Some progress towards nested banks.
edwardalee Dec 20, 2021
d1fc69d
Fixed initialization of actions
edwardalee Dec 20, 2021
346d1be
Start on unit tests for PortInstance.
edwardalee Dec 20, 2021
62e5a79
Made sorting of ranges deterministic, enabling regression tests, and …
edwardalee Dec 21, 2021
71526c1
Temporarily disable single dominating reaction plus more.
edwardalee Dec 22, 2021
b77d075
Interrim checkin
edwardalee Dec 22, 2021
1faca77
Interrim checkin
edwardalee Dec 24, 2021
5aa55c0
Renamed bank_index to runtime_index for clarity
edwardalee Dec 25, 2021
c29a53d
Comments only
edwardalee Dec 25, 2021
9ed0e3d
Limit ranges to widths that are visible at a given level of the hiera…
edwardalee Dec 25, 2021
f6c80b8
More graph corner cases.
edwardalee Dec 26, 2021
25acebe
Make parameter initializer intermediate variable static so array init…
edwardalee Dec 27, 2021
e74a0ab
Use static initializer to prevent initial array value for a parameter…
edwardalee Dec 27, 2021
ca1f5fe
Merged with master and fixed conflicts as best I could
edwardalee Dec 27, 2021
869241f
Convert types of form int[] to int* because C can't have int[]
edwardalee Dec 27, 2021
31b2268
Pointer connector
edwardalee Dec 27, 2021
d4ce815
Return ZERO when popping up to the top level
edwardalee Dec 27, 2021
04ebf9d
Rename methods and fix handling of outputs that trigger reactions
edwardalee Dec 27, 2021
329584e
Do not optimize single downstream reaction invocation unless the reac…
edwardalee Dec 27, 2021
48aafeb
Fixed setting of output_produced with multiple destinations
edwardalee Dec 28, 2021
32305f8
Get LFC to compile.
petervdonovan Dec 28, 2021
988919c
Bring back special handling for arrays.
petervdonovan Dec 28, 2021
1c98c89
Further refinement of C types special cases
edwardalee Dec 28, 2021
906d6c2
Handle reactions driven by an output port of a contained reactor
edwardalee Dec 28, 2021
8ef1e33
Store both declaration and definition of reactor.
edwardalee Dec 28, 2021
ba78867
Use declaration rather than definition to solve typing problems
edwardalee Dec 28, 2021
832f28a
In the diagrams, use the renamed name of an imported reactor rather t…
edwardalee Dec 28, 2021
4409cf2
Allow for reactions within banks that send to multiple ports, themsel…
edwardalee Dec 29, 2021
c695f87
More tests passing with multicast over banks and multiports
edwardalee Dec 30, 2021
e80c2c0
Typo
edwardalee Dec 31, 2021
1460524
Tolerate variable width banks that happen to have width one.
edwardalee Dec 31, 2021
a9cc612
Removed transitiveClosure methods (not used)
edwardalee Dec 31, 2021
21bd78b
Drastically simplified mixed-radix infrastructure and usage.
edwardalee Jan 2, 2022
7424583
Temporarily commented out cycle detection
edwardalee Jan 4, 2022
4d96d38
Wrap rather than add an infinite radix digit to match C runtime
edwardalee Jan 4, 2022
e1b9dc9
Restored cycle detection.
edwardalee Jan 4, 2022
d038435
Added support for detecting overlapping ranges
edwardalee Jan 4, 2022
01a5cc6
Major refactoring so that eventualDestinations() returns a list of Se…
edwardalee Jan 4, 2022
4dc3a4c
Inherit interleaving status more systematically.
edwardalee Jan 4, 2022
5fd4195
Updated level assignment to support multiple levels
edwardalee Jan 5, 2022
baf9fc1
Do not generate reactor arrays for reactors not in the federate.
edwardalee Jan 5, 2022
6cffccb
Fixed bug with dependence graph construction and guard against genera…
edwardalee Jan 5, 2022
01f5f9c
One more place where guard for current federate wasn't quite right.
edwardalee Jan 6, 2022
55dd448
Comments only
edwardalee Jan 6, 2022
17b6e93
Comments
edwardalee Jan 9, 2022
d2880a4
Simplified access to outputs
edwardalee Jan 9, 2022
5bb54de
Pad digits when asked and provide numDigits function
edwardalee Jan 9, 2022
3335727
Added support to get total width within a federate
edwardalee Jan 9, 2022
c593bb7
Removed redundant scoped block
edwardalee Jan 9, 2022
f4d8611
Fixed NPE in getTotalWidth()
edwardalee Jan 9, 2022
cb85765
Added numRuntimeInstances function
edwardalee Jan 10, 2022
65f4961
First pass on getting some federated tests to run
edwardalee Jan 10, 2022
89b5dd9
Separate the runtime and bank indices when iterating using mixed-radi…
edwardalee Jan 11, 2022
34d00a8
Added function getLevelsList()
edwardalee Jan 11, 2022
dcb190e
Use function getLevelsList, not the set function.
edwardalee Jan 11, 2022
43825a7
Added argument to clearCaches() that enables preserving Runtime insta…
edwardalee Jan 12, 2022
c652e43
Method renaming and comments only
edwardalee Jan 12, 2022
8762329
Preserve runtimes when clearing caches
edwardalee Jan 12, 2022
002dc38
Fixed gating for proper federate on setting last_enabling_reaction
edwardalee Jan 12, 2022
122f5cb
Updated reactor-c
edwardalee Jan 12, 2022
5865bcc
Fixed typo in generated code for _lf_intended_tags_fields
edwardalee Jan 12, 2022
b81677d
Declare output port as an effect of the reaction so that memory is al…
edwardalee Jan 12, 2022
79421a1
Merge master into scalability-banks.
petervdonovan Jan 13, 2022
d1b6271
Address failing "no cmake" tests.
petervdonovan Jan 13, 2022
fa43f9a
Update submodule.
petervdonovan Jan 13, 2022
cb5f3fb
All federated tests pass.
edwardalee Jan 13, 2022
b7972df
Removed unused imports
edwardalee Jan 14, 2022
968c04f
Merge branch 'master' into scalability-banks
edwardalee Jan 14, 2022
fb447a2
Updated to use Either class in parameter
edwardalee Jan 14, 2022
83b2aca
Address test failures for TypeScript.
petervdonovan Jan 14, 2022
8521362
Address test failures due to missing core/reactor.c.
petervdonovan Jan 15, 2022
bf8b59c
Python: Fix "undefined type" errors.
petervdonovan Jan 15, 2022
9362363
Python: /* */ comments are invalid.
petervdonovan Jan 15, 2022
efc30c2
Python: Address failing serialization tests.
petervdonovan Jan 15, 2022
3937ebd
Merge branch 'master' into scalability-banks
edwardalee Jan 15, 2022
a544ad3
Tolerate errors when retrieving levels
edwardalee Jan 15, 2022
844ad52
Removed obsolete methods and fields previously used to provide reacto…
edwardalee Jan 16, 2022
8ebd97e
Removed unused reactor ID and related fields and methods
edwardalee Jan 16, 2022
200388f
Added comment that this is no longer used.
edwardalee Jan 16, 2022
d6a48c5
Use ReactionInstanceGraph rather than TopologyGraph and update cycle …
edwardalee Jan 16, 2022
b877ea0
Made class public
edwardalee Jan 16, 2022
1bbddef
Skip code generation if there are cuasality cycles.
edwardalee Jan 16, 2022
f200a27
Filter out connections with after delays when finding eventual destin…
edwardalee Jan 16, 2022
49b9bf0
Tolerate unknown widths in more places
edwardalee Jan 17, 2022
194ec28
Make minute not min the canonical name for minute units to not collid…
edwardalee Jan 17, 2022
1771216
Prevent NPE on complicated combinations of levels
edwardalee Jan 17, 2022
5214b2d
Added exit code and stack trace printouts for failed tests
Soroosh129 Jan 11, 2022
df7e250
Fixed transposition error on arguments
edwardalee Jan 18, 2022
fd890d1
Do not generate dead code
edwardalee Jan 18, 2022
faac829
Merge branch 'master' into scalability-banks
petervdonovan Jan 18, 2022
4eafd98
Python: Fix syntax error.
petervdonovan Jan 18, 2022
8092f9c
Python: Fix other syntax error.
petervdonovan Jan 18, 2022
5910b68
Python: Related syntax error.
petervdonovan Jan 19, 2022
4dcbf2e
Merge remote-tracking branch 'origin/master' into scalability-banks
edwardalee Jan 19, 2022
b6285a9
Generate include of mixed_radix.h.
edwardalee Jan 19, 2022
85683a5
Suppress warnings by using size_t rather than int
edwardalee Jan 19, 2022
422cf10
Use CUtil.bankIndex rather than hardcoding the bank index variable name.
edwardalee Jan 19, 2022
20691b1
Updated reactor-c version
edwardalee Jan 19, 2022
d407b9d
Added special handling of bank_index (and some format fixes
Soroosh129 Jan 21, 2022
eb98cd3
Merge remote-tracking branch 'origin/master' into scalability-banks
Soroosh129 Jan 21, 2022
2856284
Fixed merge artifact
Soroosh129 Jan 21, 2022
919b6db
Fixed syntax error
Soroosh129 Jan 21, 2022
29aeec8
Purely aesthetic changes
Soroosh129 Jan 21, 2022
bc04849
Merge remote-tracking branch 'origin/master' into scalability-banks
Soroosh129 Jan 24, 2022
89d1431
Update org.lflang/src/org/lflang/generator/ReactorInstance.java
edwardalee Jan 25, 2022
47d6792
Update org.lflang/src/org/lflang/generator/c/CGenerator.xtend
edwardalee Jan 25, 2022
8ce66b8
Moved and renamed function per code review
edwardalee Jan 25, 2022
909f882
Use imperative case in comments, per code review.
edwardalee Jan 25, 2022
0903484
Clarified comment by referring to runtime instances
edwardalee Jan 25, 2022
7aad2c6
If clearCaches argument is true, remove runtimes.
edwardalee Jan 25, 2022
d9e8b39
Improved class comments for ReactorInstance and related classes
edwardalee Jan 25, 2022
b7882ea
Used more compact list constructors
edwardalee Jan 25, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import de.cau.cs.kieler.klighd.syntheses.AbstractDiagramSynthesis
import de.cau.cs.kieler.klighd.util.KlighdProperties
import java.util.Collection
import java.util.EnumSet
import java.util.LinkedList
import java.util.List
import java.util.Map
import javax.inject.Inject
Expand Down Expand Up @@ -91,7 +92,6 @@ import org.lflang.generator.ReactorInstance
import org.lflang.generator.TimerInstance
import org.lflang.generator.TriggerInstance
import org.lflang.generator.TriggerInstance.BuiltinTriggerVariable
import org.lflang.lf.Connection
import org.lflang.lf.Model

import static extension org.eclipse.emf.ecore.util.EcoreUtil.*
Expand Down Expand Up @@ -326,13 +326,7 @@ class LinguaFrancaSynthesis extends AbstractDiagramSynthesis<Model> {
node.setLayoutOption(LayeredOptions.SPACING_COMPONENT_COMPONENT, LayeredOptions.SPACING_COMPONENT_COMPONENT.^default * 0.5f)
}
} else {
// If the reactor is a bank, then obtain the details from the first
// element of the bank rather than the bank itself.
val instance = if (reactorInstance.bankSize > 0) {
reactorInstance.bankMembers.get(0)
} else {
reactorInstance
}
val instance = reactorInstance

// Expanded Rectangle
node.addReactorFigure(reactorInstance, label) => [ ReactorFigureComponents comps |
Expand Down Expand Up @@ -576,12 +570,9 @@ class LinguaFrancaSynthesis extends AbstractDiagramSynthesis<Model> {
// Transform instances
for (entry : reactorInstance.children.reverseView.indexed) {
val child = entry.value
// Do not render individual reactors in a bank.
if (child.getBank() === null) {
val rNodes = child.createReactorNode(child.getExpansionState?:false, inputPorts, outputPorts, allReactorNodes)
rNodes.head.setLayoutOption(CoreOptions.PRIORITY, entry.key)
nodes += rNodes
}
val rNodes = child.createReactorNode(child.getExpansionState?:false, inputPorts, outputPorts, allReactorNodes)
rNodes.head.setLayoutOption(CoreOptions.PRIORITY, entry.key)
nodes += rNodes
}

// Create timers
Expand Down Expand Up @@ -680,29 +671,24 @@ class LinguaFrancaSynthesis extends AbstractDiagramSynthesis<Model> {
// connect outputs
port = null // create new ports
for (TriggerInstance<?> effect : reaction.effects?:emptyList) {
// Skip this effect if it is contained in a bank with index other than 0.
if (!(effect instanceof PortInstance)
|| (effect.parent.bankIndex <= 0)
) {
port = if (REACTIONS_USE_HYPEREDGES.booleanValue && port !== null) {
port
port = if (REACTIONS_USE_HYPEREDGES.booleanValue && port !== null) {
port
} else {
node.addInvisiblePort() => [
setLayoutOption(CoreOptions.PORT_SIDE, PortSide.EAST)
]
}
if (effect instanceof ActionInstance) {
actionSources.put(effect, port)
} else if (effect instanceof PortInstance) {
var KPort dst = null
if (effect.isOutput) {
dst = parentOutputPorts.get(effect)
} else {
node.addInvisiblePort() => [
setLayoutOption(CoreOptions.PORT_SIDE, PortSide.EAST)
]
dst = inputPorts.get(effect.parent, effect)
}
if (effect instanceof ActionInstance) {
actionSources.put(effect, port)
} else if (effect instanceof PortInstance) {
var KPort dst = null
if (effect.isOutput) {
dst = parentOutputPorts.get(effect)
} else {
dst = inputPorts.get(effect.parent, effect)
}
if (dst !== null) {
createDependencyEdge(effect).connect(port, dst)
}
if (dst !== null) {
createDependencyEdge(effect).connect(port, dst)
}
}
}
Expand Down Expand Up @@ -745,65 +731,67 @@ class LinguaFrancaSynthesis extends AbstractDiagramSynthesis<Model> {
}

// Transform connections.
// The connections data structure maps connections to their connections as they appear
// in a visualization of the program. For each connection, there is map
// from source ports (single ports and multiports) on the left side of the
// connection to a set of destination ports (single ports and multiports)
// on the right side of the connection. The ports contained by the multiports
// are not represented.
for (Connection connection : reactorInstance.connections.keySet) {
// TODO check banks
val connections = reactorInstance.connections.get(connection);
for (leftPort : connections.keySet) {
val rightPorts = connections.get(leftPort);
for (rightPort : rightPorts) {
val source = if (leftPort.parent == reactorInstance) {
parentInputPorts.get(leftPort)
} else {
outputPorts.get(leftPort.parent, leftPort)
}
// First, collect all the source ports.
val sourcePorts = new LinkedList<PortInstance>(reactorInstance.inputs);
for (child : reactorInstance.children) {
sourcePorts.addAll(child.outputs);
}

for (leftPort : sourcePorts) {
val source = if (leftPort.parent == reactorInstance) {
parentInputPorts.get(leftPort)
} else {
outputPorts.get(leftPort.parent, leftPort)
}
for (sendRange : leftPort.dependentPorts) {
for (rightRange : sendRange.destinations) {
val rightPort = rightRange.instance;
val target = if (rightPort.parent == reactorInstance) {
parentOutputPorts.get(rightPort)
} else {
inputPorts.get(rightPort.parent, rightPort)
}
val edge = createIODependencyEdge(connection, leftPort.isMultiport() || rightPort.isMultiport())
if (connection.delay !== null) {
edge.addCenterEdgeLabel(connection.delay.toText) => [
associateWith(connection.delay)
if (connection.physical) {
applyOnEdgePysicalDelayStyle(
reactorInstance.mainOrFederated ? Colors.WHITE : Colors.GRAY_95)
} else {
applyOnEdgeDelayStyle()
}
]
} else if (connection.physical) {
edge.addCenterEdgeLabel("---").applyOnEdgePysicalStyle(
reactorInstance.mainOrFederated ? Colors.WHITE : Colors.GRAY_95)
}
if (source !== null && target !== null) {
// check for inside loop (direct in -> out connection with delay)
if (parentInputPorts.values.contains(source) && parentOutputPorts.values.contains(target)) {
// edge.setLayoutOption(CoreOptions.INSIDE_SELF_LOOPS_YO, true) // Does not work as expected
// Introduce dummy node to enable direct connection (that is also hidden when collapsed)
var dummy = createNode()
if (directConnectionDummyNodes.containsKey(target)) {
dummy = directConnectionDummyNodes.get(target)
// There should be a connection, but skip if not.
val connection = sendRange.connection;
if (connection !== null) {
val edge = createIODependencyEdge(connection, leftPort.isMultiport() || rightPort.isMultiport())
if (connection.delay !== null) {
edge.addCenterEdgeLabel(connection.delay.toText) => [
associateWith(connection.delay)
if (connection.physical) {
applyOnEdgePysicalDelayStyle(
reactorInstance.mainOrFederated ? Colors.WHITE : Colors.GRAY_95)
} else {
applyOnEdgeDelayStyle()
}
]
} else if (connection.physical) {
edge.addCenterEdgeLabel("---").applyOnEdgePysicalStyle(
reactorInstance.mainOrFederated ? Colors.WHITE : Colors.GRAY_95)
}
if (source !== null && target !== null) {
// check for inside loop (direct in -> out connection with delay)
if (parentInputPorts.values.contains(source) && parentOutputPorts.values.contains(target)) {
// edge.setLayoutOption(CoreOptions.INSIDE_SELF_LOOPS_YO, true) // Does not work as expected
// Introduce dummy node to enable direct connection (that is also hidden when collapsed)
var dummy = createNode()
if (directConnectionDummyNodes.containsKey(target)) {
dummy = directConnectionDummyNodes.get(target)
} else {
nodes += dummy
directConnectionDummyNodes.put(target, dummy)

dummy.addInvisibleContainerRendering()
dummy.setNodeSize(0, 0)

val extraEdge = createIODependencyEdge(null,
leftPort.isMultiport() || rightPort.isMultiport())
extraEdge.connect(dummy, target)
}
edge.connect(source, dummy)
} else {
nodes += dummy
directConnectionDummyNodes.put(target, dummy)

dummy.addInvisibleContainerRendering()
dummy.setNodeSize(0, 0)

val extraEdge = createIODependencyEdge(null,
leftPort.isMultiport() || rightPort.isMultiport())
extraEdge.connect(dummy, target)
edge.connect(source, target)
}
edge.connect(source, dummy)
} else {
edge.connect(source, target)
}
}
}
Expand Down Expand Up @@ -867,25 +855,18 @@ class LinguaFrancaSynthesis extends AbstractDiagramSynthesis<Model> {
}
}
if (reactorInstance.mainOrFederated) {
b.append(FileConfig.nameWithoutExtension(reactorInstance.reactorDefinition.eResource))
} else if (reactorInstance.reactorDefinition === null) {
b.append(FileConfig.nameWithoutExtension(reactorInstance.reactorDeclaration.eResource))
} else if (reactorInstance.reactorDeclaration === null) {
// There is an error in the graph.
b.append("<Unresolved Reactor>")
} else {
b.append(reactorInstance.reactorDefinition.name)
b.append(reactorInstance.reactorDeclaration.name)
}
if (REACTOR_PARAMETER_MODE.objectValue === ReactorParameterDisplayModes.TITLE) {
// If the reactor is a bank, then obtain the details from the first
// element of the bank rather than the bank itself.
val instance = if (reactorInstance.bankSize > 0) {
reactorInstance.bankMembers.get(0)
} else {
reactorInstance
}
if (instance.parameters.empty) {
if (reactorInstance.parameters.empty) {
b.append("()")
} else {
b.append(instance.parameters.join("(", ", ", ")") [
b.append(reactorInstance.parameters.join("(", ", ", ")") [
createParameterLabel(false)
])
}
Expand Down Expand Up @@ -920,8 +901,8 @@ class LinguaFrancaSynthesis extends AbstractDiagramSynthesis<Model> {
if (!t.nullOrEmpty) {
b.append(":").append(t)
}
if (!param.init.nullOrEmpty) {
b.append("(").append(param.init.join(", ", [it.toText])).append(")")
if (!param.getInitialValue.nullOrEmpty) {
b.append("(").append(param.getInitialValue.join(", ", [it.toText])).append(")")
}
return b.toString()
}
Expand Down Expand Up @@ -1058,8 +1039,9 @@ class LinguaFrancaSynthesis extends AbstractDiagramSynthesis<Model> {
}
if (SHOW_MULTIPORT_WIDTH.booleanValue) {
if (lfPort.isMultiport) {
// TODO Fix unresolvable references in ReactorInstance
label += "[" + lfPort.width + "]"
label += (lfPort.width >= 0)?
"[" + lfPort.width + "]"
: "[?]"
}
}
port.addOutsidePortLabel(label, 8).associateWith(lfPort.definition)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,16 @@ class LinguaFrancaShapeExtensions extends AbstractSynthesisExtensions {
val bank = newArrayList
val container = node.addInvisibleContainerRendering => [
// TODO handle unresolved width
val bankWidth = reactorInstance.bankSize//instance.widthSpec.width
addRoundedRectangle(8, 8, 1) => [
style.apply(it)
setAreaPlacementData().from(LEFT, BANK_FIGURE_X_OFFSET_SUM, 0, TOP, BANK_FIGURE_Y_OFFSET_SUM, 0).to(RIGHT, 0, 0, BOTTOM, 0, 0)
]
if (bankWidth === 3) {
if (reactorInstance.width === 3) {
addRoundedRectangle(8, 8, 1) => [
style.apply(it)
setAreaPlacementData().from(LEFT, BANK_FIGURE_X_OFFSET_SUM / 2, 0, TOP, BANK_FIGURE_Y_OFFSET_SUM / 2, 0).to(RIGHT, BANK_FIGURE_X_OFFSET_SUM / 2, 0, BOTTOM, BANK_FIGURE_Y_OFFSET_SUM / 2, 0)
]
} else if (bankWidth !== 2 && bankWidth !== 3) {
} else if (reactorInstance.width !== 2 && reactorInstance.width !== 3) {
addRoundedRectangle(8, 8, 1) => [
style.apply(it)
setAreaPlacementData().from(LEFT, 2 * BANK_FIGURE_X_OFFSET_SUM / 3, 0, TOP, 2 * BANK_FIGURE_Y_OFFSET_SUM / 3, 0).to(RIGHT, BANK_FIGURE_X_OFFSET_SUM / 3, 0, BOTTOM, BANK_FIGURE_Y_OFFSET_SUM / 3, 0)
Expand All @@ -229,9 +228,12 @@ class LinguaFrancaShapeExtensions extends AbstractSynthesisExtensions {
addRectangle() => [
invisible = true
setAreaPlacementData().from(LEFT, 12, 0, BOTTOM, 9, 0).to(RIGHT, 6, 0, BOTTOM, 0.5f, 0)
// TODO handle unresolved width
// Handle unresolved width.
val widthLabel = (reactorInstance.width >= 0)?
Integer.toString(reactorInstance.width)
: "?"
// addText(instance.widthSpec.toText) => [
addText(Integer.toString(reactorInstance.bankSize)) => [
addText(widthLabel) => [
horizontalAlignment = HorizontalAlignment.LEFT
verticalAlignment = VerticalAlignment.BOTTOM
fontSize = 6
Expand Down Expand Up @@ -296,13 +298,17 @@ class LinguaFrancaShapeExtensions extends AbstractSynthesisExtensions {
if (SHOW_REACTION_LEVEL.booleanValue) {
// Force calculation of levels for reactions. This calculation
// will only be done once. Note that if this fails due to a causality loop,
// then some reactions will have level -1.s
reaction.root().assignLevels();
contentContainer.addText("level: " + Long.toString(reaction.level)) => [
fontBold = false
noSelectionStyle
suppressSelectability
]
// then some reactions will have level -1.
try {
val levels = reaction.getLevels().join(", ");
contentContainer.addText("level: " + levels) => [
fontBold = false
noSelectionStyle
suppressSelectability
]
} catch (Exception ex) {
// If the graph has cycles, the above fails. Continue without showing levels.
}
}

// optional code content
Expand Down
Loading