From 6288ebca9122b7fe54902278148108795f149efc Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Sun, 4 Apr 2010 19:48:36 +0200 Subject: [PATCH] added Oversampling for processing --- matlab/InitFDTD.m | 6 ++++-- openems.cpp | 9 +++++++-- openems.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/matlab/InitFDTD.m b/matlab/InitFDTD.m index 516c6ab..228e9b7 100644 --- a/matlab/InitFDTD.m +++ b/matlab/InitFDTD.m @@ -1,7 +1,9 @@ -function FDTD = InitFDTD(NrTS, endCrit) +function FDTD = InitFDTD(NrTS, endCrit, varargin) FDTD.ATTRIBUTE.NumberOfTimesteps=NrTS; FDTD.ATTRIBUTE.endCriteria=endCrit; - +for n=1:(nargin-2)/2 + FDTD.ATTRIBUTE.(varargin{2*n-1})=varargin{2*n}; +end diff --git a/openems.cpp b/openems.cpp index 8515c4c..79f06ae 100644 --- a/openems.cpp +++ b/openems.cpp @@ -47,6 +47,7 @@ openEMS::openEMS() DebugMat = false; DebugOp = false; endCrit = 1e-6; + m_OverSampling = 4; m_engine = EngineType_Standard; m_engine_numThreads = 0; @@ -149,6 +150,10 @@ int openEMS::SetupFDTD(const char* file) if (endCrit==0) endCrit=1e-6; + FDTD_Opts->QueryIntAttribute("OverSampling",&m_OverSampling); + if (m_OverSampling<2) + m_OverSampling=2; + TiXmlElement* Excite = FDTD_Opts->FirstChildElement("Excitation"); if (Excite==NULL) { @@ -312,7 +317,7 @@ int openEMS::SetupFDTD(const char* file) procCurr->OpenFile(pb->GetName()); proc=procCurr; } - proc->SetProcessInterval(Nyquist/3); //three times as often as nyquist dictates + proc->SetProcessInterval(Nyquist/m_OverSampling); proc->DefineStartStopCoord(start,stop); PA->AddProcessing(proc); } @@ -326,7 +331,7 @@ int openEMS::SetupFDTD(const char* file) { ProcessFieldsTD* ProcTD = new ProcessFieldsTD(FDTD_Op,FDTD_Eng); ProcTD->SetEnable(Enable_Dumps); - ProcTD->SetProcessInterval(Nyquist/2); //twice as often as nyquist dictates + ProcTD->SetProcessInterval(Nyquist/m_OverSampling); //only looking for one prim atm CSPrimitives* prim = DumpProps.at(i)->GetPrimitive(0); diff --git a/openems.h b/openems.h index 981ac30..c074b2e 100644 --- a/openems.h +++ b/openems.h @@ -49,6 +49,7 @@ protected: bool DebugMat; bool DebugOp; double endCrit; + int m_OverSampling; Operator* FDTD_Op; Engine* FDTD_Eng; ProcessingArray* PA;