Skip to content

Commit

Permalink
more auto return type qualifiers (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
slayoo authored Nov 30, 2022
1 parent 5d34b60 commit fc0dfde
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 62 deletions.
20 changes: 10 additions & 10 deletions src/aero_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct AeroData {
gimmick_ptr().reset(); // TODO #117: guard
}

static int spec_by_name(const AeroData &self, const std::string &name) {
static auto spec_by_name(const AeroData &self, const std::string &name) {
int value;
const int name_size = name.size();
f_aero_data_spec_by_name(
Expand Down Expand Up @@ -67,7 +67,7 @@ struct AeroData {
);
}

static double get_frac_dim(const AeroData &self) {
static auto get_frac_dim(const AeroData &self) {
double value;
f_aero_data_get_frac_dim(
self.ptr.f_arg(),
Expand All @@ -83,7 +83,7 @@ struct AeroData {
);
}

static double get_prime_radius(AeroData &self) {
static auto get_prime_radius(AeroData &self) {
double value;
f_aero_data_get_prime_radius(
self.ptr.f_arg(),
Expand All @@ -99,7 +99,7 @@ struct AeroData {
);
}

static double get_vol_fill_factor(const AeroData &self) {
static auto get_vol_fill_factor(const AeroData &self) {
double value;
f_aero_data_get_vol_fill_factor(
self.ptr.f_arg(),
Expand All @@ -108,7 +108,7 @@ struct AeroData {
return value;
}

static double rad2vol(const AeroData &self, const double radius) {
static auto rad2vol(const AeroData &self, const double radius) {
double vol;
f_aero_data_rad2vol(
self.ptr.f_arg(),
Expand All @@ -118,7 +118,7 @@ struct AeroData {
return vol;
}

static double vol2rad(const AeroData &self, const double vol) {
static auto vol2rad(const AeroData &self, const double vol) {
double radius;
f_aero_data_vol2rad(
self.ptr.f_arg(),
Expand All @@ -128,7 +128,7 @@ struct AeroData {
return radius;
}

static double diam2vol(const AeroData &self, const double diam) {
static auto diam2vol(const AeroData &self, const double diam) {
double vol;
f_aero_data_diam2vol(
self.ptr.f_arg(),
Expand All @@ -138,7 +138,7 @@ struct AeroData {
return vol;
}

static double vol2diam(const AeroData &self, const double vol) {
static auto vol2diam(const AeroData &self, const double vol) {
double diam;
f_aero_data_vol2diam(
self.ptr.f_arg(),
Expand All @@ -148,7 +148,7 @@ struct AeroData {
return diam;
}

static std::valarray<double> densities(const AeroData &self) {
static auto densities(const AeroData &self) {
int len;
f_aero_data_len(
self.ptr.f_arg(),
Expand All @@ -166,7 +166,7 @@ struct AeroData {
return data;
}

static double density(const AeroData &self, const std::string &name) {
static auto density(const AeroData &self, const std::string &name) {
int idx;
double data;
const int name_size = name.size();
Expand Down
14 changes: 7 additions & 7 deletions src/aero_mode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ struct AeroMode {
gimmick_ptr().reset();
}

static double get_num_conc(const AeroMode &self){
static auto get_num_conc(const AeroMode &self){
double val;
f_aero_mode_get_num_conc(self.ptr.f_arg(), &val);
return val;
Expand All @@ -134,7 +134,7 @@ struct AeroMode {
f_aero_mode_set_num_conc(self.ptr.f_arg_non_const(), &val);
}

static std::valarray<double> num_dist(const AeroMode &self,
static auto num_dist(const AeroMode &self,
const BinGrid &bin_grid, const AeroData &aero_data)
{
int len;
Expand Down Expand Up @@ -166,7 +166,7 @@ struct AeroMode {
);
}

static std::valarray<double> get_vol_frac(const AeroMode &self)
static auto get_vol_frac(const AeroMode &self)
{
int len;
f_aero_mode_get_n_spec(self.ptr.f_arg(), &len);
Expand All @@ -189,7 +189,7 @@ struct AeroMode {
);
}

static std::valarray<double> get_vol_frac_std(const AeroMode &self)
static auto get_vol_frac_std(const AeroMode &self)
{
int len;
f_aero_mode_get_n_spec(self.ptr.f_arg(), &len);
Expand All @@ -198,7 +198,7 @@ struct AeroMode {
return data;
}

static double get_char_radius(const AeroMode &self){
static auto get_char_radius(const AeroMode &self){
double val;
f_aero_mode_get_char_radius(self.ptr.f_arg(), &val);
return val;
Expand All @@ -208,7 +208,7 @@ struct AeroMode {
f_aero_mode_set_char_radius(self.ptr.f_arg_non_const(), &val);
}

static double get_gsd(const AeroMode &self){
static auto get_gsd(const AeroMode &self){
double val;
f_aero_mode_get_gsd(self.ptr.f_arg(), &val);
return val;
Expand Down Expand Up @@ -261,7 +261,7 @@ struct AeroMode {
f_aero_mode_set_type(self.ptr.f_arg_non_const(), &type);
}

static std::string get_type(const AeroMode &self) {
static auto get_type(const AeroMode &self) {
int type;
f_aero_mode_get_type(self.ptr.f_arg(), &type);

Expand Down
24 changes: 12 additions & 12 deletions src/aero_particle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct AeroParticle {
throw std::runtime_error("AeroData size mistmatch");
}

static std::valarray<double> volumes(const AeroParticle &self)
static auto volumes(const AeroParticle &self)
{
int len = AeroData::__len__(*self.aero_data);
std::valarray<double> data(len);
Expand All @@ -57,7 +57,7 @@ struct AeroParticle {
return data;
}

static double volume(const AeroParticle &self) {
static auto volume(const AeroParticle &self) {
double vol;
f_aero_particle_volume(
self.ptr.f_arg(),
Expand All @@ -66,7 +66,7 @@ struct AeroParticle {
return vol;
}

static double species_volume(const AeroParticle &self, const int &i_spec) {
static auto species_volume(const AeroParticle &self, const int &i_spec) {
double vol;
f_aero_particle_species_volume(
self.ptr.f_arg(),
Expand All @@ -76,7 +76,7 @@ struct AeroParticle {
return vol;
}

static double dry_volume(const AeroParticle &self) {
static auto dry_volume(const AeroParticle &self) {
double vol;
f_aero_particle_dry_volume(
self.ptr.f_arg(),
Expand All @@ -86,7 +86,7 @@ struct AeroParticle {
return vol;
}

static double radius(const AeroParticle &self) {
static auto radius(const AeroParticle &self) {
double radius;
f_aero_particle_radius(
self.ptr.f_arg(),
Expand All @@ -96,7 +96,7 @@ struct AeroParticle {
return radius;
}

static double dry_radius(const AeroParticle &self) {
static auto dry_radius(const AeroParticle &self) {
double radius;
f_aero_particle_dry_radius(
self.ptr.f_arg(),
Expand All @@ -106,7 +106,7 @@ struct AeroParticle {
return radius;
}

static double diameter(const AeroParticle &self) {
static auto diameter(const AeroParticle &self) {
double diameter;
f_aero_particle_diameter(
self.ptr.f_arg(),
Expand All @@ -116,7 +116,7 @@ struct AeroParticle {
return diameter;
}

static double dry_diameter(const AeroParticle &self) {
static auto dry_diameter(const AeroParticle &self) {
double diameter;
f_aero_particle_dry_diameter(
self.ptr.f_arg(),
Expand All @@ -126,7 +126,7 @@ struct AeroParticle {
return diameter;
}

static double mass(const AeroParticle &self) {
static auto mass(const AeroParticle &self) {
double mass;
f_aero_particle_mass(
self.ptr.f_arg(),
Expand All @@ -136,7 +136,7 @@ struct AeroParticle {
return mass;
}

static double species_mass(const AeroParticle &self, const int &i_spec) {
static auto species_mass(const AeroParticle &self, const int &i_spec) {
double mass;
f_aero_particle_species_mass(
self.ptr.f_arg(),
Expand All @@ -147,7 +147,7 @@ struct AeroParticle {
return mass;
}

static std::valarray<double> species_masses(const AeroParticle &self) {
static auto species_masses(const AeroParticle &self) {
int len = AeroData::__len__(*self.aero_data);
std::valarray<double> masses(len);
f_aero_particle_species_masses(
Expand All @@ -159,7 +159,7 @@ struct AeroParticle {
return masses;
}

static double solute_kappa(const AeroParticle &self) {
static auto solute_kappa(const AeroParticle &self) {
double kappa;
f_aero_particle_solute_kappa(
self.ptr.f_arg(),
Expand Down
18 changes: 9 additions & 9 deletions src/aero_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct AeroState {
return len;
}

static double total_num_conc(const AeroState &self) {
static auto total_num_conc(const AeroState &self) {
double total_num_conc;
f_aero_state_total_num_conc(
self.ptr.f_arg(),
Expand All @@ -141,7 +141,7 @@ struct AeroState {
return total_num_conc;
}

static double total_mass_conc(const AeroState &self) {
static auto total_mass_conc(const AeroState &self) {
double total_mass_conc;
f_aero_state_total_mass_conc(
self.ptr.f_arg(),
Expand All @@ -151,7 +151,7 @@ struct AeroState {
return total_mass_conc;
}

static std::valarray<double> num_concs(const AeroState &self) {
static auto num_concs(const AeroState &self) {
int len;
f_aero_state_len(
self.ptr.f_arg(),
Expand All @@ -169,7 +169,7 @@ struct AeroState {
return num_concs;
}

static std::valarray<double> masses(
static auto masses(
const AeroState &self
) {
int len;
Expand All @@ -189,7 +189,7 @@ struct AeroState {
return masses;
}

static std::valarray<double> dry_diameters(const AeroState &self) {
static auto dry_diameters(const AeroState &self) {
int len;
f_aero_state_len(
self.ptr.f_arg(),
Expand All @@ -207,7 +207,7 @@ struct AeroState {
return dry_diameters;
}

static std::valarray<double> diameters(
static auto diameters(
const AeroState &self
) {
int len;
Expand All @@ -227,7 +227,7 @@ struct AeroState {
return diameters;
}

static std::valarray<double> volumes(
static auto volumes(
const AeroState &self
) {
int len;
Expand All @@ -247,7 +247,7 @@ struct AeroState {
return volumes;
}

static std::valarray<double> crit_rel_humids(
static auto crit_rel_humids(
const AeroState &self,
const EnvState &env_state
) {
Expand All @@ -269,7 +269,7 @@ struct AeroState {
return crit_rel_humids;
}

static std::tuple<double, double, double> mixing_state(
static auto mixing_state(
const AeroState &self
) {
int len;
Expand Down
8 changes: 4 additions & 4 deletions src/bin_grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct BinGrid {
return len;
}

static std::valarray<double> edges(const BinGrid &self)
static auto edges(const BinGrid &self)
{
int len;
f_bin_grid_size(
Expand All @@ -100,7 +100,7 @@ struct BinGrid {
return data;
}

static std::valarray<double> centers(const BinGrid &self)
static auto centers(const BinGrid &self)
{
int len;
f_bin_grid_size(
Expand All @@ -117,7 +117,7 @@ struct BinGrid {
}
};

std::valarray<double> histogram_1d(
auto histogram_1d(
const BinGrid &bin_grid,
std::valarray<double> values,
std::valarray<double> weights
Expand All @@ -141,7 +141,7 @@ std::valarray<double> histogram_1d(
return data;
}

std::vector<std::vector<double>> histogram_2d(
auto histogram_2d(
const BinGrid &x_bin_grid,
std::valarray<double> x_values,
const BinGrid &y_bin_grid,
Expand Down
Loading

0 comments on commit fc0dfde

Please sign in to comment.