All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Static Public Attributes | Protected Member Functions
QGpCoreTools::IrregularGrid2D Class Reference

A 2D grid where the coordinates of the rectangular cell are not regularly distributed. More...

#include <IrregularGrid2D.h>

Inheritance diagram for QGpCoreTools::IrregularGrid2D:
QGpCoreTools::XMLClass Histogram2D RealTimeHistogram RealTimeHistogram

List of all members.

Public Member Functions

const double * axisData (AxisType axis) const
double bottom (int iy) const
void clear ()
Point2D coordinates (int ix, int iy) const
Curve< Point2DcrossSection (AxisType axis, int ixy) const
Curve< Point2DcrossSection (Segment2D seg, double deltaX=0) const
Curve< Point2DcrossSection (const Curve< Point2D > &path, double deltaX=0) const
void cut (AxisType axis, double min, double max, SamplingOptions options)
template<class CurveClass , class PointClass >
CurveClass followMaximumX () const
template<class CurveClass , class PointClass >
CurveClass followMaximumX (int ixMin, int ixMax, int iyMax) const
template<class CurveClass , class PointClass >
void followMaximumX (CurveClass &curve, double min, double max) const
template<class CurveClass , class PointClass >
CurveClass followMaximumY () const
template<class CurveClass , class PointClass >
CurveClass followMaximumY (int iyMin, int iyMax, int ixMax) const
template<class CurveClass , class PointClass >
void followMaximumY (CurveClass &curve, double min, double max) const
double height (int iy) const
int indexOfX (double val) const
int indexOfY (double val) const
void init (int nx, int ny)
void init (int nx, int ny, double value)
void init (double value=0.0)
Curve< Point2DintegralCrossSection (AxisType axis, int index) const
void inverse (AxisType axis)
 IrregularGrid2D ()
 IrregularGrid2D (int nx, int ny)
bool isLike (IrregularGrid2D &o) const
double left (int ix) const
void log10 (AxisType axis)
void log10 ()
double maximumAxis (AxisType axis) const
double maximumValue () const
double maximumValue (int &ix, int &iy) const
double mean (AxisType along, int index) const
double median (AxisType along, int index) const
double minimumAxis (AxisType axis) const
double minimumValue () const
double minimumValue (int &ix, int &iy) const
double mode (AxisType along, int index) const
void multiplyCoordinates (AxisType axis, double fac)
void multiplyValues (AxisType along, int index, double fac)
void multiplyValues (double fac)
double normalize (AxisType along, int index)
int nx () const
int ny () const
void operator+= (const IrregularGrid2D &o)
void operator= (const GridSearch &o)
void pow10 (AxisType axis)
void pow10 ()
void printValues (AxisType along, int index)
void resample (AxisType axis, const QVector< double > &xModel, SamplingOptions options)
void resample (AxisType axis, int n, double min, double max, SamplingOptions options)
double right (int ix) const
void setLinear (AxisType axis, double min, double max)
void setLog (AxisType axis, double min, double max)
void setValue (int ix, int iy, double val)
void setX (int ix, double val)
void setY (int iy, double val)
void smooth (AxisType along, int index)
double smoothInvalidCells (AxisType along, int index, double invalidValue, double sigma2, double RVal, bool modify)
double sum (AxisType along, int index) const
double top (int iy) const
double value (int ix, int iy) const
double * valuePointer (int ix, int iy)
const double * valuePointer (int ix, int iy) const
double variance (AxisType along, int index) const
double variance (AxisType along, int index, double average) const
double width (int ix) const
QVector< double > x () const
double x (int ix) const
virtual const QString & xml_tagName () const
QVector< double > y () const
double y (int iy) const

Static Public Attributes

static const QString xmlIrregularGrid2DTag = "IrregularGrid2D"

Protected Member Functions

virtual XMLMember xml_member (XML_MEMBER_ARGS)
virtual bool xml_setBinaryData (XML_SETBINARYDATA_ARGS)
virtual bool xml_setBinaryData200411 (XML_SETBINARYDATA_ARGS)
virtual bool xml_setProperty (XML_SETPROPERTY_ARGS)
virtual void xml_writeBinaryData (XML_WRITEBINARYDATA_ARGS) const
virtual void xml_writeProperties (XML_WRITEPROPERTIES_ARGS) const

Detailed Description

A 2D grid where the coordinates of the rectangular cell are not regularly distributed.

Full description of class still missing


Constructor & Destructor Documentation

