From edb40489d74241260c96bd85e89b69bb12c4355d Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Mon, 14 Mar 2011 16:20:33 +0100 Subject: [PATCH] MPI: tell MPI-operator about global mesh and its position in it --- FDTD/openems_fdtd_mpi.cpp | 7 +++++++ FDTD/operator_mpi.cpp | 18 ++++++++++++++++++ FDTD/operator_mpi.h | 7 +++++++ 3 files changed, 32 insertions(+) diff --git a/FDTD/openems_fdtd_mpi.cpp b/FDTD/openems_fdtd_mpi.cpp index 83a20ce..adf3440 100644 --- a/FDTD/openems_fdtd_mpi.cpp +++ b/FDTD/openems_fdtd_mpi.cpp @@ -18,6 +18,7 @@ #include "openems_fdtd_mpi.h" #include "FDTD/engine_interface_fdtd.h" #include "FDTD/operator_mpi.h" +#include "FDTD/operator_cylinder.h" #include "FDTD/engine_mpi.h" #include "Common/processfields.h" #include "Common/processintegral.h" @@ -231,6 +232,10 @@ bool openEMS_FDTD_MPI::SetupMPI(TiXmlElement* FDTD_Opts) for (unsigned int n=SplitNumber[2].at(k);n<=SplitNumber[2].at(k+1);++n) grid->AddDiscLine(2, m_Original_Grid->GetLine(2,n) ); + m_MPI_Op->SetSplitPos(0,SplitNumber[0].at(i)); + m_MPI_Op->SetSplitPos(1,SplitNumber[1].at(i)); + m_MPI_Op->SetSplitPos(2,SplitNumber[2].at(i)); + if (i>0) m_MPI_Op->SetNeighborDown(0,procTable[i-1][j][k]); if (iSetOriginalMesh(m_Original_Grid); + m_MPI_Op->SetTag(0); return true; diff --git a/FDTD/operator_mpi.cpp b/FDTD/operator_mpi.cpp index b007d91..dafe8f1 100644 --- a/FDTD/operator_mpi.cpp +++ b/FDTD/operator_mpi.cpp @@ -129,6 +129,7 @@ void Operator_MPI::Init() { m_NeighborUp[i]=-1; m_NeighborDown[i]=-1; + m_OrigDiscLines[i]=NULL; } int namelen; @@ -145,6 +146,13 @@ void Operator_MPI::Init() void Operator_MPI::Delete() { delete[] m_Processor_Name; + m_Processor_Name = NULL; + for (int i=0;i<3;++i) + { + delete[] m_OrigDiscLines[i]; + m_OrigDiscLines[i] = NULL; + } + } void Operator_MPI::Reset() @@ -153,6 +161,16 @@ void Operator_MPI::Reset() Operator_SSE_Compressed::Reset(); } +void Operator_MPI::SetOriginalMesh(CSRectGrid* orig_Mesh) +{ + for (int n=0;n<3;++n) + { + delete[] m_OrigDiscLines[n]; + m_OrigDiscLines[n] = NULL; + orig_Mesh->GetLines(n,m_OrigDiscLines[n],m_OrigNumLines[n]); + } +} + string Operator_MPI::PrependRank(string name) { stringstream out_name; diff --git a/FDTD/operator_mpi.h b/FDTD/operator_mpi.h index ab51b7e..37874f6 100644 --- a/FDTD/operator_mpi.h +++ b/FDTD/operator_mpi.h @@ -42,6 +42,9 @@ public: virtual void DumpExciationSignals(); + virtual void SetSplitPos(int ny, unsigned int pos) {m_SplitPos[ny]=pos;} + virtual void SetOriginalMesh(CSRectGrid* orig_Mesh); + protected: Operator_MPI(); bool m_MPI_Enabled; @@ -60,6 +63,10 @@ protected: int m_NeighborUp[3]; int m_NeighborDown[3]; + double* m_OrigDiscLines[3]; + unsigned int m_OrigNumLines[3]; + unsigned int m_SplitPos[3]; + string PrependRank(string name); virtual void DumpOperator2File(string filename);