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

framework is prepared; ready to implement engine run functions

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: 3922
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent c509bb17
......@@ -88,25 +88,23 @@ void initstfinvengine(struct CTriples triples,
cxxstf.sampling.n));
// convert pointer triples
stfinv::Tvectoroftriples cxxtriples;
STFINV_assert(triples.n>0, "no triples provided");
stfinv::Tvectoroftriples cxxtriples(triples.n);
for (int i=0; i<triples.n; ++i)
{
stfinv::WaveformTriple triple;
CWaveformTriple ctriple=triples.triples[i];
triple.header=ctriple.header;
const int& n=triple.header.sampling.n;
cxxtriples[i].header=ctriple.header;
const int& n=cxxtriples[i].header.sampling.n;
shape=aff::LinearShape(0, n-1, 0);
triple.data
cxxtriples[i].data
=stfinv::Tseries::Tcoc(shape,
aff::SharedHeap<Tvalue>::Tcoc(ctriple.data, n));
triple.synthetics
cxxtriples[i].synthetics
=stfinv::Tseries::Tcoc(shape,
aff::SharedHeap<Tvalue>::Tcoc(ctriple.synthetics, n));
triple.convolvedsynthetics
cxxtriples[i].convolvedsynthetics
=stfinv::Tseries(shape,
aff::SharedHeap<Tvalue>(ctriple.convolvedsynthetics, n));
cxxtriples.push_back(triple);
}
// create engine
......@@ -134,6 +132,7 @@ void freestfinvengine()
void printhelp()
{
stfinv::STFEngine::help();
stfinv::help();
} // void printhelp()
......
......@@ -39,15 +39,87 @@
"$Id$"
#include <stfinv/stfinvany.h>
#include <stfinv/stfinvblinddeconv.h>
#include <stfinv/stfinvfixedstf.h>
#include <stfinv/stfinvidentity.h>
#include <stfinv/parameterhandler.h>
#include <stfinv/error.h>
namespace stfinv {
//! \brief Constructor.
STFEngine::STFEngine(const stfinv::Tvectoroftriples& triples,
const stfinv::Waveform& stf,
const std::string& parameters)
{
std::string para=parameters;
std::string id=stfinv::tools::clipstring(para, ":");
if (id == std::string(stfinv::STFEngineIdentity::ID))
{
Mengine=new stfinv::STFEngineIdentity(triples, stf, para);
}
else if (id == std::string(stfinv::STFEngineFixedWavelet::ID))
{
Mengine=new stfinv::STFEngineFixedWavelet(triples, stf, para);
}
else if (id == std::string(stfinv::STFEngineBlindDeconvolution::ID))
{
Mengine=new stfinv::STFEngineBlindDeconvolution(triples, stf, para);
}
else
{
std::cerr << "ERROR: engine ID " << id << " is unkown!" << std::endl;
STFINV_abort("aborting since engine ID is not recognized");
}
STFINV_assert(Mengine!=0, "engine was not created correctly");
}
/*----------------------------------------------------------------------*/
STFEngine::~STFEngine()
{
delete Mengine;
} // STFEngine::~STFEngine()
/*----------------------------------------------------------------------*/
void STFEngine::help(std::ostream& os)
{
os << "Currently the following engines are available:" << std::endl;
os << "---------------------------------------------" << std::endl;
os << std::endl;
const int width1=10;
/*----------------------------------------------------------------------*/
os.width(width1);
os << STFEngineIdentity::ID;
os.width(0);
os << ": " << STFEngineIdentity::description << std::endl;
/*----------------------------------------------------------------------*/
os.width(width1);
os << STFEngineFixedWavelet::ID;
os.width(0);
os << ": " << STFEngineFixedWavelet::description << std::endl;
/*----------------------------------------------------------------------*/
os.width(width1);
os << STFEngineBlindDeconvolution::ID;
os.width(0);
os << ": " << STFEngineBlindDeconvolution::description << std::endl;
} // void STFEngine::help(std::ostream& os=std::cout)
/*======================================================================*/
void help(std::ostream& os)
{
os << "Details descriptions of available engines:" << std::endl;
os << "------------------------------------------" << std::endl;
os << std::endl;
STFEngineIdentity::classhelp(os);
os << std::endl;
STFEngineFixedWavelet::classhelp(os);
os << std::endl;
STFEngineBlindDeconvolution::classhelp(os);
} // void help(std::ostream& os=std::cout)
} // namespace stfinv
/* ----- END OF stfinvany.cc ----- */
......@@ -67,6 +67,8 @@ namespace stfinv {
stfinv::STFBaseEngine& STFBaseEngine() { return (*Mengine); }
//! \brief Start engine and return source time function.
stfinv::Waveform run() { return(Mengine->run()); }
//! \brief List engines currently recognized
static void help(std::ostream& os=std::cout);
private:
//! \brief Pointer to actual engine.
stfinv::STFBaseEngine* Mengine;
......
......@@ -47,6 +47,24 @@ namespace stfinv {
const char* const STFEngineBlindDeconvolution::description
="blind deconvolution in the frequency domain";
/*----------------------------------------------------------------------*/
void STFEngineBlindDeconvolution::help(std::ostream& os) const
{
STFEngineBlindDeconvolution::classhelp(os);
} // void STFEngineBlindDeconvolution::help(std::ostream& os) const
/*----------------------------------------------------------------------*/
void STFEngineBlindDeconvolution::classhelp(std::ostream& os)
{
os << "class STFEngineBlindDeconvolution ("
<< STFEngineBlindDeconvolution::ID << ")\n";
os << STFEngineBlindDeconvolution::description << "\n" << std::endl;
os << "This class is not yet implemented." << std::endl;
os << "Online help is not yet provided." << std::endl;
} // void STFEngineBlindDeconvolution::classhelp(std::ostream& os)
} // namespace stfinv
/* ----- END OF stfinvblinddeconv.cc ----- */
......@@ -49,7 +49,7 @@ namespace stfinv {
/*! \brief Blind deconvolution engine
* \ingroup engines
*/
class STFEngineBlindDeconvolution: private stfinv::STFBaseEngine {
class STFEngineBlindDeconvolution: public stfinv::STFBaseEngine {
public:
//! \brief typedef to refer to base class
typedef stfinv::STFBaseEngine Tbase;
......@@ -67,6 +67,10 @@ namespace stfinv {
virtual ~STFEngineBlindDeconvolution() { }
//! \brief Start engine and return source time function.
virtual stfinv::Waveform run();
//! \brief print online help
virtual void help(std::ostream& os=std::cout) const;
//! \brief print online help
static void classhelp(std::ostream& os=std::cout);
}; // class STFEngineBlindDeconvolution
} // namespace stfinv
......
......@@ -47,6 +47,23 @@ namespace stfinv {
const char* const STFEngineFixedWavelet::description
="use fixed wavelet as read from file";
/*----------------------------------------------------------------------*/
void STFEngineFixedWavelet::help(std::ostream& os) const
{
STFEngineFixedWavelet::classhelp(os);
} // void STFEngineFixedWavelet::help(std::ostream& os) const
/*----------------------------------------------------------------------*/
void STFEngineFixedWavelet::classhelp(std::ostream& os)
{
os << "class STFEngineFixedWavelet (" << STFEngineFixedWavelet::ID << ")\n";
os << STFEngineFixedWavelet::description << "\n" << std::endl;
os << "This class is not yet implemented." << std::endl;
os << "Online help is not yet provided." << std::endl;
} // void STFEngineFixedWavelet::classhelp(std::ostream& os)
} // namespace stfinv
/* ----- END OF stfinvfixedstf.cc ----- */
......@@ -49,7 +49,7 @@ namespace stfinv {
/*! \brief Engine to provide a fixed wavelet
* \ingroup engines
*/
class STFEngineFixedWavelet: private stfinv::STFBaseEngine {
class STFEngineFixedWavelet: public stfinv::STFBaseEngine {
public:
//! \brief typedef to refer to base class
typedef stfinv::STFBaseEngine Tbase;
......@@ -67,6 +67,10 @@ namespace stfinv {
virtual ~STFEngineFixedWavelet() { }
//! \brief Start engine and return source time function.
virtual stfinv::Waveform run();
//! \brief print online help
virtual void help(std::ostream& os=std::cout) const;
//! \brief print online help
static void classhelp(std::ostream& os=std::cout);
}; // class STFEngineFixedWavelet
} // namespace stfinv
......
......@@ -47,6 +47,23 @@ namespace stfinv {
const char* const STFEngineIdentity::description
="identity: just apply a scalar factor";
/*----------------------------------------------------------------------*/
void STFEngineIdentity::help(std::ostream& os) const
{
STFEngineIdentity::classhelp(os);
} // void STFEngineIdentity::help(std::ostream& os) const
/*----------------------------------------------------------------------*/
void STFEngineIdentity::classhelp(std::ostream& os)
{
os << "class STFEngineIdentity (" << STFEngineIdentity::ID << ")\n";
os << STFEngineIdentity::description << "\n" << std::endl;
os << "This class is not yet implemented." << std::endl;
os << "Online help is not yet provided." << std::endl;
} // void STFEngineIdentity::classhelp(std::ostream& os)
} // namespace stfinv
/* ----- END OF stfinvidentity.cc ----- */
......@@ -49,7 +49,7 @@ namespace stfinv {
/*! \brief Engine to apply a scalar factor
* \ingroup engines
*/
class STFEngineIdentity: private stfinv::STFBaseEngine {
class STFEngineIdentity: public stfinv::STFBaseEngine {
public:
//! \brief typedef to refer to base class
typedef stfinv::STFBaseEngine Tbase;
......@@ -67,6 +67,10 @@ namespace stfinv {
virtual ~STFEngineIdentity() { }
//! \brief Start engine and return source time function.
virtual stfinv::Waveform run();
//! \brief print online help
virtual void help(std::ostream& os=std::cout) const;
//! \brief print online help
static void classhelp(std::ostream& os=std::cout);
}; // class STFEngineIdentity
} // namespace stfinv
......
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