Skip to content

Commit

Permalink
Fix naming of eigenVecs struct to EigenVecs
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaddy committed Jul 14, 2023
1 parent c6cb442 commit a43e632
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/reconstruction/plmc_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ __global__ __launch_bounds__(TPB) void PLMC_cuda(Real *dev_conserved, Real *dev_

// Compute the eigenvectors
#ifdef MHD
reconstruction::eigenVecs const eigenvectors =
reconstruction::EigenVecs const eigenvectors =
reconstruction::Compute_Eigenvectors(cell_i, sound_speed, sound_speed_squared, gamma);
#else
reconstruction::eigenVecs eigenvectors;
reconstruction::EigenVecs eigenvectors;
#endif // MHD

// Compute the left, right, centered, and van Leer differences of the
Expand Down
6 changes: 3 additions & 3 deletions src/reconstruction/ppmc_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun
Real sound_speed = hydro_utilities::Calc_Sound_Speed(cell_im1.pressure, cell_im1.density, gamma);
// this isn't actually used and the compiler should optimize it away but since this is the only reconstruction
// function that won't use it it was easier to add it here as an unused variable
reconstruction::eigenVecs eigenvector;
reconstruction::EigenVecs eigenvector;

// Step 2 - Compute the left, right, centered, and van Leer differences of the primitive variables. Note that here L
// and R refer to locations relative to the cell center Stone Eqn 36
Expand Down Expand Up @@ -608,10 +608,10 @@ __global__ __launch_bounds__(TPB) void PPMC_VL(Real *dev_conserved, Real *dev_bo
Real const sound_speed_squared = sound_speed * sound_speed;

#ifdef MHD
reconstruction::eigenVecs eigenvectors =
reconstruction::EigenVecs eigenvectors =
reconstruction::Compute_Eigenvectors(cell_i, sound_speed, sound_speed_squared, gamma);
#else
reconstruction::eigenVecs eigenvectors;
reconstruction::EigenVecs eigenvectors;
#endif // MHD

// Cell i
Expand Down
16 changes: 8 additions & 8 deletions src/reconstruction/reconstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct Primitive {
// =====================================================================================================================

// =====================================================================================================================
struct eigenVecs {
struct EigenVecs {
Real magnetosonic_speed_fast, magnetosonic_speed_slow, magnetosonic_speed_fast_squared,
magnetosonic_speed_slow_squared;
Real alpha_fast, alpha_slow;
Expand Down Expand Up @@ -263,13 +263,13 @@ Primitive __device__ __host__ __inline__ Van_Leer_Slope(Primitive const &left_sl
* \param[in] sound_speed The sound speed
* \param[in] sound_speed_squared The sound speed squared
* \param[in] gamma The adiabatic index
* \return eigenVecs
* \return EigenVecs
*/
#ifdef MHD
eigenVecs __device__ __inline__ Compute_Eigenvectors(Primitive const &primitive, Real const &sound_speed,
EigenVecs __device__ __inline__ Compute_Eigenvectors(Primitive const &primitive, Real const &sound_speed,
Real const &sound_speed_squared, Real const &gamma)
{
eigenVecs output;
EigenVecs output;
// This is taken from Stone et al. 2008, appendix A. Equation numbers will be quoted as relevant

// Compute wave speeds and their squares
Expand Down Expand Up @@ -328,15 +328,15 @@ eigenVecs __device__ __inline__ Compute_Eigenvectors(Primitive const &primitive,
*
* \param[in] primitive The primitive variables
* \param[in] primitive_slope The primitive variables slopes
* \param[in] eigenVecs The eigenvectors
* \param[in] EigenVecs The eigenvectors
* \param[in] sound_speed The speed of sound
* \param[in] sound_speed_squared The speed of sound squared
* \param[in] gamma The adiabatic index
* \return Characteristic
*/
Characteristic __device__ __inline__ Primitive_To_Characteristic(Primitive const &primitive,
Primitive const &primitive_slope,
eigenVecs const &eigen, Real const &sound_speed,
EigenVecs const &eigen, Real const &sound_speed,
Real const &sound_speed_squared, Real const &gamma)
{
Characteristic output;
Expand Down Expand Up @@ -408,7 +408,7 @@ Characteristic __device__ __inline__ Primitive_To_Characteristic(Primitive const
*/
Primitive __device__ __host__ __inline__ Characteristic_To_Primitive(Primitive const &primitive,
Characteristic const &characteristic_slope,
eigenVecs const &eigen, Real const &sound_speed,
EigenVecs const &eigen, Real const &sound_speed,
Real const &sound_speed_squared, Real const &gamma)
{
Primitive output;
Expand Down Expand Up @@ -471,7 +471,7 @@ Primitive __device__ __host__ __inline__ Characteristic_To_Primitive(Primitive c
Primitive __device__ __inline__ Monotonize_Characteristic_Return_Primitive(
Primitive const &primitive, Primitive const &del_L, Primitive const &del_R, Primitive const &del_C,
Primitive const &del_G, Characteristic const &del_a_L, Characteristic const &del_a_R, Characteristic const &del_a_C,
Characteristic const &del_a_G, eigenVecs const &eigenvectors, Real const &sound_speed,
Characteristic const &del_a_G, EigenVecs const &eigenvectors, Real const &sound_speed,
Real const &sound_speed_squared, Real const &gamma)
{
// The function that will actually do the monotozation
Expand Down
20 changes: 10 additions & 10 deletions src/reconstruction/reconstruction_tests.cu
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#ifdef MHD
__global__ void test_prim_2_char(reconstruction::Primitive const primitive,
reconstruction::Primitive const primitive_slope,
reconstruction::eigenVecs const eigenvectors, Real const gamma, Real const sound_speed,
reconstruction::EigenVecs const eigenvectors, Real const gamma, Real const sound_speed,
Real const sound_speed_squared, reconstruction::Characteristic *characteristic_slope)
{
*characteristic_slope = reconstruction::Primitive_To_Characteristic(primitive, primitive_slope, eigenvectors,
Expand All @@ -33,7 +33,7 @@ __global__ void test_prim_2_char(reconstruction::Primitive const primitive,

__global__ void test_char_2_prim(reconstruction::Primitive const primitive,
reconstruction::Characteristic const characteristic_slope,
reconstruction::eigenVecs const eigenvectors, Real const gamma, Real const sound_speed,
reconstruction::EigenVecs const eigenvectors, Real const gamma, Real const sound_speed,
Real const sound_speed_squared, reconstruction::Primitive *primitive_slope)
{
*primitive_slope = reconstruction::Characteristic_To_Primitive(primitive, characteristic_slope, eigenvectors,
Expand All @@ -42,7 +42,7 @@ __global__ void test_char_2_prim(reconstruction::Primitive const primitive,

__global__ void test_compute_eigenvectors(reconstruction::Primitive const primitive, Real const sound_speed,
Real const sound_speed_squared, Real const gamma,
reconstruction::eigenVecs *eigenvectors)
reconstruction::EigenVecs *eigenvectors)
{
*eigenvectors = reconstruction::Compute_Eigenvectors(primitive, sound_speed, sound_speed_squared, gamma);
}
Expand All @@ -53,7 +53,7 @@ TEST(tMHDReconstructionPrimitive2Characteristic, CorrectInputExpectCorrectOutput
Real const &gamma = 5. / 3.;
reconstruction::Primitive const primitive{1, 2, 3, 4, 5, 6, 7, 8};
reconstruction::Primitive const primitive_slope{9, 10, 11, 12, 13, 14, 15, 16};
reconstruction::eigenVecs const eigenvectors{
reconstruction::EigenVecs const eigenvectors{
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
};
Real const sound_speed = hydro_utilities::Calc_Sound_Speed(primitive.pressure, primitive.density, gamma);
Expand Down Expand Up @@ -84,7 +84,7 @@ TEST(tMHDReconstructionCharacteristic2Primitive, CorrectInputExpectCorrectOutput
Real const &gamma = 5. / 3.;
reconstruction::Primitive const primitive{1, 2, 3, 4, 5, 6, 7, 8};
reconstruction::Characteristic const characteristic_slope{17, 18, 19, 20, 21, 22, 23};
reconstruction::eigenVecs const eigenvectors{
reconstruction::EigenVecs const eigenvectors{
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
};
Real const sound_speed = hydro_utilities::Calc_Sound_Speed(primitive.pressure, primitive.density, gamma);
Expand Down Expand Up @@ -119,12 +119,12 @@ TEST(tMHDReconstructionComputeEigenvectors, CorrectInputExpectCorrectOutput)
Real const sound_speed_squared = sound_speed * sound_speed;

// Run test
cuda_utilities::DeviceVector<reconstruction::eigenVecs> dev_results(1);
cuda_utilities::DeviceVector<reconstruction::EigenVecs> dev_results(1);
hipLaunchKernelGGL(test_compute_eigenvectors, 1, 1, 0, 0, primitive, sound_speed, sound_speed_squared, gamma,
dev_results.data());
CudaCheckError();
cudaDeviceSynchronize();
reconstruction::eigenVecs const host_results = dev_results.at(0);
reconstruction::EigenVecs const host_results = dev_results.at(0);
// std::cout << to_string_exact(host_results.magnetosonic_speed_fast) << ",";
// std::cout << to_string_exact(host_results.magnetosonic_speed_slow) << ",";
// std::cout << to_string_exact(host_results.magnetosonic_speed_fast_squared) << ",";
Expand All @@ -144,7 +144,7 @@ TEST(tMHDReconstructionComputeEigenvectors, CorrectInputExpectCorrectOutput)
// std::cout << to_string_exact(host_results.a_prime_fast) << ",";
// std::cout << to_string_exact(host_results.a_prime_slow) << "," << std::endl;
// Check results
reconstruction::eigenVecs const fiducial_results{
reconstruction::EigenVecs const fiducial_results{
12.466068627219666, 1.3894122191714398, 155.40286701855041, 1.9304663147829049, 0.20425471836256681,
0.97891777490585408, 0.65850460786851805, 0.75257669470687782, 0.059999999999999984, 1,
2.546253336541183, 1.3601203180183106, 0.58963258314939582, 2.825892204282022, 0.15277520019247093,
Expand Down Expand Up @@ -297,7 +297,7 @@ __global__ void test_monotize_characteristic_return_primitive(
reconstruction::Primitive const del_R, reconstruction::Primitive const del_C, reconstruction::Primitive const del_G,
reconstruction::Characteristic const del_a_L, reconstruction::Characteristic const del_a_R,
reconstruction::Characteristic const del_a_C, reconstruction::Characteristic const del_a_G,
reconstruction::eigenVecs const eigenvectors, Real const sound_speed, Real const sound_speed_squared,
reconstruction::EigenVecs const eigenvectors, Real const sound_speed, Real const sound_speed_squared,
Real const gamma, reconstruction::Primitive *monotonized_slope)
{
*monotonized_slope = reconstruction::Monotonize_Characteristic_Return_Primitive(
Expand Down Expand Up @@ -330,7 +330,7 @@ TEST(tALLReconstructionMonotonizeCharacteristicReturnPrimitive, CorrectInputExpe
#endif // MHD
Real const sound_speed = 17.0, sound_speed_squared = sound_speed * sound_speed;
Real const gamma = 5. / 3.;
reconstruction::eigenVecs const eigenvectors{
reconstruction::EigenVecs const eigenvectors{
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
};

Expand Down

0 comments on commit a43e632

Please sign in to comment.