extensions check for CylindircalMultiGrid & allow Mur-ABC in radial direction

pull/1/head
Thorsten Liebig 2010-09-22 09:58:45 +02:00
parent 54dd06590b
commit 8c95f21858
5 changed files with 43 additions and 8 deletions

View File

@ -187,26 +187,37 @@ void Operator_CylinderMultiGrid::Reset()
void Operator_CylinderMultiGrid::SetBoundaryCondition(int* BCs)
{
Operator_Cylinder::SetBoundaryCondition(BCs);
int oldBC = BCs[1];
BCs[1] = 0; //always PEC in +r-direction
m_InnerOp->SetBoundaryCondition(BCs);
BCs[1] = oldBC;
}
void Operator_CylinderMultiGrid::AddExtension(Operator_Extension* op_ext)
{
if (dynamic_cast<Operator_Ext_Cylinder*>(op_ext))
{
if (op_ext->IsCylindricalMultiGridSave(false)==false)
return;
else
cerr << "Operator_CylinderMultiGrid::AddExtension: Warning: Operator extension \"" << op_ext->GetExtensionName() << "\" is not compatible with cylindrical multi-grids!! skipping...!" << endl;
Operator_Cylinder::AddExtension(op_ext);
return;
}
if (op_ext->IsCylindricalMultiGridSave(true))
{
Operator_Extension* child_Ext = op_ext->Clone(m_InnerOp);
if (child_Ext==NULL)
{
cerr << "Operator_CylinderMultiGrid::AddExtension: Warning, extension: " << op_ext->GetExtensionName() << " can not be cloned for the child operator. Skipping Extension... " << endl;
return;
}
Operator_Cylinder::AddExtension(op_ext);
//give the copy to child
m_InnerOp->AddExtension(child_Ext);
}
Operator_Cylinder::AddExtension(op_ext);
}
void Operator_CylinderMultiGrid::ShowStat() const

View File

@ -35,6 +35,7 @@ public:
virtual Engine_Extension* CreateEngineExtention();
virtual bool IsCylinderCoordsSave() const {return true;}
virtual bool IsCylindricalMultiGridChildSave(bool child) const {UNUSED(child);return true;}
virtual std::string GetExtensionName() const {return std::string("Extension for the Cylinder-Coords Operator");}

View File

@ -47,6 +47,25 @@ Operator_Extension* Operator_Ext_Mur_ABC::Clone(Operator* op)
return new Operator_Ext_Mur_ABC(op, this);
}
bool Operator_Ext_Mur_ABC::IsCylinderCoordsSave() const
{
if (m_ny==2)
return true;
if ((m_ny==0) && (m_top))
return true;
return false;
}
bool Operator_Ext_Mur_ABC::IsCylindricalMultiGridSave(bool child) const
{
if (m_ny==2) //always allow in z-direction
return true;
if ((m_ny==0) && (m_top) && (!child)) //if top r-direction and is not a child grid allow Mur...
return true;
//in all other cases this ABC is not save to use in CylindricalMultiGrid
return false;
}
void Operator_Ext_Mur_ABC::Initialize()
{
m_ny = -1;

View File

@ -41,7 +41,8 @@ public:
virtual Engine_Extension* CreateEngineExtention();
virtual bool IsCylinderCoordsSave() const {if (m_ny==2) return true; else return false;}
virtual bool IsCylinderCoordsSave() const;
virtual bool IsCylindricalMultiGridSave(bool child) const;
virtual string GetExtensionName() const {return string("Mur ABC Extension");}

View File

@ -26,7 +26,6 @@
using namespace std;
class Operator;
class Engine_Extension;
@ -46,8 +45,12 @@ public:
virtual Engine_Extension* CreateEngineExtention() {return 0;}
//! The cylindrical operator will check whether the extension is save to use. Default is false. Derive this method to override.
virtual bool IsCylinderCoordsSave() const {return false;}
//! The cylindrical multi grid operator will check whether the extension is save to use. Default is false. Derive this method to override.
virtual bool IsCylindricalMultiGridSave(bool /*child*/) const {return false;}
virtual std::string GetExtensionName() const {return std::string("Abstract Operator Extension Base Class");}
virtual void ShowStat(ostream &ostr) const;