//-------------------------------------------------------------------------- // File and Version Information: // $Id: specrespvector.cc,v 1.3 1999-11-21 23:25:47 ansari Exp $ // // Description: // Aim of the class: To give the energy density // The unity used here is W/m^2/Hz/sr // // History (add to end): // Sophie Oct, 1999 - creation // //------------------------------------------------------------------------ //--------------- // C++ Headers -- //--------------- #include "machdefs.h" #include #include // #include #include "specrespvector.h" #include "pexceptions.h" //---------------- // Constructor -- //---------------- SpecRespVec::SpecRespVec(Vector const & nu, Vector const & fdenu, double numin, double numax) : SpectralResponse(numin, numax) { if(nu.NElts() != fdenu.NElts()) throw SzMismatchError("SpecRespVec::SpecRespVec() - Non equal vector sizes"); _vecOfNu = nu; _vecOfFDeNu = fdenu; _numin = nu(0); _numax = nu(nu.NElts()-1); if(_vecOfNu.NElts() != _vecOfFDeNu.NElts()) cout << "vectors are not compatible" << exit; } //-------------- // Destructor -- //-------------- SpecRespVec::~SpecRespVec() { } // --------------------------- // -- Function Definitions -- // --------------------------- double SpecRespVec::transmission(double nu) const { if ( (nu < _numin) || (nu > _numax) ) return(0.); double value = 0.; int sizeVecOfNu = _vecOfNu.NElts(); if(nu <= _vecOfNu(0)) return _vecOfFDeNu(0); if(nu >= _vecOfNu(sizeVecOfNu-1)) return _vecOfFDeNu(sizeVecOfNu-1); for (int i=1; i