{_d=new IrregularGrid2DData;}
QGpCoreTools::IrregularGrid2D::IrregularGrid2D ( int  nx,
int  ny 
) [inline]
{_d=new IrregularGrid2DData(nx, ny);}

Member Function Documentation

const double* QGpCoreTools::IrregularGrid2D::axisData ( AxisType  axis) const [inline]
{return _d->axisData(axis);}
double QGpCoreTools::IrregularGrid2D::bottom ( int  iy) const [inline]

Referenced by SciFigs::IrregularGrid2DPlot::boundingRect().

{return _d->bottom(iy);}

Reimplemented in RealTimeHistogram, and RealTimeHistogram.

{_d->clear();}
Point2D QGpCoreTools::IrregularGrid2D::coordinates ( int  ix,
int  iy 
) const [inline]

Referenced by SciFigs::IrregularGrid2DPlot::trackRectangle().

{return _d->coordinates(ix, iy);}
Curve<Point2D> QGpCoreTools::IrregularGrid2D::crossSection ( AxisType  axis,
int  ixy 
) const [inline]

Referenced by StatGridAnalyser::on_freqScroll_valueChanged().

{return _d->crossSection(axis, ixy);}
Curve<Point2D> QGpCoreTools::IrregularGrid2D::crossSection ( Segment2D  seg,
double  deltaX = 0 
) const [inline]
{return _d->crossSection(seg, deltaX);}
Curve<Point2D> QGpCoreTools::IrregularGrid2D::crossSection ( const Curve< Point2D > &  path,
double  deltaX = 0 
) const [inline]
{return _d->crossSection(path, deltaX);}
void QGpCoreTools::IrregularGrid2D::cut ( AxisType  axis,
double  min,
double  max,
SamplingOptions  options 
) [inline]
{_d->cut(axis, min, max, options);}
template<class CurveClass , class PointClass >
CurveClass QGpCoreTools::IrregularGrid2D::followMaximumX ( ) const [inline]
                                                                                  {
    return _d->followMaximumX<CurveClass, PointClass>();
  }
template<class CurveClass , class PointClass >
CurveClass QGpCoreTools::IrregularGrid2D::followMaximumX ( int  ixMin,
int  ixMax,
int  iyMax 
) const [inline]
                                                                                                                 {
    return _d->followMaximumX<CurveClass, PointClass>(ixMin, ixMax, iyMax);
  }
template<class CurveClass , class PointClass >
void QGpCoreTools::IrregularGrid2D::followMaximumX ( CurveClass &  curve,
double  min,
double  max 
) const [inline]
                                                                                                                     {
    return _d->followMaximumX<CurveClass, PointClass>(curve, min, max);
  }
template<class CurveClass , class PointClass >
CurveClass QGpCoreTools::IrregularGrid2D::followMaximumY ( ) const [inline]
                                                                                  {
    return _d->followMaximumY<CurveClass, PointClass>();
  }
template<class CurveClass , class PointClass >
CurveClass QGpCoreTools::IrregularGrid2D::followMaximumY ( int  iyMin,
int  iyMax,
int  ixMax 
) const [inline]
                                                                                                                 {
    return _d->followMaximumY<CurveClass, PointClass>(iyMin, iyMax, ixMax);
  }
template<class CurveClass , class PointClass >
void QGpCoreTools::IrregularGrid2D::followMaximumY ( CurveClass &  curve,
double  min,
double  max 
) const [inline]
                                                                                                                     {
    return _d->followMaximumY<CurveClass, PointClass>(curve, min, max);
  }
double QGpCoreTools::IrregularGrid2D::height ( int  iy) const [inline]

Referenced by StatGridAnalyser::on_freqScroll_valueChanged().

{return _d->height(iy);}
int QGpCoreTools::IrregularGrid2D::indexOfX ( double  val) const [inline]
int QGpCoreTools::IrregularGrid2D::indexOfY ( double  val) const [inline]
void QGpCoreTools::IrregularGrid2D::init ( int  nx,
int  ny 
) [inline]
void QGpCoreTools::IrregularGrid2D::init ( int  nx,
int  ny,
double  value 
) [inline]
{_d->init(nx, ny, value);}
void QGpCoreTools::IrregularGrid2D::init ( double  value = 0.0) [inline]
{_d->init(value);}
                                                                     {
     return _d->integralCrossSection(axis, index);
  }
{return _d->isLike( *o._d);}
double QGpCoreTools::IrregularGrid2D::left ( int  ix) const [inline]

