Storage for modal computation. More...
#include <ModalStorage.h>
Classes | |
class | Iterator |
Public Member Functions | |
void | abs () |
Curve< Point2D > | curve (int iMode) const |
void | exp10 () |
ModalRefine & | lastRefine () |
void | log10 () |
ModalStorage () | |
ModalStorage (int nModes, const QVector< double > *x) | |
RealValue * | mode (int index) |
const RealValue * | mode (int index) const |
int | modeCount () const |
ModalStorage & | operator= (const ModalStorage &o) |
ModalRefine & | refineAdd (double x) |
RefineIterator | refineBegin () const |
void | refineClear () |
int | refineCount () const |
RefineIterator | refineEnd () const |
void | refineSort () |
void | set (int nModes, const QVector< double > *x) |
void | toStream (QTextStream &s, int modeIndex=-1) const |
void | writeReport (QDataStream &s) const |
const QVector< double > * | x () const |
double | x (int ix) const |
int | xCount () const |
~ModalStorage () |
Storage for modal computation.
Storage for modal computation such as dispersion curve, ellipticity or spac
Init a empty storage. Use set() before using this object.
References TRACE.
Referenced by QGpCoreWave::Dispersion::deltaK().
{ TRACE; _nModes=0; _nX=0; _values=0; _x=0; }
QGpCoreWave::ModalStorage::ModalStorage | ( | int | nModes, |
const QVector< double > * | x | ||
) | [inline] |
Init storage with nModes and with the list of x o (not owned by this object)
{set(nModes, x);}
QGpCoreWave::ModalStorage::~ModalStorage | ( | ) | [inline] |
Delete stored values but not the list of x provided in constructor's arguments
{delete [] _values;}
void QGpCoreWave::ModalStorage::abs | ( | ) |
Transforms all values into their absolute value
References QGpCoreTools::RealValue::abs().
Referenced by QGpCoreWave::DispersionFactory::calculate(), EllipticityReader::parse(), and QGpCoreWave::EllipticityFactory::peakMisfit().
{ int nValues=_nModes * _nX; for(int i=0; i<nValues;i++) { _values[i].abs(); } for(RefineList::iterator it=_refines.begin(); it!=_refines.end(); it++) { for(int i=0; i<_nModes; i++) { it->setValue(i, fabs(it->value(i).value())); } } }
Curve< Point2D > QGpCoreWave::ModalStorage::curve | ( | int | iMode | ) | const |
Return a curve for mode iMode, mixing refines and original samples, removing invalid values
References QGpCoreTools::Curve< pointType >::append(), QGpCoreWave::ModalStorage::Iterator::atEnd(), QGpCoreTools::Value< numberType >::isValid(), and QGpCoreTools::Value< numberType >::value().
void QGpCoreWave::ModalStorage::exp10 | ( | ) |
Transforms all values into their exp10
References QGpCoreTools::RealValue::exp10().
{ int nValues=_nModes * _nX; for(int i=0; i<nValues;i++) { _values[i].exp10(); } for(RefineList::iterator it=_refines.begin(); it!=_refines.end(); it++) { for(int i=0; i<_nModes; i++) { it->setValue(i, ::pow(10.0, it->value(i).value())); } } }
ModalRefine& QGpCoreWave::ModalStorage::lastRefine | ( | ) | [inline] |
{return _refines.last();}
void QGpCoreWave::ModalStorage::log10 | ( | ) |
Transforms all values into their log10.
References QGpCoreTools::RealValue::log10().
RealValue* QGpCoreWave::ModalStorage::mode | ( | int | index | ) | [inline] |
Referenced by QGpCoreWave::AutocorrFactory::calculateHorizontal(), QGpCoreWave::AutocorrFactory::calculateVertical(), QGpCoreWave::Dispersion::deltaK(), dispersion_curve_love_(), dispersion_curve_rayleigh_(), QGpCoreWave::ModalStorage::Iterator::Iterator(), QGpCoreWave::EllipticityFactory::mode(), QGpCoreWave::DispersionFactory::mode(), QGpCoreWave::AutocorrFactory::mode(), QGpCoreWave::Ellipticity::peakMisfit(), QGpCoreWave::Ellipticity::peaks(), Spac3CForward::radial(), QGpCoreWave::Dispersion::refine(), QGpCoreWave::Dispersion::setGroupSlowness(), Spac3CForward::setModel(), Spac3CForward::transverse(), and Spac3CForward::vertical().
{return _values+index*_nX;}
const RealValue* QGpCoreWave::ModalStorage::mode | ( | int | index | ) | const [inline] |
{return _values+index*_nX;}
int QGpCoreWave::ModalStorage::modeCount | ( | ) | const [inline] |
ModalStorage & QGpCoreWave::ModalStorage::operator= | ( | const ModalStorage & | o | ) |
ModalRefine& QGpCoreWave::ModalStorage::refineAdd | ( | double | x | ) | [inline] |
References QGpCoreWave::ModalRefine::setValid().
Referenced by QGpCoreWave::Dispersion::refine().
{ _refines.append(ModalRefine(_nModes, x)); _refines.last().setValid(false); return _refines.last(); }
RefineIterator QGpCoreWave::ModalStorage::refineBegin | ( | ) | const [inline] |
Referenced by QGpCoreWave::ModalStorage::Iterator::Iterator().
{return _refines.begin();}
void QGpCoreWave::ModalStorage::refineClear | ( | ) | [inline] |
{_refines.clear();}
int QGpCoreWave::ModalStorage::refineCount | ( | ) | const [inline] |
{return _refines.count();}
RefineIterator QGpCoreWave::ModalStorage::refineEnd | ( | ) | const [inline] |
Referenced by QGpCoreWave::ModalStorage::Iterator::Iterator().
{return _refines.end();}
void QGpCoreWave::ModalStorage::refineSort | ( | ) | [inline] |
Referenced by QGpCoreWave::Ellipticity::peakMisfit().
{qSort(_refines);}
void QGpCoreWave::ModalStorage::set | ( | int | nModes, |
const QVector< double > * | x | ||
) |
void QGpCoreWave::ModalStorage::toStream | ( | QTextStream & | s, |
int | modeIndex = -1 |
||
) | const |
Output to stream s, mixing refines and original samples, removing invalid values. If modeIndex is negative, all modes are ouput.
References QGpCoreWave::ModalStorage::Iterator::atEnd(), QGpCoreTools::Value< numberType >::isValid(), TRACE, and QGpCoreTools::Value< numberType >::value().
Referenced by EllipticityReader::parse(), DispersionReader::parse(), and SpacReader::parse().
{ TRACE; static const QString fmt("%1 %2\n"); double xFactor=0.5/M_PI; for (int im=0; im<_nModes; im++) { if(modeIndex<0 || im==modeIndex) { s << "# Mode " << im << "\n"; for (Iterator it(this, im); !it.atEnd(); ++it) { const RealValue& val=it.value(); if (val.isValid()) s << fmt.arg(it.x()*xFactor, 0, 'g', 15).arg(val.value(), 0, 'g', 15); } } } }
void QGpCoreWave::ModalStorage::writeReport | ( | QDataStream & | s | ) | const |
Save all to report (including frequency), mixing refines and original samples, removing invalid values
Begin with a table of the number of samples per mode
4 nm Modes For each mode: 4 number of samples for this mode mode, nx[im] nx[im]*2*8 values x,y
References QGpCoreWave::ModalStorage::Iterator::atEnd(), QGpCoreTools::Value< numberType >::isValid(), TRACE, and QGpCoreTools::Value< numberType >::value().
{ TRACE; double xFactor=0.5/M_PI; s << _nModes; for(int im=0; im < _nModes;im++ ) { // room for sample per mode table int xCountReal=0; qint64 nSamplesPos=s.device() ->pos(); s << xCountReal; for(Iterator it(this, im); !it.atEnd(); ++it) { const RealValue & val=it.value(); if(val.isValid()) { s << it.x() * xFactor << val.value(); xCountReal++; } } // Write the real number of x at the beginning qint64 curPos=s.device() ->pos(); s.device() ->seek(nSamplesPos); s << xCountReal; s.device() ->seek(curPos); } }
const QVector<double>* QGpCoreWave::ModalStorage::x | ( | ) | const [inline] |
double QGpCoreWave::ModalStorage::x | ( | int | ix | ) | const [inline] |
{return _x->at(ix);}
int QGpCoreWave::ModalStorage::xCount | ( | ) | const [inline] |
Referenced by QGpCoreWave::Dispersion::deltaK(), DinverDCCore::TargetList::dispersionSampleCount(), QGpCoreWave::ModalStorage::Iterator::operator++(), QGpCoreWave::Ellipticity::peakMisfit(), QGpCoreWave::Ellipticity::peaks(), QGpCoreWave::Dispersion::refine(), and QGpCoreWave::Dispersion::setGroupSlowness().
{return _nX;}