From 3ecde7c478cc12a53791753eb04b236b1b7d9f02 Mon Sep 17 00:00:00 2001 From: Matthew Abruzzo Date: Fri, 26 Jul 2024 11:09:51 -0400 Subject: [PATCH] satisfy clang-tidy and clang-format --- src/gravity/grav3D.cpp | 4 +-- src/gravity/grav3D.h | 4 +-- src/grid/spatial_domain_props.cpp | 34 ++++++++++++------------- src/grid/spatial_domain_props.h | 24 ++++++++--------- src/particles/density_boundaries_gpu.cu | 4 +-- src/particles/particles_3D.cpp | 14 +++++----- src/particles/particles_3D.h | 6 ++--- src/particles/particles_boundaries.cpp | 4 +-- 8 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/gravity/grav3D.cpp b/src/gravity/grav3D.cpp index 9234b2199..8f29c51a1 100644 --- a/src/gravity/grav3D.cpp +++ b/src/gravity/grav3D.cpp @@ -16,8 +16,8 @@ Grav3D::Grav3D(void) {} -void Grav3D::Initialize(const SpatialDomainProps& spatial_props, Real Lx, Real Ly, Real Lz, - int n_ghost_pot_offset, Parameters *P) +void Grav3D::Initialize(const SpatialDomainProps &spatial_props, Real Lx, Real Ly, Real Lz, int n_ghost_pot_offset, + Parameters *P) { // Set Box Size Lbox_x = Lx; diff --git a/src/gravity/grav3D.h b/src/gravity/grav3D.h index bbb3cf733..8e71b6983 100644 --- a/src/gravity/grav3D.h +++ b/src/gravity/grav3D.h @@ -192,8 +192,8 @@ class Grav3D /*! \fn void Initialize(int nx_in, int ny_in, int nz_in) * \brief Initialize the grid. */ - void Initialize(const SpatialDomainProps& spatial_props, Real Lx, Real Ly, Real Lz, - int n_ghost_pot_offset, struct Parameters *P); + void Initialize(const SpatialDomainProps &spatial_props, Real Lx, Real Ly, Real Lz, int n_ghost_pot_offset, + struct Parameters *P); void AllocateMemory_CPU(void); void Initialize_values_CPU(); diff --git a/src/grid/spatial_domain_props.cpp b/src/grid/spatial_domain_props.cpp index 7f64875fd..132c897ba 100644 --- a/src/grid/spatial_domain_props.cpp +++ b/src/grid/spatial_domain_props.cpp @@ -1,4 +1,5 @@ #include "../grid/spatial_domain_props.h" + #include "../gravity/grav3D.h" #include "../grid/grid3D.h" @@ -31,34 +32,33 @@ SpatialDomainProps SpatialDomainProps::From_Grav3D(Grav3D& grav) return out; } -SpatialDomainProps SpatialDomainProps::From_Grid3D(Grid3D& grid, struct Parameters * P) +SpatialDomainProps SpatialDomainProps::From_Grid3D(Grid3D& grid, struct Parameters* P) { - SpatialDomainProps out; // Set Box Left boundary positions - out.xMin = grid.H.xblocal; // x_min - out.yMin = grid.H.yblocal; // y_min - out.zMin = grid.H.zblocal; // z_min + out.xMin = grid.H.xblocal; // x_min + out.yMin = grid.H.yblocal; // y_min + out.zMin = grid.H.zblocal; // z_min // Set Box Right boundary positions - out.xMax = grid.H.xblocal_max; //x_max; - out.yMax = grid.H.yblocal_max; //y_max; - out.zMax = grid.H.zblocal_max; //z_max; + out.xMax = grid.H.xblocal_max; // x_max; + out.yMax = grid.H.yblocal_max; // y_max; + out.zMax = grid.H.zblocal_max; // z_max; // Set uniform ( dx, dy, dz ) - out.dx = grid.H.dx; // dx_real; - out.dy = grid.H.dy; // dy_real; - out.dz = grid.H.dz; // dz_real; + out.dx = grid.H.dx; // dx_real; + out.dy = grid.H.dy; // dy_real; + out.dz = grid.H.dz; // dz_real; // Set Box Total number of cells - out.nx_total = P->nx; // nx; - out.ny_total = P->ny; // ny; - out.nz_total = P->nz; // nz; + out.nx_total = P->nx; // nx; + out.ny_total = P->ny; // ny; + out.nz_total = P->nz; // nz; // Set Box local domain number of cells - out.nx_local = grid.H.nx_real; // nx_real; - out.ny_local = grid.H.ny_real; // ny_real; - out.nz_local = grid.H.nz_real; // nz_real; + out.nx_local = grid.H.nx_real; // nx_real; + out.ny_local = grid.H.ny_real; // ny_real; + out.nz_local = grid.H.nz_real; // nz_real; return out; }; \ No newline at end of file diff --git a/src/grid/spatial_domain_props.h b/src/grid/spatial_domain_props.h index 55e4c6d95..6527dd4a2 100644 --- a/src/grid/spatial_domain_props.h +++ b/src/grid/spatial_domain_props.h @@ -12,21 +12,21 @@ struct Parameters; * another. (But it may make sense to refactor other parts of the code in terms of this object) */ struct SpatialDomainProps { - // number of cells in the local domain - int nx_local, ny_local, nz_local; + // number of cells in the local domain + int nx_local, ny_local, nz_local; - // total number of cells in the entire (global) domain - int nx_total, ny_total, nz_total; + // total number of cells in the entire (global) domain + int nx_total, ny_total, nz_total; - // Left boundaries of the local domain - Real xMin, yMin, zMin; + // Left boundaries of the local domain + Real xMin, yMin, zMin; - // Right boundaries of the local domain - Real xMax, yMax, zMax; + // Right boundaries of the local domain + Real xMax, yMax, zMax; - // cell widths - Real dx, dy, dz; + // cell widths + Real dx, dy, dz; - static SpatialDomainProps From_Grav3D(Grav3D&); - static SpatialDomainProps From_Grid3D(Grid3D&, Parameters* P); + static SpatialDomainProps From_Grav3D(Grav3D& grav); + static SpatialDomainProps From_Grid3D(Grid3D& grid, Parameters* P); }; \ No newline at end of file diff --git a/src/particles/density_boundaries_gpu.cu b/src/particles/density_boundaries_gpu.cu index d14069e68..6c0bd525f 100644 --- a/src/particles/density_boundaries_gpu.cu +++ b/src/particles/density_boundaries_gpu.cu @@ -69,9 +69,9 @@ __global__ void Set_Particles_Density_Boundaries_Periodic_kernel(int direction, void Grid3D::Set_Particles_Density_Boundaries_Periodic_GPU(int direction, int side) { - #ifndef GRAVITY_GPU + #ifndef GRAVITY_GPU CHOLLA_ERROR("This function should not be invoked when compiled without GPU-Gravity"); - #endif GRAVITY_GPU + #endif GRAVITY_GPU int n_ghost, nx_g, ny_g, nz_g, size, ngrid, n_i, n_j; n_ghost = Particles.G.n_ghost_particles_grid; nx_g = Particles.G.nx_local + 2 * n_ghost; diff --git a/src/particles/particles_3D.cpp b/src/particles/particles_3D.cpp index d9bfbd421..04333fcc9 100644 --- a/src/particles/particles_3D.cpp +++ b/src/particles/particles_3D.cpp @@ -29,11 +29,11 @@ void Grid3D::Initialize_Particles(struct Parameters *P) { chprintf("\nInitializing Particles...\n"); -#ifdef GRAVITY + #ifdef GRAVITY SpatialDomainProps spatial_props = SpatialDomainProps::From_Grav3D(Grav); -#else + #else SpatialDomainProps spatial_props = SpatialDomainProps::From_Grid3D(*this, P); -#endif + #endif Particles.Initialize(P, spatial_props, H.xbound, H.ybound, H.zbound, H.xdglobal, H.ydglobal, H.zdglobal); @@ -53,8 +53,8 @@ void Grid3D::Initialize_Particles(struct Parameters *P) chprintf("Particles Initialized Successfully. \n\n"); } -void Particles3D::Initialize(struct Parameters *P, const SpatialDomainProps& spatial_props, Real xbound, Real ybound, Real zbound, Real xdglobal, - Real ydglobal, Real zdglobal) +void Particles3D::Initialize(struct Parameters *P, const SpatialDomainProps &spatial_props, Real xbound, Real ybound, + Real zbound, Real xdglobal, Real ydglobal, Real zdglobal) { // Initialize local and total number of particles to 0 n_local = 0; @@ -189,8 +189,8 @@ void Particles3D::Initialize(struct Parameters *P, const SpatialDomainProps& spa int n_ghost_pot = 0; #endif - G.n_cells_potential = (G.nx_local + 2 * n_ghost_pot) * (G.ny_local + 2 * n_ghost_pot) * - (G.nz_local + 2 * n_ghost_pot); + G.n_cells_potential = + (G.nx_local + 2 * n_ghost_pot) * (G.ny_local + 2 * n_ghost_pot) * (G.nz_local + 2 * n_ghost_pot); } #ifdef SINGLE_PARTICLE_MASS diff --git a/src/particles/particles_3D.h b/src/particles/particles_3D.h index d64e35e34..845cb233f 100644 --- a/src/particles/particles_3D.h +++ b/src/particles/particles_3D.h @@ -17,7 +17,7 @@ #include "../grid/spatial_domain_props.h" #ifdef PARTICLES_GPU - #include "../utils/gpu.hpp" // cudaFree + #include "../utils/gpu.hpp" // cudaFree #define TPB_PARTICLES 1024 // #define PRINT_GPU_MEMORY @@ -221,8 +221,8 @@ class Particles3D Particles3D(void); - void Initialize(struct Parameters *P, const SpatialDomainProps& spatial_props, Real xbound, Real ybound, Real zbound, Real xdglobal, - Real ydglobal, Real zdglobal); + void Initialize(struct Parameters *P, const SpatialDomainProps &spatial_props, Real xbound, Real ybound, Real zbound, + Real xdglobal, Real ydglobal, Real zdglobal); void Allocate_Particles_Grid_Field_Real(Real **array_dev, int size); void Free_GPU_Array_Real(Real *array); diff --git a/src/particles/particles_boundaries.cpp b/src/particles/particles_boundaries.cpp index 5310a847d..4c1fbedc9 100644 --- a/src/particles/particles_boundaries.cpp +++ b/src/particles/particles_boundaries.cpp @@ -96,11 +96,11 @@ void Grid3D::Unload_Particles_From_Buffers_BLOCK(int index, int *flags) if (H.TRANSFER_HYDRO_BOUNDARIES) { return; } - #ifdef GRAVITY + #ifdef GRAVITY if (Grav.TRANSFER_POTENTIAL_BOUNDARIES) { return; } - #endif + #endif if (index == 0) { Unload_Particles_from_Buffer_X0(flags);