Skip to content

Commit

Permalink
refactor: ensure types are size_t
Browse files Browse the repository at this point in the history
  • Loading branch information
yoctoyotta1024 committed Apr 18, 2024
1 parent dbf72d0 commit 5b94dd1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions libs/cartesiandomain/createcartesianmaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Author: Clara Bayley (CB)
* Additional Contributors:
* -----
* Last Modified: Wednesday 17th April 2024
* Last Modified: Thursday 18th April 2024
* Modified By: CB
* -----
* License: BSD 3-Clause "New" or "Revised" License
Expand Down Expand Up @@ -61,7 +61,7 @@ however the area and volume of each gridbox remains finite.
E.g. In the 0-D case, the bounds maps all have 1 {key, value} where
key=gbxidx=0 and value = {max, min} numerical limits, meanwhile volume
function returns a value determined from the gridfile 'grid_filename' */
CartesianMaps create_cartesian_maps(const unsigned int ngbxs, const unsigned int nspacedims,
CartesianMaps create_cartesian_maps(const size_t ngbxs, const unsigned int nspacedims,
const std::filesystem::path grid_filename) {
std::cout << "\n--- create cartesian gridbox maps ---\n";

Expand Down
4 changes: 2 additions & 2 deletions libs/cartesiandomain/createcartesianmaps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Author: Clara Bayley (CB)
* Additional Contributors:
* -----
* Last Modified: Wednesday 17th April 2024
* Last Modified: Thursday 18th April 2024
* Modified By: CB
* -----
* License: BSD 3-Clause "New" or "Revised" License
Expand Down Expand Up @@ -47,7 +47,7 @@ gridbox remains finite. E.g. In the 0-D case, the bounds maps all
have 1 {key, value} where key=gbxidx=0 and value = {max, min}
numerical limits, meanwhile volume function returns a value determined
from the gridfile 'grid_filename' */
CartesianMaps create_cartesian_maps(const unsigned int ngbxs, const unsigned int nspacedims,
CartesianMaps create_cartesian_maps(const size_t ngbxs, const unsigned int nspacedims,
const std::filesystem::path grid_filename);

#endif // LIBS_CARTESIANDOMAIN_CREATECARTESIANMAPS_HPP_
10 changes: 5 additions & 5 deletions libs/cartesiandomain/withreset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Author: Clara Bayley (CB)
* Additional Contributors:
* -----
* Last Modified: Tuesday 16th April 2024
* Last Modified: Thursday 18th April 2024
* Modified By: CB
* -----
* License: BSD 3-Clause "New" or "Revised" License
Expand Down Expand Up @@ -90,11 +90,11 @@ struct ProbDistrib {
struct ResetSuperdrop {
GenRandomPool genpool4reset;
Kokkos::View<double[101]> log10redges; // edges to radius bins
Kokkos::pair<unsigned int, unsigned int> gbxidxs;
Kokkos::pair<size_t, size_t> gbxidxs;
uint64_t nbins;
ProbDistrib prob_distrib;

ResetSuperdrop(const unsigned int ngbxs, const unsigned int ngbxs4reset)
ResetSuperdrop(const size_t ngbxs, const size_t ngbxs4reset)
: genpool4reset(std::random_device {}()),
log10redges("log10redges"),
gbxidxs({ngbxs - ngbxs4reset, ngbxs}),
Expand Down Expand Up @@ -210,7 +210,7 @@ coord3(...){...} function */
struct CartesianChangeIfNghbrWithReset {
ResetSuperdrop reset_superdrop;

CartesianChangeIfNghbrWithReset(const unsigned int ngbxs, const unsigned int ngbxs4reset)
CartesianChangeIfNghbrWithReset(const size_t ngbxs, const size_t ngbxs4reset)
: reset_superdrop(ResetSuperdrop(ngbxs, ngbxs4reset)) {}

KOKKOS_INLINE_FUNCTION unsigned int coord3(const CartesianMaps &gbxmaps, unsigned int idx,
Expand All @@ -237,7 +237,7 @@ template <VelocityFormula TV>
inline PredCorrMotion<CartesianMaps, TV, CartesianChangeIfNghbrWithReset, CartesianCheckBounds>
CartesianMotionWithReset(const unsigned int motionstep,
const std::function<double(unsigned int)> int2time, const TV terminalv,
const unsigned int ngbxs, const unsigned int ngbxs4reset) {
const size_t ngbxs, const size_t ngbxs4reset) {
const auto cin = CartesianChangeIfNghbrWithReset(ngbxs, ngbxs4reset);
return PredCorrMotion<CartesianMaps, TV, CartesianChangeIfNghbrWithReset, CartesianCheckBounds>(
motionstep, int2time, terminalv, cin, CartesianCheckBounds{});
Expand Down
6 changes: 3 additions & 3 deletions libs/initialise/gbxbounds_frombinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Author: Clara Bayley (CB)
* Additional Contributors:
* -----
* Last Modified: Wednesday 17th April 2024
* Last Modified: Thursday 18th April 2024
* Modified By: CB
* -----
* License: BSD 3-Clause "New" or "Revised" License
Expand All @@ -26,7 +26,7 @@

/* read metadata and data in binary file called 'gridfile', then
return GbxBoundsFromBinary instance created from that data */
GbxBoundsFromBinary::GbxBoundsFromBinary(const unsigned int ngbxs, const unsigned int nspacedims,
GbxBoundsFromBinary::GbxBoundsFromBinary(const size_t ngbxs, const unsigned int nspacedims,
const std::filesystem::path grid_filename) {
/* open file and read in the metatdata
for all the variables in gridfile */
Expand All @@ -53,7 +53,7 @@ GbxBoundsFromBinary::GbxBoundsFromBinary(const unsigned int ngbxs, const unsigne
/* Throws error if ngbxs is not consistent with
number of gridboxes from gridfile as calculated
via the get_ngbxs() function */
void GbxBoundsFromBinary::is_ngbxs_compatible(const unsigned int ngbxs) const {
void GbxBoundsFromBinary::is_ngbxs_compatible(const size_t ngbxs) const {
if (ngbxs != get_ngbxs()) {
std::string err =
"number of gridboxes read from gridfile"
Expand Down
6 changes: 3 additions & 3 deletions libs/initialise/gbxbounds_frombinary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Author: Clara Bayley (CB)
* Additional Contributors:
* -----
* Last Modified: Wednesday 17th April 2024
* Last Modified: Thursday 18th April 2024
* Modified By: CB
* -----
* License: BSD 3-Clause "New" or "Revised" License
Expand Down Expand Up @@ -45,7 +45,7 @@ coordinate boundaries which are read from gridfile
and used in construction of GridboxMaps */
struct GbxBoundsFromBinary {
private:
void is_ngbxs_compatible(const unsigned int ngbxs) const;
void is_ngbxs_compatible(const size_t ngbxs) const;
void is_nspacedims_compatible(const unsigned int nspacedims) const;

bool check_0Dmodel_gbxbounds() const;
Expand All @@ -61,7 +61,7 @@ struct GbxBoundsFromBinary {
std::vector<double> gbxbounds; // corresponding [coord3 {l, u}, coord1 {l, u}, coord2 {l, u}]
// lower and upper coordinate boundaries

GbxBoundsFromBinary(const unsigned int ngbxs, const unsigned int nspacedims,
GbxBoundsFromBinary(const size_t ngbxs, const unsigned int nspacedims,
const std::filesystem::path grid_filename);

/* returns coord3 {lower, upper} gridbox bounds
Expand Down

0 comments on commit 5b94dd1

Please sign in to comment.