From be2c70410a62de5aa05f972a90d690bcf3440774 Mon Sep 17 00:00:00 2001 From: Bob Caddy Date: Tue, 6 Feb 2024 16:46:29 -0500 Subject: [PATCH] Add initialization of variables to constructor --- src/reconstruction/reconstruction.h | 3 +++ src/utils/basic_structs.h | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/reconstruction/reconstruction.h b/src/reconstruction/reconstruction.h index 2fcbe8e19..b709b8edb 100644 --- a/src/reconstruction/reconstruction.h +++ b/src/reconstruction/reconstruction.h @@ -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; diff --git a/src/utils/basic_structs.h b/src/utils/basic_structs.h index e5adfd8c8..4dc49686c 100644 --- a/src/utils/basic_structs.h +++ b/src/utils/basic_structs.h @@ -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 }; }; // =====================================================================================================================