log_taper.cc 2.58 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*! \file log_taper.cc
 * \brief provide taper for averaging on a logarithmic scale (implementation)
 * 
 * ----------------------------------------------------------------------------
 * 
 * \author Thomas Forbriger
 * \date 12/01/2019
 * 
 * provide taper for averaging on a logarithmic scale (implementation)
 * 
 * Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach) 
 * 
 * ----
 * 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 2 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/>.
 * ----
 *
 * REVISIONS and CHANGES 
 *  - 12/01/2019   V1.0   Thomas Forbriger
 * 
 * ============================================================================
 */
#define PSDXX_LOG_TAPER_CC_VERSION \
  "PSDXX_LOG_TAPER_CC   V1.0"

#include <psdxx/helper.h>
37
#include <psdxx/error.h>
38
39
40
41
42

namespace psd {

  namespace helper {

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
    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

83
84
85
86
87
  } // namespace helper

} // namespace psd

/* ----- END OF log_taper.cc ----- */