Brief description of class still missing. More...
#include <AutocorrCurves.h>
Public Member Functions | |
void | add (const AutocorrCurves &curves) |
void | addCurve (const ModalCurve &c) |
void | addRing () |
void | addRing (const AutocorrRing &r) |
const QList< ModalCurve > & | curves () const |
QList< ModalCurve > & | curves () |
ModalCurve | dispersionCurve (int index, double kmin, double kmax, int maxSolutionCount) const |
int | indexOf (const AutocorrRing &r) const |
bool | isEmpty () const |
ModalCurve & | lastCurve () |
void | removeRing (int index) |
const AutocorrRing & | ring (int index) const |
AutocorrRing & | ring (int index) |
int | ringCount () const |
QList< ModalCurve > | ringCurves (int index) const |
const QVector< AutocorrRing > * | rings () const |
void | sort () |
virtual const QString & | xml_tagName () const |
Static Public Attributes | |
static const QString | xmlAutocorrCurvesTag = "AutocorrCurves" |
Protected Member Functions | |
XMLMember | xml_member (XML_MEMBER_ARGS) |
void | xml_writeChildren (XML_WRITECHILDREN_ARGS) const |
Brief description of class still missing.
Full description of class still missing
void QGpCoreWave::AutocorrCurves::add | ( | const AutocorrCurves & | curves | ) |
Adds all curves and rings from c into this object. Common rings are smartly merged
References addRing(), QGpCoreTools::endl(), indexOf(), QGpCoreWave::ModalCurve::modes(), QGpCoreWave::ModalCurve::name(), ringCount(), QGpCoreTools::tr(), and TRACE.
Referenced by main().
{ TRACE; for(QList<ModalCurve>::ConstIterator it=curves._curves.begin(); it!=curves._curves.end(); it++ ) { const ModalCurve& c=*it; int iCurvesRing=c.modes().first().ringIndex(); if(iCurvesRing >= curves._rings.count()) { App::stream() << tr("Bad ring index for curve %1: %2 while max is %3").arg(c.name()).arg(iCurvesRing).arg(curves._rings.count()-1) << endl; } else { const AutocorrRing& r=curves._rings.at(iCurvesRing); int iRing=indexOf(r); if(iRing==-1) { iRing=ringCount(); addRing(r); } _curves.append(c); QList<Mode>& modes=_curves.last().modes(); for(QList<Mode>::Iterator it=modes.begin(); it!=modes.end(); it++ ) { it->setRingIndex(iRing); } } } }
void QGpCoreWave::AutocorrCurves::addCurve | ( | const ModalCurve & | c | ) |
Adds a new curve. Make sure ring index fits with the number of rings. At least one ring must be available.
References QGpCoreTools::endl(), QGpCoreWave::ModalCurve::name(), QGpCoreTools::tr(), TRACE, and QGpCoreWave::Mode::Vertical.
Referenced by AutocorrTargetWidget::curves(), and SpacSelector::selectSamples().
{ TRACE; ASSERT(_rings.count()>0); _curves.append(c); QList<Mode>& modes=_curves.last().modes(); int iRing; if(modes.isEmpty()) { _curves.last().addMode(Mode( Mode::Vertical, 0, 0) ); iRing=0; } else { iRing=modes.first().ringIndex(); if(iRing < 0 || iRing >= _rings.count()) { App::stream() << tr("Bad ring index for curve %1: %2 while max is %3").arg(c.name()).arg(iRing).arg(_rings.count()-1) << endl; } for(QList<Mode>::Iterator it=modes.begin(); it!=modes.end(); it++ ) { it->setRingIndex(iRing); } } }
void QGpCoreWave::AutocorrCurves::addRing | ( | ) | [inline] |
References addRing().
Referenced by add(), addRing(), AutocorrTargetWidget::curves(), SpacSelector::selectSamples(), and xml_member().
{addRing(AutocorrRing());}
void QGpCoreWave::AutocorrCurves::addRing | ( | const AutocorrRing & | r | ) |
const QList<ModalCurve>& QGpCoreWave::AutocorrCurves::curves | ( | ) | const [inline] |
Referenced by SpacSelector::createObjects(), AutocorrTargetWidget::curves(), SpacSelector::inverse(), SpacSelector::inverseAt(), main(), SPACLoopTask::run(), SpacSelector::selectSamples(), Spac3CForward::setCurves(), DinverDCCore::TargetList::surfaceMisfit(), DinverDCCore::TargetList::validateTargets(), and xml_writeChildren().
{return _curves;}
QList<ModalCurve>& QGpCoreWave::AutocorrCurves::curves | ( | ) | [inline] |
{return _curves;}
ModalCurve QGpCoreWave::AutocorrCurves::dispersionCurve | ( | int | index, |
double | kmin, | ||
double | kmax, | ||
int | maxSolutionCount | ||
) | const |
Calculate the dispersion curve corresponding to curve index. The solutions are searched between kmin and kmax. The returned curve may contain various values for the same frequency.
References QGpCoreWave::ModalCurve::addMode(), QGpCoreTools::Curve< pointType >::append(), QGpCoreTools::Curve< pointType >::at(), QGpCoreTools::Curve< pointType >::count(), QGpCoreWave::AutocorrDispersion::dispersion(), QGpCoreTools::StatisticalValue< numberType >::isValid(), QGpCoreWave::ModalCurve::modes(), QGpCoreWave::Mode::Phase, QGpCoreWave::Mode::Rayleigh, QGpCoreWave::AutocorrDispersion::setRing(), and QGpCoreTools::StatisticalPoint< numberType >::x().
Referenced by main().
{ const ModalCurve& autocorr=_curves.at(index); int nx=autocorr.count(); ModalCurve dispersion; AutocorrDispersion eng; eng.setRing(_rings.at(autocorr.modes().first().ringIndex()) ); for(int ix=0; ix<nx; ix++ ) { const FactoryPoint& p=autocorr.at(ix); if(p.isValid()) { QVector<double> solutions=eng.dispersion(p, kmin, kmax); for(int i=0; i<solutions.count() && i<maxSolutionCount; i++) { dispersion.append(FactoryPoint( p.x(), solutions.at(i))); } } } dispersion.addMode(Mode( Mode::Phase, Mode::Rayleigh, 0) ); return dispersion; }
int QGpCoreWave::AutocorrCurves::indexOf | ( | const AutocorrRing & | r | ) | const [inline] |
Referenced by add().
{return _rings.indexOf(r);}
bool QGpCoreWave::AutocorrCurves::isEmpty | ( | ) | const [inline] |
Referenced by DinverDCCore::TargetList::isEmpty(), main(), TargetListWidget::setFrom(), DinverDCGui::AutocorrViewer::setTarget(), DinverDCCore::TargetList::surfaceMisfit(), and DinverDCCore::TargetList::validateTargets().
{return _curves.isEmpty();}
ModalCurve& QGpCoreWave::AutocorrCurves::lastCurve | ( | ) | [inline] |
References QGpCoreTools::Curve< pointType >::last().
{return _curves.last();}
void QGpCoreWave::AutocorrCurves::removeRing | ( | int | index | ) |
const AutocorrRing& QGpCoreWave::AutocorrCurves::ring | ( | int | index | ) | const [inline] |
Referenced by AutocorrTargetWidget::addCurves(), SpacSelector::createObjects(), SpacSelector::inverse(), SpacSelector::inverseAt(), main(), SpacSelector::radiusScroll_valueChanged(), SpacSelector::selectSamples(), and DinverDCGui::AutocorrViewer::setTarget().
{return _rings[index];}
AutocorrRing& QGpCoreWave::AutocorrCurves::ring | ( | int | index | ) | [inline] |
{return _rings[index];}
int QGpCoreWave::AutocorrCurves::ringCount | ( | ) | const [inline] |
Referenced by add(), AutocorrTargetWidget::addCurves(), DinverDCGui::AutocorrViewer::setTarget(), and DinverDCCore::TargetList::validateTargets().
{return _rings.count();}
QList< ModalCurve > QGpCoreWave::AutocorrCurves::ringCurves | ( | int | index | ) | const |
References QGpCoreTools::Curve< pointType >::append(), and QGpCoreWave::ModalCurve::modes().
Referenced by AutocorrTargetWidget::addCurves(), SpacSelector::createObjects(), SpacSelector::inverse(), SpacSelector::inverseAt(), SpacSelector::selectSamples(), DinverDCGui::AutocorrViewer::setTarget(), DinverDCCore::TargetList::validateTargets(), and xml_writeChildren().
{ QList<ModalCurve> l; for(QList<ModalCurve>::ConstIterator it=_curves.begin(); it!=_curves.end(); it++ ) { const ModalCurve& c=*it; if(c.modes().first().ringIndex()==index) { l.append(c); } } return l; }
const QVector<AutocorrRing>* QGpCoreWave::AutocorrCurves::rings | ( | ) | const [inline] |
void QGpCoreWave::AutocorrCurves::sort | ( | ) |
Referenced by DinverDCCore::AutocorrTarget::setCurves().
{
for(QList<ModalCurve>::Iterator it=_curves.begin(); it!=_curves.end(); it++ ) {
it->sort();
}
}
XMLMember QGpCoreWave::AutocorrCurves::xml_member | ( | XML_MEMBER_ARGS | ) | [protected, virtual] |
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:
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 addRing(), QGpCoreTools::endl(), QGpCoreTools::tr(), and TRACE.
{ TRACE; Q_UNUSED(context); if(tag=="ModalCurve" ) { static const QString typeAtt("type"); XMLRestoreAttributeIterator it=attributes.find(typeAtt); if(it!=attributes.end()) { if(it.value()=="autocorr") { _curves.append(ModalCurve()); return XMLMember(&_curves.last()); } else { App::stream() << tr("Wrong type of modal curve %1").arg(it.value().toString()) << endl; return XMLMember(XMLMember::Unknown); } } else { App::stream() << tr("No type defined for modal curve") << endl; return XMLMember(XMLMember::Unknown); } } else if(tag=="AutocorrRing") { addRing(); return XMLMember(&_rings.last()); } else return XMLMember(XMLMember::Unknown); }
virtual const QString& QGpCoreWave::AutocorrCurves::xml_tagName | ( | ) | const [inline, virtual] |
Implements QGpCoreTools::XMLClass.
{return xmlAutocorrCurvesTag;}
void QGpCoreWave::AutocorrCurves::xml_writeChildren | ( | XML_WRITECHILDREN_ARGS | ) | const [protected, virtual] |
Reimplemented from QGpCoreTools::XMLClass.
References QGpCoreTools::XMLSaveAttributes::add(), curves(), ringCurves(), and TRACE.
{ TRACE; int nRings=_rings.count(); static const QString key("type"); static const QString value("autocorr"); XMLSaveAttributes att; att.add(key, value); for(int iRing=0;iRing<nRings;iRing++ ) { _rings.at(iRing).xml_save(s, context); QList<ModalCurve> curves=ringCurves(iRing); for(QList<ModalCurve>::Iterator it=curves.begin(); it!=curves.end(); it++ ) { it->xml_save(s, context, att); } } }
const QString QGpCoreWave::AutocorrCurves::xmlAutocorrCurvesTag = "AutocorrCurves" [static] |