Referenced by SciFigs::IrregularGrid2DPlot::boundingRect().

{return _d->left(ix);}
{_d->log10();}
double QGpCoreTools::IrregularGrid2D::maximumAxis ( AxisType  axis) const [inline]
{return _d->maximumAxis(axis);}
double QGpCoreTools::IrregularGrid2D::maximumValue ( int &  ix,
int &  iy 
) const [inline]
{return _d->maximumValue(ix, iy);}
double QGpCoreTools::IrregularGrid2D::mean ( AxisType  along,
int  index 
) const [inline]

Referenced by Histogram2D::meanCurve(), and StatGridAnalyser::on_freqScroll_valueChanged().

{return _d->mean(along, index);}
double QGpCoreTools::IrregularGrid2D::median ( AxisType  along,
int  index 
) const [inline]

Referenced by Histogram2D::medianCurve(), and StatGridAnalyser::on_freqScroll_valueChanged().

{return _d->median(along, index);}
double QGpCoreTools::IrregularGrid2D::minimumAxis ( AxisType  axis) const [inline]
{return _d->minimumAxis(axis);}

Referenced by SciFigs::IrregularGrid2DPlot::setLinearPalette().

{return _d->minimumValue();}
double QGpCoreTools::IrregularGrid2D::minimumValue ( int &  ix,
int &  iy 
) const [inline]
{return _d->minimumValue(ix, iy);}
double QGpCoreTools::IrregularGrid2D::mode ( AxisType  along,
int  index 
) const [inline]

Referenced by Histogram2D::modeCurve(), and StatGridAnalyser::on_freqScroll_valueChanged().

{return _d->mode(along, index);}
void QGpCoreTools::IrregularGrid2D::multiplyCoordinates ( AxisType  axis,
double  fac 
) [inline]
{_d->multiplyCoordinates(axis, fac);}
void QGpCoreTools::IrregularGrid2D::multiplyValues ( AxisType  along,
int  index,
double  fac 
) [inline]

Referenced by HVRotateStation::start(), and SpectrumRotateStation::start().

{_d->multiplyValues(along, index, fac);}
void QGpCoreTools::IrregularGrid2D::multiplyValues ( double  fac) [inline]
{_d->multiplyValues(fac);}
double QGpCoreTools::IrregularGrid2D::normalize ( AxisType  along,
int  index 
) [inline]

Referenced by Histogram2D::meanCurve(), Histogram2D::medianCurve(), and Histogram2D::modeCurve().

{return _d->normalize(along, index);}
int QGpCoreTools::IrregularGrid2D::nx ( ) const [inline]
int QGpCoreTools::IrregularGrid2D::ny ( ) const [inline]
void QGpCoreTools::IrregularGrid2D::operator+= ( const IrregularGrid2D o) [inline]
{_d->operator+=( *o._d);}
void QGpCoreTools::IrregularGrid2D::operator= ( const GridSearch o) [inline]
{_d->operator=(o);}

Referenced by HVRotateStation::start(), and SpectrumRotateStation::start().

{_d->pow10(axis);}
{_d->pow10();}
void QGpCoreTools::IrregularGrid2D::printValues ( AxisType  along,
int  index 
) [inline]
{_d->printValues(along, index);}
void QGpCoreTools::IrregularGrid2D::resample ( AxisType  axis,
const QVector< double > &  xModel,
SamplingOptions  options 
) [inline]
{_d->resample(axis, xModel, options);}
void QGpCoreTools::IrregularGrid2D::resample ( AxisType  axis,
int  n,
double  min,
double  max,
SamplingOptions  options 
) [inline]
{_d->resample(axis, n, min, max, options);}
double QGpCoreTools::IrregularGrid2D::right ( int  ix) const [inline]

Referenced by SciFigs::IrregularGrid2DPlot::boundingRect().

{return _d->right(ix);}
void QGpCoreTools::IrregularGrid2D::setLinear ( AxisType  axis,
double  min,
double  max 
) [inline]
void QGpCoreTools::IrregularGrid2D::setLog ( AxisType  axis,
double  min,
double  max 
) [inline]

Referenced by RealTimeHistogram::init(), MaxEntryList::initGrid(), and DispersionReader::parse().

{_d->setLog(axis, min, max);}
void QGpCoreTools::IrregularGrid2D::setValue ( int  ix,
int  iy,
double  val 
) [inline]

Referenced by TFAResults::compute(), QGpCoreTools::operator>>(), and DispersionReader::parse().

