From 911f7c5528a5841358d1ca276abb1bb166fadd33 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Sun, 11 Jul 2010 23:45:41 +0200 Subject: [PATCH] show extensions status & define const methods --- FDTD/operator.cpp | 7 +++++++ FDTD/operator.h | 1 + FDTD/operator_ext_cylinder.cpp | 9 +++++++++ FDTD/operator_ext_cylinder.h | 6 ++++-- FDTD/operator_ext_dispersive.cpp | 9 +++++++++ FDTD/operator_ext_dispersive.h | 4 +++- FDTD/operator_ext_lorentzmaterial.cpp | 5 +++++ FDTD/operator_ext_lorentzmaterial.h | 6 ++++-- FDTD/operator_ext_mur_abc.cpp | 8 ++++++++ FDTD/operator_ext_mur_abc.h | 6 ++++-- FDTD/operator_extension.cpp | 5 +++++ FDTD/operator_extension.h | 13 +++++++++++-- openems.cpp | 1 + 13 files changed, 71 insertions(+), 9 deletions(-) diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index 744fbc8..770dd6b 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -308,6 +308,13 @@ void Operator::ShowStat() const cout << "-----------------------------------" << endl; } +void Operator::ShowExtStat() const +{ + cout << "-----------------------------------" << endl; + for (size_t n=0;nShowStat(cout); + cout << "-----------------------------------" << endl; +} void Operator::DumpOperator2File(string filename) { diff --git a/FDTD/operator.h b/FDTD/operator.h index d93bc61..42344cf 100644 --- a/FDTD/operator.h +++ b/FDTD/operator.h @@ -62,6 +62,7 @@ public: virtual unsigned int GetOriginalNumLines(int ny) const {return numLines[ny];} virtual void ShowStat() const; + virtual void ShowExtStat() const; virtual void DumpOperator2File(string filename); virtual void DumpMaterial2File(string filename); diff --git a/FDTD/operator_ext_cylinder.cpp b/FDTD/operator_ext_cylinder.cpp index 81e6b6b..e29eae1 100644 --- a/FDTD/operator_ext_cylinder.cpp +++ b/FDTD/operator_ext_cylinder.cpp @@ -58,3 +58,12 @@ Engine_Extension* Operator_Ext_Cylinder::CreateEngineExtention() Engine_Ext_Cylinder* eng_ext = new Engine_Ext_Cylinder(this); return eng_ext; } + + +void Operator_Ext_Cylinder::ShowStat(ostream &ostr) const +{ + Operator_Extension::ShowStat(ostr); + string On_Off[2] = {"Off", "On"}; + ostr << " Zeroth Radius\t\t: " << On_Off[CC_R0_included] << endl; + ostr << " Closed Rotation\t: " << On_Off[CC_closedAlpha] << endl; +} diff --git a/FDTD/operator_ext_cylinder.h b/FDTD/operator_ext_cylinder.h index e306913..26730d2 100644 --- a/FDTD/operator_ext_cylinder.h +++ b/FDTD/operator_ext_cylinder.h @@ -17,9 +17,11 @@ public: virtual Engine_Extension* CreateEngineExtention(); - virtual bool IsCylinderCoordsSave() {return true;} + virtual bool IsCylinderCoordsSave() const {return true;} - virtual std::string GetExtensionName() {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; protected: Operator_Cylinder* m_Op_Cyl; diff --git a/FDTD/operator_ext_dispersive.cpp b/FDTD/operator_ext_dispersive.cpp index f38a65e..95b9525 100644 --- a/FDTD/operator_ext_dispersive.cpp +++ b/FDTD/operator_ext_dispersive.cpp @@ -39,3 +39,12 @@ Operator_Ext_Dispersive::~Operator_Ext_Dispersive() m_LM_pos[1]=NULL; m_LM_pos[2]=NULL; } + +void Operator_Ext_Dispersive::ShowStat(ostream &ostr) const +{ + Operator_Extension::ShowStat(ostr); + string On_Off[2] = {"Off", "On"}; + ostr << " Active cells\t\t: " << m_LM_Count << endl; + ostr << " Voltage ADE is \t: " << On_Off[m_volt_ADE_On] << endl; + ostr << " Current ADE is \t: " << On_Off[m_curr_ADE_On] << endl; +} diff --git a/FDTD/operator_ext_dispersive.h b/FDTD/operator_ext_dispersive.h index 42410ae..21e2329 100644 --- a/FDTD/operator_ext_dispersive.h +++ b/FDTD/operator_ext_dispersive.h @@ -28,7 +28,9 @@ class Operator_Ext_Dispersive : public Operator_Extension public: virtual ~Operator_Ext_Dispersive(); - virtual string GetExtensionName() {return string("Dispersive Material Abstract Base class");} + virtual string GetExtensionName() const {return string("Dispersive Material Abstract Base class");} + + virtual void ShowStat(ostream &ostr) const; protected: Operator_Ext_Dispersive(Operator* op); diff --git a/FDTD/operator_ext_lorentzmaterial.cpp b/FDTD/operator_ext_lorentzmaterial.cpp index b0331c0..6e797bf 100644 --- a/FDTD/operator_ext_lorentzmaterial.cpp +++ b/FDTD/operator_ext_lorentzmaterial.cpp @@ -175,3 +175,8 @@ Engine_Extension* Operator_Ext_LorentzMaterial::CreateEngineExtention() Engine_Ext_LorentzMaterial* eng_ext_lor = new Engine_Ext_LorentzMaterial(this); return eng_ext_lor; } + +void Operator_Ext_LorentzMaterial::ShowStat(ostream &ostr) const +{ + Operator_Ext_Dispersive::ShowStat(ostr); +} diff --git a/FDTD/operator_ext_lorentzmaterial.h b/FDTD/operator_ext_lorentzmaterial.h index 32eea0a..9da4aaa 100644 --- a/FDTD/operator_ext_lorentzmaterial.h +++ b/FDTD/operator_ext_lorentzmaterial.h @@ -32,9 +32,11 @@ public: virtual Engine_Extension* CreateEngineExtention(); - virtual bool IsCylinderCoordsSave() {return false;} + virtual bool IsCylinderCoordsSave() const {return false;} - virtual std::string GetExtensionName() {return std::string("Lorentz Dispersive Material Extension");} + virtual std::string GetExtensionName() const {return std::string("Lorentz Dispersive Material Extension");} + + virtual void ShowStat(ostream &ostr) const; protected: diff --git a/FDTD/operator_ext_mur_abc.cpp b/FDTD/operator_ext_mur_abc.cpp index f8bd248..083b823 100644 --- a/FDTD/operator_ext_mur_abc.cpp +++ b/FDTD/operator_ext_mur_abc.cpp @@ -139,3 +139,11 @@ Engine_Extension* Operator_Ext_Mur_ABC::CreateEngineExtention() Engine_Ext_Mur_ABC* eng_ext = new Engine_Ext_Mur_ABC(this); return eng_ext; } + + +void Operator_Ext_Mur_ABC::ShowStat(ostream &ostr) const +{ + Operator_Extension::ShowStat(ostr); + string XYZ[3] = {"x","y","z"}; + ostr << " Active direction: " << XYZ[m_ny] << " at line: " << m_LineNr << endl; +} diff --git a/FDTD/operator_ext_mur_abc.h b/FDTD/operator_ext_mur_abc.h index 0fd1376..b8136e9 100644 --- a/FDTD/operator_ext_mur_abc.h +++ b/FDTD/operator_ext_mur_abc.h @@ -35,9 +35,11 @@ public: virtual Engine_Extension* CreateEngineExtention(); - virtual bool IsCylinderCoordsSave() {if (m_ny==2) return true; else return false;} + virtual bool IsCylinderCoordsSave() const {if (m_ny==2) return true; else return false;} - virtual string GetExtensionName() {return string("Mur ABC extension");} + virtual string GetExtensionName() const {return string("Mur ABC Extension");} + + virtual void ShowStat(ostream &ostr) const; protected: int m_ny; diff --git a/FDTD/operator_extension.cpp b/FDTD/operator_extension.cpp index a94b2a1..69f0442 100644 --- a/FDTD/operator_extension.cpp +++ b/FDTD/operator_extension.cpp @@ -23,3 +23,8 @@ Operator_Extension::Operator_Extension(Operator* op) { m_Op = op; } + +void Operator_Extension::ShowStat(ostream &ostr) const +{ + ostr << "--- " << GetExtensionName() << " ---" << endl; +} diff --git a/FDTD/operator_extension.h b/FDTD/operator_extension.h index b062162..fcc24cb 100644 --- a/FDTD/operator_extension.h +++ b/FDTD/operator_extension.h @@ -20,6 +20,13 @@ #include +#include +#include +#include + +using namespace std; + + class Operator; class Engine_Extension; @@ -32,9 +39,11 @@ public: virtual Engine_Extension* CreateEngineExtention() {return 0;} - virtual bool IsCylinderCoordsSave() {return false;} + virtual bool IsCylinderCoordsSave() const {return false;} - virtual std::string GetExtensionName() {return std::string("Abstract Operator Extension Base Class");} + virtual std::string GetExtensionName() const {return std::string("Abstract Operator Extension Base Class");} + + virtual void ShowStat(ostream &ostr) const; protected: Operator_Extension(Operator* op); diff --git a/openems.cpp b/openems.cpp index 5571384..549d381 100644 --- a/openems.cpp +++ b/openems.cpp @@ -298,6 +298,7 @@ int openEMS::SetupFDTD(const char* file) gettimeofday(&OpDoneTime,NULL); FDTD_Op->ShowStat(); + FDTD_Op->ShowExtStat(); cout << "Creation time for operator: " << CalcDiffTime(OpDoneTime,startTime) << " s" << endl;