Skip to content
Snippets Groups Projects
Commit 32cdb182 authored by Dave Moxey's avatar Dave Moxey
Browse files

Fix periodic boundary conditions when using --shared-filesystem

parent 6e3d43e2
No related branches found
No related tags found
No related merge requests found
......@@ -1421,7 +1421,11 @@ namespace Nektar
SessionReaderSharedPtr vSession = GetSharedThisPtr();
if (DefinesCmdLineArgument("shared-filesystem"))
{
if (GetComm()->GetRank() == 0)
CommSharedPtr vComm = GetComm();
vector<unsigned int> keys, vals;
int i;
if (vComm->GetRank() == 0)
{
m_xmlDoc = MergeDoc(m_filenames);
......@@ -1433,11 +1437,108 @@ namespace Nektar
vPartitioner->GetCompositeOrdering(m_compOrder);
vPartitioner->GetBndRegionOrdering(m_bndRegOrder);
// Communicate orderings to the other processors.
// First send sizes of the orderings and boundary
// regions to allocate storage on the remote end.
keys.resize(2);
keys[0] = m_compOrder.size();
keys[1] = m_bndRegOrder.size();
for (i = 1; i < vComm->GetSize(); ++i)
{
vComm->Send(i, keys);
}
// Construct the keys and sizes of values for composite
// ordering
CompositeOrdering::iterator cIt;
keys.resize(m_compOrder.size());
vals.resize(m_compOrder.size());
for (cIt = m_compOrder.begin(), i = 0;
cIt != m_compOrder.end(); ++cIt, ++i)
{
keys[i] = cIt->first;
vals[i] = cIt->second.size();
}
// Send across data.
for (i = 1; i < vComm->GetSize(); ++i)
{
vComm->Send(i, keys);
vComm->Send(i, vals);
for (cIt = m_compOrder.begin();
cIt != m_compOrder.end(); ++cIt)
{
vComm->Send(i, cIt->second);
}
}
// Construct the keys and sizes of values for composite
// ordering
BndRegionOrdering::iterator bIt;
keys.resize(m_bndRegOrder.size());
vals.resize(m_bndRegOrder.size());
for (bIt = m_bndRegOrder.begin(), i = 0;
bIt != m_bndRegOrder.end(); ++bIt, ++i)
{
keys[i] = bIt->first;
vals[i] = bIt->second.size();
}
// Send across data.
for (i = 1; i < vComm->GetSize(); ++i)
{
vComm->Send(i, keys);
vComm->Send(i, vals);
for (bIt = m_bndRegOrder.begin();
bIt != m_bndRegOrder.end(); ++bIt)
{
vComm->Send(i, bIt->second);
}
}
if (DefinesCmdLineArgument("part-info"))
{
vPartitioner->PrintPartInfo(std::cout);
}
}
else
{
keys.resize(2);
vComm->Recv(0, keys);
int cmpSize = keys[0];
int bndSize = keys[1];
keys.resize(cmpSize);
vals.resize(cmpSize);
vComm->Recv(0, keys);
vComm->Recv(0, vals);
for (int i = 0; i < keys.size(); ++i)
{
vector<unsigned int> tmp(vals[i]);
vComm->Recv(0, tmp);
m_compOrder[keys[i]] = tmp;
}
keys.resize(bndSize);
vals.resize(bndSize);
vComm->Recv(0, keys);
vComm->Recv(0, vals);
for (int i = 0; i < keys.size(); ++i)
{
vector<unsigned int> tmp(vals[i]);
vComm->Recv(0, tmp);
m_bndRegOrder[keys[i]] = tmp;
}
}
}
else
{
......
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