{return _d->setValue(ix, iy, val);}
void QGpCoreTools::IrregularGrid2D::setX ( int  ix,
double  val 
) [inline]
void QGpCoreTools::IrregularGrid2D::setY ( int  iy,
double  val 
) [inline]
void QGpCoreTools::IrregularGrid2D::smooth ( AxisType  along,
int  index 
) [inline]
{_d->smooth(along, index);}
double QGpCoreTools::IrregularGrid2D::smoothInvalidCells ( AxisType  along,
int  index,
double  invalidValue,
double  sigma2,
double  RVal,
bool  modify 
) [inline]
                                                      {return _d->smoothInvalidCells(along, index, invalidValue, sigma2, RVal, modify);}
double QGpCoreTools::IrregularGrid2D::sum ( AxisType  along,
int  index 
) const [inline]

Referenced by Histogram2D::meanCurve(), Histogram2D::medianCurve(), and Histogram2D::modeCurve().

{return _d->sum(along, index);}
double QGpCoreTools::IrregularGrid2D::top ( int  iy) const [inline]

Referenced by SciFigs::IrregularGrid2DPlot::boundingRect().

{return _d->top(iy);}
double QGpCoreTools::IrregularGrid2D::value ( int  ix,
int  iy 
) const [inline]
double* QGpCoreTools::IrregularGrid2D::valuePointer ( int  ix,
int  iy 
) [inline]
const double* QGpCoreTools::IrregularGrid2D::valuePointer ( int  ix,
int  iy 
) const [inline]
{return _d->valuePointer(ix, iy);}
double QGpCoreTools::IrregularGrid2D::variance ( AxisType  along,
int  index 
) const [inline]
double QGpCoreTools::IrregularGrid2D::variance ( AxisType  along,
int  index,
double  average 
) const [inline]
{return _d->variance(along, index, average);}
double QGpCoreTools::IrregularGrid2D::width ( int  ix) const [inline]
{return _d->width(ix);}
QVector<double> QGpCoreTools::IrregularGrid2D::x ( ) const [inline]
double QGpCoreTools::IrregularGrid2D::x ( int  ix) const [inline]
{return _d->x(ix);}

Re-implement this function to offer XML restore (children and properties) support to your class.

From tag and map (with contains the attibute value) return a unique identifier under the format of a XMLMember. XMLMember is initialized with 3 types of contructors:

  • An integer: id number of a property
  • A XMLClass * : a child of this object identified by tag
  • Default constructor: error, unknow child or property

Map of attributes can be inspected in this way (can be achived also in xml_setProperty()):

    static const QString tmp("childrenName");
    XMLRestoreAttributeIterator it=map.find(tmp);
    if(it!=map.end()) {
      // found attribute "childrenName"
    }

If the map of attributes is not used:

    Q_UNUSED(attributes);
    if(tag=="x1") return XMLMember(0);
    else if(tag=="y1") return XMLMember(1);
    else if(tag=="x2") return XMLMember(2);
    else if(tag=="y2") return XMLMember(3);
    else return XMLMember(XMLMember::Unknown);

Arithmetic operations + and - apply to XMLMember to avoid confusion of property id numbers between inherited objects. Offset 3 corresponds to the number of properties defined in this object.

    if(tag=="anInteger") return XMLMember(0);
    else if(tag=="aString") return XMLMember(1);
    else if(tag=="aDouble") return XMLMember(2);
    return AbstractLine::xml_member(tag, attributes, context)+3;

For the arguments of this function use Macro XML_MEMBER_ARGS.

Reimplemented from QGpCoreTools::XMLClass.

References TRACE, and QGpCoreTools::XMLMember::Unknown.

{
  TRACE;
  Q_UNUSED(attributes);
  Q_UNUSED(context);
  if(tag=="nx" ) return XMLMember(0);
  else if(tag=="ny" ) return XMLMember(1);
  else if(tag=="cells" ) return XMLMember(2);
  return XMLMember(XMLMember::Unknown);
}

This function must be re-implemented in all classes dealing with binary data that cannot be saved in an ASCII xml file (e.g. due to the amount of data).

See also xml_writeBinaryData().

The difference between xml_setBinaryData() and xml_setBinaryData200410() is detected by the type of tag at the beginning of each block if it can be read with QString ==> 200510, else try with a normal C string, if it match the current tag then execute xml_setBinaryData200411().

See also xml_setBinaryData200411() to maintain compatibility with previous versions of xml storages.

For the arguments of this function use Macro XML_SETBINARYDATA_ARGS.

Reimplemented from QGpCoreTools::XMLClass.

References QGpCoreTools::endl(), init(), nx(), ny(), QGpCoreTools::App::stream(), QGpCoreTools::tr(), and TRACE.

Referenced by xml_setBinaryData200411().

{
  TRACE;
  Q_UNUSED(context);
  int nrx, nry;
  s >> nrx;
  s >> nry;
  if(nrx!=nx() || nry!=ny()) {
    App::stream() << tr( "IrregularGrid2D size in binary file: %1x%2\n"
                     "                     in XML data   : %3x%4" )
    .arg(nrx).arg(nry).arg(nx()).arg(ny()) << endl;
  }
  init(nrx, nry);
  s.readRawData((char *)_d->xPointer(), sizeof(double)* nrx);
  s.readRawData((char *)_d->yPointer(), sizeof(double)* nry);
  s.readRawData((char *)_d->valuePointer(0,0), sizeof(double) * nrx * nry);
  return true;
}

This function must be re-implemented in all classes dealing with binary data that cannot be saved in an ASCII xml file (e.g. due to the amount of data).

See also xml_setBinaryData().

For the arguments of this function use Macro XML_SETBINARYDATA_ARGS.

This function must not used in new codes. This is only kept for compatibility reasons, to be able to read all xml.bin files generated by releases before November 2006.

Reimplemented from QGpCoreTools::XMLClass.

References TRACE, and xml_setBinaryData().

{
  TRACE;
  Q_UNUSED(context);
  s.setByteOrder(QDataStream::LittleEndian);
  bool ret=xml_setBinaryData(s, context);
  s.setByteOrder(QDataStream::BigEndian);
  return ret;
}

Re-implement this function to offer XML restore properties support to your class.

From memberID set the corresponding property with value content. The map of attributes is given as a supplementary information (not useful in all cases).

For a general case:

  Q_UNUSED(attributes);
  double val=content.toDouble();
  switch (memberID) {
  case 0:
    _x1=val;
    return true;
  case 1:
    _y1=val;
    return true;
  case 2:
    _x2=val;
    return true;
  case 3:
    _y2=val;
    return true;
  default:
    return false;
  }

For classes inheriting other classes (see also xml_member())

  switch (memberID) {
  case 0:
    _anInteger=content.toString();
    return true;
  case 1:
    _aString=content.toInt();
    return true;
  case 2:
    _aDouble=content.toDouble();
    return true;
  default:
    return AbstractLine::xml_setProperty(memberID-3, map, content);

For the arguments of this function use Macro XML_SETPROPERTY_ARGS.

Reimplemented from QGpCoreTools::XMLClass.

References init(), nx(), ny(), and TRACE.

{
  TRACE;
  Q_UNUSED(tag);
  Q_UNUSED(attributes);
  Q_UNUSED(context);
  switch (memberID) {
  case 0: init(content.toInt(), ny()); return true;
  case 1: init(nx(), content.toInt()); return true;
  default: return false;
  }
}
virtual const QString& QGpCoreTools::IrregularGrid2D::xml_tagName ( ) const [inline, virtual]

This function must be re-implemented in all classes dealing with binary data that cannot be saved in an ASCII xml file (e.g. due to the amount of data).

The way binary data is stored drastically changed in November 2006 with the introduction of tar.gz structures for xml files. Each class willing to store binary data can automatically generate a new file (with an automatic file name) in the .tar.gz structure by sending bytes to s.

See also xml_setBinaryData().

For the arguments of this function use Macro XML_WRITEBINARYDATA_ARGS.

Reimplemented from QGpCoreTools::XMLClass.

References nx(), ny(), and TRACE.

{
  TRACE;
  Q_UNUSED(context);
  s << nx();
  s << ny();
  s.writeRawData((const char *)_d->xPointer(), sizeof(double)* nx());
  s.writeRawData((const char *)_d->yPointer(), sizeof(double)* ny());
  s.writeRawData((const char *)_d->valuePointer(0,0), sizeof(double)* nx() * ny());
}
QVector<double> QGpCoreTools::IrregularGrid2D::y ( ) const [inline]
double QGpCoreTools::IrregularGrid2D::y ( int  iy) const [inline]
{return _d->y(iy);}

Member Data Documentation

const QString QGpCoreTools::IrregularGrid2D::xmlIrregularGrid2DTag = "IrregularGrid2D" [static]

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