// globalconf.cpp // // last-edit-by: J.A. de Jong // // Description: // ////////////////////////////////////////////////////////////////////// #include "globalconf.h" #include "tasmet_constants.h" #include "tasmet_exception.h" #include "tasmet_io.h" GlobalConf::GlobalConf(us Nf,d freq): _Nf(Nf) { TRACE(10,"GlobalConf constructor done"); if(Nf>=constants::max_Nf) throw TaSMETError("Too large number of frequencies given"); us Ns=this->Ns(); // Reinitialize all operators _iDFT=zeros(Ns,Ns); _fDFT=zeros(Ns,Ns); _fDFT.row(0).fill(1.0/double(Ns)); for(us i=1;i<=_Nf;i++){ for(us j=0; jNs(); d lastt = (Ns-1)/(Ns*getfreq()); return arma::linspace(0,lastt,Ns); } void GlobalConf::show() const { cout << "------- Global configuration ------ \n"; cout << "------- Number of harmonics to solve for: "<< _Nf <<"\n"; cout << "------- Fundamental frequency : " << _omg/2/number_pi << " Hz\n"; } void GlobalConf::setomg(d omg){ TRACE(15,"GlobalConf::set(_Nf,freq)"); _DDTfd=zeros(Ns(),Ns()); // Sanity checks if(omgconstants::max_omg) throw TaSMETError("Illegal frequency given"); this->_omg=omg; for(us i=1;i<=_Nf;i++){ _DDTfd(2*i-1,2*i )=-double(i)*_omg; _DDTfd(2*i ,2*i-1)=double(i)*_omg; } } //////////////////////////////////////////////////////////////////////