diff --git a/Common/operator_base.h b/Common/operator_base.h index 901ae52..cad69d8 100644 --- a/Common/operator_base.h +++ b/Common/operator_base.h @@ -81,6 +81,8 @@ public: //! Check storage flags and cleanup virtual void CleanupMaterialStorage() = 0; + //! Get stored discrete material (if storage is enabled). + virtual double GetDiscMaterial(int type, int ny, const unsigned int pos[3]) const = 0; protected: Operator_Base(); diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index 279de8c..f7164f4 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -669,6 +669,30 @@ void Operator::CleanupMaterialStorage() } } +double Operator::GetDiscMaterial(int type, int n, const unsigned int pos[3]) const +{ + switch (type) + { + case 0: + if (m_epsR==0) + return 0; + return m_epsR[n][pos[0]][pos[1]][pos[2]]; + case 1: + if (m_kappa==0) + return 0; + return m_kappa[n][pos[0]][pos[1]][pos[2]]; + case 2: + if (m_mueR==0) + return 0; + return m_mueR[n][pos[0]][pos[1]][pos[2]]; + case 3: + if (m_sigma==0) + return 0; + return m_sigma[n][pos[0]][pos[1]][pos[2]]; + } + return 0; +} + void Operator::InitExcitation() { delete Exc; diff --git a/FDTD/operator.h b/FDTD/operator.h index c960d3b..effc9e8 100644 --- a/FDTD/operator.h +++ b/FDTD/operator.h @@ -120,6 +120,8 @@ public: virtual void CleanupMaterialStorage(); + virtual double GetDiscMaterial(int type, int ny, const unsigned int pos[3]) const; + protected: //! use New() for creating a new Operator Operator();