Commit 21d5de65 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

libtsxx, tidofi [FIX]: take return value of filter function

Take the return value in order to allow for a change in number of samples
parent d67e8ae6
......@@ -29,11 +29,13 @@
* REVISIONS and CHANGES
* - 05/07/2005 V1.0 Thomas Forbriger
* - 18/12/2007 V1.1 - support debugging
* - 25/02/2019 V1.2 - pass return value to filter, to allow for change
* in number of samples or sampling interval
*
* ============================================================================
*/
#define TF_FILTERBASE_CC_VERSION \
"TF_FILTERBASE_CC V1.1"
"TF_FILTERBASE_CC V1.2"
#include <iostream>
#include <tsxx/filterbase.h>
......@@ -46,17 +48,18 @@ namespace ts {
Ttimeseries FilterCollection::operator()(const Ttimeseries& s,
const bool& debug) const
{
Ttimeseries retval(s);
Tfilterlist::const_iterator i=this->Tfilterlist::begin();
while (i!=this->Tfilterlist::end())
{
TSXX_debug(debug, "FilterCollection::operator()",
"apply filter" );
(*i)->operator()(s, debug);
retval=(*i)->operator()(retval, debug);
++i;
}
TSXX_debug(debug, "FilterCollection::operator()",
"applied all filters" );
return s;
return retval;
}
void Exception::report() const {
......
......@@ -36,11 +36,14 @@
* - write header data only if supported by output
* format
* - implemented offset variable tapers
* - 25.02.2019 V1.6 take return value of filter function in order to
* allow a change of number of samples or sampling
* interval
*
* ============================================================================
*/
#define TIDOFI_VERSION \
"TIDOFI V1.5 time domain filter"
"TIDOFI V1.6 time domain filter"
#include <iostream>
#include <fstream>
......@@ -528,7 +531,7 @@ int main(int iargc, char* argv[])
=prefiltertaper.taper(offset, t0, T);
taper.apply(series);
}
filter(Ttimeseries(series, wid2.dt), opt.debug);
series=filter(Ttimeseries(series, wid2.dt), opt.debug);
if (applypostfiltertaper)
{
// apply post-filter taper
......@@ -551,6 +554,7 @@ int main(int iargc, char* argv[])
{
if (opt.verbose) { std::cout << " passed unchanged" << std::endl; }
}
wid2.nsamples=series.size();
os << wid2;
TFXX_debug(opt.debug, "main",
" series and WID are written");
......
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