-
Notifications
You must be signed in to change notification settings - Fork 71
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
ENUM refactor #216
Open
Flavsditz
wants to merge
11
commits into
reilleya:staging
Choose a base branch
from
Flavsditz:enum_refactor
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ENUM refactor #216
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1988f19
moved fileIO existing enum into its own file and updated deps
Flavsditz 9f8968d
moved `SimAlertType` and `SimAlertLevel` existing enums into its own …
Flavsditz a85cd57
simplified code by making `SimAlertType` and `SimAlertLevel` use strings
Flavsditz 2d8efbd
fixed bug due to new version of matplotlib that likely also fixes iss…
Flavsditz 0107f16
Multi and Single Value channels extracted to ENUMs
Flavsditz 5c2752e
Units extracted into ENUMs
Flavsditz fd5f988
Extracted `InhibitedEnds` to its own ENUM
Flavsditz 4aa88b2
extracted other variables to enums and fixed file names to start with…
Flavsditz 72b7c19
fix for preferences loading
Flavsditz 7210a69
merged Unit files into single file
Flavsditz 826d408
removed superfluous comments
Flavsditz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from enum import Enum | ||
|
||
|
||
# Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
# https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
class InhibitedEnds(str, Enum): | ||
NEITHER = 'Neither' | ||
TOP = 'Top' | ||
BOTTOM = 'Bottom' | ||
BOTH = 'Both' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from enum import Enum | ||
|
||
|
||
# Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
# https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
class MultiValueChannels(str, Enum): | ||
MASS = 'mass' | ||
MASS_FLOW = 'massFlow' | ||
MASS_FLUX = 'massFlux' | ||
REGRESSION = 'regression' | ||
WEB = 'web' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from enum import Enum | ||
|
||
|
||
# Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
# https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
class SimAlertLevel(str, Enum): | ||
"""Levels of severity for sim alerts""" | ||
ERROR = 'Error' | ||
WARNING = 'Warning' | ||
MESSAGE = 'Message' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from enum import Enum | ||
|
||
# Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
# https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
class SimAlertType(str, Enum): | ||
"""Types of sim alerts""" | ||
GEOMETRY = 'Geometry' | ||
CONSTRAINT = 'Constraint' | ||
VALUE = 'Value' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from enum import Enum | ||
|
||
|
||
# Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
# https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
class SingleValueChannels(str, Enum): | ||
TIME = 'time' | ||
KN = 'kn' | ||
PRESSURE = 'pressure' | ||
FORCE = 'force' | ||
VOLUME_LOADING = 'volumeLoading' | ||
EXIT_PRESSURE = 'exitPressure' | ||
D_THROAT = 'dThroat' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
from enum import Enum | ||
|
||
|
||
# Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
# https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
class Unit(str, Enum): | ||
# Angle | ||
DEGREES = 'deg' | ||
|
||
# Burn Rate Coefficient | ||
METER_PER_SECOND_PASCAL_TO_THE_POWER_OF_N = 'm/(s*Pa^n)' | ||
INCH_PER_SECOND_POUND_PER_SQUARE_INCH_TO_THE_POWER_OF_N = 'in/(s*psi^n)' | ||
|
||
# Density | ||
KILOGRAM_PER_CUBIC_METER = 'kg/m^3' | ||
POUND_PER_CUBIC_INCH = 'lb/in^3' | ||
GRAM_PER_CUBIC_CENTIMETER = 'g/cm^3' | ||
|
||
# Force | ||
NEWTON = 'N' | ||
POUND_FORCE = 'lbf' | ||
|
||
# Impulse | ||
NEWTON_SECOND = 'Ns' | ||
POUND_FORCE_SECOND = 'lbfs' | ||
|
||
# Length | ||
METER = 'm' | ||
CENTIMETER = 'cm' | ||
MILLIMETER = 'mm' | ||
INCH = 'in' | ||
FOOT = 'ft' | ||
|
||
# Mass Flow | ||
KILOGRAM_PER_SECOND = 'kg/s' | ||
POUND_PER_SECOND = 'lb/s' | ||
GRAM_PER_SECOND = 'g/s' | ||
|
||
# Mass Flux | ||
KILOGRAM_PER_SQUARE_METER_PER_SECOND = 'kg/(m^2*s)' | ||
POUND_PER_SQUARE_INCH_PER_SECOND = 'lb/(in^2*s)' | ||
|
||
# Mass | ||
KILOGRAM = 'kg' | ||
GRAM = 'g' | ||
POUND = 'lb' | ||
OUNCE = 'oz' | ||
GRAM_PER_MOLE = 'g/mol' | ||
|
||
# Nozzle Erosion Coefficient | ||
METER_PER_SECOND_PASCAL = 'm/(s*Pa)' | ||
METER_PER_SECOND_MEGAPASCAL = 'm/(s*MPa)' | ||
THOUSANDTH_INCH_PER_SECOND_POUND_PER_SQUARE_INCH = 'thou/(s*psi)' | ||
|
||
# Nozzle Slag Coefficient | ||
METER_PASCAL_PER_SECOND = '(m*Pa)/s' | ||
METER_MEGAPASCAL_PER_SECOND = '(m*MPa)/s' | ||
INCH_POUND_PER_SQUARE_INCH_PER_SECOND = '(in*psi)/s' | ||
|
||
# Pressure | ||
PASCAL = 'Pa' | ||
MEGAPASCAL = 'MPa' | ||
POUND_PER_SQUARE_INCH = 'psi' | ||
|
||
# Temperature | ||
KELVIN = 'K' | ||
|
||
# Time | ||
SECOND = 's' | ||
|
||
# Velocity | ||
METER_PER_SECOND = 'm/s' | ||
CENTIMETER_PER_SECOND = 'cm/s' | ||
MILLIMETER_PER_SECOND = 'mm/s' | ||
FOOT_PER_SECOND = 'ft/s' | ||
INCH_PER_SECOND = 'in/s' | ||
|
||
# Volume | ||
CUBIC_METER = 'm^3' | ||
CUBIC_CENTIMETER = 'cm^3' | ||
CUBIC_MILLIMETER = 'mm^3' | ||
CUBIC_INCH = 'in^3' | ||
CUBIC_FOOT = 'ft^3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should try to take this opportunity to make a migration that converts "top"->"forward" and "bottom"->"aft".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see this would only be present on the
.ric
files. Is this assumption correct?So that the necessary migration can be done I don't want to miss anything.
Any chance for a more complex
.ric
file to be made available so I can use it for testing too?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay! Here's a kind of silly example that uses all 4 inhibitor configurations:
![image](https://private-user-images.githubusercontent.com/9787344/249334475-192eb371-f096-4480-9d5a-718f3acd6b3f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0MDEyMzQsIm5iZiI6MTcyNTQwMDkzNCwicGF0aCI6Ii85Nzg3MzQ0LzI0OTMzNDQ3NS0xOTJlYjM3MS1mMDk2LTQ0ODAtOWQ1YS03MThmM2FjZDZiM2YucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDNUMjIwMjE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Mjc4YjIxZjIyNzZkZTliNWY5Y2M1YzE2ZDAzYTIwMDY0MTYyZDQzODI0ZmJmYzcwM2RkZDNlYWZlZjViMTYyMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.Vn8n2UarWJTqWcArlntSbD0A33INsg9dTLzUPm2Vn4w)
example.ric.txt
and what it looks like on my end, so you can verify nothing changed: