Skip to content

Commit

Permalink
satisfy clang-tidy and clang-format
Browse files Browse the repository at this point in the history
mabruzzo committed Jul 26, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent cf3ac58 commit 3ecde7c
Showing 8 changed files with 47 additions and 47 deletions.
4 changes: 2 additions & 2 deletions src/gravity/grav3D.cpp
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 2 additions & 2 deletions src/gravity/grav3D.h
Original file line number Diff line number Diff line change
@@ -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();
34 changes: 17 additions & 17 deletions src/grid/spatial_domain_props.cpp
Original file line number Diff line number Diff line change
@@ -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;
};
24 changes: 12 additions & 12 deletions src/grid/spatial_domain_props.h
Original file line number Diff line number Diff line change
@@ -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);
};
4 changes: 2 additions & 2 deletions src/particles/density_boundaries_gpu.cu
Original file line number Diff line number Diff line change
@@ -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;
14 changes: 7 additions & 7 deletions src/particles/particles_3D.cpp
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions src/particles/particles_3D.h
Original file line number Diff line number Diff line change
@@ -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);
4 changes: 2 additions & 2 deletions src/particles/particles_boundaries.cpp
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 3ecde7c

Please sign in to comment.