本文整理汇总了C++中CurveData类的典型用法代码示例。如果您正苦于以下问题:C++ CurveData类的具体用法?C++ CurveData怎么用?C++ CurveData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CurveData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateCurve
void OscilloscopePlot::updateCurve()
{
CurveData *data = static_cast<CurveData *>( d_curve->data() );
data->values().lock();
const int numPoints = data->size();
if ( numPoints > d_paintedPoints )
{
const bool doClip = !canvas()->testAttribute( Qt::WA_PaintOnScreen );
if ( doClip )
{
/*
Depending on the platform setting a clip might be an important
performance issue. F.e. for Qt Embedded this reduces the
part of the backing store that has to be copied out - maybe
to an unaccelerated frame buffer device.
*/
const QwtScaleMap xMap = canvasMap( d_curve->xAxis() );
const QwtScaleMap yMap = canvasMap( d_curve->yAxis() );
QRectF br = qwtBoundingRect( *data,
d_paintedPoints - 1, numPoints - 1 );
const QRect clipRect = QwtScaleMap::transform( xMap, yMap, br ).toRect();
d_directPainter->setClipRegion( clipRect );
}
d_directPainter->drawSeries( d_curve,
d_paintedPoints - 1, numPoints - 1 );
d_paintedPoints = numPoints;
}
data->values().unlock();
}
示例2:
boost::shared_ptr<BlackCapFloorEngine> MustCapFloor::setEngineQuantLibBalckFT(){
CurveData cData;
// Fill out with some sample market data
cData.sampleMktData(cData);
// Build a curve linked to this market data
boost::shared_ptr<YieldTermStructure> ocurve = (cData.buildCurve(cData));
// Link the curve to the term structure
this->forwardingTermStructure.linkTo(ocurve);
//Date today(6, October, 2014);
Settings::instance().evaluationDate() = today;
//Date todaysDate = Date(8, Apr, 2015);
//capletsVolatilies = buildCurveOptionletAtmVol(cVol);
//capletsVolatilies = buildOptionletSurfaceVol(cVol);
//capletsVolatilies = buildOptionletCurveVol(cVol);
cVol.termStructure.linkTo(ocurve);
capletsVolatilies = (cVol.buildFlatCurveVol(cVol));
//capVol->enableExtrapolation();
return boost::shared_ptr<BlackCapFloorEngine>(new
BlackCapFloorEngine(forwardingTermStructure, capletsVolatilies));
}
示例3: appendPoint
void IncrementalPlot::appendPoint( const QPointF &point )
{
CurveData *data = static_cast<CurveData *>( d_curve->data() );
data->append( point );
const bool doClip = !canvas()->testAttribute( Qt::WA_PaintOnScreen );
// if ( doClip )
// {
// /*
// Depending on the platform setting a clip might be an important
// performance issue. F.e. for Qt Embedded this reduces the
// part of the backing store that has to be copied out - maybe
// to an unaccelerated frame buffer device.
// */
// const QwtScaleMap xMap = canvasMap( d_curve->xAxis() );
// const QwtScaleMap yMap = canvasMap( d_curve->yAxis() );
// QRegion clipRegion;
// const QSize symbolSize = d_curve->symbol()->size();
// QRect r( 0, 0, symbolSize.width() + 2, symbolSize.height() + 2 );
// const QPointF center =
// QwtScaleMap::transform( xMap, yMap, point );
// r.moveCenter( center.toPoint() );
// clipRegion += r;
// d_directPainter->setClipRegion( clipRegion );
// }
d_directPainter->drawSeries( d_curve,
data->size() - 1, data->size() - 1 );
}
示例4: clearPoints
void BrainPlot::clearPoints(int Channel)
{
CurveData *data = static_cast<CurveData *>( d_curves[Channel]->data() );
data->clear();
replot();
}
示例5: clearPoints
void IncrementalPlot::clearPoints()
{
CurveData *data = static_cast<CurveData *>( d_curve->data() );
data->clear();
replot();
}
示例6: QwtInterval
void OscilloscopePlot::incrementInterval()
{
d_interval = QwtInterval( d_interval.maxValue(),
d_interval.maxValue() + d_interval.width() );
CurveData *data = static_cast<CurveData *>( d_curve->data() );
data->values().clearStaleValues( d_interval.minValue() );
// To avoid, that the grid is jumping, we disable
// the autocalculation of the ticks and shift them
// manually instead.
QwtScaleDiv scaleDiv = axisScaleDiv( QwtPlot::xBottom );
scaleDiv.setInterval( d_interval );
for ( int i = 0; i < QwtScaleDiv::NTickTypes; i++ )
{
QList<double> ticks = scaleDiv.ticks( i );
for ( int j = 0; j < ticks.size(); j++ )
ticks[j] += d_interval.width();
scaleDiv.setTicks( i, ticks );
}
setAxisScaleDiv( QwtPlot::xBottom, scaleDiv );
d_origin->setValue( d_interval.minValue() + d_interval.width() / 2.0, 0.0 );
d_paintedPoints = 0;
replot();
}
示例7:
void Wykres2d::wyczysc()
{
CurveData *data = static_cast<CurveData *> (plot2dCurve->data());
data->clear();
punkty.clear();
plot2d->replot();
}
示例8:
// -------------------------------------------------------------------------- //
//
void Test_CurveData::testGetChi2New()
{
CurveData cd;
const double chi2_new = 1.1246722311651241;
cd.chi2_new_ = chi2_new;
CPPUNIT_ASSERT_DOUBLES_EQUAL( cd.get_chi2_new(), chi2_new, 1.0e-12 );
}
示例9: replot
void Plot::replot()
{
CurveData *data = (CurveData *)d_curve->data();
data->values().lock();
QwtPlot::replot();
d_paintedPoints = data->size();
data->values().unlock();
}
示例10: replot
void OscilloscopePlot::replot()
{
CurveData *data = static_cast<CurveData *>( d_curve->data() );
data->values().lock();
QwtPlot::replot();
d_paintedPoints = data->size();
data->values().unlock();
}
示例11: appendPoint
void BrainPlot::appendPoint( QPointF point, int Channel )
{
/*Adds new point - with proper index and offset - to the data series*/
CurveData *data = static_cast<CurveData *>( d_curves[Channel]->data() );
point.setY(minusExpectedAmplitude*(2*Channel+1)+point.y());
data->replace(sample%plotLength, point);
setClipRegion(d_curves[Channel], point);
d_directPainter->drawSeries( d_curves[Channel],
data->size() - 1, data->size() - 1 );
}
示例12: updateCurve
void Plot::updateCurve()
{
CurveData *data = (CurveData *)d_curve->data();
data->values().lock();
const int numPoints = d_curve->data()->size();
if ( numPoints > d_paintedPoints )
{
d_directPainter->drawSeries(d_curve,
d_paintedPoints - 1, numPoints - 1);
d_paintedPoints = numPoints;
}
data->values().unlock();
}
示例13: LiborForwardModelProcess
boost::shared_ptr<AnalyticCapFloorEngine> MustCapFloor::setEngineQuantLibLMM(){
CurveData cData;
// Fill out with some sample market data
cData.sampleMktData(cData);
//Date today(10, October, 2014);
//Settings::instance().evaluationDate() = today;
// Build a curve linked to this market data
boost::shared_ptr<YieldTermStructure> ocurve = (cData.buildCurve(cData));
// Link the curve to the term structure
boost::shared_ptr<IborIndex> index = boost::shared_ptr<IborIndex>(new Euribor6M(forwardingTermStructure));
Date todaysDate =
myIndex->fixingCalendar().adjust(today);
Settings::instance().evaluationDate() = todaysDate;
this->forwardingTermStructure.linkTo(ocurve);
const Size size = floatingLeg.size();
boost::shared_ptr<LiborForwardModelProcess> process(
new LiborForwardModelProcess(size, myIndex));
//// set-up the model
///* const Real a = 0.02;
//const Real b = 0.12;
//const Real c = 0.1;
//const Real d = 0.01;*/
const Real a = 0.025;
const Real b = 0.12;
const Real c = 0.1;
const Real d = 0.01;
boost::shared_ptr<LmVolatilityModel> volaModel(
new LmLinearExponentialVolatilityModel(process->fixingTimes(), a, b, c, d));
boost::shared_ptr<LmCorrelationModel> corrModel(
new LmLinearExponentialCorrelationModel(size, 0.1, 0.1));
boost::shared_ptr<LiborForwardModel> liborModel(
new LiborForwardModel(process, volaModel, corrModel));
return boost::shared_ptr<AnalyticCapFloorEngine> (
new AnalyticCapFloorEngine(liborModel, forwardingTermStructure));
}
示例14: while
void StringToCurve::UpdateCurve()
{
// Remove any existing curves
while ( !m_OutCurveList->getCurveList().empty() ) {
delete m_OutCurveList->getCurveList().back();
m_OutCurveList->getCurveList().pop_back();
}
std::string dataString = f_CurveString->getStringValue();
dataString.append( f_CurveSeparator->getStringValue() );
std::string indexString = f_IndexString->getStringValue();
std::vector< float > indexValues;
if (indexString.length() != 0 ){
StringToVector(indexString, indexValues );
}
if ( dataString.length() > 0 ){
// Split string into curves
std::vector<std::string> curves;
boost::split(curves, dataString, boost::is_any_of(f_CurveSeparator->getStringValue() ));
// Iterate over curves
std::vector<std::string>::iterator stringIt = curves.begin();
for (;stringIt < curves.end(); ++stringIt ){
std::string curCurve = *stringIt;
if (curCurve.length() == 0) {continue;}
// Remove leading and trailing spaces
boost::trim( curCurve );
std::vector< MLfloat > curveValues;
StringToVector( curCurve, curveValues );
CurveData *outputCurve = new CurveData;
outputCurve->setY( curveValues.size(),&curveValues[0], 1 );
if ( f_IndexString->getStringValue().length() != 0 ){
outputCurve->setX( indexValues.size(),&indexValues[0], 1 );
}
m_OutCurveList->getCurveList().push_back( outputCurve );
}
}
}
示例15: qDebug
void Plot::appendPoint1(double u)
{
double elapsed = d_clock.elapsed() / 1000.0;
qDebug() << "d_clock1: " << elapsed;
qDebug() << "udouble1: " << u;
QPointF point(elapsed,(u*5/1024));
CurveData *data = static_cast<CurveData *>( d_curve1->data() );
data->append(point);
RecToFile1(elapsed,u);
const int numPoints = data->size();
if ( numPoints > d_paintedPoints1 )
{
const bool doClip = !canvas()->testAttribute( Qt::WA_PaintOnScreen );
if ( doClip )
{
/*
Depending on the platform setting a clip might be an important
performance issue. F.e. for Qt Embedded this reduces the
part of the backing store that has to be copied out - maybe
to an unaccelerated frame buffer device.
*/
const QwtScaleMap xMap = canvasMap( d_curve1->xAxis() );
const QwtScaleMap yMap = canvasMap( d_curve1->yAxis() );
QRectF br = qwtBoundingRect( *data,
d_paintedPoints1 - 1, numPoints - 1 );
const QRect clipRect = QwtScaleMap::transform( xMap, yMap, br ).toRect();
d_directPainter0->setClipRegion( clipRect );
}
d_directPainter0->drawSeries(d_curve1,
d_paintedPoints1 - 1, numPoints - 1);
d_paintedPoints1 = numPoints;
}
}