#include #include "operator.h" #include "tools/array_ops.h" Operator::Operator() { Operator::Init(); } Operator::~Operator() { Operator::Reset(); } void Operator::Init() { CSX = NULL; ExciteSignal = NULL; E_Ex_delay = NULL; vv=NULL; vi=NULL; iv=NULL; ii=NULL; for (int n=0;n<3;++n) { discLines[n]=NULL; E_Ex_amp[n]=NULL; E_Ex_index[n]=NULL; } } void Operator::Reset() { delete[] ExciteSignal; delete[] E_Ex_delay; Delete_N_3DArray(vv,numLines); Delete_N_3DArray(vi,numLines); Delete_N_3DArray(iv,numLines); Delete_N_3DArray(ii,numLines); for (int n=0;n<3;++n) { delete[] discLines[n]; delete[] E_Ex_amp[n]; delete[] E_Ex_index[n]; } Operator::Init(); } unsigned int Operator::GetNyquistNum(double fmax) { if (dT==0) return 1; double T0 = 1/fmax; return floor(T0/2/dT); } bool Operator::SnapToMesh(double* dcoord, unsigned int* uicoord, bool lower) { bool ok=true; for (int n=0;n<3;++n) { uicoord[n]=0; if (dcoord[n]discLines[n][numLines[n]-1]) {ok=false;uicoord[n]=numLines[n]-1; if (lower) uicoord[n]=numLines[n]-2;} else if (dcoord[n]==discLines[n][numLines[n]-1]) {uicoord[n]=numLines[n]-1; if (lower) uicoord[n]=numLines[n]-2;} else for (unsigned int i=0;i