Public Member Functions | Protected Member Functions | Protected Attributes
ToolArrayBase Class Reference

Abstract base class for all array techniques. More...

#include <ToolArrayBase.h>

Inheritance diagram for ToolArrayBase:
GeopsyGui::ToolBase ToolFK ToolSPAC ToolHRFK ToolLinearFKPassive

List of all members.

Public Member Functions

void setTimeWindowLayer (TimeWindowList *winList)
 ToolArrayBase (QWidget *parent, int nChildren)

Protected Member Functions

StationSignalsbelongsTo (Signal *sig)
bool initStations (SubSignalPool *subPool, WindowingParameterWidget *winParam)
void resetLogs ()
virtual const char * toolName ()=0
void writeParameterLogs (QString outputFile)
void writeProcessLogs (QString outputFile)

Protected Attributes

ArrayStations _array
QString _initLog
QString _log
QString _paramLog

Detailed Description

Abstract base class for all array techniques.

Stores the list of stations and log stream. Call beginProcess() and endProcess() to calculate the signal processing for all frequencies and time windows It initializes of structure ArrayProcess with contains parameters, current frequency and keep vector (for window placement).


Constructor & Destructor Documentation

ToolArrayBase::ToolArrayBase ( QWidget *  parent,
int  nChildren 
)

References TRACE.

                                                            :
    ToolBase(parent, nChildren)
{
  TRACE;
}

Member Function Documentation

References _array, and TRACE.

{
  TRACE;
  QList<StationSignals *>::iterator it;
  for(it=_array.begin();it!=_array.end();++it) {
    if((*it)->contains(sig)) return *it;
  }
  return 0;
}
bool ToolArrayBase::initStations ( SubSignalPool subPool,
WindowingParameterWidget winParam 
) [protected]

References _array, _initLog, GeopsyGui::ToolBase::_subPool, GeopsyGui::WindowingParameterWidget::addComponent(), GeopsyCore::StationList::addSignals(), GeopsyGui::WindowingParameterWidget::addStation(), GeopsyCore::StationList::component(), QGpCoreTools::endl(), GeopsyCore::geopsyCore, GeopsyCore::StationList::hasAllComponents(), ArrayCore::ArrayStations::hasCompatibleStations(), MSG_ID, GeopsyCore::SubSignalPool::name(), GeopsyCore::StationList::nComponents(), GeopsyCore::GeopsyCoreEngine::showMessage(), QGpCoreTools::tr(), TRACE, and GeopsyGui::ToolBase::updateSubPool().

Referenced by ToolFK::initStations(), and ToolSPAC::initStations().

{
  TRACE;
  _subPool=subPool;
  _initLog=QString("*********** %1 ***********\n").arg(_subPool->name());
  geopsyCore->showMessage(tr("Loading samples ..." ));
  StationSignals::organizeSubPool(_subPool);
  if(!_array.addSignals(_subPool, &_initLog) ||
     !_array.hasAllComponents(&_initLog) ||
     !_array.hasCompatibleStations(&_initLog)) {
    Message::warning(MSG_ID, tr("Checking stations"), _initLog, Message::cancel());
    return false;
  }
  if(_array.count()<2) {
    Message::warning(MSG_ID, tr("Creating array"),
                     tr("Found less than 2 stations."),
                     Message::cancel());
    return false;
  }
  _initLog+=tr("Found %1 different stations\n").arg(_array.count());
  emit updateSubPool();
  App::stream() << _initLog << endl;
  if(winParam) {
    // Set station names in apply list
    for(int i=0; i<_array.nComponents(); i++) {
      winParam->addComponent(Signal::userName(_array.component(i)));
    }
    for(ArrayStations::iterator it=_array.begin(); it!=_array.end(); ++it) {
      winParam->addStation((*it)->name());
    }
  }
  return true;
}
void ToolArrayBase::resetLogs ( ) [protected]

Add all station to time window layer

References _array, GeopsyGui::TimeWindowLayer::addTimeWindows(), GeopsyCore::SubSignalPool::begin(), GeopsyCore::SubSignalPool::end(), GeopsyCore::StationList::nComponents(), GeopsyGui::ToolBase::timeWindowLayer(), and TRACE.

Referenced by ToolSPAC::initStations(), ToolHRFK::test(), and ToolFK::test().

{
  TRACE;
  if(timeWindowLayer()) {
    int nComp=_array.nComponents();
    for(QList<StationSignals *>::iterator it=_array.begin();it!=_array.end();++it) {
      for(int iComp=0; iComp<nComp; iComp++ ) {
        const SubSignalPool subPool=(*it)->originals(iComp);
        for(SubSignalPool::const_iterator itSig=subPool.begin();itSig!=subPool.end(); itSig++) {
          timeWindowLayer()->addTimeWindows(*itSig, winList);
        }
      }
    }
  }
}
virtual const char* ToolArrayBase::toolName ( ) [protected, pure virtual]
void ToolArrayBase::writeParameterLogs ( QString  outputFile) [protected]

References _initLog, _paramLog, QGpCoreTools::endl(), MSG_ID, toolName(), QGpCoreTools::tr(), and TRACE.

Referenced by ToolSPAC::startLoop(), and ToolFK::startLoop().

{
  TRACE;
  QFileInfo fi(outputFile);
  QDir d(fi.absolutePath());
  QFile f(d.absoluteFilePath(fi.baseName() + ".log" ));
  if( !f.open(QIODevice::WriteOnly) ) {
    Message::warning(MSG_ID, toolName(),
                         tr("Cannot open .log file for writing"), Message::cancel());
    return;
  }
  QTextStream s(&f);
  s << "### Init Log ###\n";
  s << _initLog;
  s << "### End Init Log ###\n";
  s << "### Parameters ###\n";
  s << _paramLog;
  s << "### End Parameters ###" << endl;
}
void ToolArrayBase::writeProcessLogs ( QString  outputFile) [protected]

References _log, QGpCoreTools::endl(), MSG_ID, toolName(), QGpCoreTools::tr(), and TRACE.

Referenced by ToolFK::finish().

{
  TRACE;
  QFileInfo fi(outputFile);
  QDir d(fi.absolutePath());
  QFile f(d.absoluteFilePath(fi.baseName() + ".log" ));
  if( !f.open(QIODevice::Append) ) {
    Message::warning(MSG_ID, toolName(),
                         tr("Cannot open .log file for writing"), Message::cancel());
    return;
  }
  QTextStream s(&f);
  s << "### Process Log ###\n";
  s << _log;
  s << "### End Process Log ###" << endl;
}

Member Data Documentation

QString ToolArrayBase::_initLog [protected]
QString ToolArrayBase::_log [protected]
QString ToolArrayBase::_paramLog [protected]

Referenced by resetLogs(), and writeParameterLogs().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines