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

proceeding with stuploxx

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: 2425
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 7cb70935
......@@ -4,7 +4,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: readtsdata.cc,v 1.6 2007-03-02 12:03:55 tforb Exp $
* $Id: readtsdata.cc,v 1.7 2007-11-02 10:51:58 tforb Exp $
* \author Thomas Forbriger
* \date 31/01/2007
*
......@@ -31,19 +31,30 @@
*
* REVISIONS and CHANGES
* - 31/01/2007 V1.0 Thomas Forbriger
* - 31/10/2007 V1.1 added single precision versions
* PGPLOT requires single precision data
*
* ============================================================================
*/
#define TF_READTSDATA_CC_VERSION \
"TF_READTSDATA_CC V1.0 "
"TF_READTSDATA_CC V1.1"
#define TF_READTSDATA_CC_CVSID \
"$Id: readtsdata.cc,v 1.6 2007-03-02 12:03:55 tforb Exp $"
"$Id: readtsdata.cc,v 1.7 2007-11-02 10:51:58 tforb Exp $"
#include <tfxx/readtsdata.h>
namespace tfxx {
namespace tsio {
//! read complete SFF file
SFile readSSFF(const std::string& filename,
const bool& verbose,
const datread::Eformat& format)
{
Ttracelist rangelist;
return (readSSFF(filename, rangelist, verbose, format));
}
//! read complete SFF file
DFile readDSFF(const std::string& filename,
const bool& verbose,
......@@ -55,6 +66,24 @@ namespace tfxx {
/*----------------------------------------------------------------------*/
//! read complete SFF file with trace selection
SFile readSSFF(const std::string& filename,
const Ttracelist& selection,
const bool& verbose,
const datread::Eformat& format)
{
SFile retval;
retval.arguments.name=filename;
if (verbose)
{
std::cout << "open input file " << filename << std::endl;
}
std::ifstream ifs(filename.c_str());
datread::ianystream is(ifs, format);
retval.data.read(is.idatstream(), selection, verbose);
return(retval);
}
//! read complete SFF file with trace selection
DFile readDSFF(const std::string& filename,
const Ttracelist& selection,
......@@ -75,6 +104,19 @@ namespace tfxx {
/*----------------------------------------------------------------------*/
//! read complete SFF file with trace selection
SFile readSSFF(const tfxx::cmdline::Filename& filename,
const bool& verbose,
Ttracelistkey tracekey,
const datread::Eformat& format)
{
Ttracelist selection=
tfxx::string::rangelist<Ttracelist::Tvalue>(filename.value(tracekey));
SFile retval=readSSFF(filename.name, selection, verbose, format);
retval.arguments=filename;
return(retval);
}
//! read complete SFF file with trace selection
DFile readDSFF(const tfxx::cmdline::Filename& filename,
const bool& verbose,
......@@ -90,6 +132,22 @@ namespace tfxx {
/*----------------------------------------------------------------------*/
//! read complete list of SFF files with trace selection
TSFileList readSSFF(const tfxx::cmdline::Tparsed& flist,
const bool& verbose,
Ttracelistkey tracekey,
const datread::Eformat& format)
{
TSFileList retval;
tfxx::cmdline::Tparsed::const_iterator file=flist.begin();
while (file != flist.end())
{
retval.push_back(readSSFF(*file, verbose, tracekey, format));
++file;
}
return(retval);
}
//! read complete list of SFF files with trace selection
TDFileList readDSFF(const tfxx::cmdline::Tparsed& flist,
const bool& verbose,
......
......@@ -4,7 +4,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: readtsdata.h,v 1.5 2007-02-12 10:58:50 tforb Exp $
* $Id: readtsdata.h,v 1.6 2007-11-02 10:51:58 tforb Exp $
* \author Thomas Forbriger
* \date 31/01/2007
*
......@@ -31,6 +31,8 @@
*
* REVISIONS and CHANGES
* - 31/01/2007 V1.0 Thomas Forbriger
* - 31/10/2007 V1.1 added single precision versions
* PGPLOT requires single precision data
*
* ============================================================================
*/
......@@ -39,9 +41,9 @@
#ifndef TF_READTSDATA_H_VERSION
#define TF_READTSDATA_H_VERSION \
"TF_READTSDATA_H V1.0 "
"TF_READTSDATA_H V1.1"
#define TF_READTSDATA_H_CVSID \
"$Id: readtsdata.h,v 1.5 2007-02-12 10:58:50 tforb Exp $"
"$Id: readtsdata.h,v 1.6 2007-11-02 10:51:58 tforb Exp $"
#include<tfxx/rangelist.h>
#include<tfxx/xcmdline.h>
......@@ -96,6 +98,32 @@ namespace tfxx {
*/
typedef const char* Ttracelistkey;
/*! \brief structure to contain file data together with command line
* arguments (single precision).
*
* \ingroup group_readtsdata, readtsdata_h
*
* A struct to hold a complete data file including
* -# command line arguments associated with the file
* -# the file header
* -# headers and samples from all selected traces
*
* This specific struct will hold samples in form of doubles.
*/
struct SFile {
//! provides reading into doubles
typedef float Tvalue;
//! container to be used
typedef aff::Series<Tvalue> Tseries;
//! file container
typedef ts::sff::File<Tseries> Tfile;
//! command line arguments
tfxx::cmdline::Filename arguments;
//! container to hold data headers and samples
ts::sff::File<Tseries> data;
}; // struct SFile
/*! \brief structure to contain file data together with command line
* arguments.
*
......@@ -119,7 +147,7 @@ namespace tfxx {
tfxx::cmdline::Filename arguments;
//! container to hold data headers and samples
ts::sff::File<Tseries> data;
}; // struct File
}; // struct DFile
/*! \brief complete list of files.
*
......@@ -129,6 +157,15 @@ namespace tfxx {
* command line at once.
*/
typedef std::list<DFile> TDFileList;
/*! \brief complete list of files (single precision version).
*
* \ingroup group_readtsdata, readtsdata_h
*
* A list of DFile structs, to store all data files provided on the
* command line at once.
*/
typedef std::list<SFile> TSFileList;
/*! \brief read complete SFF file.
*
......@@ -206,6 +243,86 @@ namespace tfxx {
const bool& verbose=false,
Ttracelistkey tracekey="t",
const datread::Eformat& format=datread::Fsff);
/*! \brief read complete SFF file (single precision version).
*
* \ingroup group_readtsdata, readtsdata_h
*
* Read a complete data file with headers and samples at once.
*
* \return structure that contains file data together with command line
* arguments
* \param filename input file name of file to be read
* \param verbose select verbosity
* \param format data format to be read
*/
SFile readSSFF(const std::string& filename,
const bool& verbose=false,
const datread::Eformat& format=datread::Fsff);
/*! \brief read complete SFF file with trace selection (single precision
* version).
*
* \ingroup group_readtsdata, readtsdata_h
*
* Read a complete data file with all headers and samples but only for the
* selected traces.
*
* \return structure that contains file data together with command line
* arguments (here: only file name)
* \param filename input file name of file to be read
* \param selection numerical list of selected traces
* \param verbose select verbosity
* \param format data format to be read
*/
SFile readSSFF(const std::string& filename,
const Ttracelist& selection,
const bool& verbose=false,
const datread::Eformat& format=datread::Fsff);
/*! \brief read complete SFF file with trace selection (single precision
* version).
*
* \ingroup group_readtsdata, readtsdata_h
*
* Read a complete data file, but take selection from the structure of
* command line arguments.
*
* \return structure that contains file data together with command line
* arguments (here: only file name)
* \param filename input file name together with command line options and
* arguments
* \param verbose select verbosity
* \param tracekey key string for command line option that defines trace
* selection
* \param format data format to be read
*/
SFile readSSFF(const tfxx::cmdline::Filename& filename,
const bool& verbose=false,
Ttracelistkey tracekey="t",
const datread::Eformat& format=datread::Fsff);
/*! \brief read complete list of SFF files with trace selection (single
* precision version).
*
* \ingroup group_readtsdata, readtsdata_h
*
* Read a complete set of files like defined in the structure of command
* line arguments.
*
* \return structure that contains file data together with command line
* arguments
* \param flist list of file names together with
* command line options and arguments
* \param verbose select verbosity
* \param tracekey key string for command line option that defines trace
* selection
* \param format data format to be read
*/
TSFileList readSSFF(const tfxx::cmdline::Tparsed& flist,
const bool& verbose=false,
Ttracelistkey tracekey="t",
const datread::Eformat& format=datread::Fsff);
} // namespace tsio
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sffheaders.cc,v 1.3 2006-03-29 07:42:58 tforb Exp $
* $Id: sffheaders.cc,v 1.4 2007-11-02 10:51:58 tforb Exp $
* \author Thomas Forbriger
* \date 18/07/2005
*
......@@ -29,13 +29,14 @@
*
* REVISIONS and CHANGES
* - 18/07/2005 V1.0 Thomas Forbriger
* - 31/10/2007 V1.1 support trace index
*
* ============================================================================
*/
#define TF_SFFHEADERS_CC_VERSION \
"TF_SFFHEADERS_CC V1.0 "
"TF_SFFHEADERS_CC V1.1"
#define TF_SFFHEADERS_CC_CVSID \
"$Id: sffheaders.cc,v 1.3 2006-03-29 07:42:58 tforb Exp $"
"$Id: sffheaders.cc,v 1.4 2007-11-02 10:51:58 tforb Exp $"
#include <tsxx/sffheaders.h>
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sffheaders.h,v 1.10 2007-03-02 12:09:09 tforb Exp $
* $Id: sffheaders.h,v 1.11 2007-11-02 10:51:59 tforb Exp $
* \author Thomas Forbriger
* \date 18/07/2005
*
......@@ -30,6 +30,7 @@
* REVISIONS and CHANGES
* - 18/07/2005 V1.0 Thomas Forbriger
* - 29/06/2006 V1.1 added constructors
* - 31/10/2007 V1.2 support trace index
*
* ============================================================================
*/
......@@ -38,9 +39,9 @@
#ifndef TF_SFFHEADERS_H_VERSION
#define TF_SFFHEADERS_H_VERSION \
"TF_SFFHEADERS_H V1.1"
"TF_SFFHEADERS_H V1.2"
#define TF_SFFHEADERS_H_CVSID \
"$Id: sffheaders.h,v 1.10 2007-03-02 12:09:09 tforb Exp $"
"$Id: sffheaders.h,v 1.11 2007-11-02 10:51:59 tforb Exp $"
#include<sffxx.h>
#include<tsxx/tsxx.h>
......@@ -114,13 +115,16 @@ namespace ts {
typedef typename Tbase::Tcoc Tcoc;
typedef typename Tbase::Ttimeseries Ttimeseries;
typedef typename Tbase::Tconsttimeseries Tconsttimeseries;
SFFTimeSeries(): Tbase() { }
SFFTimeSeries(const Tseries& s): Tbase(s) { }
SFFTimeSeries(): Tbase(), Mtraceindex(-1) { }
SFFTimeSeries(const Tseries& s): Tbase(s), Mtraceindex(-1) { }
void read(std::istream& is, const bool& verbose=false);
int traceindex() const { return Mtraceindex; }
void settraceindex(int ti) { Mtraceindex=ti; }
operator Twid2timeseries() const
{ return Twid2timeseries(this->series(), this->header.wid2()); }
operator Tdttimeseries() const
{ return Tdttimeseries(this->series(), this->header.wid2().dt); }
int Mtraceindex; //!< trace index in data file
}; // class SFFTimeSeries
/*----------------------------------------------------------------------*/
......@@ -245,6 +249,7 @@ namespace ts {
{ std::cout << " * read trace #" << itrace << std::endl; }
Ttimeseries timeseries;
is >> timeseries;
timerseries.settraceindex(itrace);
this->push_back(timeseries);
}
else
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: stuploxx.cc,v 1.8 2007-10-04 13:23:19 tforb Exp $
* $Id: stuploxx.cc,v 1.9 2007-11-02 10:51:59 tforb Exp $
* \author Thomas Forbriger
* \date 30/01/2007
*
......@@ -16,6 +16,59 @@
* - only two modes will be provided: all panels use the same time scale or
* each panel has its own time scale
*
* About the way data files are read:
* 1. The function
* setparameters (const tfxx::cmdline::Tparsed &fns, const PGstyle &pgs)
* creates a list of type TFileParametersList from
* a) all command line arguments including file specific options as stored
* an object of type tfxx::cmdline::Tparsed
* b) all default pgplot settings
* Each list element is of type FileParameters and contains the filename
* with command line parameters together with file specific parameters.
*
* This list is created only once. It is an image of the configuration
* passed through the command line. At this point the number of traces to
* be read and processed is not necessarily defined yet. This may still
* depend on the number of traces that are met in each file.
*
* When rereading the data, we have to return to this list of type
* TFileParametersList. The next time we read data files, the number of
* traces may be different. This is no problem, this is a feature. The
* program will react flexible on the actual contents of the file. The
* command line definitions represent the intention of the user in an
* abstract way.
*
* 2. The function
* readdata (const TFileParametersList &fpl)
* reads the data files and creates a list of type TDataFileList. The
* elements in this list are of type DataFile. They contain the file
* specific settings in an object of type FileParameters together with the
* actual trace data in an object of type TSFile.
*
* This step just adds actual data to the definitions taken from the
* command line.
*
* 3. The function
* setuppanels (const TDataFileList &fpl)
* take the definitions together with the trace data and splits the file
* into traces. These traces will then be associated to plot panels
* depending upon the settings defined by the user. The result of this
* function is a vector of type TPanelList. Each element in this vector is
* of type Panel and contains a list of type TDataTraceList. This list
* contains all traces to be plot within in the specific panel. The
* elements in the object of type TDataTraceList are of type DataTrace.
* This struct contains the parameters of the file from which the trace was
* obtained in an object of type FileParameters together with the trace
* data in and object to type Ttimeseries.
*
* 4. The function
* plotdata (pgplot::basic_device &dev, const TPanelList &pl, const PGstyle
* &)
* takes the vector of panels together with a PGPLOT device class and
* PGPLOT style settings and creates the graphical display of the data. It
* is called within a loop the supports interactive modification of plot
* parameters.
*
* weitere Vorgehensweise:
* - alle Dateien mit allen Spuren in single precision einlesen
* - dazu SFile analog zu DFile in libtfxx anlegen
......@@ -36,7 +89,7 @@
#define STUPLOXX_VERSION \
"STUPLOXX V1.0 Plot SFF waveform data"
#define STUPLOXX_CVSID \
"$Id: stuploxx.cc,v 1.8 2007-10-04 13:23:19 tforb Exp $"
"$Id: stuploxx.cc,v 1.9 2007-11-02 10:51:59 tforb Exp $"
#include <iostream>
#include <string>
......@@ -125,14 +178,14 @@ typedef std::list<FileParameters> TFileParametersList;
// use floats for PGPLOT functions
typedef float Tvalue;
typedef tfxx::tsio::DFile TDFile;
typedef TDFile::Tfile::Ttimeseries Ttimeseries;
typedef tfxx::tsio::SFile TSFile;
typedef TSFile::Tfile::Ttimeseries Ttimeseries;
typedef Ttimeseries::Tseries Tseries;
// struct to hold data together with file parameters
struct DataFile {
FileParameters para;
TDFile file;
TSFile file;
}; // struct DataFile
typedef std::list<DataFile> TDataFileList;
......@@ -250,7 +303,7 @@ TDataFileList readdata(const TFileParametersList& fpl)
{
DataFile df;
df.para = *I;
df.file = tfxx::tsio::readDSFF(I->filename, false, tracekey, I->format);
df.file = tfxx::tsio::readSSFF(I->filename, false, tracekey, I->format);
retval.push_back(df);
++I;
}
......
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