MPI: new check extension compatibility framework

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
pull/1/head
Thorsten Liebig 2012-09-17 16:56:14 +02:00
parent a7380816e8
commit a704b49947
10 changed files with 33 additions and 0 deletions

View File

@ -38,6 +38,7 @@ public:
virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const {UNUSED(closedAlpha); UNUSED(R0_included); return true;} virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const {UNUSED(closedAlpha); UNUSED(R0_included); return true;}
virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return true;} virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return true;}
virtual bool IsMPISave() const {return true;}
virtual string GetExtensionName() const {return string("Conducting Sheet Extension");} virtual string GetExtensionName() const {return string("Conducting Sheet Extension");}

View File

@ -38,6 +38,9 @@ public:
virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const {UNUSED(closedAlpha); UNUSED(R0_included); return true;} virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const {UNUSED(closedAlpha); UNUSED(R0_included); return true;}
virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return true;} virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return true;}
// FIXME, this extension is not save or unknown to be save to use with MPI
virtual bool IsMPISave() const {return false;}
virtual std::string GetExtensionName() const {return std::string("Extension for the Cylinder-Coords Operator");} virtual std::string GetExtensionName() const {return std::string("Extension for the Cylinder-Coords Operator");}
virtual void ShowStat(ostream &ostr) const; virtual void ShowStat(ostream &ostr) const;

View File

@ -40,6 +40,7 @@ public:
virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const {UNUSED(closedAlpha); UNUSED(R0_included); return true;} virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const {UNUSED(closedAlpha); UNUSED(R0_included); return true;}
virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return true;} virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return true;}
virtual bool IsMPISave() const {return true;}
virtual string GetExtensionName() const {return string("Excitation Extension");} virtual string GetExtensionName() const {return string("Excitation Extension");}

View File

@ -36,6 +36,7 @@ public:
virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const {UNUSED(closedAlpha); UNUSED(R0_included); return true;} virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const {UNUSED(closedAlpha); UNUSED(R0_included); return true;}
virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return true;} virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return true;}
virtual bool IsMPISave() const {return true;}
virtual string GetExtensionName() const {return string("Drude/Lorentz Dispersive Material Extension");} virtual string GetExtensionName() const {return string("Drude/Lorentz Dispersive Material Extension");}

View File

@ -42,6 +42,7 @@ public:
virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const; virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const;
virtual bool IsCylindricalMultiGridSave(bool child) const; virtual bool IsCylindricalMultiGridSave(bool child) const;
virtual bool IsMPISave() const {return true;}
virtual string GetExtensionName() const {return string("Mur ABC Extension");} virtual string GetExtensionName() const {return string("Mur ABC Extension");}

View File

@ -40,6 +40,9 @@ public:
virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const {UNUSED(closedAlpha); UNUSED(R0_included); return false;} virtual bool IsCylinderCoordsSave(bool closedAlpha, bool R0_included) const {UNUSED(closedAlpha); UNUSED(R0_included); return false;}
virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return false;} virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return false;}
// FIXME, this extension is not save to use with MPI
virtual bool IsMPISave() const {return false;}
virtual string GetExtensionName() const {return string("Total-Field/Scattered-Field Extension");} virtual string GetExtensionName() const {return string("Total-Field/Scattered-Field Extension");}
virtual void ShowStat(ostream &ostr) const; virtual void ShowStat(ostream &ostr) const;

View File

@ -41,6 +41,8 @@ public:
//! Returns always true if base grid, Create_UPML will create proper child pml extensions. //! Returns always true if base grid, Create_UPML will create proper child pml extensions.
virtual bool IsCylindricalMultiGridSave(bool child) const {if (child) return false; return true;} virtual bool IsCylindricalMultiGridSave(bool child) const {if (child) return false; return true;}
virtual bool IsMPISave() const {return true;}
void SetBoundaryCondition(const int* BCs, const unsigned int size[6]); void SetBoundaryCondition(const int* BCs, const unsigned int size[6]);
void SetRange(const unsigned int start[3], const unsigned int stop[3]); void SetRange(const unsigned int start[3], const unsigned int stop[3]);

View File

@ -56,6 +56,9 @@ public:
//! The cylindrical multi grid operator will check whether the extension is save to use. Default is false. Derive this method to override. //! The cylindrical multi grid operator will check whether the extension is save to use. Default is false. Derive this method to override.
virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return false;} virtual bool IsCylindricalMultiGridSave(bool child) const {UNUSED(child); return false;}
//! The MPI operator (if enabled) will check whether the extension is compatible with MPI. Default is false. Derive this method to override.
virtual bool IsMPISave() const {return false;}
virtual string GetExtensionName() const {return string("Abstract Operator Extension Base Class");} virtual string GetExtensionName() const {return string("Abstract Operator Extension Base Class");}
virtual void ShowStat(ostream &ostr) const; virtual void ShowStat(ostream &ostr) const;

View File

@ -19,6 +19,7 @@
#include "operator_sse_compressed.h" #include "operator_sse_compressed.h"
#include "engine_sse_compressed.h" #include "engine_sse_compressed.h"
#include "engine_mpi.h" #include "engine_mpi.h"
#include "extensions/operator_extension.h"
#include "tools/array_ops.h" #include "tools/array_ops.h"
#include "tools/useful.h" #include "tools/useful.h"
#include "mpi.h" #include "mpi.h"
@ -163,6 +164,21 @@ unsigned int Operator_MPI::GetNumberOfLines(int ny) const
return Operator_SSE_Compressed::GetNumberOfLines(ny)-1; return Operator_SSE_Compressed::GetNumberOfLines(ny)-1;
} }
void Operator_MPI::AddExtension(Operator_Extension* op_ext)
{
if (m_MPI_Enabled==false)
return Operator_SSE_Compressed::AddExtension(op_ext);
if (op_ext->IsMPISave())
Operator_SSE_Compressed::AddExtension(op_ext);
else
{
delete op_ext;
cerr << "Operator_MPI::AddExtension: Warning: Operator extension \"" << op_ext->GetExtensionName() << "\" is not compatible with MPI!! skipping...!" << endl;
}
}
string Operator_MPI::PrependRank(string name) string Operator_MPI::PrependRank(string name)
{ {
stringstream out_name; stringstream out_name;

View File

@ -52,6 +52,8 @@ public:
virtual unsigned int GetNumberOfLines(int ny) const; virtual unsigned int GetNumberOfLines(int ny) const;
virtual void AddExtension(Operator_Extension* op_ext);
protected: protected:
Operator_MPI(); Operator_MPI();
bool m_MPI_Enabled; bool m_MPI_Enabled;