From f0141f6c7eeaa2dd5978920663fdd6c8eb86a7f9 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Sat, 5 Jun 2010 11:47:21 +0200 Subject: [PATCH] Operator: split Calc_EC into Init_EC + Calc_EC --- FDTD/operator.cpp | 27 +++++++++++++++++---------- FDTD/operator.h | 1 + 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index cc1dd43..01ca5ff 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -23,7 +23,6 @@ #include "tools/array_ops.h" #include "fparser.hh" - Operator* Operator::New() { cout << "Create FDTD operator" << endl; @@ -499,6 +498,8 @@ void Operator::Calc_ECOperatorPos(int n, unsigned int* pos) int Operator::CalcECOperator() { + Init_EC(); + if (Calc_EC()==0) return -1; @@ -506,8 +507,6 @@ int Operator::CalcECOperator() InitOperator(); - InitExcitation(); - unsigned int pos[3]; for (int n=0;n<3;++n) @@ -541,7 +540,10 @@ int Operator::CalcECOperator() bool PEC[6]={1,1,1,1,1,1}; ApplyElectricBC(PEC); + InitExcitation(); + if (CalcFieldExcitation()==false) return -1; + CalcPEC(); bool PMC[6]; @@ -769,14 +771,8 @@ bool Operator::Calc_EffMatPos(int n, unsigned int* pos, double* inMat) return true; } - -bool Operator::Calc_EC() +void Operator::Init_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) { //init x-cell-array @@ -795,6 +791,17 @@ bool Operator::Calc_EC() EC_L[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]