diff options
Diffstat (limited to 'openEMS/Common')
-rw-r--r-- | openEMS/Common/engine_interface_base.h | 4 | ||||
-rw-r--r-- | openEMS/Common/processfields.cpp | 66 | ||||
-rw-r--r-- | openEMS/Common/processfields.h | 4 | ||||
-rw-r--r-- | openEMS/Common/processmodematch.cpp | 2 |
4 files changed, 74 insertions, 2 deletions
diff --git a/openEMS/Common/engine_interface_base.h b/openEMS/Common/engine_interface_base.h index 6ce466b..15be488 100644 --- a/openEMS/Common/engine_interface_base.h +++ b/openEMS/Common/engine_interface_base.h @@ -56,6 +56,10 @@ public: virtual double* GetJField(const unsigned int* pos, double* out) const =0; //! Get the total current density field by rot(H) at \p pos. \sa SetInterpolationType virtual double* GetRotHField(const unsigned int* pos, double* out) const =0; + //! Get the (interpolated) electric flux density field at \p pos. \sa SetInterpolationType + virtual double* GetDField(const unsigned int* pos, double* out) const =0; + //! Get the (interpolated) magnetic flux density field at \p pos. \sa SetInterpolationType + virtual double* GetBField(const unsigned int* pos, double* out) const =0; //! Calculate the electric field integral along a given line virtual double CalcVoltageIntegral(const unsigned int* start, const unsigned int* stop) const =0; diff --git a/openEMS/Common/processfields.cpp b/openEMS/Common/processfields.cpp index f52fc14..b486c32 100644 --- a/openEMS/Common/processfields.cpp +++ b/openEMS/Common/processfields.cpp @@ -71,6 +71,10 @@ string ProcessFields::GetFieldNameByType(DumpType type) return "J-Field"; case ROTH_FIELD_DUMP: return "RotH-Field"; + case D_FIELD_DUMP: + return "D-Field"; + case B_FIELD_DUMP: + return "B-Field"; case SAR_LOCAL_DUMP: return "SAR-local"; case SAR_1G_DUMP: @@ -95,6 +99,30 @@ bool ProcessFields::NeedConductivity() const return false; } +bool ProcessFields::NeedPermittivity() const +{ + switch (m_DumpType) + { + case D_FIELD_DUMP: + return true; + default: + return false; + } + return false; +} + +bool ProcessFields::NeedPermeability() const +{ + switch (m_DumpType) + { + case B_FIELD_DUMP: + return true; + default: + return false; + } + return false; +} + void ProcessFields::InitProcess() { if (Enabled==false) return; @@ -333,6 +361,44 @@ FDTD_FLOAT**** ProcessFields::CalcField() } } return field; + case D_FIELD_DUMP: + for (unsigned int i=0; i<numLines[0]; ++i) + { + pos[0]=posLines[0][i]; + for (unsigned int j=0; j<numLines[1]; ++j) + { + pos[1]=posLines[1][j]; + for (unsigned int k=0; k<numLines[2]; ++k) + { + pos[2]=posLines[2][k]; + + m_Eng_Interface->GetDField(pos,out); + field[0][i][j][k] = out[0]; + field[1][i][j][k] = out[1]; + field[2][i][j][k] = out[2]; + } + } + } + return field; + case B_FIELD_DUMP: + for (unsigned int i=0; i<numLines[0]; ++i) + { + pos[0]=posLines[0][i]; + for (unsigned int j=0; j<numLines[1]; ++j) + { + pos[1]=posLines[1][j]; + for (unsigned int k=0; k<numLines[2]; ++k) + { + pos[2]=posLines[2][k]; + + m_Eng_Interface->GetBField(pos,out); + field[0][i][j][k] = out[0]; + field[1][i][j][k] = out[1]; + field[2][i][j][k] = out[2]; + } + } + } + return field; default: cerr << "ProcessFields::CalcField(): Error, unknown dump type..." << endl; return field; diff --git a/openEMS/Common/processfields.h b/openEMS/Common/processfields.h index 3d4085b..d954484 100644 --- a/openEMS/Common/processfields.h +++ b/openEMS/Common/processfields.h @@ -40,7 +40,7 @@ public: Current dump types are electric field (E_FIELD_DUMP), magnetic field (H_FIELD_DUMP), (conduction) electric current density (kappa*E) (J_FIELD_DUMP) and total current density (rotH) */ - enum DumpType { E_FIELD_DUMP=0, H_FIELD_DUMP=1, J_FIELD_DUMP=2, ROTH_FIELD_DUMP=3, SAR_LOCAL_DUMP=20, SAR_1G_DUMP=21, SAR_10G_DUMP=22, SAR_RAW_DATA=29}; + enum DumpType { E_FIELD_DUMP=0, H_FIELD_DUMP=1, J_FIELD_DUMP=2, ROTH_FIELD_DUMP=3, D_FIELD_DUMP=4, B_FIELD_DUMP=5, SAR_LOCAL_DUMP=20, SAR_1G_DUMP=21, SAR_10G_DUMP=22, SAR_RAW_DATA=29}; virtual std::string GetProcessingName() const {return "common field processing";} @@ -75,6 +75,8 @@ public: static std::string GetFieldNameByType(DumpType type); virtual bool NeedConductivity() const; + virtual bool NeedPermittivity() const; + virtual bool NeedPermeability() const; protected: DumpType m_DumpType; diff --git a/openEMS/Common/processmodematch.cpp b/openEMS/Common/processmodematch.cpp index 620257d..85d2d58 100644 --- a/openEMS/Common/processmodematch.cpp +++ b/openEMS/Common/processmodematch.cpp @@ -174,7 +174,7 @@ void ProcessModeMatch::InitProcess() for (int n=0; n<2; ++n) { m_ModeDist[n][posP][posPP] = m_ModeParser[n]->Eval(var); //calc mode template - if ((isnan(m_ModeDist[n][posP][posPP])) || (isinf(m_ModeDist[n][posP][posPP]))) + if ((std::isnan(m_ModeDist[n][posP][posPP])) || (std::isinf(m_ModeDist[n][posP][posPP]))) m_ModeDist[n][posP][posPP] = 0.0; norm += pow(m_ModeDist[n][posP][posPP],2) * area; } |