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

implemented fftinput and fftoutput

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: 3973
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 5655f3f5
......@@ -77,7 +77,7 @@ LAYOUT_FILE =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
......@@ -93,7 +93,7 @@ FILE_PATTERNS = README onlinehelp.xxx \
*.h \
*.cc
RECURSIVE = YES
EXCLUDE =
EXCLUDE = .svn
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
......
......@@ -149,14 +149,16 @@ namespace stfinv {
*
* \ingroup group_error
* \param M message of type char*
* \param E exception class to throw
*/
#define STFINV_abort(M) \
throw( stfinv::Exception ( M , __FILE__, __LINE__ ))
/*! \brief Abort if function is called illegally.
*
* \ingroup group_error
*/
#define STFINV_illegal STFINV_abort("illegal call!")
/*! \brief Check an assertion and report only.
*
* \ingroup group_error
......
......@@ -77,9 +77,9 @@ namespace stfinv {
/*! \brief Create a parameter map from a parameter string
* \ingroup tools
*
* \para p parameter string
* \para delimiter delimiter which separates two parameters
* \para assign symbol seprating key and value
* \param p parameter string
* \param delimiter delimiter which separates two parameters
* \param assign symbol seprating key and value
* \return a multimap created from the parameter string
*/
Tparamap makeparamap(const std::string& p,
......
......@@ -143,6 +143,38 @@ namespace stfinv {
return("STFBaseEngine");
} // const char const* STFBaseEngine::name() const
/*----------------------------------------------------------------------*/
Tseries::Tcoc STFBaseEngine::recording(const unsigned int& i) const
{
this->checkreceiverindex(i);
return(Mtriples[i].data);
}
/*----------------------------------------------------------------------*/
Tseries::Tcoc STFBaseEngine::synthetic(const unsigned int& i) const
{
this->checkreceiverindex(i);
return(Mtriples[i].synthetics);
}
/*----------------------------------------------------------------------*/
Tseries STFBaseEngine::convolvedsynthetic(const unsigned int& i) const
{
this->checkreceiverindex(i);
return(Mtriples[i].convolvedsynthetics);
}
/*----------------------------------------------------------------------*/
void STFBaseEngine::checkreceiverindex(const unsigned int& i) const
{
STFINV_assert(i<Mtriples.size(),
"ERROR: receiver index out of range");
}
} // namespace stfinv
/* ----- END OF stfinvbase.cc ----- */
......@@ -167,12 +167,26 @@ namespace stfinv {
//! \brief return number of receiver signals in use
unsigned int nreceivers() const
{ return (Mtriples.size()); }
//! \brief return sampling interval
double dt() const
{ return (Mstf.sampling.dt); }
//! \brief return source time function series
Tseries stf() const
{ return (Mstf.series); }
//! \brief return recorded data at receiver \c i
Tseries::Tcoc recording(const unsigned int& i) const ;
//! \brief return synthetic data at receiver \c i
Tseries::Tcoc synthetic(const unsigned int& i) const ;
//! \brief return synthetic data convolved with stf at receiver \c i
Tseries convolvedsynthetic(const unsigned int& i) const ;
protected:
//! \brief return the value of a parameters
std::string parameter(const std::string& key,
const std::string& defvalue="false") const;
//! \brief check is parameter was set by user
bool parameterisset(const std::string& key) const;
//! \brief check for vaid receiver index
void checkreceiverindex(const unsigned int& i) const;
private:
//! \brief parse parameters in Mparameters
void parseparameters(std::string parameters);
......
......@@ -114,12 +114,12 @@ namespace stfinv {
*
* \par Workspace
* Two FFT engines will be created:
* -# One engine (\c Mfftengineinput) being shared by recorded data and
* synthetic data, because both have to be transformed to Fourier domain at
* once.
* -# One engine (\c Mfftengineoutpu) being shared by the stf and the
* convolved synthetics, because both have to be transformed to the time
* domain at once.
* -# One engine (\c STFFourierDomainEngine::Mfftengineinput) being shared
* by recorded data and synthetic data, because both have to be transformed
* to Fourier domain at once.
* -# One engine (\c STFFourierDomainEngine::Mfftengineoutput) being shared
* by the stf and the convolved synthetics, because both have to be
* transformed to the time domain at once.
*/
void STFFourierDomainEngine::initialize()
{
......@@ -138,10 +138,11 @@ namespace stfinv {
// flag: use integer multiples of divisor
bool divisorset=this->parameterisset("fdiv");
// number of samples shall be integer power of divisor
unsigned int divisor;
unsigned int divisor=1;
if (divisorset)
{
std::istringstream is (this->parameter("fdiv","100"));
is >> divisor;
STFINV_assert(divisor > 0,
"ERROR: parameter for option \"fdiv\" not larger than 0");
}
......@@ -177,36 +178,60 @@ namespace stfinv {
void STFFourierDomainEngine::fftinput()
{
STFINV_abort("STFFourierDomainEngine::fftinput not yet implemented");
// clear workspace
TAseries sarray=Mfftengineinput.series();
sarray=0.;
// cycle through receivers
for (unsigned int i=0; i<this->nreceivers(); ++i)
{
// get references to time series in workspace
TAseries recording=Mfftengineinput.series(i);
TAseries synthetic=Mfftengineinput.series(i+this->nreceivers());
// copyin function copies as many elements as possible
recording.copyin(this->recording(i));
synthetic.copyin(this->synthetic(i));
} // for (unsigned int i=0; i<this->nreceivers(); ++i)
} // void STFFourierDomainEngine::fftinput()
/*----------------------------------------------------------------------*/
void STFFourierDomainEngine::fftoutput()
{
STFINV_abort("STFFourierDomainEngine::fftoutput not yet implemented");
// cycle through receivers
for (unsigned int i=0; i<this->nreceivers(); ++i)
{
// get references to time series
stfinv::Tseries convolvedsynthetics=this->convolvedsynthetic(i);
// copyin function copies as many elements as possible
convolvedsynthetics.copyin(Mfftengineoutput.series(i));
} // for (unsigned int i=0; i<this->nreceivers(); ++i)
// copy stf too
stfinv::Tseries stf=this->stf();
stf.copyin(Mfftengineoutput.series(this->nreceivers()));
} // void STFFourierDomainEngine::fftoutput()
/*----------------------------------------------------------------------*/
STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::data() const
STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::recordingspec() const
{
STFINV_abort("STFFourierDomainEngine::data not yet implemented");
} // STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::data() const
} // STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::recordingspec() const
/*----------------------------------------------------------------------*/
STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::synthetics() const
STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::syntheticspec() const
{
STFINV_abort("STFFourierDomainEngine::synthetics not yet implemented");
} // STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::synthetics() const
} // STFFourierDomainEngine::TAspectrum STFFourierDomainEngine::syntheticspec() const
/*----------------------------------------------------------------------*/
STFFourierDomainEngine::Tspectrum STFFourierDomainEngine::stf() const
STFFourierDomainEngine::Tspectrum STFFourierDomainEngine::stfspec() const
{
STFINV_abort("STFFourierDomainEngine::stf not yet implemented");
} // STFFourierDomainEngine::Tspectrum STFFourierDomainEngine::stf() const
} // STFFourierDomainEngine::Tspectrum STFFourierDomainEngine::stfspec() const
} // namespace stfinv
......
......@@ -75,7 +75,7 @@ namespace stfinv {
//! \brief type of array for Fourier transforms
typedef Tfftengine::TAspectrum TAspectrum;
//! \brief type of series for time series values
typedef Tfftengine::Tseries Tseries;
typedef Tfftengine::Tseries Tfftseries;
//! \brief type of series for Fourier coefficients
typedef Tfftengine::Tspectrum Tspectrum;
protected:
......@@ -106,23 +106,23 @@ namespace stfinv {
*/
void fftoutput();
//! \brief return reference to Fourier transform of recorded data
TAspectrum data() const;
TAspectrum recordingspec() const;
//! \brief return reference to Fourier transform of synthetics
TAspectrum synthetics() const;
TAspectrum syntheticspec() const;
//! \brief return reference to Fourier transform of stf
Tspectrum stf() const;
Tspectrum stfspec() const;
/*! \brief return reference to Fourier coeffients of recorded data for
* frequency i
*/
TAspectrum data(const unsigned int& i) const;
TAspectrum recordingcoeff(const unsigned int& i) const;
/*! \brief return reference to Fourier coefficients of synthetics for
* frequency i
*/
TAspectrum synthetics(const unsigned int& i) const;
TAspectrum syntheticcoeff(const unsigned int& i) const;
/*! \brief return reference to Fourier coefficients of stf for frequency
* i
*/
Tspectrum::Tvalue& stf(const unsigned int& i) const;
TAspectrum::Tvalue& stfcoeff(const unsigned int& i) const;
//! \brief return value of frequency i in Hz
double frequency(const unsigned int& i) const;
//! \brief return number of frequencies in use
......
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