diff --git a/FDTD/openems_fdtd_mpi.cpp b/FDTD/openems_fdtd_mpi.cpp index fd7e0cc..27b5b82 100644 --- a/FDTD/openems_fdtd_mpi.cpp +++ b/FDTD/openems_fdtd_mpi.cpp @@ -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_MyIDm_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; diff --git a/FDTD/operator_mpi.cpp b/FDTD/operator_mpi.cpp index 68a5f02..f299205 100644 --- a/FDTD/operator_mpi.cpp +++ b/FDTD/operator_mpi.cpp @@ -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(); diff --git a/FDTD/operator_mpi.h b/FDTD/operator_mpi.h index f480868..1fd4d95 100644 --- a/FDTD/operator_mpi.h +++ b/FDTD/operator_mpi.h @@ -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;