Operator: split Calc_EC into Init_EC + Calc_EC

pull/1/head
Thorsten Liebig 2010-06-05 11:47:21 +02:00
parent 0954177dc6
commit f0141f6c7e
2 changed files with 18 additions and 10 deletions

View File

@ -23,7 +23,6 @@
#include "tools/array_ops.h" #include "tools/array_ops.h"
#include "fparser.hh" #include "fparser.hh"
Operator* Operator::New() Operator* Operator::New()
{ {
cout << "Create FDTD operator" << endl; cout << "Create FDTD operator" << endl;
@ -499,6 +498,8 @@ void Operator::Calc_ECOperatorPos(int n, unsigned int* pos)
int Operator::CalcECOperator() int Operator::CalcECOperator()
{ {
Init_EC();
if (Calc_EC()==0) if (Calc_EC()==0)
return -1; return -1;
@ -506,8 +507,6 @@ int Operator::CalcECOperator()
InitOperator(); InitOperator();
InitExcitation();
unsigned int pos[3]; unsigned int pos[3];
for (int n=0;n<3;++n) for (int n=0;n<3;++n)
@ -541,7 +540,10 @@ int Operator::CalcECOperator()
bool PEC[6]={1,1,1,1,1,1}; bool PEC[6]={1,1,1,1,1,1};
ApplyElectricBC(PEC); ApplyElectricBC(PEC);
InitExcitation();
if (CalcFieldExcitation()==false) return -1; if (CalcFieldExcitation()==false) return -1;
CalcPEC(); CalcPEC();
bool PMC[6]; bool PMC[6];
@ -769,14 +771,8 @@ bool Operator::Calc_EffMatPos(int n, unsigned int* pos, double* inMat)
return true; return true;
} }
void Operator::Init_EC()
bool Operator::Calc_EC()
{ {
if (CSX==NULL) {cerr << "CartOperator::Calc_EC: CSX not given or invalid!!!" << endl; return false;}
unsigned int ipos;
unsigned int pos[3];
double inEC[4];
for (int n=0;n<3;++n) for (int n=0;n<3;++n)
{ {
//init x-cell-array //init x-cell-array
@ -795,6 +791,17 @@ bool Operator::Calc_EC()
EC_L[n][i]=0; EC_L[n][i]=0;
EC_R[n][i]=0; EC_R[n][i]=0;
} }
}
}
bool Operator::Calc_EC()
{
if (CSX==NULL) {cerr << "CartOperator::Calc_EC: CSX not given or invalid!!!" << endl; return false;}
unsigned int ipos;
unsigned int pos[3];
double inEC[4];
for (int n=0;n<3;++n)
{
for (pos[2]=0;pos[2]<numLines[2];++pos[2]) for (pos[2]=0;pos[2]<numLines[2];++pos[2])
{ {
for (pos[1]=0;pos[1]<numLines[1];++pos[1]) for (pos[1]=0;pos[1]<numLines[1];++pos[1])

View File

@ -116,6 +116,7 @@ protected:
virtual void Calc_ECOperatorPos(int n, unsigned int* pos); virtual void Calc_ECOperatorPos(int n, unsigned int* pos);
//EC elements, internal only! //EC elements, internal only!
virtual void Init_EC();
virtual bool Calc_EC(); virtual bool Calc_EC();
virtual bool Calc_ECPos(int n, unsigned int* pos, double* inEC); virtual bool Calc_ECPos(int n, unsigned int* pos, double* inEC);
virtual bool Calc_EffMatPos(int n, unsigned int* pos, double* inMat); virtual bool Calc_EffMatPos(int n, unsigned int* pos, double* inMat);