Operator Extension clone method: allows to create a copy/clone of an existing extension
This will be necessary for the upcoming multi-grid approach...pull/1/head
parent
1a818f659b
commit
fc2b60ba3e
|
@ -21,6 +21,33 @@
|
|||
#include "tools/array_ops.h"
|
||||
|
||||
Operator_Ext_Mur_ABC::Operator_Ext_Mur_ABC(Operator* op) : Operator_Extension(op)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
Operator_Ext_Mur_ABC::~Operator_Ext_Mur_ABC()
|
||||
{
|
||||
Delete2DArray(m_Mur_Coeff_nyP,m_numLines);
|
||||
m_Mur_Coeff_nyP = NULL;
|
||||
Delete2DArray(m_Mur_Coeff_nyPP,m_numLines);
|
||||
m_Mur_Coeff_nyPP = NULL;
|
||||
}
|
||||
|
||||
Operator_Ext_Mur_ABC::Operator_Ext_Mur_ABC(Operator* op, Operator_Ext_Mur_ABC* op_ext) : Operator_Extension(op, op_ext)
|
||||
{
|
||||
Initialize();
|
||||
m_v_phase = op_ext->m_v_phase;
|
||||
SetDirection(op_ext->m_ny,op_ext->m_top);
|
||||
}
|
||||
|
||||
Operator_Extension* Operator_Ext_Mur_ABC::Clone(Operator* op)
|
||||
{
|
||||
if (dynamic_cast<Operator_Ext_Mur_ABC*>(this)==NULL)
|
||||
return NULL;
|
||||
return new Operator_Ext_Mur_ABC(op, this);
|
||||
}
|
||||
|
||||
void Operator_Ext_Mur_ABC::Initialize()
|
||||
{
|
||||
m_ny = -1;
|
||||
m_nyP = -1;
|
||||
|
@ -37,14 +64,6 @@ Operator_Ext_Mur_ABC::Operator_Ext_Mur_ABC(Operator* op) : Operator_Extension(op
|
|||
m_numLines[1]=0;
|
||||
}
|
||||
|
||||
Operator_Ext_Mur_ABC::~Operator_Ext_Mur_ABC()
|
||||
{
|
||||
Delete2DArray(m_Mur_Coeff_nyP,m_numLines);
|
||||
m_Mur_Coeff_nyP = NULL;
|
||||
Delete2DArray(m_Mur_Coeff_nyPP,m_numLines);
|
||||
m_Mur_Coeff_nyPP = NULL;
|
||||
}
|
||||
|
||||
void Operator_Ext_Mur_ABC::SetDirection(int ny, bool top_ny)
|
||||
{
|
||||
if ((ny<0) || (ny>2))
|
||||
|
@ -54,6 +73,7 @@ void Operator_Ext_Mur_ABC::SetDirection(int ny, bool top_ny)
|
|||
Delete2DArray(m_Mur_Coeff_nyPP,m_numLines);
|
||||
|
||||
m_ny = ny;
|
||||
m_top = top_ny;
|
||||
m_nyP = (ny+1)%3;
|
||||
m_nyPP = (ny+2)%3;
|
||||
if (!top_ny)
|
||||
|
|
|
@ -28,6 +28,9 @@ public:
|
|||
Operator_Ext_Mur_ABC(Operator* op);
|
||||
~Operator_Ext_Mur_ABC();
|
||||
|
||||
Operator_Ext_Mur_ABC(Operator* op, Operator_Ext_Mur_ABC* op_ext);
|
||||
virtual Operator_Extension* Clone(Operator* op);
|
||||
|
||||
//! Define the direction of this ABC: \a ny=0,1,2 -> x,y,z and if at bottom_ny -> e.g. x=0 or x=end
|
||||
void SetDirection(int ny, bool top_ny);
|
||||
|
||||
|
@ -45,8 +48,10 @@ public:
|
|||
virtual void ShowStat(ostream &ostr) const;
|
||||
|
||||
protected:
|
||||
void Initialize();
|
||||
int m_ny;
|
||||
int m_nyP,m_nyPP;
|
||||
bool m_top;
|
||||
unsigned int m_LineNr;
|
||||
int m_LineNr_Shift;
|
||||
|
||||
|
|
|
@ -24,7 +24,20 @@ Operator_Extension::Operator_Extension(Operator* op)
|
|||
m_Op = op;
|
||||
}
|
||||
|
||||
Operator_Extension::Operator_Extension(Operator* op, Operator_Extension* op_ext)
|
||||
{
|
||||
UNUSED(op_ext);
|
||||
m_Op = op;
|
||||
}
|
||||
|
||||
void Operator_Extension::ShowStat(ostream &ostr) const
|
||||
{
|
||||
ostr << "--- " << GetExtensionName() << " ---" << endl;
|
||||
}
|
||||
|
||||
Operator_Extension* Operator_Extension::Clone(Operator* op)
|
||||
{
|
||||
if (dynamic_cast<Operator_Extension*>(this)==NULL)
|
||||
return NULL;
|
||||
return new Operator_Extension(op, this);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,13 @@ class Operator_Extension
|
|||
{
|
||||
friend class Engine_Extension;
|
||||
public:
|
||||
//! Create a clone of this extension, will return NULL if this is impossible
|
||||
/*!
|
||||
Create a clone of this extension, will return NULL if this is impossible (e.g. derived extension has no clone method and copy-constructor)...
|
||||
BuildExtension has to be called separatly!
|
||||
*/
|
||||
virtual Operator_Extension* Clone(Operator* op);
|
||||
|
||||
virtual bool BuildExtension() {return true;}
|
||||
|
||||
virtual Engine_Extension* CreateEngineExtention() {return 0;}
|
||||
|
@ -47,6 +54,8 @@ public:
|
|||
|
||||
protected:
|
||||
Operator_Extension(Operator* op);
|
||||
//! Copy constructor, returns NULL if extension cannot be copied...
|
||||
Operator_Extension(Operator* op, Operator_Extension* op_ext);
|
||||
Operator* m_Op;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue