Skip to content

Commit

Permalink
feat: allow forcings engine provider to set MPI communicator [no ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
program-- committed Feb 12, 2024
1 parent a2c189e commit 329d314
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
23 changes: 23 additions & 0 deletions include/forcing/ForcingsEngineDataProvider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,34 @@ namespace data_access {
struct ForcingsEngineDataProvider
: public GenericDataProvider
{
/**
* @brief Construct a new Forcings Engine Data Provider instance
*
* @param init Path to initialization config
* @param time_start start time for module as a unix epoch
* @param time_end end time for module as a unix epoch
*/
explicit ForcingsEngineDataProvider(const std::string& init, std::size_t time_start, std::size_t time_end);

/**
* @brief Construct a new Forcings Engine Data Provider instance
*
* @param init Path to initialization config
* @param time_start start time for module as a string timestamp
* @param time_end end time for module as a string timestamp
* @param fmt format of timestamps
*/
explicit ForcingsEngineDataProvider(const std::string& init, const std::string& time_start, const std::string& time_end, const std::string& fmt = "%Y-%m-%d %H:%M:%S");

~ForcingsEngineDataProvider() override;

/**
* @brief Set the MPI communicator that the Forcings Engine should use.
*
* @param handle int representing a communicator handle.
*/
void set_communicator(int handle);

auto get_available_variable_names()
-> boost::span<const std::string> override;

Expand Down
6 changes: 6 additions & 0 deletions src/forcing/ForcingsEngineDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ ForcingsEngineDataProvider::ForcingsEngineDataProvider(const std::string& init,

ForcingsEngineDataProvider::~ForcingsEngineDataProvider() = default;

void ForcingsEngineDataProvider::set_communicator(int handle)
{
int idx = 0;
instance_.set_value_at_indices<int>("bmi_mpi_comm_handle", &idx, 1, &handle, "int");
}

auto ForcingsEngineDataProvider::get_available_variable_names()
-> boost::span<const std::string>
{
Expand Down

0 comments on commit 329d314

Please sign in to comment.