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();
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()
@ -51,3 +55,10 @@ void Operator_Base::Reset()
delete[] discLines[n];
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
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:
Operator_Base();
virtual ~Operator_Base();
@ -82,6 +88,9 @@ protected:
//! The operator timestep
double dT;
//! bool flag array to store material data for post-processing
bool m_StoreMaterial[4];
Processing::MeshType m_MeshType;
unsigned int numLines[3];
double* discLines[3];

View File

@ -62,6 +62,11 @@ void Operator::Init()
iv=NULL;
ii=NULL;
m_epsR=NULL;
m_kappa=NULL;
m_mueR=NULL;
m_sigma=NULL;
MainOp=NULL;
DualOp=NULL;
@ -94,6 +99,11 @@ void Operator::Reset()
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();
}
@ -585,6 +595,70 @@ void Operator::InitOperator()
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()
{
delete Exc;
@ -619,6 +693,7 @@ void Operator::Calc_ECOperatorPos(int n, unsigned int* pos)
int Operator::CalcECOperator( DebugFlags debugFlags )
{
Init_EC();
InitDataStorage();
if (Calc_EC()==0)
return -1;
@ -800,6 +875,14 @@ bool Operator::Calc_ECPos(int ny, const unsigned int* pos, double* EC) const
double EffMat[4];
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 area = GetEdgeArea(ny,pos);

View File

@ -119,6 +119,8 @@ public:
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 void CleanupMaterialStorage();
protected:
//! use New() for creating a new Operator
Operator();
@ -126,6 +128,7 @@ protected:
virtual void Init();
virtual void Reset();
virtual void InitOperator();
virtual void InitDataStorage();
virtual void InitExcitation();
struct Grid_Path
@ -162,6 +165,12 @@ protected:
//! Calc operator at certain \a 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!
virtual void Init_EC();
virtual bool Calc_EC();