Skip to content

Commit

Permalink
Fix all instances of typo recieve
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilMiller committed May 16, 2024
1 parent d8bb903 commit e8e042b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions include/core/nexus/HY_PointHydroNexusRemote.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class HY_PointHydroNexusRemote : public HY_PointHydroNexus
virtual ~HY_PointHydroNexusRemote();

/** get the request percentage of downstream flow through this nexus at timestep t. If the indicated catchment is not local a async send will be
created. Will attempt to process all async recieves currently queued before processing flows*/
created. Will attempt to process all async receives currently queued before processing flows*/
double get_downstream_flow(std::string catchment_id, time_step_t t, double percent_flow);

/** add flow to this nexus for timestep t. If the indicated catchment is not local an async receive will be started*/
Expand Down Expand Up @@ -96,7 +96,7 @@ class HY_PointHydroNexusRemote : public HY_PointHydroNexus
MPI_Request mpi_request;
};

std::list<async_request> stored_recieves;
std::list<async_request> stored_receives;
std::list<async_request> stored_sends;

std::string nexus_prefix = "cat-";
Expand Down
2 changes: 1 addition & 1 deletion src/core/nexus/HY_PointHydroNexus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ double HY_PointHydroNexus::get_downstream_flow(std::string catchment_id, time_st

if ( percent_flow > 100.0)
{
// no downstream may ever recieve more than 100% of flows
// no downstream may ever receive more than 100% of flows

BOOST_THROW_EXCEPTION(invalid_downstream_request());
}
Expand Down
22 changes: 11 additions & 11 deletions src/core/nexus/HY_PointHydroNexusRemote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ HY_PointHydroNexusRemote::~HY_PointHydroNexusRemote()
int mpi_finalized;
MPI_Finalized(&mpi_finalized);

while ( (stored_recieves.size() > 0 || stored_sends.size() > 0) && !mpi_finalized )
while ( (stored_receives.size() > 0 || stored_sends.size() > 0) && !mpi_finalized )
{
//std::cerr << "Neuxs with rank " << id << " has pending communications\n";

Expand Down Expand Up @@ -134,28 +134,28 @@ double HY_PointHydroNexusRemote::get_downstream_flow(std::string catchment_id, t
{
int status;

stored_recieves.resize(stored_recieves.size() + 1);
stored_recieves.back().buffer = std::make_shared<time_step_and_flow_t>();
stored_receives.resize(stored_receives.size() + 1);
stored_receives.back().buffer = std::make_shared<time_step_and_flow_t>();

int tag = extract(id);

//Receive downstream_flow from Upstream Remote Nexus to this Downstream Remote Nexus
status = MPI_Irecv(
stored_recieves.back().buffer.get(),
stored_receives.back().buffer.get(),
1,
time_step_and_flow_type,
rank,
tag,
MPI_COMM_WORLD,
&stored_recieves.back().mpi_request);
&stored_receives.back().mpi_request);

MPI_Handle_Error(status);

//std::cerr << "Creating recieve with target_rank=" << rank << " on tag=" << tag << "\n";
//std::cerr << "Creating receive with target_rank=" << rank << " on tag=" << tag << "\n";
}

//std::cerr << "Waiting on recieves\n";
while ( stored_recieves.size() > 0 )
//std::cerr << "Waiting on receives\n";
while ( stored_receives.size() > 0 )
{
process_communications();
std::this_thread::sleep_for(std::chrono::milliseconds(1));
Expand Down Expand Up @@ -231,7 +231,7 @@ void HY_PointHydroNexusRemote::process_communications()
int flag; // boolean value for if a request has completed
MPI_Status status; // status of the completed request

for ( auto i = stored_recieves.begin(); i != stored_recieves.end(); )
for ( auto i = stored_receives.begin(); i != stored_receives.end(); )
{
MPI_Handle_Error( MPI_Test(&i->mpi_request, &flag, &status) );

Expand All @@ -243,9 +243,9 @@ void HY_PointHydroNexusRemote::process_communications()
double flow = i->buffer->flow;

// remove this object from the vector
i = stored_recieves.erase(i);
i = stored_receives.erase(i);

// add the recieved flow
// add the received flow
HY_PointHydroNexus::add_upstream_flow(flow, contributing_id, time_step);
}
else
Expand Down
46 changes: 23 additions & 23 deletions test/core/nexus/NexusRemoteTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ TEST_F(Nexus_Remote_Test, TestInit0)

case 1:
//nexus->add_upstream_flow(dummy_flow,"cat-26",ts);
double recieved_flow = nexus->get_downstream_flow("cat-27",ts,100);
ASSERT_EQ(discharge,recieved_flow);
std::cerr << "Rank 1: Recieving flow of " << recieved_flow << " from catchment Nexus connected to catchment 26\n";
double received_flow = nexus->get_downstream_flow("cat-27",ts,100);
ASSERT_EQ(discharge,received_flow);
std::cerr << "Rank 1: Recieving flow of " << received_flow << " from catchment Nexus connected to catchment 26\n";
break;
}

Expand Down Expand Up @@ -167,17 +167,17 @@ TEST_F(Nexus_Remote_Test, Test2RemoteSenders)

double dummy_flow = -9999.0;
long ts = 0;
double recieved_flow = -9999.0;
double received_flow = -9999.0;

for ( auto discharge : stored_discharge)
{
switch(mpi_rank)
{

case 0:
recieved_flow = nexus->get_downstream_flow("cat-27",ts,100);
ASSERT_EQ(discharge+discharge,recieved_flow);
std::cerr << "Rank 0: Recieving flow of " << recieved_flow << " from catchment Nexus connected to catchment 27\n";
received_flow = nexus->get_downstream_flow("cat-27",ts,100);
ASSERT_EQ(discharge+discharge,received_flow);
std::cerr << "Rank 0: Recieving flow of " << received_flow << " from catchment Nexus connected to catchment 27\n";
break;

case 1:
Expand Down Expand Up @@ -248,7 +248,7 @@ TEST_F(Nexus_Remote_Test, Test2RemoteSenders1LocalSender)

double dummy_flow = -9999.0;
long ts = 0;
double recieved_flow = -9999.0;
double received_flow = -9999.0;

for ( auto discharge : stored_discharge)
{
Expand All @@ -257,9 +257,9 @@ TEST_F(Nexus_Remote_Test, Test2RemoteSenders1LocalSender)

case 0:
nexus->add_upstream_flow(discharge,"cat-24",ts);
recieved_flow = nexus->get_downstream_flow("cat-27",ts,100);
ASSERT_EQ(discharge*3,recieved_flow);
std::cerr << "Rank 0: Recieving flow of " << recieved_flow << " from catchment Nexus connected to catchment 27\n";
received_flow = nexus->get_downstream_flow("cat-27",ts,100);
ASSERT_EQ(discharge*3,received_flow);
std::cerr << "Rank 0: Recieving flow of " << received_flow << " from catchment Nexus connected to catchment 27\n";
break;

case 1:
Expand Down Expand Up @@ -357,7 +357,7 @@ TEST_F(Nexus_Remote_Test, Test4R2S2LS)

double dummy_flow = -9999.0;
long ts = 0;
double recieved_flow = -9999.0;
double received_flow = -9999.0;

for ( auto discharge : stored_discharge)
{
Expand All @@ -366,9 +366,9 @@ TEST_F(Nexus_Remote_Test, Test4R2S2LS)

case 0:
nexus->add_upstream_flow(discharge,"cat-24",ts);
recieved_flow = nexus->get_downstream_flow("cat-27",ts,100);
ASSERT_EQ(discharge*3,recieved_flow);
std::cerr << "Rank 0: Recieving flow of " << recieved_flow << " from catchment Nexus connected to catchment 27\n";
received_flow = nexus->get_downstream_flow("cat-27",ts,100);
ASSERT_EQ(discharge*3,received_flow);
std::cerr << "Rank 0: Recieving flow of " << received_flow << " from catchment Nexus connected to catchment 27\n";
break;

case 1:
Expand All @@ -383,9 +383,9 @@ TEST_F(Nexus_Remote_Test, Test4R2S2LS)

case 3:
nexus->add_upstream_flow(discharge,"cat-14",ts);
recieved_flow = nexus->get_downstream_flow("cat-17",ts,100);
ASSERT_EQ(discharge*3,recieved_flow);
std::cerr << "Rank 3: Recieving flow of " << recieved_flow << " from catchment Nexus connected to catchment 27\n";
received_flow = nexus->get_downstream_flow("cat-17",ts,100);
ASSERT_EQ(discharge*3,received_flow);
std::cerr << "Rank 3: Recieving flow of " << received_flow << " from catchment Nexus connected to catchment 27\n";
break;

case 4:
Expand Down Expand Up @@ -423,7 +423,7 @@ TEST_F(Nexus_Remote_Test, TestDeadlock1)
std::shared_ptr<HY_PointHydroNexusRemote> nexus2;

double dummy_flow = -9999.0;
double recieved_flow;
double received_flow;
long ts = 0;

std::vector<std::string> downstream_catchments;
Expand All @@ -444,8 +444,8 @@ TEST_F(Nexus_Remote_Test, TestDeadlock1)
// We use two differnt time steps becuase a nexus does not allow water to be added after a send
nexus1->add_upstream_flow(200.0,"cat-25",ts); // sending to rank 1

recieved_flow = nexus2->get_downstream_flow("cat-26",ts,100); // get the recieved flow
std::cout << "rank 0 recieved a flow of " << recieved_flow << "\n";
received_flow = nexus2->get_downstream_flow("cat-26",ts,100); // get the received flow
std::cout << "rank 0 received a flow of " << received_flow << "\n";
}
else if ( mpi_rank == 1)
{
Expand All @@ -459,8 +459,8 @@ TEST_F(Nexus_Remote_Test, TestDeadlock1)
// We use two differnt time steps becuase a nexus does not allow water to be added after a send
nexus1->add_upstream_flow(200.0,"cat-26",ts); // sending to rank 0

recieved_flow = nexus2->get_downstream_flow("cat-25",ts,100); // get the recieved flow
std::cout << "rank 1 recieved a flow of " << recieved_flow << "\n";
received_flow = nexus2->get_downstream_flow("cat-25",ts,100); // get the received flow
std::cout << "rank 1 received a flow of " << received_flow << "\n";
}

MPI_Barrier(MPI_COMM_WORLD);
Expand Down

0 comments on commit e8e042b

Please sign in to comment.