From 6892a0c58914b21075f6fda3d9ba77cf5713c3d3 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Thu, 19 Dec 2013 15:15:36 +0100 Subject: [PATCH] support for multigrid level request of dump boxes Signed-off-by: Thorsten Liebig --- FDTD/operator_cylindermultigrid.h | 3 +++ openems.cpp | 30 +++++++++++++++++++++++++----- openems.h | 2 +- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/FDTD/operator_cylindermultigrid.h b/FDTD/operator_cylindermultigrid.h index 25d63af..2316fbb 100644 --- a/FDTD/operator_cylindermultigrid.h +++ b/FDTD/operator_cylindermultigrid.h @@ -50,6 +50,9 @@ public: virtual void AddExtension(Operator_Extension* op_ext); + //! Get the multi grid level of this operator, e.g. 0 is main grid --> no parent grid + int GetMultiGridLevel() const {return m_MultiGridLevel;} + Operator_Cylinder* GetInnerOperator() const {return m_InnerOp;} virtual void SetExcitationSignal(Excitation* exc); diff --git a/openems.cpp b/openems.cpp index 7b9677c..3af6a57 100644 --- a/openems.cpp +++ b/openems.cpp @@ -304,10 +304,30 @@ bool openEMS::SetupBoundaryConditions(TiXmlElement* BC) return true; } -Engine_Interface_FDTD* openEMS::NewEngineInterface() +Engine_Interface_FDTD* openEMS::NewEngineInterface(int multigridlevel) { - Operator_Cylinder* op_cyl = dynamic_cast(FDTD_Op); + Operator_CylinderMultiGrid* op_cyl_mg = dynamic_cast(FDTD_Op); Engine_sse* eng_sse = dynamic_cast(FDTD_Eng); + while (op_cyl_mg && eng_sse && multigridlevel>0) + { + int mgl = op_cyl_mg->GetMultiGridLevel(); + if (mgl==multigridlevel) + { + if (g_settings.GetVerboseLevel()>0) + cerr << __func__ << ": Operator with requested multi-grid level found." << endl; + return new Engine_Interface_Cylindrical_FDTD(op_cyl_mg,eng_sse); + } + Operator_Cylinder* op_cyl_inner = op_cyl_mg->GetInnerOperator(); + op_cyl_mg = dynamic_cast(op_cyl_inner); + if (op_cyl_mg==NULL) //inner most operator reached + { + if (g_settings.GetVerboseLevel()>0) + cerr << __func__ << ": Operator with highest multi-grid level chosen." << endl; + return new Engine_Interface_Cylindrical_FDTD(op_cyl_inner,eng_sse); + } + // try next level + } + Operator_Cylinder* op_cyl = dynamic_cast(FDTD_Op); if (op_cyl && eng_sse) return new Engine_Interface_Cylindrical_FDTD(op_cyl,eng_sse); Operator_sse* op_sse = dynamic_cast(FDTD_Op); @@ -432,12 +452,12 @@ bool openEMS::SetupProcessing() if (db) { if ((db->GetDumpType()>=0) && (db->GetDumpType()<=3)) - ProcField = new ProcessFieldsTD(NewEngineInterface()); + ProcField = new ProcessFieldsTD(NewEngineInterface(db->GetMultiGridLevel())); else if ((db->GetDumpType()>=10) && (db->GetDumpType()<=13)) - ProcField = new ProcessFieldsFD(NewEngineInterface()); + ProcField = new ProcessFieldsFD(NewEngineInterface(db->GetMultiGridLevel())); else if ( ((db->GetDumpType()>=20) && (db->GetDumpType()<=22)) || (db->GetDumpType()==29) ) { - ProcessFieldsSAR* procSAR = new ProcessFieldsSAR(NewEngineInterface()); + ProcessFieldsSAR* procSAR = new ProcessFieldsSAR(NewEngineInterface(db->GetMultiGridLevel())); ProcField = procSAR; string method = db->GetAttributeValue("SAR_Method"); if (!method.empty()) diff --git a/openems.h b/openems.h index e8106f0..4072850 100644 --- a/openems.h +++ b/openems.h @@ -68,7 +68,7 @@ public: //! Check for abort conditions bool CheckAbortCond(); - Engine_Interface_FDTD* NewEngineInterface(); + Engine_Interface_FDTD* NewEngineInterface(int multigridlevel = 0); protected: bool CylinderCoords;