All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions
ArrayCore::RingCouples Class Reference

#include <RingCouples.h>

Inheritance diagram for ArrayCore::RingCouples:
QVector QGpCoreWave::AutocorrRing QGpCoreTools::XMLClass

List of all members.

Public Member Functions

QString log () const
QString name () const
void operator= (const RingCouples &o)
 RingCouples ()
 RingCouples (double rMin, double rMax)
 RingCouples (const RingCouples &o)
bool setCouples (const QVector< StationCouple > &couples)
double weight (int index) const
 ~RingCouples ()

Constructor & Destructor Documentation

: AutocorrRing() {_weights=0;}
ArrayCore::RingCouples::RingCouples ( double  rMin,
double  rMax 
) [inline]
: AutocorrRing(rMin, rMax) {_weights=0;}
  : QVector<const StationCouple *>(o), AutocorrRing(o)
{
  _weights=new double[count()];
  memcpy(_weights, o._weights, sizeof(double) * count());
}
{delete [] _weights;}

Member Function Documentation

QString ArrayCore::RingCouples::log ( ) const

References name(), and str.

Referenced by SPACLoop::setParameters().

{
  QString str;
  str += QString( " --- Ring %1\n" ).arg(name());
  double totalWeight=0;
  int nCouples=count();
  for(int i=0;i < nCouples;i++ ) {
    str += QString( "%1 azimuth=%2 weight=%3\n" ).
           arg(at( i) ->name()).arg(at( i) ->azimuth().degrees()).arg(_weights[ i ] );
    totalWeight += _weights[ i ];
  }
  str += QString( "Total weight=%1\n" ).arg(totalWeight);
  return str;
}
QString ArrayCore::RingCouples::name ( ) const [inline]

Referenced by log().

{return QString( "(%1 m, %2 m)" ).arg(minRadius()).arg(maxRadius());}
void ArrayCore::RingCouples::operator= ( const RingCouples o)
{
  delete _weights;
  _weights=new double[o.count()];
  memcpy(_weights, o._weights, sizeof(double) * o.count());
  QVector<const StationCouple *>::operator=(o);
  AutocorrRing::operator=(o);
}

Identify couples belonging to this ring and store the weight of all of them. The range for angle does not matter (it can be from 0 to M_PI or -M_PI/2 to M_PI/2), but must be in radians.

References ArrayCore::StationCouple::azimuth(), QGpCoreTools::Angle::degrees(), ArrayCore::StationCouple::distance(), QGpCoreWave::AutocorrRing::maxRadius(), QGpCoreWave::AutocorrRing::minRadius(), TRACE, and weight().

Referenced by ArrayCore::SPACParameters::addRing().

{
  TRACE;
  clear();
  //_stations.clear();
  int nCouples=couples.count();
  int iCouple;
  for(iCouple=0;iCouple < nCouples;iCouple++ ) {
    const StationCouple& cp=couples[ iCouple ];
    if(cp.distance() >= minRadius() && cp.distance() <= maxRadius()) {
      append(&cp);
    }
  }
  // Compute dPhis
  qSort(begin(), end(), lessThan);
  // Update number of couples, maybe none were selected
  nCouples=count();
  if(nCouples==0) {
    return false;
  }
  delete _weights;
  _weights=new double [ nCouples ];
  const StationCouple * cp;
  const StationCouple * lastcp=at(0);
  double azimuth, lastAzimuth=0;
  int nStatPerAzimuth=1;
  for(iCouple=1;iCouple < nCouples;iCouple++ ) {
    cp=at(iCouple);
    if(cp->azimuth()==lastcp->azimuth()) nStatPerAzimuth++;
    else {
      azimuth=(cp->azimuth().degrees() + lastcp->azimuth().degrees()) * 0.5;
      if(nStatPerAzimuth==1) _weights[ iCouple - 1 ]=azimuth - lastAzimuth;
      else {
        // Last nStatPerPhi was not 1, so share dphi between various couples
        double weight=(azimuth - lastAzimuth)/nStatPerAzimuth;
        int n=iCouple - 1 - nStatPerAzimuth;
        for(int i=iCouple - 1;i > n;i-- )
          _weights[ i ]=weight;
        nStatPerAzimuth=1;
      }
      lastAzimuth=azimuth;
    }
    lastcp=cp;
  }
  // Close last angular ring section
  double weight=(180.0 - lastAzimuth)/nStatPerAzimuth;
  int n=nCouples - 1 - nStatPerAzimuth;
  for(int i=nCouples - 1;i > n;i-- )
    _weights[ i ] =weight;
  return true;
}
double ArrayCore::RingCouples::weight ( int  index) const [inline]

Referenced by ArrayCore::RingCouplesProcess::init(), and setCouples().

{return _weights[index];}

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