Skip to content
Snippets Groups Projects
Commit 7857faaa authored by Podhorszki, Norbert's avatar Podhorszki, Norbert
Browse files

comment out debug messages and use sin/cos function to init array instead of ranks

parent 6ad2127e
No related branches found
No related tags found
1 merge request!203fix the left-right/up-down direction in code to make communication co…
......@@ -158,16 +158,16 @@ void HeatTransfer::exchange(MPI_Comm comm)
MPI_Status status;
if (m_s.rank_left >= 0)
{
std::cout << "Rank " << m_s.rank << " send left to rank "
<< m_s.rank_left << std::endl;
// std::cout << "Rank " << m_s.rank << " send left to rank "
// << m_s.rank_left << std::endl;
for (unsigned int i = 0; i < m_s.ndx + 2; ++i)
send_x[i] = m_TCurrent[i][1];
MPI_Send(send_x, m_s.ndx + 2, MPI_REAL8, m_s.rank_left, tag, comm);
}
if (m_s.rank_right >= 0)
{
std::cout << "Rank " << m_s.rank << " receive from right from rank "
<< m_s.rank_right << std::endl;
// std::cout << "Rank " << m_s.rank << " receive from right from rank "
// << m_s.rank_right << std::endl;
MPI_Recv(recv_x, m_s.ndx + 2, MPI_REAL8, m_s.rank_right, tag, comm,
&status);
for (unsigned int i = 0; i < m_s.ndx + 2; ++i)
......@@ -178,16 +178,16 @@ void HeatTransfer::exchange(MPI_Comm comm)
tag = 2;
if (m_s.rank_right >= 0)
{
std::cout << "Rank " << m_s.rank << " send right to rank "
<< m_s.rank_right << std::endl;
// std::cout << "Rank " << m_s.rank << " send right to rank "
// << m_s.rank_right << std::endl;
for (unsigned int i = 0; i < m_s.ndx + 2; ++i)
send_x[i] = m_TCurrent[i][m_s.ndy];
MPI_Send(send_x, m_s.ndx + 2, MPI_REAL8, m_s.rank_right, tag, comm);
}
if (m_s.rank_left >= 0)
{
std::cout << "Rank " << m_s.rank << " receive from left from rank "
<< m_s.rank_left << std::endl;
// std::cout << "Rank " << m_s.rank << " receive from left from rank "
// << m_s.rank_left << std::endl;
MPI_Recv(recv_x, m_s.ndx + 2, MPI_REAL8, m_s.rank_left, tag, comm,
&status);
for (unsigned int i = 0; i < m_s.ndx + 2; ++i)
......@@ -198,15 +198,15 @@ void HeatTransfer::exchange(MPI_Comm comm)
tag = 3;
if (m_s.rank_down >= 0)
{
std::cout << "Rank " << m_s.rank << " send down to rank "
<< m_s.rank_down << std::endl;
// std::cout << "Rank " << m_s.rank << " send down to rank "
// << m_s.rank_down << std::endl;
MPI_Send(m_TCurrent[m_s.ndx], m_s.ndy + 2, MPI_REAL8, m_s.rank_down,
tag, comm);
}
if (m_s.rank_up >= 0)
{
std::cout << "Rank " << m_s.rank << " receive from above from rank "
<< m_s.rank_up << std::endl;
// std::cout << "Rank " << m_s.rank << " receive from above from rank "
// << m_s.rank_up << std::endl;
MPI_Recv(m_TCurrent[0], m_s.ndy + 2, MPI_REAL8, m_s.rank_up, tag, comm,
&status);
}
......@@ -215,14 +215,15 @@ void HeatTransfer::exchange(MPI_Comm comm)
tag = 4;
if (m_s.rank_up >= 0)
{
std::cout << "Rank " << m_s.rank << " send up to rank " << m_s.rank_up
<< std::endl;
// std::cout << "Rank " << m_s.rank << " send up to rank " <<
// m_s.rank_up
// << std::endl;
MPI_Send(m_TCurrent[1], m_s.ndy + 2, MPI_REAL8, m_s.rank_up, tag, comm);
}
if (m_s.rank_down >= 0)
{
std::cout << "Rank " << m_s.rank << " receive from below from rank "
<< m_s.rank_down << std::endl;
// std::cout << "Rank " << m_s.rank << " receive from below from rank "
// << m_s.rank_down << std::endl;
MPI_Recv(m_TCurrent[m_s.ndx + 1], m_s.ndy + 2, MPI_REAL8, m_s.rank_down,
tag, comm, &status);
}
......
......@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
HeatTransfer ht(settings);
IO io(settings, mpiHeatTransferComm);
ht.init(true);
ht.init(false);
// ht.printT("Initialized T:", mpiHeatTransferComm);
ht.heatEdges();
ht.exchange(mpiHeatTransferComm);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment