-
Notifications
You must be signed in to change notification settings - Fork 4
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
Return physical constants object from opacities #52
Conversation
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.
This is a nice idea. Unfortunate we can't output the constants with a static method though... I feel like that's much more likely the model we'd want in, e.g., Phoebus. Are you sure you can't do static constexpr
to output the object?
The issue I ultimately couldn't avoid was having a variant method that's like PORTABLE_INLINE_FUNCTION
auto GetPhysicalConstants() const {
return mpark::visit[](... opac.GetPhysicalConstants();
} because type deduction for the return value fails because it'll necessarily be different We may want to leave My workaround is to have a |
Yeah I think your workaround is reasonable. I wonder if an alternative workaround is if the unit system modifier lives on top of the variant, so the return type is known and no visit is required? I.e., an individual opacity doesn't own the unit system, the variant itself does? |
I think the issue with doing that is that in a downstream code youll then have to template on the unit system, so you'd have to either have one unit system at compile time or template your whole code on the unit system. Stop me if I'm not seeing a way around that though. |
Ah yeah you're right. Let's leave it then. |
It would be nice to see the physical constants being used by
singularity-opac
in downstream codes for consistency. This PR provides a way to do that, although we lose theconstexpr
ness of the constants with this approach (templating the variant to makeReturnPhysicalConstants
astatic
method appears to be a tricky proposition).