Commit df746752 authored by laura.gassner's avatar laura.gassner
Browse files

Merge branch 'thof/DENISE-import_Seitosh'

parents aca39e8a 628f7bb8
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: parameterhandler.h 3973 2011-05-28 14:40:41Z tforb $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 06/05/2011 * \date 06/05/2011
* *
...@@ -38,9 +37,7 @@ ...@@ -38,9 +37,7 @@
#ifndef STFINV_PARAMETERHANDLER_H_VERSION #ifndef STFINV_PARAMETERHANDLER_H_VERSION
#define STFINV_PARAMETERHANDLER_H_VERSION \ #define STFINV_PARAMETERHANDLER_H_VERSION \
"STFINV_PARAMETERHANDLER_H V1.0 " "STFINV_PARAMETERHANDLER_H V1.0"
#define STFINV_PARAMETERHANDLER_H_CVSID \
"$Id: parameterhandler.h 3973 2011-05-28 14:40:41Z tforb $"
#include <string> #include <string>
#include <map> #include <map>
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: stfinv.cc 4968 2013-02-01 13:58:05Z lrehor $
*
* ---- * ----
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -33,13 +31,12 @@ ...@@ -33,13 +31,12 @@
* - 30/09/2011 V1.1 implemented handling of additional time series pairs * - 30/09/2011 V1.1 implemented handling of additional time series pairs
* - 05/10/2011 V1.2 correction: initstfinvenginewithpairs was named * - 05/10/2011 V1.2 correction: initstfinvenginewithpairs was named
* incorrectly initstfinvenginepairs * incorrectly initstfinvenginepairs
* - 14/10/2015 V1.3 new end-user usage functions
* *
* ============================================================================ * ============================================================================
*/ */
#define STFINV_STFINV_C_VERSION \ #define STFINV_STFINV_C_VERSION \
"STFINV_STFINV_C V1.2" "STFINV_STFINV_C V1.3"
#define STFINV_STFINV_C_CVSID \
"$Id: stfinv.cc 4968 2013-02-01 13:58:05Z lrehor $"
#include <stfinv/stfinv.h> #include <stfinv/stfinv.h>
#include <stfinv/error.h> #include <stfinv/error.h>
...@@ -168,10 +165,24 @@ void freestfinvengine() ...@@ -168,10 +165,24 @@ void freestfinvengine()
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
void printengines()
{
stfinv::engines();
} // void printengines()
/*----------------------------------------------------------------------*/
void printhelp() void printhelp()
{ {
stfinv::STFEngine::help();
stfinv::help(); stfinv::help();
} // void printhelp() } // void printhelp()
/*----------------------------------------------------------------------*/
void printusage(char* id)
{
std::string selectid(id);
stfinv::usage(selectid);
} // void printhelp(age(char* id)
/* ----- END OF stfinv.cc ----- */ /* ----- END OF stfinv.cc ----- */
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
* \ingroup cinterface * \ingroup cinterface
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: stfinv.h 4968 2013-02-01 13:58:05Z lrehor $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 06/05/2011 * \date 06/05/2011
* *
...@@ -34,6 +33,7 @@ ...@@ -34,6 +33,7 @@
* - 28/06/2011 V1.1 requires extern declaration for C++ since binary * - 28/06/2011 V1.1 requires extern declaration for C++ since binary
* code is compiled by C++ compiler, not C compiler * code is compiled by C++ compiler, not C compiler
* - 30/09/2011 V1.2 implemented handling of additional time series pairs * - 30/09/2011 V1.2 implemented handling of additional time series pairs
* - 14/10/2015 V1.3 new end-user usage functions
* *
* ============================================================================ * ============================================================================
*/ */
...@@ -42,9 +42,7 @@ ...@@ -42,9 +42,7 @@
#ifndef STFINV_STFINV__H_VERSION #ifndef STFINV_STFINV__H_VERSION
#define STFINV_STFINV__H_VERSION \ #define STFINV_STFINV__H_VERSION \
"STFINV_STFINV__H V1.2" "STFINV_STFINV__H V1.3"
#define STFINV_STFINV__H_CVSID \
"$Id: stfinv.h 4968 2013-02-01 13:58:05Z lrehor $"
#include <stfinv/waveformheader.h> #include <stfinv/waveformheader.h>
...@@ -219,7 +217,7 @@ struct CPairs { ...@@ -219,7 +217,7 @@ struct CPairs {
* \param parameters * \param parameters
* Parameters to select one of the engines as well as to control the engines * Parameters to select one of the engines as well as to control the engines
* are passed in a character sequence. * are passed in a character sequence.
* See also \ref main_subsec_parameters * See also \ref page_eu_subsec_parameters
*/ */
void initstfinvengine(struct CTriples triples, void initstfinvengine(struct CTriples triples,
struct CWaveform stf, struct CWaveform stf,
...@@ -259,7 +257,7 @@ void initstfinvengine(struct CTriples triples, ...@@ -259,7 +257,7 @@ void initstfinvengine(struct CTriples triples,
* \param parameters * \param parameters
* Parameters to select one of the engines as well as to control the engines * Parameters to select one of the engines as well as to control the engines
* are passed in a character sequence. * are passed in a character sequence.
* See also \ref main_subsec_parameters * See also \ref page_eu_subsec_parameters
*/ */
void initstfinvenginewithpairs(struct CTriples triples, void initstfinvenginewithpairs(struct CTriples triples,
struct CWaveform stf, struct CWaveform stf,
...@@ -278,12 +276,26 @@ void runstfinvengine(); ...@@ -278,12 +276,26 @@ void runstfinvengine();
*/ */
void freestfinvengine(); void freestfinvengine();
/*! \brief Print online help to stdout /*! \brief List procedures (engines) on stdout
*
* \ingroup cinterface
*/
void printengines();
/*! \brief Print usage summary to stdout
* *
* \ingroup cinterface * \ingroup cinterface
*/ */
void printhelp(); void printhelp();
/*! \brief Print detailed description for engine "id" to stdout
*
* \param id character string selecting a specific engine
*
* \ingroup cinterface
*/
void printusage(char* id);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: stfinvany.cc 4968 2013-02-01 13:58:05Z lrehor $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 06/05/2011 * \date 06/05/2011
* *
...@@ -32,20 +31,24 @@ ...@@ -32,20 +31,24 @@
* - 06/05/2011 V1.0 Thomas Forbriger * - 06/05/2011 V1.0 Thomas Forbriger
* - 30/09/2011 V1.1 implemented handling of additional time series pairs * - 30/09/2011 V1.1 implemented handling of additional time series pairs
* - 04/10/2011 V1.2 renamed Fourier domain least squares engine * - 04/10/2011 V1.2 renamed Fourier domain least squares engine
* - 14/10/2015 V1.3 new end-user usage functions
* *
* ============================================================================ * ============================================================================
*/ */
#define STFINV_STFINVANY_CC_VERSION \ #define STFINV_STFINVANY_CC_VERSION \
"STFINV_STFINVANY_CC V1.1" "STFINV_STFINVANY_CC V1.3"
#define STFINV_STFINVANY_CC_CVSID \
"$Id: stfinvany.cc 4968 2013-02-01 13:58:05Z lrehor $"
#include <stfinv/stfinvany.h> #include <stfinv/stfinvany.h>
#include <stfinv/stfinvfdleastsquares.h> #include <stfinv/stfinvfdleastsquares.h>
#include <stfinv/stfinvfixedstf.h> #include <stfinv/stfinvfixedstf.h>
#include <stfinv/stfinvidentity.h> #include <stfinv/stfinvidentity.h>
#include <stfinv/parameterhandler.h> #include <stfinv/parameterhandler.h>
#include <stfinv/stfinvany_summary_usage.h>
#include <stfinv/stfinvany_description_usage.h>
#include <stfinv/stfinv_summary_usage.h>
#include <stfinv/stfinv_description_usage.h>
#include <stfinv/error.h> #include <stfinv/error.h>
#include <stfinv/tools.h>
namespace stfinv { namespace stfinv {
...@@ -80,16 +83,16 @@ namespace stfinv { ...@@ -80,16 +83,16 @@ namespace stfinv {
std::string id=stfinv::tools::clipstring(para, ":"); std::string id=stfinv::tools::clipstring(para, ":");
if (id == std::string(stfinv::STFEngineIdentity::ID)) if (id == std::string(stfinv::STFEngineIdentity::ID))
{ {
STFINV_assert(pairs.size()==0,
"ERROR: engine does not support additional time series pairs");
Mengine=new stfinv::STFEngineIdentity(triples, stf, para); Mengine=new stfinv::STFEngineIdentity(triples, stf, para);
} }
/*
else if (id == std::string(stfinv::STFEngineFixedWavelet::ID)) else if (id == std::string(stfinv::STFEngineFixedWavelet::ID))
{ {
STFINV_assert(pairs.size()==0, STFINV_assert(pairs.size()==0,
"ERROR: engine does not support additional time series pairs"); "ERROR: engine does not support additional time series pairs");
Mengine=new stfinv::STFEngineFixedWavelet(triples, stf, para); Mengine=new stfinv::STFEngineFixedWavelet(triples, stf, para);
} }
*/
else if ((id == std::string(stfinv::STFEngineFDLeastSquares::ID)) else if ((id == std::string(stfinv::STFEngineFDLeastSquares::ID))
|| (id == std::string("fbd"))) || (id == std::string("fbd")))
{ {
...@@ -128,82 +131,74 @@ namespace stfinv { ...@@ -128,82 +131,74 @@ namespace stfinv {
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
void STFEngine::help(std::ostream& os) void STFEngine::engines(std::ostream& os)
{ {
os << "Currently the following engines are available:" << std::endl; os << "Available procedures:" << std::endl;
os << "---------------------------------------------" << std::endl; os << "---------------------" << std::endl;
os << std::endl; tools::report_engine<STFEngineIdentity>(os);
const int width1=10; // tools::report_engine<STFEngineFixedWavelet>(os);
/*----------------------------------------------------------------------*/ tools::report_engine<STFEngineFDLeastSquares>(os);
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 << STFEngineFDLeastSquares::ID;
os.width(0);
os << ": " << STFEngineFDLeastSquares::description << std::endl;
} // void STFEngine::help(std::ostream& os=std::cout) } // void STFEngine::help(std::ostream& os=std::cout)
/*======================================================================*/ /*----------------------------------------------------------------------*/
void help(std::ostream& os) void STFEngine::help(std::ostream& os)
{ {
os << "Details descriptions of available engines:" << std::endl; os << stfinv_summary_usage;
os << "------------------------------------------" << std::endl;
os << std::endl; os << std::endl;
STFEngineIdentity::classhelp(os); STFEngine::engines(os);
os << std::endl; os << std::endl;
STFEngineFixedWavelet::classhelp(os); STFEngineIdentity::classhelp(os);
os << std::endl; os << std::endl;
STFEngineFDLeastSquares::classhelp(os); STFEngineFDLeastSquares::classhelp(os);
os << std::endl;
STFFourierDomainEngine::classhelp(os);
os << std::endl;
STFBaseEngine::classhelp(os);
os << std::endl;
os << stfinvany_summary_usage;
} // void STFEngine::help(std::ostream& os=std::cout)
// parameter strings /*----------------------------------------------------------------------*/
os << "\n";
os << "How to construct parameter strings" << std::endl;
os << "----------------------------------" << std::endl;
os << "A specific engine is selected by passing a parameter string.\n"
<< "This parameter string may further contain parameters to control\n"
<< "the execution mode of the engine.\n";
os << "The parameter string starts with an ID-sequence identifying\n"
<< "the desired engine. See the list below for available engines.\n"
<< "In the parameter string the ID-sequence is terminated by a\n"
<< "colon (:).\n";
os << "After selecting the desired engine, the interface function\n"
<< "strips of the ID-sequence as well as the colon from the\n"
<< "parameter string and initializes the engine and passes the\n"
<< "remainder of the parameter string to the engine. This\n"
<< "remainder may consist of several control parameters being\n"
<< "separated by colons (:). Each control parameter may just be\n"
<< "a flag (switch to turn an option on) or may come along with\n"
<< "a parameter value. The value of the parameter is separated\n"
<< "by an equal sign (=).\n";
os << "\n";
os << "Examples:\n";
os << "- To select Fourier domain least squares and shift\n"
<< " the returned source correction filter wavelet by 0.4s and\n"
<< " switch on verbose mode, pass the following parameter string:\n";
os << " fdlsq:tshift=0.4:verbose\n";
os << "- To select the identity engine and to switch on debug level 4:\n";
os << " ident:DEBUG=4\n";
os << "- To select Fourier domain least squares, apply offset\n"
<< " dependent weights and use a power of two to speed up the FFT:\n";
os << " fdlsq:pow2:exp=1.4\n";
void STFEngine::usage(const std::string& id, std::ostream& os)
{
os << stfinv_description_usage;
os << std::endl;
if (id == std::string(stfinv::STFEngineIdentity::ID))
{
stfinv::STFEngineIdentity::classusage(os);
}
else if ((id == std::string(stfinv::STFEngineFDLeastSquares::ID)))
{
stfinv::STFEngineFDLeastSquares::classusage(os);
}
else
{
std::cerr << "ERROR: engine ID " << id << " is unkown!" << std::endl;
STFINV_abort("aborting since engine ID is not recognized");
}
os << std::endl; os << std::endl;
os << stfinvany_description_usage;
} // void STFEngine::help(std::ostream& os=std::cout)
/*======================================================================*/
void engines(std::ostream& os)
{
STFEngine::engines(os);
} // void engines(std::ostream& os)
void help(std::ostream& os)
{
STFEngine::help(os); STFEngine::help(os);
} // void help(std::ostream& os=std::cout) } // void help(std::ostream& os=std::cout)
void usage(const std::string& id, std::ostream& os)
{
STFEngine::usage(id, os);
} // void usage(const std::string& id, std::ostream& os)
} // namespace stfinv } // namespace stfinv
/* ----- END OF stfinvany.cc ----- */ /* ----- END OF stfinvany.cc ----- */
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: stfinvany.h 4968 2013-02-01 13:58:05Z lrehor $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 06/05/2011 * \date 06/05/2011
* *
...@@ -31,6 +30,7 @@ ...@@ -31,6 +30,7 @@
* REVISIONS and CHANGES * REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger * - 06/05/2011 V1.0 Thomas Forbriger
* - 30/09/2011 V1.1 implemented handling of additional time series pairs * - 30/09/2011 V1.1 implemented handling of additional time series pairs
* - 14/10/2015 V1.2 new end-user usage functions
* *
* ============================================================================ * ============================================================================
*/ */
...@@ -39,9 +39,7 @@ ...@@ -39,9 +39,7 @@
#ifndef STFINV_STFINVANY_H_VERSION #ifndef STFINV_STFINVANY_H_VERSION
#define STFINV_STFINVANY_H_VERSION \ #define STFINV_STFINVANY_H_VERSION \
"STFINV_STFINVANY_H V1.1" "STFINV_STFINVANY_H V1.2"
#define STFINV_STFINVANY_H_CVSID \
"$Id: stfinvany.h 4968 2013-02-01 13:58:05Z lrehor $"
#include<stfinv/stfinvbase.h> #include<stfinv/stfinvbase.h>
...@@ -55,6 +53,9 @@ namespace stfinv { ...@@ -55,6 +53,9 @@ namespace stfinv {
* abstract base class stfinv::STFBaseEngine except that the first prefix * abstract base class stfinv::STFBaseEngine except that the first prefix
* (up to the first colon) in the parameter string is understood to identify * (up to the first colon) in the parameter string is understood to identify
* the selected engine. * the selected engine.
*
* It serves as a kind of handle to provide user selectable engines to
* application programs.
*/ */
class STFEngine { class STFEngine {
public: public:
...@@ -74,7 +75,7 @@ namespace stfinv { ...@@ -74,7 +75,7 @@ namespace stfinv {
* \param parameters * \param parameters
* Parameters to select one of the engines as well as to control the * Parameters to select one of the engines as well as to control the
* engines are passed in a character sequence. * engines are passed in a character sequence.
* See also \ref main_subsec_parameters * See also \ref page_eu_subsec_parameters
*/ */
STFEngine(const stfinv::Tvectoroftriples& triples, STFEngine(const stfinv::Tvectoroftriples& triples,
const stfinv::Waveform& stf, const stfinv::Waveform& stf,
...@@ -107,7 +108,7 @@ namespace stfinv { ...@@ -107,7 +108,7 @@ namespace stfinv {
* \param parameters * \param parameters
* Parameters to select one of the engines as well as to control the * Parameters to select one of the engines as well as to control the
* engines are passed in a character sequence. * engines are passed in a character sequence.
* See also \ref main_subsec_parameters * See also \ref page_eu_subsec_parameters
*/ */
STFEngine(const stfinv::Tvectoroftriples& triples, STFEngine(const stfinv::Tvectoroftriples& triples,
const stfinv::Waveform& stf, const stfinv::Waveform& stf,
...@@ -119,8 +120,16 @@ namespace stfinv { ...@@ -119,8 +120,16 @@ namespace stfinv {
stfinv::STFBaseEngine& STFBaseEngine() { return (*Mengine); } stfinv::STFBaseEngine& STFBaseEngine() { return (*Mengine); }
//! \brief Start engine and return source correction filter. //! \brief Start engine and return source correction filter.
stfinv::Waveform run() { return(Mengine->run()); } stfinv::Waveform run() { return(Mengine->run()); }
//! \brief List engines currently recognized //! \brief List procedures (engines) currently recognized
static void engines(std::ostream& os=std::cout);
//! \brief List engines currently recognized and print summary
static void help(std::ostream& os=std::cout); static void help(std::ostream& os=std::cout);
/*! \brief Print detailed usage description.
*
* \param id ID of procedure (engine) to be described.
* \param os stream to send output to
*/
static void usage(const std::string& id, std::ostream& os=std::cout);
private: private:
//! \brief initialize engine. //! \brief initialize engine.
void initialize(const stfinv::Tvectoroftriples& triples, void initialize(const stfinv::Tvectoroftriples& triples,
...@@ -133,11 +142,27 @@ namespace stfinv { ...@@ -133,11 +142,27 @@ namespace stfinv {
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
/*! print online help of the whole implemented system of engines /*! print list available procedures (engines)
* \ingroup cxxinterface
*
* Just delegates to STFEngine::engines()
*/
void engines(std::ostream& os=std::cout);
/*! print print usage summary
* \ingroup cxxinterface * \ingroup cxxinterface
*
* Just delegates to STFEngine::help()
*/ */
void help(std::ostream& os=std::cout); void help(std::ostream& os=std::cout);
/*! print print detailed description for selected engine
* \ingroup cxxinterface
*
* Just delegates to STFEngine::usage()
*/
void usage(const std::string& id, std::ostream& os=std::cout);
} // namespace stfinv } // namespace stfinv
#endif // STFINV_STFINVANY_H_VERSION (includeguard) #endif // STFINV_STFINVANY_H_VERSION (includeguard)
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: stfinvbase.cc 4161 2011-10-01 08:00:43Z tforb $
* \author Thomas Forbriger * \author Thomas Forbriger
* \date 06/05/2011 * \date 06/05/2011
* *
...@@ -31,21 +30,26 @@ ...@@ -31,21 +30,26 @@
* REVISIONS and CHANGES * REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger * - 06/05/2011 V1.0 Thomas Forbriger
* - 30/09/2011 V1.1 implemented handling of additional time series pairs * - 30/09/2011 V1.1 implemented handling of additional time series pairs
* - 14/10/2015 V1.2 new end-user usage functions
* *
* ============================================================================ * ============================================================================
*/ */
#define STFINV_STFINVBASE_CC_VERSION \ #define STFINV_STFINVBASE_CC_VERSION \
"STFINV_STFINVBASE_CC V1.1" "STFINV_STFINVBASE_CC V1.2"
#define STFINV_STFINVBASE_CC_CVSID \
"$Id: stfinvbase.cc 4161 2011-10-01 08:00:43Z tforb $"
#include <sstream> #include <sstream>
#include <cmath> #include <cmath>
#include <stfinv/stfinvbase.h> #include <stfinv/stfinvbase.h>
#include <stfinv/stfinvbase_summary_usage.h>
#include <stfinv/stfinvbase_description_usage.h>
#include <stfinv/debug.h> #include <stfinv/debug.h>
namespace stfinv { namespace stfinv {
/*!
* Constructor stores all references to time series data passed by the
* caller.
*/
STFBaseEngine::STFBaseEngine(const stfinv::Tvectoroftriples& triples, STFBaseEngine::STFBaseEngine(const stfinv::Tvectoroftriples& triples,
const stfinv::Waveform& stf, const stfinv::Waveform& stf,
const stfinv::Tvectorofpairs& pairs,