2010-03-01 08:19:39 +00:00
|
|
|
#ifndef OPERATOR_H
|
|
|
|
#define OPERATOR_H
|
|
|
|
|
|
|
|
#include "ContinuousStructure.h"
|
|
|
|
#include "tools/AdrOp.h"
|
|
|
|
#include "tools/constants.h"
|
|
|
|
|
|
|
|
#define FDTD_FLOAT float
|
|
|
|
|
|
|
|
//! Abstract base-class for the FDTD-operator
|
|
|
|
class Operator
|
|
|
|
{
|
|
|
|
friend class Engine;
|
2010-03-02 13:54:50 +00:00
|
|
|
friend class ProcessFields;
|
|
|
|
friend class ProcessFieldsTD;
|
2010-03-01 08:19:39 +00:00
|
|
|
public:
|
|
|
|
Operator();
|
|
|
|
virtual ~Operator();
|
|
|
|
|
|
|
|
virtual void SetGeometryCSX(ContinuousStructure* geo);
|
|
|
|
|
2010-03-05 13:20:25 +00:00
|
|
|
virtual int CalcECOperator();
|
2010-03-01 08:19:39 +00:00
|
|
|
|
2010-03-09 20:34:23 +00:00
|
|
|
//! Calculate an excitation with center of f0 and the half bandwidth fc
|
2010-03-01 13:56:27 +00:00
|
|
|
virtual void CalcGaussianPulsExcitation(double f0, double fc);
|
2010-03-09 20:34:23 +00:00
|
|
|
//! Calculate a sinusoidal excitation with frequency f0 and a duration of nTS number of timesteps
|
|
|
|
virtual void CalcSinusExcitation(double f0, int nTS);
|
2010-03-01 13:56:27 +00:00
|
|
|
|
2010-03-05 13:20:25 +00:00
|
|
|
virtual void ApplyElectricBC(bool* dirs); //applied by default to all boundaries
|
|
|
|
virtual void ApplyMagneticBC(bool* dirs);
|
2010-03-01 08:19:39 +00:00
|
|
|
|
|
|
|
double GetTimestep() {return dT;};
|
2010-03-01 18:35:28 +00:00
|
|
|
unsigned int GetNyquistNum(double fmax);
|
2010-03-01 13:56:27 +00:00
|
|
|
double GetNumberCells();
|
|
|
|
|
|
|
|
void ShowSize();
|
2010-03-01 08:19:39 +00:00
|
|
|
|
2010-03-01 18:35:28 +00:00
|
|
|
void DumpOperator2File(string filename);
|
|
|
|
|
2010-03-01 08:19:39 +00:00
|
|
|
virtual void Reset();
|
|
|
|
|
2010-03-02 13:54:50 +00:00
|
|
|
bool SnapToMesh(double* coord, unsigned int* uicoord, bool lower=false);
|
2010-03-01 18:35:28 +00:00
|
|
|
|
2010-03-01 08:19:39 +00:00
|
|
|
protected:
|
|
|
|
virtual void Init();
|
2010-03-05 13:20:25 +00:00
|
|
|
virtual void InitOperator();
|
|
|
|
|
2010-03-01 08:19:39 +00:00
|
|
|
ContinuousStructure* CSX;
|
|
|
|
double gridDelta;
|
|
|
|
|
|
|
|
double* discLines[3];
|
|
|
|
unsigned int numLines[3];
|
|
|
|
|
2010-03-05 13:20:25 +00:00
|
|
|
AdrOp* MainOp;
|
|
|
|
AdrOp* DualOp;
|
|
|
|
|
2010-03-01 08:19:39 +00:00
|
|
|
//EC operator
|
2010-03-01 13:56:27 +00:00
|
|
|
FDTD_FLOAT**** vv; //calc new voltage from old voltage
|
|
|
|
FDTD_FLOAT**** vi; //calc new voltage from old current
|
|
|
|
FDTD_FLOAT**** ii; //calc new current from old current
|
|
|
|
FDTD_FLOAT**** iv; //calc new current from old voltage
|
|
|
|
|
|
|
|
//Excitation time-signal
|
|
|
|
unsigned int ExciteLength;
|
|
|
|
FDTD_FLOAT* ExciteSignal;
|
2010-03-01 08:19:39 +00:00
|
|
|
|
|
|
|
//E-Field Excitation
|
|
|
|
//! Calc the electric field excitation.
|
2010-03-05 13:20:25 +00:00
|
|
|
virtual bool CalcEFieldExcitation();
|
2010-03-01 08:19:39 +00:00
|
|
|
unsigned int E_Ex_Count;
|
2010-03-01 13:56:27 +00:00
|
|
|
unsigned int* E_Ex_index[3];
|
2010-03-01 08:19:39 +00:00
|
|
|
FDTD_FLOAT* E_Ex_amp[3]; //represented as edge-voltages!!
|
2010-03-01 13:56:27 +00:00
|
|
|
unsigned int* E_Ex_delay;
|
2010-03-01 08:19:39 +00:00
|
|
|
|
2010-03-05 13:20:25 +00:00
|
|
|
virtual bool CalcPEC();
|
|
|
|
|
2010-03-01 08:19:39 +00:00
|
|
|
//Calc timestep only internal use
|
2010-03-05 13:20:25 +00:00
|
|
|
virtual double CalcTimestep();
|
2010-03-01 08:19:39 +00:00
|
|
|
double dT; //FDTD timestep!
|
2010-03-05 13:20:25 +00:00
|
|
|
|
|
|
|
//EC elements, internal only!
|
|
|
|
bool Calc_EC();
|
|
|
|
bool Calc_ECPos(int n, unsigned int* pos, double* inEC);
|
|
|
|
bool Calc_EffMatPos(int n, unsigned int* pos, double* inMat);
|
|
|
|
double* EC_C[3];
|
|
|
|
double* EC_G[3];
|
|
|
|
double* EC_L[3];
|
|
|
|
double* EC_R[3];
|
2010-03-01 08:19:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // OPERATOR_H
|