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

essentially implemented C interface

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: 3918
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 90e86a67
......@@ -69,11 +69,49 @@ namespace stfinv {
/*======================================================================*/
void initstfinvengine(struct CTriples triples,
struct CWaveform stf,
char* parameters)
struct CWaveform stf,
char* parameters)
{
STFINV_abort("initstfinvengine(): not yet implemented");
// remove existing engine if has previously been initialized
freestfinvengine();
// convert parameter string
std::string cxxparameters(parameters);
// convert pointer to source time function array
stfinv::Waveform cxxstf;
cxxstf.sampling=stf.sampling;
aff::LinearShape shape(0, cxxstf.sampling.n-1, 0);
cxxstf.series
=stfinv::Tseries(shape,
aff::SharedHeap<Tvalue>(stf.series,
cxxstf.sampling.n));
// convert pointer triples
stfinv::Tlistoftriples cxxtriples;
STFINV_assert(triples.n>0, "no triples provided");
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;
shape=aff::LinearShape(0, n-1, 0);
triple.data
=stfinv::Tseries(shape,
aff::SharedHeap<Tvalue>(ctriple.data, n));
triple.synthetics
=stfinv::Tseries(shape,
aff::SharedHeap<Tvalue>(ctriple.synthetics, n));
triple.convolvedsynthetics
=stfinv::Tseries(shape,
aff::SharedHeap<Tvalue>(ctriple.convolvedsynthetics, n));
cxxtriples.push_back(triple);
}
// create engine
stfinv::capi::Pengine=new stfinv::STFEngine(cxxtriples, cxxstf,
cxxparameters);
} // void initstfinvengine
/*----------------------------------------------------------------------*/
......@@ -92,4 +130,11 @@ void freestfinvengine()
if (stfinv::capi::Pengine != 0) { delete stfinv::capi::Pengine; }
} // void freestfinvengine()
/*----------------------------------------------------------------------*/
void printhelp()
{
stfinv::help();
} // void printhelp()
/* ----- END OF stfinv.cc ----- */
......@@ -108,8 +108,8 @@ struct CTriples {
* \ingroup cinterface
*/
void initstfinvengine(struct CTriples triples,
struct CWaveform stf,
char* parameters);
struct CWaveform stf,
char* parameters);
/*! \brief Run the engine.
*
......@@ -123,6 +123,12 @@ void runstfinvengine();
*/
void freestfinvengine();
/*! \brief Print online help to stdout
*
* \ingroup cinterface
*/
void printhelp();
#endif // STFINV_STFINV__H_VERSION (includeguard)
/* ----- END OF stfinv.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