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

Update Newtonian Euler interface #1390

Merged
merged 6 commits into from Mar 11, 2019

Conversation

carmaza
Copy link
Contributor

@carmaza carmaza commented Feb 24, 2019

Proposed changes

Types of changes:

  • Bugfix
  • New feature

Component:

  • Code
  • Documentation
  • Build system
  • Continuous integration

Code review checklist

  • The PR passes all checks, including unit tests, clang-tidy and IWYU.
    For instructions on how to perform the CI checks locally refer to the Dev
    guide on the Travis CI
    .
  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.

Further comments

@nilsdeppe
Copy link
Member

Could you please add descriptions to your PRs in the future that summarize the changes?

Copy link
Member

@nilsdeppe nilsdeppe left a 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

src/Evolution/Systems/NewtonianEuler/Characteristics.hpp Outdated Show resolved Hide resolved
Scalar<DataType> sound_speed_squared(
const Scalar<DataType>& mass_density,
const Scalar<DataType>& specific_internal_energy,
const EquationOfStateType& equation_of_state) noexcept;
Copy link
Member

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.

Copy link
Member

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>
Copy link
Contributor

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

Copy link
Contributor

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 👍

@carmaza carmaza force-pushed the ne_update_equations branch 2 times, most recently from 0a49dd3 to 79db247 Compare March 2, 2019 22:36
@carmaza
Copy link
Contributor Author

carmaza commented Mar 2, 2019

Squashed and rebased on develop.

@carmaza carmaza added the updated all comments addressed, ready for re-review label Mar 2, 2019
// 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
Copy link
Member

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;
Copy link
Member

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.

Copy link
Member

@nilsdeppe nilsdeppe left a 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)
@carmaza carmaza force-pushed the ne_update_equations branch 3 times, most recently from e4c9a64 to 106cf33 Compare March 7, 2019 20:57
@kidder
Copy link
Member

kidder commented Mar 11, 2019

Current status:

  • @gsb76 needs to review

Copy link
Contributor

@mar-celine mar-celine left a 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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be const?

Copy link
Member

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,
Copy link
Contributor

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

Copy link
Member

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 {
Copy link
Contributor

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.

Copy link
Member

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!

@nilsdeppe
Copy link
Member

@gsb76 let me know if you're happy with my responses :)

@nilsdeppe nilsdeppe merged commit aaf5e0c into sxs-collaboration:develop Mar 11, 2019
@carmaza carmaza deleted the ne_update_equations branch April 1, 2019 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
updated all comments addressed, ready for re-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants