Commit bfeed45e authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2190
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 01297a98
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: dropcontainer.h,v 1.3 2006-11-22 14:12:18 tforb Exp $
* $Id: dropcontainer.h,v 1.4 2006-11-23 09:47:41 tforb Exp $
* \author Thomas Forbriger
* \date 21/11/2006
*
......@@ -39,7 +39,7 @@
#define TF_DROPCONTAINER_H_VERSION \
"TF_DROPCONTAINER_H V1.0"
#define TF_DROPCONTAINER_H_CVSID \
"$Id: dropcontainer.h,v 1.3 2006-11-22 14:12:18 tforb Exp $"
"$Id: dropcontainer.h,v 1.4 2006-11-23 09:47:41 tforb Exp $"
#include<string>
#include<tsxx/tsxx.h>
......@@ -209,10 +209,10 @@ namespace ts {
virtual ~DropDropContainer() { }
virtual void drop(const Tvalue& v)
{
++Mi;
if (Mi>=Mn)
--Mi;
if (Mi<1)
{
Mi=0;
Mi=Mn;
attached()->drop(v);
}
}
......@@ -270,7 +270,8 @@ namespace ts {
typedef typename Tbase::Tvalue Tvalue;
typedef DropContainer<Tvalue>* PDropContainer;
typedef ts::fir::FIRfilter<Tvalue> Tfirfilter;
FIRDropContainer(const std::string& name);
FIRDropContainer(const std::string& name):
Mf(new Tfirfilter(name)), Mi(Mf->fir().delay) { }
virtual ~FIRDropContainer() { delete Mf; }
virtual void drop(const Tvalue& v);
protected:
......@@ -280,7 +281,15 @@ namespace ts {
return(retval);
}
virtual void initializenext(const int& n)
{ Moutput->initialize(n/Mf->fir().decimation_factor); }
{
Moutput->initialize(n/Mf->fir().decimation_factor);
Mf->clear();
Mi=Mf->fir().delay;
}
virtual int downsampling_factor() const
{ return(Mf->fir().decimation_factor*Tbase::downsampling_factor()); }
virtual Tvalue gain() const
{ return(Mf->fir().gain*Tbase::gain()); }
private:
Tfirfilter* Mf;
int Mi;
......@@ -298,30 +307,14 @@ namespace ts {
/*----------------------------------------------------------------------*/
template<class T>
FIRDropContainer<T>::FIRDropContainer(const std::string& name)
{
if (name == "MP")
{ Mf=new Tfirfilter(&ts::fir::SeisCompMP); }
else if (name == "LP")
{ Mf=new Tfirfilter(&ts::fir::SeisCompLP); }
else if (name == "VLP")
{ Mf=new Tfirfilter(&ts::fir::SeisCompVLP); }
else
{ TSXX_abort("FIRDropContainer: unknown FIR filter name"); }
Mi=0;
}
/*----------------------------------------------------------------------*/
template<class T>
void FIRDropContainer<T>::drop(const Tvalue& v)
{
Mf->push(v);
++Mi;
if (Mi>=Mf->fir().decimation_factor)
--Mi;
if (Mi<1)
{
Mi=0;
Mi=Mf->fir().decimation_factor;
attached()->drop(Mf->pop());
}
}
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: firfilters.cc,v 1.2 2006-11-22 14:12:18 tforb Exp $
* $Id: firfilters.cc,v 1.3 2006-11-23 09:47:41 tforb Exp $
* \author Thomas Forbriger
* \date 21/11/2006
*
......@@ -35,7 +35,7 @@
#define TF_FIRFILTERS_CC_VERSION \
"TF_FIRFILTERS_CC V1.0 "
#define TF_FIRFILTERS_CC_CVSID \
"$Id: firfilters.cc,v 1.2 2006-11-22 14:12:18 tforb Exp $"
"$Id: firfilters.cc,v 1.3 2006-11-23 09:47:41 tforb Exp $"
#include <tsxx/tsxx.h>
#include <tsxx/firfilters.h>
......@@ -177,6 +177,16 @@ namespace ts {
/*======================================================================*/
const FIR* FIRfilters[]=
{
&SeisCompMP,
&SeisCompLP,
&SeisCompVLP,
0x00
};
/*======================================================================*/
std::ostream& operator<<(std::ostream& os, const FIR& fir)
{
os << "FIR filter " << fir.name << ":" << std::endl;
......@@ -191,6 +201,17 @@ namespace ts {
return(os);
}
/*----------------------------------------------------------------------*/
void help(std::ostream& os)
{
os << "The following FIR filters are available:" << std::endl;
int i=0;
while (FIRfilters[i] != 0)
{ os << *FIRfilters[i]; ++i; }
}
} // namespace fir
} // namespace ts
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: firfilters.h,v 1.3 2006-11-22 14:12:18 tforb Exp $
* $Id: firfilters.h,v 1.4 2006-11-23 09:47:41 tforb Exp $
* \author Thomas Forbriger
* \date 21/11/2006
*
......@@ -39,9 +39,10 @@
#define TF_FIRFILTERS_H_VERSION \
"TF_FIRFILTERS_H V1.0 "
#define TF_FIRFILTERS_H_CVSID \
"$Id: firfilters.h,v 1.3 2006-11-22 14:12:18 tforb Exp $"
"$Id: firfilters.h,v 1.4 2006-11-23 09:47:41 tforb Exp $"
#include<iostream>
#include<string>
#include<aff/series.h>
#include<aff/iterator.h>
......@@ -68,6 +69,10 @@ namespace ts {
extern const FIR SeisCompLP;
extern const FIR SeisCompVLP;
/*! collection of FIR filters
*/
extern const FIR* FIRfilters[];
/*----------------------------------------------------------------------*/
/*! dump filter characteristics
......@@ -76,6 +81,12 @@ namespace ts {
/*----------------------------------------------------------------------*/
/*! print information on available FIR filters
*/
void help(std::ostream& os);
/*----------------------------------------------------------------------*/
/*! Class to evaluate a FIR filter
*
* Add new sample through member function push().
......@@ -93,6 +104,19 @@ namespace ts {
typedef aff::Iterator<Tseries> Titerator;
FIRfilter(const FIR* fir): Mfir(fir), Ms(fir->points), Mi(Ms)
{ this->clear(); }
FIRfilter(const std::string name): Mfir(0), Ms(1), Mi(Ms)
{
int i=0;
while (FIRfilters[i]!=0)
{
if (name == FIRfilters[i]->name) { Mfir=FIRfilters[i]; }
++i;
}
TSXX_assert(Mfir != 0, "FIRfilter: unknown FIR filter name");
Ms=Tseries(Mfir->points);
Mi=Titerator(Ms);
this->clear();
}
void push(const Tvalue& v)
{
*Mi = v;
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tstest.cc,v 1.7 2006-11-22 14:12:18 tforb Exp $
* $Id: tstest.cc,v 1.8 2006-11-23 09:47:41 tforb Exp $
* \author Thomas Forbriger
* \date 20/12/2003
*
......@@ -38,7 +38,7 @@
#define TSTEST_VERSION \
"TSTEST V1.2 test time series modules"
#define TSTEST_CVSID \
"$Id: tstest.cc,v 1.7 2006-11-22 14:12:18 tforb Exp $"
"$Id: tstest.cc,v 1.8 2006-11-23 09:47:41 tforb Exp $"
#include <iostream>
#include <tsxx/tsxx.h>
......@@ -113,6 +113,7 @@ int main(int iargc, char* argv[])
{
cerr << usage_text << endl;
cerr << help_text << endl;
ts::fir::help(cerr);
exit(0);
}
......@@ -221,7 +222,7 @@ int main(int iargc, char* argv[])
for (int i=b.f(); i<=b.l(); ++i) { b(i)=i; }
ts::drop::FIRDropContainer<double> d4("MP");
ts::drop::FIRDropContainer<double> d5("LP");
d4.attach(d5);
// d4.attach(d5);
d4.initialize(b.size());
for (int i=b.f(); i<=b.l(); ++i) { d4.drop(b(i)); }
DUMP( d4.container() );
......
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