MPI: new methode to define neighbors

pull/1/head
Thorsten Liebig 2011-02-22 12:11:08 +01:00
parent 729a92c5e1
commit 14e12f9138
3 changed files with 23 additions and 3 deletions

View File

@ -118,10 +118,12 @@ bool openEMS_FDTD_MPI::SetupMPI(TiXmlElement* FDTD_Opts)
//lower neighbor is ID-1
if (m_MyID>0)
m_MPI_Op->m_NeighborDown[2]=m_MyID-1;
m_MPI_Op->SetNeighborDown(2,m_MyID-1);
//upper neighbor is ID+1
if (m_MyID<m_NumProc-1)
m_MPI_Op->m_NeighborUp[2]=m_MyID+1;
m_MPI_Op->SetNeighborUp(2,m_MyID+1);
m_MPI_Op->SetTag(0);
}
else
cerr << "openEMS_FDTD_MPI::SetupMPI: Warning: Number of MPI processes is 1, skipping MPI engine... " << endl;

View File

@ -99,6 +99,20 @@ Engine* Operator_MPI::CreateEngine() const
return Engine_SSE_Compressed::New(this);
}
void Operator_MPI::SetNeighborUp(int ny, int id)
{
if ((ny<0) || (ny>2))
return;
m_NeighborUp[ny]=id;
}
void Operator_MPI::SetNeighborDown(int ny, int id)
{
if ((ny<0) || (ny>2))
return;
m_NeighborDown[ny]=id;
}
void Operator_MPI::Init()
{
Operator_SSE_Compressed::Init();

View File

@ -23,7 +23,6 @@
class Operator_MPI : public Operator_SSE_Compressed
{
friend class Engine_MPI;
friend class openEMS_FDTD_MPI;
public:
//! Create a new operator
static Operator_MPI* New();
@ -36,6 +35,11 @@ public:
virtual Engine* CreateEngine() const;
virtual void SetTag(int tag) {m_MyTag=tag;}
virtual void SetNeighborUp(int ny, int id);
virtual void SetNeighborDown(int ny, int id);
protected:
Operator_MPI();
bool m_MPI_Enabled;