Commit 89385123 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

[WP] (libstfinv): implement function calls

All usage output function calls are implemented. Texts are still missing.
parent c49c7f3c
......@@ -40,6 +40,8 @@
#include <sstream>
#include <cmath>
#include <stfinv/stfinvbase.h>
#include <stfinv/stfinvbase_summary_usage.h>
#include <stfinv/stfinvbase_description_usage.h>
#include <stfinv/debug.h>
namespace stfinv {
......@@ -210,18 +212,25 @@ namespace stfinv {
void STFBaseEngine::classhelp(std::ostream& os)
{
os << "Options and parameters in common for all engines:\n"
<< "verbose produce verbose output (if implemented)\n"
<< "DEBUG=l produce debug output with level l\n"
<< "exp=k apply offset dependent weights to signals\n"
<< "If implemented in the engine in use then setting the parameter\n"
<< "exp=k will give a weight factor of ((r/1m)**k) to each signal\n"
<< "in order to compensate the decrease in signal energy."
<< std::endl;
os << stfinvbase_description_usage << std::endl;
} // void STFBaseEngine::classhelp(std::ostream& os)
/*----------------------------------------------------------------------*/
void STFBaseEngine::usage(std::ostream& os) const
{
STFBaseEngine::classusage(os);
} // void STFBaseEngine::usage(std::ostream& os) const
/*----------------------------------------------------------------------*/
void STFBaseEngine::classusage(std::ostream& os)
{
os << stfinvbase_summary_usage << std::endl;
} // void STFBaseEngine::classusage(std::ostream& os)
/*----------------------------------------------------------------------*/
/*!
* Pass the parameter string (as usually passed along the chain of
* constructors to the constructor and initialize() function of
......
......@@ -239,13 +239,13 @@ namespace stfinv {
}
//! \brief print online help
virtual void help(std::ostream& os=std::cout) const;
//! \brief print online help
//! \brief print detailed description
virtual void usage(std::ostream& os=std::cout) const;
//! \brief return name of engine
virtual const char* name() const;
//! \brief print online help
static void classhelp(std::ostream& os=std::cout);
//! \brief print online help
//! \brief print detailed description
static void classusage(std::ostream& os=std::cout);
//@}
......
......@@ -40,7 +40,10 @@
#include <iostream>
#include <aff/functions/sqrsum.h>
#include <stfinv/stfinvfdleastsquares.h>
#include <stfinv/stfinvfdleastsquares_summary_usage.h>
#include <stfinv/stfinvfdleastsquares_description_usage.h>
#include <stfinv/debug.h>
#include <stfinv/tools.h>
namespace stfinv {
......@@ -58,6 +61,13 @@ namespace stfinv {
/*----------------------------------------------------------------------*/
void STFEngineFDLeastSquares::usage(std::ostream& os) const
{
STFEngineFDLeastSquares::classusage(os);
} // void STFEngineFDLeastSquares::usage(std::ostream& os) const
/*----------------------------------------------------------------------*/
const char* STFEngineFDLeastSquares::name() const
{
return("STFEngineFDLeastSquares");
......@@ -80,21 +90,21 @@ namespace stfinv {
void STFEngineFDLeastSquares::classhelp(std::ostream& os)
{
os << "class STFEngineFDLeastSquares ("
<< STFEngineFDLeastSquares::ID << ")\n";
os << STFEngineFDLeastSquares::description << "\n" << std::endl;
os << "This engine calculates a least squares fit in the Fourier\n"
<< "domain. A waterlevel as a fraction of the signal energy of the\n"
<< "input synthetics is applied. If per receiver scaling is\n"
<< "selected, the receivers will be weighted in the deconvolution.\n";
os << "Options and parameters:\n"
<< "waterlevel=l waterlevel to be applied for regularization."
<< std::endl;
Tbase::classhelp(os);
stfinv::tools::report_engine<STFEngineFDLeastSquares>(os);
os << stfinvfdleastsquares_summary_usage << std::endl;
} // void STFEngineFDLeastSquares::classhelp(std::ostream& os)
/*----------------------------------------------------------------------*/
void STFEngineFDLeastSquares::classusage(std::ostream& os)
{
stfinv::tools::report_engine<STFEngineFDLeastSquares>(os);
os << stfinvfdleastsquares_description_usage << std::endl;
Tbase::classusage(os);
} // void STFEngineFDLeastSquares::classusage(std::ostream& os)
/*----------------------------------------------------------------------*/
void STFEngineFDLeastSquares::exec()
{
// read signals and calculate FFT
......
......@@ -247,9 +247,9 @@ namespace stfinv {
virtual void help(std::ostream& os=std::cout) const;
//! \brief print online help
static void classhelp(std::ostream& os=std::cout);
//! \brief print online help
//! \brief print detailed description
virtual void usage(std::ostream& os=std::cout) const;
//! \brief print online help
//! \brief print detailed description
static void classusage(std::ostream& os=std::cout);
//! \brief return name of engine
virtual const char* name() const;
......
......@@ -40,6 +40,8 @@
#include <sstream>
#include <stfinv/stfinvfourier.h>
#include <stfinv/stfinvfourier_summary_usage.h>
#include <stfinv/stfinvfourier_description_usage.h>
#include <stfinv/debug.h>
#include <aff/subarray.h>
#include <aff/slice.h>
......@@ -101,6 +103,13 @@ namespace stfinv {
STFFourierDomainEngine::classhelp(os);
} // void STFFourierDomainEngine::help(std::ostream& os) const
/*----------------------------------------------------------------------*/
void STFFourierDomainEngine::usage(std::ostream& os) const
{
STFFourierDomainEngine::classusage(os);
} // void STFFourierDomainEngine::usage(std::ostream& os) const
/*----------------------------------------------------------------------*/
......@@ -108,6 +117,7 @@ namespace stfinv {
{
return("STFFourierDomainEngine");
} // const char const* STFFourierDomainEngine::name() const
/*----------------------------------------------------------------------*/
/*! \brief online help text giving information on options
......@@ -117,23 +127,24 @@ namespace stfinv {
*/
void STFFourierDomainEngine::classhelp(std::ostream& os)
{
os << "Options and parameters in common for Fourier engines:\n"
<< "fpad=f padding factor (default: 1.5)\n"
<< "fpow2 use power of two\n"
<< "fdiv=d use integer multiple of d\n"
<< "tshift=d delay source correction filter wavelet by \"d\"\n"
<< " seconds in order to expose acausal parts\n"
<< "These options define the number of samples N used for the FFT.\n"
<< "This should be larger than the number of samples M in the\n"
<< "original series to avoid wrap-around. N=M*f at least. If fpow2\n"
<< "is set, N will be the next power of 2 larger than M*f. Else if\n"
<< "fdiv is set, N will be the next integer multiple of d larger\n"
<< "than M*f." << std::endl;
Tbase::classhelp(os);
os << stfinvfourier_summary_usage << std::endl;
} // void STFFourierDomainEngine::classhelp(std::ostream& os)
/*----------------------------------------------------------------------*/
/*! \brief online help text giving information on options
*
* This must be kept synchronous with the options used by
* STFFourierDomainEngine::initialize()
*/
void STFFourierDomainEngine::classusage(std::ostream& os)
{
os << stfinvfourier_description_usage << std::endl;
Tbase::classusage(os);
} // void STFFourierDomainEngine::classusage(std::ostream& os)
/*----------------------------------------------------------------------*/
/*! \brief Create FFT engines
*
* \par Number of samples
......
......@@ -112,9 +112,9 @@ namespace stfinv {
virtual void help(std::ostream& os=std::cout) const;
//! \brief print online help
static void classhelp(std::ostream& os=std::cout);
//! \brief print online help
//! \brief print detailed description
virtual void usage(std::ostream& os=std::cout) const;
//! \brief print online help
//! \brief print detailed description
static void classusage(std::ostream& os=std::cout);
//! \brief return name of engine
virtual const char* name() const;
......
......@@ -38,9 +38,12 @@
"STFINV_STFINVIDENTITY_CC V1.2"
#include <stfinv/stfinvidentity.h>
#include <stfinv/stfinvidentity_summary_usage.h>
#include <stfinv/stfinvidentity_description_usage.h>
#include <aff/functions/sqrsum.h>
#include <aff/seriesoperators.h>
#include <cmath>
#include <stfinv/tools.h>
namespace stfinv {
......@@ -58,6 +61,13 @@ namespace stfinv {
/*----------------------------------------------------------------------*/
void STFEngineIdentity::usage(std::ostream& os) const
{
STFEngineIdentity::classusage(os);
} // void STFEngineIdentity::usage(std::ostream& os) const
/*----------------------------------------------------------------------*/
const char* STFEngineIdentity::name() const
{
return("STFEngineIdentity");
......@@ -116,20 +126,19 @@ namespace stfinv {
void STFEngineIdentity::classhelp(std::ostream& os)
{
os << "class STFEngineIdentity ("
<< STFEngineIdentity::ID << ")\n";
os << STFEngineIdentity::description << "\n" << std::endl;
os << "This engine convolves the synthetic data with a discrete delta\n"
<< "pulse so to speak. Optionally the delta-peak is scaled such that\n"
<< "the convolved synthetics will be of equal scaled energy as the\n"
<< "recordings. Signal energy is calculated as the weighted average\n"
<< "the energy of all traces.\n";
os << "Options and parameters:\n"
<< "scaleenergy if flag is set: scale energy"
<< std::endl;
Tbase::classhelp(os);
stfinv::tools::report_engine<STFEngineIdentity>(os);
os << stfinvidentity_summary_usage << std::endl;
} // void STFEngineIdentity::classhelp(std::ostream& os)
/*----------------------------------------------------------------------*/
void STFEngineIdentity::classusage(std::ostream& os)
{
stfinv::tools::report_engine<STFEngineIdentity>(os);
os << stfinvidentity_description_usage << std::endl;
Tbase::classusage(os);
} // void STFEngineIdentity::classusage(std::ostream& os)
} // namespace stfinv
/* ----- END OF stfinvidentity.cc ----- */
......@@ -86,9 +86,9 @@ namespace stfinv {
virtual void help(std::ostream& os=std::cout) const;
//! \brief print online help
static void classhelp(std::ostream& os=std::cout);
//! \brief print online help
//! \brief print detailed description
virtual void usage(std::ostream& os=std::cout) const;
//! \brief print online help
//! \brief print detailed description
static void classusage(std::ostream& os=std::cout);
//! \brief return name of engine
virtual const char* name() const;
......
......@@ -30,6 +30,7 @@
*
* REVISIONS and CHANGES
* - 28/05/2011 V1.0 Thomas Forbriger
* - 15/10/2015 V1.1 new report function (report_engine)
*
* ============================================================================
*/
......@@ -38,7 +39,9 @@
#ifndef STFINV_TOOLS_H_VERSION
#define STFINV_TOOLS_H_VERSION \
"STFINV_TOOLS_H V1.0"
"STFINV_TOOLS_H V1.1"
#include<iostream>
namespace stfinv {
......@@ -53,6 +56,18 @@ namespace stfinv {
* \p eps
*/
bool sameineps(const double &a, const double& b, const double& eps=1.e-8);
/* ---------------------------------------------------------------------- */
/*! \brief report engine identifier
* \ingroup tools
*/
template<class C>
void report_engine(std::ostream& os)
{
os << "Procedure: " << C::description << "\n"
<< " ID: " << C::ID << std::endl;
} // void report_engine(std::ostream& os)
} // namespace tools
......
Supports Markdown
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