Skip to content

Commit

Permalink
Add initialization of variables to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaddy committed Feb 8, 2024
1 parent 6c04b29 commit be2c704
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/reconstruction/reconstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ struct InterfaceState {
Real const in_total_pressure = 0.0)
: density(in_density), velocity(in_velocity), energy(in_energy), pressure(in_pressure)
{
momentum.x = velocity.x * density;
momentum.y = velocity.y * density;
momentum.z = velocity.z * density;
#ifdef MHD
magnetic = in_magnetic;
total_pressure = in_total_pressure;
Expand Down
6 changes: 5 additions & 1 deletion src/utils/basic_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@ struct Primitive {
Primitive() = default;
/// Manual constructor, mostly used for testing and doesn't init all members
Primitive(Real const in_density, Vector const &in_velocity, Real const in_pressure,
Vector const &in_magnetic = {0, 0, 0})
Vector const &in_magnetic = {0, 0, 0}, Real const in_gas_energy_specific = 0.0)
: density(in_density), velocity(in_velocity), pressure(in_pressure)
{
#ifdef MHD
magnetic = in_magnetic;
#endif // mhd

#ifdef DE
gas_energy_specific = in_gas_energy_specific;
#endif // DE
};
};
// =====================================================================================================================
Expand Down

0 comments on commit be2c704

Please sign in to comment.