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

Adjustable port sides for reactors #1807

Merged
merged 5 commits into from
Jun 10, 2023
Merged

Adjustable port sides for reactors #1807

merged 5 commits into from
Jun 10, 2023

Conversation

a-sr
Copy link
Collaborator

@a-sr a-sr commented Jun 1, 2023

Introduces a new attribute @side that influences the side of a reactor port in the diagram.

reactor IO {
    input I1:int
    @side("east")
    input I2:int
    
    output O1:int
    @side("west")
    output O2:int
}

main reactor {
    a = new IO()
    b = new IO()
    
    a.O1 -> b.I1
    b.O1 -> a.I1
    a.O2 -> b.I2
    b.O2 -> a.I2
}

port-side

Additionally, there is a new synthesis option (in the Layout category) named "Fixed Reactor Port Side". If inactive, the layout algorithm will decide the best location for ports. However, this will ignore the user attribute because the current layout algorithm does not support mixed constraints.
The result for the example above will look like this:

port-side-free

@a-sr a-sr added enhancement Enhancement of existing feature diagrams Problems with diagram synthesis labels Jun 1, 2023
@a-sr a-sr requested review from lhstrh and edwardalee June 1, 2023 09:10
Copy link
Collaborator

@edwardalee edwardalee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! Minor suggestion made for docs. Also, I guess the formatter needs to be applied to get the test to pass.

org.lflang/src/org/lflang/AttributeUtils.java Outdated Show resolved Hide resolved
@lhstrh
Copy link
Member

lhstrh commented Jun 2, 2023

I'm guessing that the strings "north", "east", etc. are the ones required by ELK? I would have opted for "top", "left", etc. but I guess it's easy enough to get used to...

Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty cool! Haven't yet had a chance to try it out, but this looks good :-)

@lhstrh lhstrh added this pull request to the merge queue Jun 10, 2023
Merged via the queue into master with commit 8382d5a Jun 10, 2023
@lhstrh lhstrh deleted the port-sides branch June 10, 2023 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagrams Problems with diagram synthesis enhancement Enhancement of existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants