operator: new material data storage for post-processing purposes

pull/1/head
Thorsten Liebig 2011-01-07 10:45:26 +01:00
parent c4c5a2c080
commit ea496b6129
4 changed files with 112 additions and 0 deletions

View File

@ -21,6 +21,10 @@ Operator_Base::Operator_Base()
{ {
Init(); Init();
m_MeshType = Processing::CARTESIAN_MESH; m_MeshType = Processing::CARTESIAN_MESH;
m_StoreMaterial[0]=false;
m_StoreMaterial[1]=false;
m_StoreMaterial[2]=false;
m_StoreMaterial[3]=false;
} }
Operator_Base::~Operator_Base() Operator_Base::~Operator_Base()
@ -51,3 +55,10 @@ void Operator_Base::Reset()
delete[] discLines[n]; delete[] discLines[n];
Init(); Init();
} }
void Operator_Base::SetMaterialStoreFlags(int type, bool val)
{
if ((type<0) || (type>4))
return;
m_StoreMaterial[type]=val;
}

View File

@ -69,6 +69,12 @@ public:
//! Set the boundary conditions //! Set the boundary conditions
virtual void SetBoundaryCondition(int* BCs) {for (int n=0; n<6; ++n) m_BC[n]=BCs[n];} virtual void SetBoundaryCondition(int* BCs) {for (int n=0; n<6; ++n) m_BC[n]=BCs[n];}
//! Set flags to store material data for post-processing
virtual void SetMaterialStoreFlags(int type, bool val);
//! Check storage flags and cleanup
virtual void CleanupMaterialStorage() = 0;
protected: protected:
Operator_Base(); Operator_Base();
virtual ~Operator_Base(); virtual ~Operator_Base();
@ -82,6 +88,9 @@ protected:
//! The operator timestep //! The operator timestep
double dT; double dT;
//! bool flag array to store material data for post-processing
bool m_StoreMaterial[4];
Processing::MeshType m_MeshType; Processing::MeshType m_MeshType;
unsigned int numLines[3]; unsigned int numLines[3];
double* discLines[3]; double* discLines[3];

View File

@ -62,6 +62,11 @@ void Operator::Init()
iv=NULL; iv=NULL;
ii=NULL; ii=NULL;
m_epsR=NULL;
m_kappa=NULL;
m_mueR=NULL;
m_sigma=NULL;
MainOp=NULL; MainOp=NULL;
DualOp=NULL; DualOp=NULL;
@ -94,6 +99,11 @@ void Operator::Reset()
delete Exc; delete Exc;
Delete_N_3DArray(m_epsR,numLines);
Delete_N_3DArray(m_kappa,numLines);
Delete_N_3DArray(m_mueR,numLines);
Delete_N_3DArray(m_sigma,numLines);
Operator_Base::Reset(); Operator_Base::Reset();
} }
@ -585,6 +595,70 @@ void Operator::InitOperator()
ii = Create_N_3DArray<FDTD_FLOAT>(numLines); ii = Create_N_3DArray<FDTD_FLOAT>(numLines);
} }
void Operator::InitDataStorage()
{
if (m_StoreMaterial[0])
{
if (g_settings.GetVerboseLevel()>0)
cerr << "Operator::InitDataStorage(): Storing epsR material data..." << endl;
Delete_N_3DArray(m_epsR,numLines);
m_epsR = Create_N_3DArray<float>(numLines);
}
if (m_StoreMaterial[1])
{
if (g_settings.GetVerboseLevel()>0)
cerr << "Operator::InitDataStorage(): Storing kappa material data..." << endl;
Delete_N_3DArray(m_kappa,numLines);
m_kappa = Create_N_3DArray<float>(numLines);
}
if (m_StoreMaterial[2])
{
if (g_settings.GetVerboseLevel()>0)
cerr << "Operator::InitDataStorage(): Storing muR material data..." << endl;
Delete_N_3DArray(m_mueR,numLines);
m_mueR = Create_N_3DArray<float>(numLines);
}
if (m_StoreMaterial[3])
{
if (g_settings.GetVerboseLevel()>0)
cerr << "Operator::InitDataStorage(): Storing sigma material data..." << endl;
Delete_N_3DArray(m_sigma,numLines);
m_sigma = Create_N_3DArray<float>(numLines);
}
}
void Operator::CleanupMaterialStorage()
{
if (!m_StoreMaterial[0] && m_epsR)
{
if (g_settings.GetVerboseLevel()>0)
cerr << "Operator::CleanupMaterialStorage(): Delete epsR material data..." << endl;
Delete_N_3DArray(m_epsR,numLines);
m_epsR = NULL;
}
if (!m_StoreMaterial[1] && m_kappa)
{
if (g_settings.GetVerboseLevel()>0)
cerr << "Operator::CleanupMaterialStorage(): Delete kappa material data..." << endl;
Delete_N_3DArray(m_kappa,numLines);
m_kappa = NULL;
}
if (!m_StoreMaterial[2] && m_mueR)
{
if (g_settings.GetVerboseLevel()>0)
cerr << "Operator::CleanupMaterialStorage(): Delete mueR material data..." << endl;
Delete_N_3DArray(m_mueR,numLines);
m_mueR = NULL;
}
if (!m_StoreMaterial[3] && m_sigma)
{
if (g_settings.GetVerboseLevel()>0)
cerr << "Operator::CleanupMaterialStorage(): Delete sigma material data..." << endl;
Delete_N_3DArray(m_sigma,numLines);
m_sigma = NULL;
}
}
void Operator::InitExcitation() void Operator::InitExcitation()
{ {
delete Exc; delete Exc;
@ -619,6 +693,7 @@ void Operator::Calc_ECOperatorPos(int n, unsigned int* pos)
int Operator::CalcECOperator( DebugFlags debugFlags ) int Operator::CalcECOperator( DebugFlags debugFlags )
{ {
Init_EC(); Init_EC();
InitDataStorage();
if (Calc_EC()==0) if (Calc_EC()==0)
return -1; return -1;
@ -800,6 +875,14 @@ bool Operator::Calc_ECPos(int ny, const unsigned int* pos, double* EC) const
double EffMat[4]; double EffMat[4];
Calc_EffMatPos(ny,pos,EffMat); Calc_EffMatPos(ny,pos,EffMat);
if (m_epsR)
m_epsR[ny][pos[0]][pos[1]][pos[2]] = EffMat[0];
if (m_kappa)
m_kappa[ny][pos[0]][pos[1]][pos[2]] = EffMat[1];
if (m_mueR)
m_mueR[ny][pos[0]][pos[1]][pos[2]] = EffMat[2];
if (m_sigma)
m_sigma[ny][pos[0]][pos[1]][pos[2]] = EffMat[3];
double delta = GetEdgeLength(ny,pos); double delta = GetEdgeLength(ny,pos);
double area = GetEdgeArea(ny,pos); double area = GetEdgeArea(ny,pos);

View File

@ -119,6 +119,8 @@ public:
virtual size_t GetNumberOfExtentions() const {return m_Op_exts.size();} virtual size_t GetNumberOfExtentions() const {return m_Op_exts.size();}
virtual Operator_Extension* GetExtension(size_t index) const {return m_Op_exts.at(index);} virtual Operator_Extension* GetExtension(size_t index) const {return m_Op_exts.at(index);}
virtual void CleanupMaterialStorage();
protected: protected:
//! use New() for creating a new Operator //! use New() for creating a new Operator
Operator(); Operator();
@ -126,6 +128,7 @@ protected:
virtual void Init(); virtual void Init();
virtual void Reset(); virtual void Reset();
virtual void InitOperator(); virtual void InitOperator();
virtual void InitDataStorage();
virtual void InitExcitation(); virtual void InitExcitation();
struct Grid_Path struct Grid_Path
@ -162,6 +165,12 @@ protected:
//! Calc operator at certain \a pos //! Calc operator at certain \a pos
virtual void Calc_ECOperatorPos(int n, unsigned int* pos); virtual void Calc_ECOperatorPos(int n, unsigned int* pos);
//store material properties for post-processing
float**** m_epsR;
float**** m_kappa;
float**** m_mueR;
float**** m_sigma;
//EC elements, internal only! //EC elements, internal only!
virtual void Init_EC(); virtual void Init_EC();
virtual bool Calc_EC(); virtual bool Calc_EC();