more options to setup SAR averaging method
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>pull/1/head
parent
c65b5df785
commit
a607bc6969
|
@ -26,6 +26,7 @@
|
||||||
ProcessFieldsSAR::ProcessFieldsSAR(Engine_Interface_Base* eng_if) : ProcessFieldsFD(eng_if)
|
ProcessFieldsSAR::ProcessFieldsSAR(Engine_Interface_Base* eng_if) : ProcessFieldsFD(eng_if)
|
||||||
{
|
{
|
||||||
m_UseCellKappa = false;
|
m_UseCellKappa = false;
|
||||||
|
m_SAR_method = "Simple";
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessFieldsSAR::~ProcessFieldsSAR()
|
ProcessFieldsSAR::~ProcessFieldsSAR()
|
||||||
|
@ -48,9 +49,7 @@ void ProcessFieldsSAR::SetDumpType(DumpType type)
|
||||||
|
|
||||||
bool ProcessFieldsSAR::NeedConductivity() const
|
bool ProcessFieldsSAR::NeedConductivity() const
|
||||||
{
|
{
|
||||||
if (m_UseCellKappa)
|
return !m_UseCellKappa;
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessFieldsSAR::SetSubSampling(unsigned int subSampleRate, int dir)
|
void ProcessFieldsSAR::SetSubSampling(unsigned int subSampleRate, int dir)
|
||||||
|
@ -270,6 +269,7 @@ void ProcessFieldsSAR::DumpFDData()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SAR_Calculation SAR_Calc;
|
SAR_Calculation SAR_Calc;
|
||||||
|
SAR_Calc.SetAveragingMethod(m_SAR_method);
|
||||||
SAR_Calc.SetDebugLevel(g_settings.GetVerboseLevel());
|
SAR_Calc.SetDebugLevel(g_settings.GetVerboseLevel());
|
||||||
SAR_Calc.SetNumLines(numLines);
|
SAR_Calc.SetNumLines(numLines);
|
||||||
if (m_DumpType == SAR_LOCAL_DUMP)
|
if (m_DumpType == SAR_LOCAL_DUMP)
|
||||||
|
@ -285,7 +285,7 @@ void ProcessFieldsSAR::DumpFDData()
|
||||||
SAR_Calc.SetCellDensities(cell_density);
|
SAR_Calc.SetCellDensities(cell_density);
|
||||||
SAR_Calc.SetCellWidth(cellWidth);
|
SAR_Calc.SetCellWidth(cellWidth);
|
||||||
SAR_Calc.SetCellVolumes(cell_volume);
|
SAR_Calc.SetCellVolumes(cell_volume);
|
||||||
SAR_Calc.SetCellCondictivity(cell_kappa);
|
SAR_Calc.SetCellCondictivity(cell_kappa); // cell_kappa will be NULL if m_UseCellKappa is false
|
||||||
|
|
||||||
for (size_t n = 0; n<m_FD_Samples.size(); ++n)
|
for (size_t n = 0; n<m_FD_Samples.size(); ++n)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,11 +43,15 @@ public:
|
||||||
//! Set to true for using the conductivity found at the center of a cell, instead of default E*J
|
//! Set to true for using the conductivity found at the center of a cell, instead of default E*J
|
||||||
virtual void SetUseCellConductivity(bool val) {m_UseCellKappa=val;}
|
virtual void SetUseCellConductivity(bool val) {m_UseCellKappa=val;}
|
||||||
|
|
||||||
|
virtual void SetSARAveragingMethod(string method) {m_SAR_method=method;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DumpFDData();
|
virtual void DumpFDData();
|
||||||
|
|
||||||
bool m_UseCellKappa;
|
bool m_UseCellKappa;
|
||||||
|
|
||||||
|
string m_SAR_method;
|
||||||
|
|
||||||
//! frequency domain electric field storage
|
//! frequency domain electric field storage
|
||||||
vector<std::complex<float>****> m_E_FD_Fields;
|
vector<std::complex<float>****> m_E_FD_Fields;
|
||||||
//! frequency domain current density storage
|
//! frequency domain current density storage
|
||||||
|
|
|
@ -435,7 +435,13 @@ bool openEMS::SetupProcessing()
|
||||||
else if ((db->GetDumpType()>=10) && (db->GetDumpType()<=13))
|
else if ((db->GetDumpType()>=10) && (db->GetDumpType()<=13))
|
||||||
ProcField = new ProcessFieldsFD(NewEngineInterface());
|
ProcField = new ProcessFieldsFD(NewEngineInterface());
|
||||||
else if ( ((db->GetDumpType()>=20) && (db->GetDumpType()<=22)) || (db->GetDumpType()==29) )
|
else if ( ((db->GetDumpType()>=20) && (db->GetDumpType()<=22)) || (db->GetDumpType()==29) )
|
||||||
ProcField = new ProcessFieldsSAR(NewEngineInterface());
|
{
|
||||||
|
ProcessFieldsSAR* procSAR = new ProcessFieldsSAR(NewEngineInterface());
|
||||||
|
ProcField = procSAR;
|
||||||
|
string method = db->GetAttributeValue("SAR_Method");
|
||||||
|
if (!method.empty())
|
||||||
|
procSAR->SetSARAveragingMethod(method);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cerr << "openEMS::SetupFDTD: unknown dump box type... skipping!" << endl;
|
cerr << "openEMS::SetupFDTD: unknown dump box type... skipping!" << endl;
|
||||||
if (ProcField)
|
if (ProcField)
|
||||||
|
|
|
@ -19,13 +19,14 @@
|
||||||
#include "sar_calculation.h"
|
#include "sar_calculation.h"
|
||||||
#include "cfloat"
|
#include "cfloat"
|
||||||
#include "array_ops.h"
|
#include "array_ops.h"
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
SAR_Calculation::SAR_Calculation()
|
SAR_Calculation::SAR_Calculation()
|
||||||
{
|
{
|
||||||
m_Vx_Used = NULL;
|
m_Vx_Used = NULL;
|
||||||
m_Vx_Valid = NULL;
|
m_Vx_Valid = NULL;
|
||||||
m_DebugLevel = 0;
|
m_DebugLevel = 0;
|
||||||
SetAveragingMethod(SIMPLE);
|
SetAveragingMethod(SIMPLE, true);
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,9 +53,23 @@ void SAR_Calculation::Reset()
|
||||||
m_Vx_Valid = NULL;
|
m_Vx_Valid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAR_Calculation::SetAveragingMethod(SARAveragingMethod method)
|
void SAR_Calculation::SetAveragingMethod(string method, bool silent)
|
||||||
{
|
{
|
||||||
if (method==IEEE_C95_3)
|
if (method.compare("IEEE_C95_3")==0)
|
||||||
|
return SetAveragingMethod(IEEE_C95_3, silent);
|
||||||
|
if (method.compare("IEEE_62704")==0)
|
||||||
|
return SetAveragingMethod(IEEE_62704, silent);
|
||||||
|
if (method.compare("SIMPLE")==0)
|
||||||
|
return SetAveragingMethod(SIMPLE, silent);
|
||||||
|
|
||||||
|
cerr << __func__ << ": Error, """ << method << """ is an unknown averaging method..." << endl;
|
||||||
|
// unknown method, fallback to simple
|
||||||
|
SetAveragingMethod(SIMPLE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SAR_Calculation::SetAveragingMethod(SARAveragingMethod method, bool silent)
|
||||||
|
{
|
||||||
|
if (method==IEEE_62704)
|
||||||
{
|
{
|
||||||
m_massTolerance = 0.0001;
|
m_massTolerance = 0.0001;
|
||||||
m_maxMassIterations = 100;
|
m_maxMassIterations = 100;
|
||||||
|
@ -62,9 +77,11 @@ void SAR_Calculation::SetAveragingMethod(SARAveragingMethod method)
|
||||||
m_markPartialAsUsed = false;
|
m_markPartialAsUsed = false;
|
||||||
m_UnusedRelativeVolLimit = 1.05;
|
m_UnusedRelativeVolLimit = 1.05;
|
||||||
m_IgnoreFaceValid = false;
|
m_IgnoreFaceValid = false;
|
||||||
|
if (!silent)
|
||||||
|
cerr << __func__ << ": Setting averaging method to IEEE_62704" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (method==IEEE_62704)
|
else if (method==IEEE_C95_3)
|
||||||
{
|
{
|
||||||
m_massTolerance = 0.05;
|
m_massTolerance = 0.05;
|
||||||
m_maxMassIterations = 100;
|
m_maxMassIterations = 100;
|
||||||
|
@ -72,6 +89,8 @@ void SAR_Calculation::SetAveragingMethod(SARAveragingMethod method)
|
||||||
m_markPartialAsUsed = true;
|
m_markPartialAsUsed = true;
|
||||||
m_UnusedRelativeVolLimit = 1;
|
m_UnusedRelativeVolLimit = 1;
|
||||||
m_IgnoreFaceValid = false;
|
m_IgnoreFaceValid = false;
|
||||||
|
if (!silent)
|
||||||
|
cerr << __func__ << ": Setting averaging method to IEEE_C95_3" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (method==SIMPLE)
|
else if (method==SIMPLE)
|
||||||
|
@ -82,11 +101,14 @@ void SAR_Calculation::SetAveragingMethod(SARAveragingMethod method)
|
||||||
m_markPartialAsUsed = true;
|
m_markPartialAsUsed = true;
|
||||||
m_UnusedRelativeVolLimit = 1;
|
m_UnusedRelativeVolLimit = 1;
|
||||||
m_IgnoreFaceValid = true;
|
m_IgnoreFaceValid = true;
|
||||||
|
if (!silent)
|
||||||
|
cerr << __func__ << ": Setting averaging method to SIMPLE" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cerr << __func__ << ": Error, unknown averaging method..." << endl;
|
||||||
// unknown method, fallback to simple
|
// unknown method, fallback to simple
|
||||||
SetAveragingMethod(SIMPLE);
|
SetAveragingMethod(SIMPLE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAR_Calculation::SetNumLines(unsigned int numLines[3])
|
void SAR_Calculation::SetNumLines(unsigned int numLines[3])
|
||||||
|
|
|
@ -34,7 +34,10 @@ public:
|
||||||
void SetDebugLevel(int level) {m_DebugLevel=level;}
|
void SetDebugLevel(int level) {m_DebugLevel=level;}
|
||||||
|
|
||||||
//! Set the used averaging method
|
//! Set the used averaging method
|
||||||
void SetAveragingMethod(SARAveragingMethod method);
|
void SetAveragingMethod(SARAveragingMethod method, bool silent=false);
|
||||||
|
|
||||||
|
//! Set the used averaging method
|
||||||
|
void SetAveragingMethod(std::string method, bool silent=false);
|
||||||
|
|
||||||
//! Set number of lines in all direcitions. (mandatory information)
|
//! Set number of lines in all direcitions. (mandatory information)
|
||||||
void SetNumLines(unsigned int numLines[3]);
|
void SetNumLines(unsigned int numLines[3]);
|
||||||
|
|
Loading…
Reference in New Issue