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
Update Newtonian Euler interface #1390
Update Newtonian Euler interface #1390
Conversation
Could you please add descriptions to your PRs in the future that summarize the changes? |
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.
A few comments, nothing major. I'm happy with you squashing immediately
Scalar<DataType> sound_speed_squared( | ||
const Scalar<DataType>& mass_density, | ||
const Scalar<DataType>& specific_internal_energy, | ||
const EquationOfStateType& equation_of_state) noexcept; |
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.
It looks like you couldn't get this to work with the base class. Could you file an issue to get this resolved in the future? I don't want to block progress on the executable for that, though.
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.
Maybe you and I can talk about this tomorrow. I think one way to get around the templating issue would be to make the function take the base class and have the compute item function
be a template for a generic EoS, then upcast to the base class. This'll mean you don't need an instantiation for each EoS while also not needing to put the function in a header.
@@ -8,66 +8,39 @@ | |||
#include "DataStructures/Tensor/Tensor.hpp" | |||
#include "Utilities/GenerateInstantiations.hpp" | |||
#include "Utilities/Gsl.hpp" | |||
#include "Utilities/MakeWithValue.hpp" | |||
|
|||
// IWYU pragma: no_include <array> |
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.
Need to add a blank line between no_include pragmas and no_forward_declare pragmas as in #1389
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.
You can squash in my fix immediately as well 👍
0a49dd3
to
79db247
Compare
Squashed and rebased on develop. |
79db247
to
280363a
Compare
// IWYU pragma: no_forward_declare EquationsOfState::EquationOfState | ||
// IWYU pragma: no_forward_declare NewtonianEuler::Tags::MassDensity | ||
// IWYU pragma: no_forward_declare NewtonianEuler::Tags::Velocity | ||
// IWYU pragma: no_forward_declare NewtonianEuler::Tags::SoundSpeed |
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.
We're probably not consistent about this in the code, but could you alphabetize these?
Scalar<DataType> sound_speed_squared( | ||
const Scalar<DataType>& mass_density, | ||
const Scalar<DataType>& specific_internal_energy, | ||
const EquationOfStateType& equation_of_state) noexcept; |
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.
Maybe you and I can talk about this tomorrow. I think one way to get around the templating issue would be to make the function take the base class and have the compute item function
be a template for a generic EoS, then upcast to the base class. This'll mean you don't need an instantiation for each EoS while also not needing to put the function in a header.
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'm happy for you to squash the last minor comments.
@gsb76 could you please review?
- Change routine from a free function to a struct with apply - Remove `double` support (now only supports DataVector)
- Change routine from a free function to a struct with apply - Remove `double` support (now only supports DataVector)
e4c9a64
to
106cf33
Compare
- Change routine from a free function to a struct with apply - Second argument is now sound speed
106cf33
to
151fb6d
Compare
Current status:
|
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.
You can squash in my changes 👍
|
||
static void apply( | ||
gsl::not_null<tnsr::I<DataVector, Dim>*> momentum_density, |
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.
Should these be const?
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.
Good question! No, because this is a declaration, not definition
Tags::MomentumDensity<DataVector, Dim>, | ||
Tags::EnergyDensity<DataVector>>; | ||
|
||
static void apply(gsl::not_null<tnsr::I<DataVector, Dim>*> velocity, |
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.
And here
@@ -33,9 +52,37 @@ namespace NewtonianEuler { | |||
* and \f$c_s\f$ is the sound speed. | |||
*/ | |||
template <size_t Dim> | |||
void characteristic_speeds( | |||
gsl::not_null<std::array<DataVector, Dim + 2>*> char_speeds, |
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.
And here
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.
Good question! No, because this is a declaration, not definition
@@ -26,10 +26,13 @@ namespace { | |||
|
|||
template <size_t Dim> | |||
void test_characteristic_speeds(const DataVector& used_for_size) noexcept { |
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.
Should this be marked noexcept? I think we've been leaving out noexcept for things that call pypp.
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.
We've been inconsistent in tests whether or not we mark things noexcept
. We agreed long ago that it's not required in testing code but also not wrong to do so. Another good question!
@gsb76 let me know if you're happy with my responses :) |
Proposed changes
Types of changes:
Component:
Code review checklist
clang-tidy
andIWYU
.For instructions on how to perform the CI checks locally refer to the Dev
guide on the Travis CI.
make doc
to generate the documentation locally intoBUILD_DIR/docs/html
.Then open
index.html
.code review guide.
Further comments