Made CalcEFieldExcitation internal operator function
parent
97481f819d
commit
db4980c32f
|
@ -15,6 +15,8 @@ void CartOperator::Init()
|
||||||
CSX = NULL;
|
CSX = NULL;
|
||||||
MainOp=NULL;
|
MainOp=NULL;
|
||||||
DualOp=NULL;
|
DualOp=NULL;
|
||||||
|
E_Ex_index = NULL;
|
||||||
|
E_Ex_delay = NULL;
|
||||||
for (int n=0;n<3;++n)
|
for (int n=0;n<3;++n)
|
||||||
{
|
{
|
||||||
discLines[n]=NULL;
|
discLines[n]=NULL;
|
||||||
|
@ -26,11 +28,14 @@ void CartOperator::Init()
|
||||||
vi[n]=NULL;
|
vi[n]=NULL;
|
||||||
iv[n]=NULL;
|
iv[n]=NULL;
|
||||||
ii[n]=NULL;
|
ii[n]=NULL;
|
||||||
|
E_Ex_amp[n]=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CartOperator::Reset()
|
void CartOperator::Reset()
|
||||||
{
|
{
|
||||||
|
delete[] E_Ex_index;
|
||||||
|
delete[] E_Ex_delay;
|
||||||
for (int n=0;n<3;++n)
|
for (int n=0;n<3;++n)
|
||||||
{
|
{
|
||||||
delete[] EC_C[n];
|
delete[] EC_C[n];
|
||||||
|
@ -41,6 +46,7 @@ void CartOperator::Reset()
|
||||||
delete[] vi[n];
|
delete[] vi[n];
|
||||||
delete[] iv[n];
|
delete[] iv[n];
|
||||||
delete[] ii[n];
|
delete[] ii[n];
|
||||||
|
delete[] E_Ex_amp[n];
|
||||||
}
|
}
|
||||||
delete MainOp;
|
delete MainOp;
|
||||||
delete DualOp;
|
delete DualOp;
|
||||||
|
@ -111,6 +117,8 @@ int CartOperator::CalcECOperator()
|
||||||
bool PEC[6]={0,0,0,0,0,0};
|
bool PEC[6]={0,0,0,0,0,0};
|
||||||
ApplyElectricBC(PEC);
|
ApplyElectricBC(PEC);
|
||||||
|
|
||||||
|
if (CalcEFieldExcitation()==false) return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +416,7 @@ double CartOperator::CalcTimestep()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CartOperator::GetVoltageExcitation(unsigned int* &index, FDTD_FLOAT** &excit_amp, FDTD_FLOAT* &excit_delay)
|
bool CartOperator::CalcEFieldExcitation()
|
||||||
{
|
{
|
||||||
vector<unsigned int> vIndex;
|
vector<unsigned int> vIndex;
|
||||||
vector<FDTD_FLOAT> vExcit[3];
|
vector<FDTD_FLOAT> vExcit[3];
|
||||||
|
@ -436,7 +444,7 @@ unsigned int CartOperator::GetVoltageExcitation(unsigned int* &index, FDTD_FLOAT
|
||||||
vIndex.push_back(ipos);
|
vIndex.push_back(ipos);
|
||||||
for (int n=0;n<3;++n)
|
for (int n=0;n<3;++n)
|
||||||
{
|
{
|
||||||
double delta=MainOp->GetIndexDelta(n,pos[n]);
|
double delta=MainOp->GetIndexDelta(n,pos[n])*gridDelta;
|
||||||
vExcit[n].push_back(elec->GetWeightedExcitation(n,coord)*delta);
|
vExcit[n].push_back(elec->GetWeightedExcitation(n,coord)*delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,5 +452,19 @@ unsigned int CartOperator::GetVoltageExcitation(unsigned int* &index, FDTD_FLOAT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cerr << "size: " << vIndex.size() << endl;
|
E_Ex_Count = vIndex.size();
|
||||||
|
delete[] E_Ex_index;
|
||||||
|
E_Ex_index = new unsigned int[E_Ex_Count];
|
||||||
|
delete[] E_Ex_delay;
|
||||||
|
E_Ex_delay = new FDTD_FLOAT[E_Ex_Count];
|
||||||
|
for (unsigned int i=0;i<E_Ex_Count;++i)
|
||||||
|
E_Ex_delay[i]=vIndex.at(i);
|
||||||
|
for (int n=0;n<3;++n)
|
||||||
|
{
|
||||||
|
delete[] E_Ex_amp[n];
|
||||||
|
E_Ex_amp[n] = new FDTD_FLOAT[E_Ex_Count];
|
||||||
|
for (unsigned int i=0;i<E_Ex_Count;++i)
|
||||||
|
E_Ex_amp[n][i]=vExcit[n].at(i);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,6 @@ public:
|
||||||
|
|
||||||
double GetTimestep() {return dT;};
|
double GetTimestep() {return dT;};
|
||||||
|
|
||||||
/*!
|
|
||||||
Get the voltage excitations. Returns number of excitations, listed position in index, with amplitude in all 3 directions and a possible time delay.
|
|
||||||
*/
|
|
||||||
unsigned int GetVoltageExcitation(unsigned int* &index, FDTD_FLOAT** &excit_amp, FDTD_FLOAT* &excit_delay);
|
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -47,6 +42,14 @@ protected:
|
||||||
FDTD_FLOAT* ii[3]; //calc new current from old current
|
FDTD_FLOAT* ii[3]; //calc new current from old current
|
||||||
FDTD_FLOAT* iv[3]; //calc new current from old voltage
|
FDTD_FLOAT* iv[3]; //calc new current from old voltage
|
||||||
|
|
||||||
|
//E-Field Excitation
|
||||||
|
//! Calc the electric field excitation.
|
||||||
|
bool CalcEFieldExcitation();
|
||||||
|
unsigned int E_Ex_Count;
|
||||||
|
unsigned int* E_Ex_index;
|
||||||
|
FDTD_FLOAT* E_Ex_amp[3]; //represented as edge-voltages!!
|
||||||
|
FDTD_FLOAT* E_Ex_delay;
|
||||||
|
|
||||||
//Calc timestep only internal use
|
//Calc timestep only internal use
|
||||||
double CalcTimestep();
|
double CalcTimestep();
|
||||||
|
|
||||||
|
|
8
main.cpp
8
main.cpp
|
@ -21,12 +21,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
cop.CalcECOperator();
|
cop.CalcECOperator();
|
||||||
|
|
||||||
unsigned int* index = NULL;
|
|
||||||
FDTD_FLOAT** amp=NULL;
|
|
||||||
FDTD_FLOAT* delay=NULL;
|
|
||||||
|
|
||||||
unsigned int nEx = cop.GetVoltageExcitation(index,amp,delay);
|
|
||||||
|
|
||||||
time_t OpDoneTime=time(NULL);
|
time_t OpDoneTime=time(NULL);
|
||||||
|
|
||||||
cerr << "Time for operator: " << difftime(OpDoneTime,startTime) << endl;
|
cerr << "Time for operator: " << difftime(OpDoneTime,startTime) << endl;
|
||||||
|
@ -76,5 +70,7 @@ void BuildMSL(ContinuousStructure &CSX)
|
||||||
for (int n=0;n<=300;n+=10)
|
for (int n=0;n<=300;n+=10)
|
||||||
grid->AddDiscLine(1,(double)n);
|
grid->AddDiscLine(1,(double)n);
|
||||||
|
|
||||||
|
grid->SetDeltaUnit(1e-3);
|
||||||
|
|
||||||
CSX.Write2XML("csx-files/MSL.xml");
|
CSX.Write2XML("csx-files/MSL.xml");
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,11 @@ TEMPLATE = app
|
||||||
OBJECTS_DIR = obj
|
OBJECTS_DIR = obj
|
||||||
INCLUDEPATH += ../CSXCAD
|
INCLUDEPATH += ../CSXCAD
|
||||||
LIBS += -L../CSXCAD \
|
LIBS += -L../CSXCAD \
|
||||||
-lCSXCAD
|
-lCSXCAD \
|
||||||
|
-L../fparser \
|
||||||
|
-lfparser \
|
||||||
|
-L../tinyxml \
|
||||||
|
-ltinyxml
|
||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
FDTD/cartoperator.cpp \
|
FDTD/cartoperator.cpp \
|
||||||
tools/ErrorMsg.cpp \
|
tools/ErrorMsg.cpp \
|
||||||
|
|
Loading…
Reference in New Issue