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

Permit user to select source terms by passed string #27

Open
nicholasmalaya opened this issue Apr 1, 2015 · 2 comments
Open

Permit user to select source terms by passed string #27

nicholasmalaya opened this issue Apr 1, 2015 · 2 comments
Milestone

Comments

@nicholasmalaya
Copy link
Member

Presently, MASA requires calling a specific method for each source term, e.g.

exact_u   = masa_eval_exact_u     (tempx,tempy);
exact_p   = masa_eval_exact_p     (tempx,tempy);

etc.

We won't break old functionality, but adding a generic source and exact term that parses a string to select which term to evaluate would be nifty. This would then look like,

exact_u   = masa_eval_exact     ("u",tempx,tempy);
exact_p   = masa_eval_exact     ("p",tempx,tempy);

No rubber to road yet, so we can plan this out, happy for any feedback/suggestions. Under the hood I'm inclined to build a map between string and a pointer to source/exact functions, e.g. "u":"masa_eval_exact_u()", after which this method calls the appropriate function evaluated at the points it was given. The trick is that we have man different methods due to the numerous overloaded functions for the various dimensionality we might have. We could circumvent this by pointing the map to a container of all the available functions for that variable and then selecting only the one that has the appropriate dimensionality, but I suspect there is a more elegant solution available.

This was an old MASA svn ticket that is being resurrected for @pbauman and @vikramgarg.

@nicholasmalaya nicholasmalaya added this to the 0.50 milestone Apr 1, 2015
@dmcdougall
Copy link
Member

What should be the behaviour if I pass "foo" and there is no foo source term?

@nicholasmalaya
Copy link
Member Author

I'm inclined to output a message to the log (e.g. "MASA ERROR: No such source term") and call masa_exit(1) -- this is how we handle the user attempting to initialize a non-existent solution.

If the user has enabled exception handling in masa, they can catch this, otherwise it calls exit and ends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants