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

Enum type of input parameter #489

Closed
friedmud opened this issue Feb 14, 2014 · 5 comments
Closed

Enum type of input parameter #489

friedmud opened this issue Feb 14, 2014 · 5 comments
Assignees
Labels
C: Framework T: task An enhancement to the software.

Comments

@friedmud
Copy link
Contributor

I would like to figure out some way to do an enumerated type of input parameter. Something where you have multiple choices... and when the input file syntax prints out it shows you the choices... and if you supply something other than one of the choices there is an error.

I honestly don't know quite how to achieve this... but it must be possible!

@ghost ghost assigned permcody Feb 14, 2014
@permcody
Copy link
Member

If you remember off the top of your head let me know what objects this is already happening in so I have a good starting point

@permcody
Copy link
Member

I've looked into this and don't believe there is a completely transparent way to accomplish this. There doesn't exist a way to get back all valid options from a raw enum in C++. We could however create a MOOSE_Enum or some other wrapped class where we could do something like this. I'm reclassifying priority for now.

@permcody
Copy link
Member

We've now talked about this some more and believe that we should go ahead and create a MooseEnum type that does all the right stuff. Reclassifying the priority up again.

@friedmud
Copy link
Contributor Author

I'm attaching a quick mockup of a class and driver that might provide a solution. It allows you to create an "enum" inline and still use it in a switch statement.

@permcody
Copy link
Member

In 892df73:

Adding MooseEnum - closes #489

permcody added a commit that referenced this issue Feb 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Framework T: task An enhancement to the software.
Projects
None yet
Development

No branches or pull requests

2 participants