2010-03-11 15:47:40 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Operator();
|
|
|
|
virtual ~Operator();
|
|
|
|
|
2010-03-11 09:48:47 +00:00
|
|
|
virtual bool SetGeometryCSX(ContinuousStructure* geo);
|
2010-03-01 08:19:39 +00:00
|
|
|
|
2010-03-05 13:20:25 +00:00
|
|
|
virtual int CalcECOperator();
|
2010-03-01 08:19:39 +00:00
|
|
|
|
2010-03-29 20:11:24 +00:00
|
|
|
//! Calculate an excitation with center of f0 and the half bandwidth fc \return number of Nyquist timesteps
|
|
|
|
virtual unsigned int CalcGaussianPulsExcitation(double f0, double fc);
|
|
|
|
//! Calculate a sinusoidal excitation with frequency f0 and a duration of nTS number of timesteps \return number of Nyquist timesteps
|
|
|
|
virtual unsigned int CalcSinusExcitation(double f0, int nTS);
|
2010-04-01 07:38:56 +00:00
|
|
|
//! Calculate a dirac impuls excitation \return number of Nyquist timesteps
|
2010-03-30 11:10:23 +00:00
|
|
|
virtual unsigned int CalcDiracPulsExcitation();
|
2010-04-01 07:38:56 +00:00
|
|
|
//! Calculate a step excitation \return number of Nyquist timesteps
|
|
|
|
virtual unsigned int CalcStepExcitation();
|
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
|
|
|
|
2010-03-31 14:35:43 +00:00
|
|
|
double GetTimestep() const {return dT;};
|
|
|
|
double GetNumberCells() const;
|
2010-03-01 13:56:27 +00:00
|
|
|
|
2010-04-02 15:20:18 +00:00
|
|
|
void SetNyquistNum(unsigned int nyquist) {m_nyquistTS=nyquist;}
|
|
|
|
unsigned int GetNyquistNum() const {return m_nyquistTS;};
|
|
|
|
unsigned int CalcNyquistNum(double fmax);
|
|
|
|
|
2010-03-31 14:35:43 +00:00
|
|
|
void ShowStat() const;
|
2010-03-01 08:19:39 +00:00
|
|
|
|
2010-03-01 18:35:28 +00:00
|
|
|
void DumpOperator2File(string filename);
|
2010-03-12 19:39:04 +00:00
|
|
|
void DumpMaterial2File(string filename);
|
2010-03-01 18:35:28 +00:00
|
|
|
|
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-26 10:28:54 +00:00
|
|
|
struct Grid_Path
|
2010-03-22 07:19:17 +00:00
|
|
|
{
|
|
|
|
vector<unsigned int> posPath[3];
|
|
|
|
vector<unsigned short> dir;
|
|
|
|
};
|
|
|
|
struct Grid_Path FindPath(double start[], double stop[]);
|
|
|
|
|
2010-03-01 08:19:39 +00:00
|
|
|
ContinuousStructure* CSX;
|
2010-03-05 13:20:25 +00:00
|
|
|
|
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
|
|
|
|
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-29 20:11:24 +00:00
|
|
|
unsigned int m_nyquistTS;
|
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-26 10:28:54 +00:00
|
|
|
|
2010-04-02 15:07:56 +00:00
|
|
|
// engine/post-proc needs access
|
2010-03-26 10:28:54 +00:00
|
|
|
public:
|
|
|
|
unsigned int numLines[3];
|
2010-04-02 15:07:56 +00:00
|
|
|
double* discLines[3];
|
|
|
|
double gridDelta;
|
|
|
|
AdrOp* MainOp;
|
|
|
|
AdrOp* DualOp;
|
2010-03-26 10:28:54 +00:00
|
|
|
|
|
|
|
//EC operator
|
|
|
|
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;
|
|
|
|
|
|
|
|
//E-Field Excitation
|
|
|
|
unsigned int E_Exc_Count;
|
|
|
|
unsigned int* E_Exc_index[3];
|
|
|
|
unsigned short* E_Exc_dir;
|
|
|
|
FDTD_FLOAT* E_Exc_amp; //represented as edge-voltages!!
|
|
|
|
unsigned int* E_Exc_delay;
|
2010-03-01 08:19:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // OPERATOR_H
|