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

added derived classes and interface class

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: 3913
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent a4fad596
......@@ -143,7 +143,7 @@ namespace stfinv {
* \param C assert condition
* \param M message of type char*
*/
#define STFINV_assert(C,M) STFINV_Xassert( C , M , datrw::Exception )
#define STFINV_assert(C,M) STFINV_Xassert( C , M , stfinv::Exception )
/*! \brief Abort and give a message.
*
......@@ -152,7 +152,7 @@ namespace stfinv {
* \param E exception class to throw
*/
#define STFINV_abort(M) \
throw( datrw::Exception ( M , __FILE__, __LINE__ ))
throw( stfinv::Exception ( M , __FILE__, __LINE__ ))
#define STFINV_illegal STFINV_abort("illegal call!")
......@@ -167,7 +167,7 @@ namespace stfinv {
*/
#define STFINV_report_assert(C,M,V) \
if (!(C)) { \
datrw::report_violation(M, __FILE__, __LINE__, #C); \
stfinv::report_violation(M, __FILE__, __LINE__, #C); \
std::cerr << "* comment: " << V << std::endl; \
std::cerr << std::endl; \
std::cerr.flush(); \
......
/*! \file parameterhandler.cc
* \brief handle a parameter configuration string (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 06/05/2011
*
* handle a parameter configuration string (implementation)
*
* Copyright (c) 2011 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
*
* REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define STFINV_PARAMETERHANDLER_CC_VERSION \
"STFINV_PARAMETERHANDLER_CC V1.0 "
#define STFINV_PARAMETERHANDLER_CC_CVSID \
"$Id$"
#include <stfinv/parameterhandler.h>
namespace stfinv {
} // namespace stfinv
/* ----- END OF parameterhandler.cc ----- */
/*! \file parameterhandler.h
* \brief handle a parameter configuration string (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 06/05/2011
*
* handle a parameter configuration string (prototypes)
*
* Copyright (c) 2011 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
*
* REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef STFINV_PARAMETERHANDLER_H_VERSION
#define STFINV_PARAMETERHANDLER_H_VERSION \
"STFINV_PARAMETERHANDLER_H V1.0 "
#define STFINV_PARAMETERHANDLER_H_CVSID \
"$Id$"
namespace stfinv {
} // namespace stfinv
#endif // STFINV_PARAMETERHANDLER_H_VERSION (includeguard)
/* ----- END OF parameterhandler.h ----- */
/*! \file stfinvany.cc
* \brief a wrapper to any STF engine in the library (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 06/05/2011
*
* a wrapper to any STF engine in the library (implementation)
*
* Copyright (c) 2011 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
*
* REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define STFINV_STFINVANY_CC_VERSION \
"STFINV_STFINVANY_CC V1.0 "
#define STFINV_STFINVANY_CC_CVSID \
"$Id$"
#include <stfinv/stfinvany.h>
#include <stfinv/parameterhandler.h>
namespace stfinv {
STFEngine::~STFEngine()
{
delete Mengine;
} // STFEngine::~STFEngine()
} // namespace stfinv
/* ----- END OF stfinvany.cc ----- */
/*! \file stfinvany.h
* \brief a wrapper to any STF engine in the library (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 06/05/2011
*
* a wrapper to any STF engine in the library (prototypes)
*
* Copyright (c) 2011 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
*
* REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef STFINV_STFINVANY_H_VERSION
#define STFINV_STFINVANY_H_VERSION \
"STFINV_STFINVANY_H V1.0 "
#define STFINV_STFINVANY_H_CVSID \
"$Id$"
#include<stfinv/stfinvbase.h>
namespace stfinv {
/*! \brief Class to access any engine in the library
*
* The interface of this class is identical to the interface defined by the
* abstract base class stfinv::STFBaseEngine except for a constructor which
* accepts the C structs and the fact that the first prefix (up to the first
* colon) in the parameter string is understood to identify the selected
* engine.
*/
class STFEngine {
public:
//! \brief Constructor.
STFEngine(const stfinv::Tlistoftriples& triples,
const stfinv::Waveform& stf,
const std::string& parameters)
{ this->create(triples, stf, parameters); }
/*! \brief Constructor.
* This type is needed for the C interface
*/
STFEngine(const Triples& triples,
const Waveform& stf,
const std::string& parameters);
//! \brief Destructor must remove engine.
~STFEngine();
//! \brief Return actual engine.
stfinv::STFBaseEngine& STFBaseEngine() { return (*Mengine); }
//! \brief Start engine and return source time function.
stfinv::Waveform run() { return(Mengine->run()); }
private:
//! \brief Function to actually create the engine.
void create(const stfinv::Tlistoftriples& triples,
const stfinv::Waveform& stf,
const std::string& parameters);
//! \brief Pointer to actual engine.
stfinv::STFBaseEngine* Mengine;
}; // class STFEngine
} // namespace stfinv
#endif // STFINV_STFINVANY_H_VERSION (includeguard)
/* ----- END OF stfinvany.h ----- */
......@@ -43,6 +43,7 @@
"$Id$"
#include<stfinv/stfinv.h>
#include<stfinv/error.h>
#include<aff/series.h>
#include<list>
......@@ -98,31 +99,41 @@ namespace stfinv {
/*----------------------------------------------------------------------*/
//! \brief Abort upon illegal call of base class function.
#define STFINV_baseillegal STFINV_abort("illegal call to abstract base class!")
/*----------------------------------------------------------------------*/
/*! \brief Abstract base class for engines to derive source time functions
*/
class STFEngine {
class STFBaseEngine {
public:
/*! \brief Constructor.
*/
STFEngine(const stfinv::Tlistoftriples& triples,
const stfinv::Waveform& stf,
const std::string& parameters)
STFBaseEngine(const stfinv::Tlistoftriples& triples,
const stfinv::Waveform& stf,
const std::string& parameters)
:Mtriples(triples), Mstf(stf), Mparameters(parameters)
{
this->checkconsistency();
}
//! \brief abstract base requires virtual destructor
virtual ~STFBaseEngine() { }
//! \brief Start engine and return source time function.
stfinv::Waveform run();
virtual stfinv::Waveform run() { STFINV_baseillegal; }
private:
//! \brief Check consistency of data members.
void checkconsistency() const;
protected:
// protected members are accessed directly from derived classes
//! \brief Waveform triples.
stfinv::Tlistoftriples Mtriples;
//! \brief Source time function.
stfinv::Waveform Mstf;
//! \brief Control parameters encoded in a string.
std::string Mparameters;
}; // class STFEngine
}; // class STFBaseEngine
} // namespace stfinv
......
/*! \file stfinvblinddeconv.cc
* \brief blind deconvolution in the frequency domain (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 06/05/2011
*
* blind deconvolution in the frequency domain (implementation)
*
* Copyright (c) 2011 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
*
* REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define STFINV_STFINVBLINDDECONV_CC_VERSION \
"STFINV_STFINVBLINDDECONV_CC V1.0 "
#define STFINV_STFINVBLINDDECONV_CC_CVSID \
"$Id$"
#include <stfinv/stfinvblinddeconv.h>
namespace stfinv {
} // namespace stfinv
/* ----- END OF stfinvblinddeconv.cc ----- */
/*! \file stfinvblinddeconv.h
* \brief blind deconvolution in the frequency domain (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 06/05/2011
*
* blind deconvolution in the frequency domain (prototypes)
*
* Copyright (c) 2011 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
*
* REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef STFINV_STFINVBLINDDECONV_H_VERSION
#define STFINV_STFINVBLINDDECONV_H_VERSION \
"STFINV_STFINVBLINDDECONV_H V1.0 "
#define STFINV_STFINVBLINDDECONV_H_CVSID \
"$Id$"
#include<stfinv/stfinvbase.h>
namespace stfinv {
/*! \brief Blind deconvolution engine
*/
class STFEngineBlindDeconvolution: private stfinv::STFBaseEngine {
public:
typedef stfinv::STFBaseEngine Tbase;
/*! \brief Constructor.
*/
STFEngineBlindDeconvolution(const stfinv::Tlistoftriples& triples,
const stfinv::Waveform& stf,
const std::string& parameters)
:Tbase(triples, stf, parameters) { }
//! \brief abstract base requires virtual destructor
virtual ~STFEngineBlindDeconvolution() { }
//! \brief Start engine and return source time function.
virtual stfinv::Waveform run();
}; // class STFEngineBlindDeconvolution
} // namespace stfinv
#endif // STFINV_STFINVBLINDDECONV_H_VERSION (includeguard)
/* ----- END OF stfinvblinddeconv.h ----- */
/*! \file stfinvfixedstf.cc
* \brief always return a fixed stf as read from file (implementation)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 06/05/2011
*
* always return a fixed stf as read from file (implementation)
*
* Copyright (c) 2011 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
*
* REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define STFINV_STFINVFIXEDSTF_CC_VERSION \
"STFINV_STFINVFIXEDSTF_CC V1.0 "
#define STFINV_STFINVFIXEDSTF_CC_CVSID \
"$Id$"
#include <stfinv/stfinvfixedstf.h>
namespace stfinv {
} // namespace stfinv
/* ----- END OF stfinvfixedstf.cc ----- */
/*! \file stfinvfixedstf.h
* \brief always return a fixed stf as read from file (prototypes)
*
* ----------------------------------------------------------------------------
*
* $Id$
* \author Thomas Forbriger
* \date 06/05/2011
*
* always return a fixed stf as read from file (prototypes)
*
* Copyright (c) 2011 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ----
*
*
* REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger
*
* ============================================================================
*/
// include guard
#ifndef STFINV_STFINVFIXEDSTF_H_VERSION
#define STFINV_STFINVFIXEDSTF_H_VERSION \
"STFINV_STFINVFIXEDSTF_H V1.0 "
#define STFINV_STFINVFIXEDSTF_H_CVSID \
"$Id$"
#include<stfinv/stfinvbase.h>
namespace stfinv {
/*! \brief Engine to provide a fixed wavelet
*/
class STFEngineFixedWavelet: private stfinv::STFBaseEngine {
public:
typedef stfinv::STFBaseEngine Tbase;
/*! \brief Constructor.
*/
STFEngineFixedWavelet(const stfinv::Tlistoftriples& triples,
const stfinv::Waveform& stf,
const std::string& parameters)
:Tbase(triples, stf, parameters) { }
//! \brief abstract base requires virtual destructor
virtual ~STFEngineFixedWavelet() { }
//! \brief Start engine and return source time function.
virtual stfinv::Waveform run();
}; // class STFEngineFixedWavelet
} // namespace stfinv
#endif // STFINV_STFINVFIXEDSTF_H_VERSION (includeguard)
/* ----- END OF stfinvfixedstf.h ----- */
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