Commit d5648854 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

libpsdxx [WP]: provide template for taper class

parent 91b648f4
......@@ -116,6 +116,32 @@ namespace psd {
double Mlnc;
}; // class LogIndex
/* ---------------------------------------------------------------------- */
/*! \brief Taper function class
*/
class Taper
{
private:
/*! Indicate location of center of taper
*/
enum Eedge {
Fmiddle= (1<<0), //!< between smallest and largest frequency index
Fupper_end=(1<<1), //!< smallest frequency index
Flower_end=(1<<2), //!< largest frequency index
}; // enum Eedge
public:
Taper(const psd::TDseries::Tcoc& f,
const unsigned int& i);
~Taper();
double operator()(const double& f);
double sum() const { return(Msum); }
private:
double Msum;
LogIndex* Mli;
Eedge Mloc;
}; // class Taper
} // namespace helper
} // namespace psd
......
......@@ -34,11 +34,52 @@
"PSDXX_LOG_TAPER_CC V1.0"
#include <psdxx/helper.h>
#include <psdxx/error.h>
namespace psd {
namespace helper {
Taper::Taper(const psd::TDseries::Tcoc& f,
const unsigned int& i): Msum(0)
{
PSDXX_assert(f.size()>2,
"at least three values of frequency are required");
if (i==0)
{
this->Mloc=Flower_end;
this->Mli=new psd::helper::LogIndex(f(f.f()), f(f.f()+1), f(f.f()+2));
}
else if (i==(f.size()-1))
{
this->Mloc=Fupper_end;
this->Mli=new psd::helper::LogIndex(f(f.l()-2), f(f.l()-1), f(f.l()));
}
else
{
this->Mloc=Fmiddle;
this->Mli=new psd::helper::LogIndex(f(f.f()+i-1),
f(f.f()+i), f(f.f()+i+1));
}
} // Taper::Taper(const psd::TDseries::Tcoc& f,
// const unsigned int& i)
/* ---------------------------------------------------------------------- */
Taper::~Taper()
{
delete Mli;
} // Taper::~Taper()
/* ---------------------------------------------------------------------- */
double Taper::operator()(const double& f)
{
double retval=0;
this->Msum += retval;
return(retval);
} // double Taper::operator()(const double& f) const
} // namespace helper
} // namespace psd
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment