MPI: tell MPI-operator about global mesh and its position in it

pull/1/head
Thorsten Liebig 2011-03-14 16:20:33 +01:00
parent 8e2fce0e8c
commit edb40489d7
3 changed files with 32 additions and 0 deletions

View File

@ -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 (i<SplitNumber[0].size()-2)
@ -251,6 +256,8 @@ bool openEMS_FDTD_MPI::SetupMPI(TiXmlElement* FDTD_Opts)
}
}
m_MPI_Op->SetOriginalMesh(m_Original_Grid);
m_MPI_Op->SetTag(0);
return true;

View File

@ -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;

View File

@ -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);