Skip to content

Commit

Permalink
Add a constructor to hydro_utilities::Conserved
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaddy committed Feb 13, 2024
1 parent 5068c62 commit 856ce96
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/utils/basic_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ struct Conserved {
#ifdef SCALAR
Real scalar[grid_enum::nscalars];
#endif // SCALAR

/// Default constructor, should init everything to zero
Conserved() = default;
/// Manual constructor, mostly used for testing and doesn't init all members
Conserved(Real const in_density, Vector const &in_momentum, Real const in_energy,
Vector const &in_magnetic = {0, 0, 0}, Real const in_gas_energy = 0.0)
: density(in_density), momentum(in_momentum), energy(in_energy)
{
#ifdef MHD
magnetic = in_magnetic;
#endif // mhd

#ifdef DE
gas_energy = in_gas_energy;
#endif // DE
};
};
// =====================================================================================================================

Expand Down

0 comments on commit 856ce96

Please sign in to comment.