more options to setup SAR averaging method

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
pull/1/head
Thorsten Liebig 2013-05-15 16:02:30 +02:00
parent c65b5df785
commit a607bc6969
5 changed files with 46 additions and 11 deletions

View File

@ -26,6 +26,7 @@
ProcessFieldsSAR::ProcessFieldsSAR(Engine_Interface_Base* eng_if) : ProcessFieldsFD(eng_if)
{
m_UseCellKappa = false;
m_SAR_method = "Simple";
}
ProcessFieldsSAR::~ProcessFieldsSAR()
@ -48,9 +49,7 @@ void ProcessFieldsSAR::SetDumpType(DumpType type)
bool ProcessFieldsSAR::NeedConductivity() const
{
if (m_UseCellKappa)
return false;
return true;
return !m_UseCellKappa;
}
void ProcessFieldsSAR::SetSubSampling(unsigned int subSampleRate, int dir)
@ -270,6 +269,7 @@ void ProcessFieldsSAR::DumpFDData()
else
{
SAR_Calculation SAR_Calc;
SAR_Calc.SetAveragingMethod(m_SAR_method);
SAR_Calc.SetDebugLevel(g_settings.GetVerboseLevel());
SAR_Calc.SetNumLines(numLines);
if (m_DumpType == SAR_LOCAL_DUMP)
@ -285,7 +285,7 @@ void ProcessFieldsSAR::DumpFDData()
SAR_Calc.SetCellDensities(cell_density);
SAR_Calc.SetCellWidth(cellWidth);
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)
{

View File

@ -43,11 +43,15 @@ public:
//! 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 SetSARAveragingMethod(string method) {m_SAR_method=method;}
protected:
virtual void DumpFDData();
bool m_UseCellKappa;
string m_SAR_method;
//! frequency domain electric field storage
vector<std::complex<float>****> m_E_FD_Fields;
//! frequency domain current density storage

View File

@ -435,7 +435,13 @@ bool openEMS::SetupProcessing()
else if ((db->GetDumpType()>=10) && (db->GetDumpType()<=13))
ProcField = new ProcessFieldsFD(NewEngineInterface());
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
cerr << "openEMS::SetupFDTD: unknown dump box type... skipping!" << endl;
if (ProcField)

View File

@ -19,13 +19,14 @@
#include "sar_calculation.h"
#include "cfloat"
#include "array_ops.h"
#include "global.h"
SAR_Calculation::SAR_Calculation()
{
m_Vx_Used = NULL;
m_Vx_Valid = NULL;
m_DebugLevel = 0;
SetAveragingMethod(SIMPLE);
SetAveragingMethod(SIMPLE, true);
Reset();
}
@ -52,9 +53,23 @@ void SAR_Calculation::Reset()
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_maxMassIterations = 100;
@ -62,9 +77,11 @@ void SAR_Calculation::SetAveragingMethod(SARAveragingMethod method)
m_markPartialAsUsed = false;
m_UnusedRelativeVolLimit = 1.05;
m_IgnoreFaceValid = false;
if (!silent)
cerr << __func__ << ": Setting averaging method to IEEE_62704" << endl;
return;
}
else if (method==IEEE_62704)
else if (method==IEEE_C95_3)
{
m_massTolerance = 0.05;
m_maxMassIterations = 100;
@ -72,6 +89,8 @@ void SAR_Calculation::SetAveragingMethod(SARAveragingMethod method)
m_markPartialAsUsed = true;
m_UnusedRelativeVolLimit = 1;
m_IgnoreFaceValid = false;
if (!silent)
cerr << __func__ << ": Setting averaging method to IEEE_C95_3" << endl;
return;
}
else if (method==SIMPLE)
@ -82,11 +101,14 @@ void SAR_Calculation::SetAveragingMethod(SARAveragingMethod method)
m_markPartialAsUsed = true;
m_UnusedRelativeVolLimit = 1;
m_IgnoreFaceValid = true;
if (!silent)
cerr << __func__ << ": Setting averaging method to SIMPLE" << endl;
return;
}
cerr << __func__ << ": Error, unknown averaging method..." << endl;
// unknown method, fallback to simple
SetAveragingMethod(SIMPLE);
SetAveragingMethod(SIMPLE, false);
}
void SAR_Calculation::SetNumLines(unsigned int numLines[3])

View File

@ -34,7 +34,10 @@ public:
void SetDebugLevel(int level) {m_DebugLevel=level;}
//! 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)
void SetNumLines(unsigned int numLines[3]);