-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make all C++ headers self contained and add a CMake check to ensure i…
- Loading branch information
Showing
14 changed files
with
327 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/*################################################################################################## | ||
# This file is a part of PyPartMC licensed under the GNU General Public License v3 (LICENSE file) # | ||
# Copyright (C) 2022 University of Illinois Urbana-Champaign # | ||
# Authors: https://github.com/open-atmos/PyPartMC/graphs/contributors # | ||
##################################################################################################*/ | ||
|
||
#include "bin_grid.hpp" | ||
|
||
std::valarray<double> histogram_1d( | ||
const BinGrid &bin_grid, | ||
std::valarray<double> values, | ||
std::valarray<double> weights | ||
) { | ||
int len; | ||
f_bin_grid_size( | ||
bin_grid.ptr.f_arg(), | ||
&len | ||
); | ||
int data_size = values.size(); | ||
std::valarray<double> data(len); | ||
f_bin_grid_histogram_1d( | ||
bin_grid.ptr.f_arg(), | ||
begin(values), | ||
begin(weights), | ||
&data_size, | ||
begin(data), | ||
&len | ||
); | ||
|
||
return data; | ||
} | ||
|
||
std::vector<std::vector<double>> histogram_2d( | ||
const BinGrid &x_bin_grid, | ||
std::valarray<double> x_values, | ||
const BinGrid &y_bin_grid, | ||
std::valarray<double> y_values, | ||
std::valarray<double> weights | ||
) { | ||
int x_len; | ||
f_bin_grid_size(x_bin_grid.ptr.f_arg(), &x_len); | ||
|
||
int y_len; | ||
f_bin_grid_size(y_bin_grid.ptr.f_arg(), &y_len); | ||
|
||
const int data_size = x_values.size(); | ||
|
||
std::vector<std::vector<double>> data( | ||
x_len, | ||
std::vector<double>(y_len, 0) | ||
); | ||
std::valarray<double> data_flat(x_len * y_len); | ||
f_bin_grid_histogram_2d( | ||
x_bin_grid.ptr.f_arg(), | ||
begin(x_values), | ||
y_bin_grid.ptr.f_arg(), | ||
begin(y_values), | ||
begin(weights), | ||
&data_size, | ||
begin(data_flat), | ||
&x_len, | ||
&y_len | ||
); | ||
|
||
for(int i = 0; i < x_len; i++) { | ||
for(int j = 0; j < y_len; j++) { | ||
data[i][j] = data_flat[i*y_len + j]; | ||
} | ||
} | ||
|
||
return data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/*################################################################################################## | ||
# This file is a part of PyPartMC licensed under the GNU General Public License v3 (LICENSE file) # | ||
# Copyright (C) 2022 University of Illinois Urbana-Champaign # | ||
# Authors: https://github.com/open-atmos/PyPartMC/graphs/contributors # | ||
##################################################################################################*/ | ||
|
||
#include "condense.hpp" | ||
|
||
void condense_equilib_particle( | ||
const EnvState &env_state, | ||
const AeroData &aero_data, | ||
const AeroParticle &aero_particle | ||
) { | ||
f_condense_equilib_particle( | ||
env_state.ptr.f_arg(), | ||
aero_data.ptr.f_arg(), | ||
aero_particle.ptr.f_arg() | ||
); | ||
} | ||
|
||
void condense_equilib_particles( | ||
const EnvState &env_state, | ||
const AeroData &aero_data, | ||
const AeroState &aero_state | ||
) { | ||
f_condense_equilib_particles( | ||
env_state.ptr.f_arg(), | ||
aero_data.ptr.f_arg(), | ||
aero_state.ptr.f_arg() | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/*################################################################################################## | ||
# This file is a part of PyPartMC licensed under the GNU General Public License v3 (LICENSE file) # | ||
# Copyright (C) 2022 University of Illinois Urbana-Champaign # | ||
# Authors: https://github.com/open-atmos/PyPartMC/graphs/contributors # | ||
##################################################################################################*/ | ||
|
||
#include "run_part.hpp" | ||
|
||
void run_part( | ||
const Scenario &scenario, | ||
EnvState &env_state, | ||
const AeroData &aero_data, | ||
AeroState &aero_state, | ||
const GasData &gas_data, | ||
GasState &gas_state, | ||
const RunPartOpt &run_part_opt, | ||
const CampCore &camp_core, | ||
const Photolysis &photolysis | ||
) { | ||
f_run_part( | ||
scenario.ptr.f_arg(), | ||
env_state.ptr.f_arg_non_const(), | ||
aero_data.ptr.f_arg(), | ||
aero_state.ptr.f_arg_non_const(), | ||
gas_data.ptr.f_arg(), | ||
gas_state.ptr.f_arg_non_const(), | ||
run_part_opt.ptr.f_arg(), | ||
camp_core.ptr.f_arg(), | ||
photolysis.ptr.f_arg() | ||
); | ||
} | ||
|
||
void run_part_timestep( | ||
const Scenario &scenario, | ||
EnvState &env_state, | ||
const AeroData &aero_data, | ||
AeroState &aero_state, | ||
const GasData &gas_data, | ||
GasState &gas_state, | ||
const RunPartOpt &run_part_opt, | ||
const CampCore &camp_core, | ||
const Photolysis &photolysis, | ||
const int &i_time, | ||
const double &t_start | ||
) { | ||
f_run_part_timestep( | ||
scenario.ptr.f_arg(), | ||
env_state.ptr.f_arg_non_const(), | ||
aero_data.ptr.f_arg(), | ||
aero_state.ptr.f_arg_non_const(), | ||
gas_data.ptr.f_arg(), | ||
gas_state.ptr.f_arg_non_const(), | ||
run_part_opt.ptr.f_arg(), | ||
camp_core.ptr.f_arg(), | ||
photolysis.ptr.f_arg(), | ||
&i_time, | ||
&t_start | ||
); | ||
} | ||
|
||
void run_part_timeblock( | ||
const Scenario &scenario, | ||
EnvState &env_state, | ||
const AeroData &aero_data, | ||
AeroState &aero_state, | ||
const GasData &gas_data, | ||
GasState &gas_state, | ||
const RunPartOpt &run_part_opt, | ||
const CampCore &camp_core, | ||
const Photolysis &photolysis, | ||
const int &i_time, | ||
const int &i_next, | ||
const double &t_start | ||
) { | ||
f_run_part_timeblock( | ||
scenario.ptr.f_arg(), | ||
env_state.ptr.f_arg_non_const(), | ||
aero_data.ptr.f_arg(), | ||
aero_state.ptr.f_arg_non_const(), | ||
gas_data.ptr.f_arg(), | ||
gas_state.ptr.f_arg_non_const(), | ||
run_part_opt.ptr.f_arg(), | ||
camp_core.ptr.f_arg(), | ||
photolysis.ptr.f_arg(), | ||
&i_time, | ||
&i_next, | ||
&t_start | ||
); | ||
} |
Oops, something went wrong.