From 87b8e22bf705b25796aaa5780bd3a59bf253c198 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Wed, 16 Jun 2010 12:50:19 +0200 Subject: [PATCH] Add Probe-Box weighting (new in CSXCAD) --- FDTD/processcurrent.cpp | 1 + FDTD/processing.cpp | 1 + FDTD/processing.h | 5 +++++ FDTD/processvoltage.cpp | 1 + openems.cpp | 1 + 5 files changed, 9 insertions(+) diff --git a/FDTD/processcurrent.cpp b/FDTD/processcurrent.cpp index dfa9e9d..80c9d1c 100644 --- a/FDTD/processcurrent.cpp +++ b/FDTD/processcurrent.cpp @@ -90,6 +90,7 @@ int ProcessCurrent::Process() current-=Eng->GetCurr(2,start[0],start[1],i); // cerr << "ts: " << Eng->numTS << " i: " << current << endl; + current*=m_weight; v_current.push_back(current); //current is sampled half a timestep later then the voltages file << setprecision(m_precision) << (0.5 + (double)Eng->GetNumberOfTimesteps())*Op->GetTimestep() << "\t" << current << endl; diff --git a/FDTD/processing.cpp b/FDTD/processing.cpp index 5b1835f..931fcfa 100644 --- a/FDTD/processing.cpp +++ b/FDTD/processing.cpp @@ -26,6 +26,7 @@ Processing::Processing(Operator* op, Engine* eng) m_PS_pos = 0; SetPrecision(12); ProcessInterval=0; + m_weight=1; } Processing::~Processing() diff --git a/FDTD/processing.h b/FDTD/processing.h index 95069a2..e6a4bf1 100644 --- a/FDTD/processing.h +++ b/FDTD/processing.h @@ -46,6 +46,9 @@ public: //! If Disabled Process() will do nothing... virtual bool GetEnable() const {return Enabled;} + virtual void SetWeight(double weight) {m_weight=weight;} + virtual double GetWeight() {return m_weight;} + //! Set the dump precision void SetPrecision(unsigned int val) {m_precision = val;} @@ -57,6 +60,8 @@ protected: Engine* Eng; unsigned int m_precision; + double m_weight; + bool Enabled; int GetNextInterval() const; diff --git a/FDTD/processvoltage.cpp b/FDTD/processvoltage.cpp index abb8fe8..ccec3ae 100644 --- a/FDTD/processvoltage.cpp +++ b/FDTD/processvoltage.cpp @@ -32,6 +32,7 @@ int ProcessVoltage::Process() if (CheckTimestep()==false) return GetNextInterval(); FDTD_FLOAT voltage=CalcLineIntegral(start,stop,0); // cerr << voltage << endl; + voltage*=m_weight; voltages.push_back(voltage); file << setprecision(m_precision) << (double)Eng->GetNumberOfTimesteps()*Op->GetTimestep() << "\t" << voltage << endl; return GetNextInterval(); diff --git a/openems.cpp b/openems.cpp index 5f9893c..ef6509d 100644 --- a/openems.cpp +++ b/openems.cpp @@ -326,6 +326,7 @@ int openEMS::SetupFDTD(const char* file) } proc->SetProcessInterval(Nyquist/m_OverSampling); proc->DefineStartStopCoord(start,stop); + proc->SetWeight(pb->GetWeighting()); PA->AddProcessing(proc); prim->SetPrimitiveUsed(true); }