(unknown)
2010-03-01 12:43:30 GMT
Hello,
I wonder whether it is possible to get the actual min and max range values of spectrogram and not to set them manually, like I do it now (see the code below). I mean, after the data for spectrogram was calculated, then the max and min values should be known, right? How to get them then? I don't want to set the range manually, but it should be done according to the current data. Help me please.
best regards,
Vitali
[CODE]typedef double (*benchFunc)(vector<double>); // definition of function pointer for benchmark function
// this class creates the data of objective function
class SpectrogramData: public QwtRasterData
{
public:
SpectrogramData(benchFunc b, double rang1[2], double rang2[2], int dims[2], vector<double> fix_vec , unsigned dimens, QwtDoubleInterval interval ):
QwtRasterData(QwtDoubleRect(rang1[0], rang2[0], rang1[1]- rang1[0], rang2[1]- rang2[0]))
{
MybenchFunc = b;
valuesRange = interval; //<<<<<<<<<< here it is set manually
dim_ind[0] = dims[0]; dim_ind[1] = dims[1];
dimensions = dimens;
fix_vals = fix_vec;
}
virtual QwtRasterData *copy() const
{
return new SpectrogramData(*this);
}
virtual QwtDoubleInterval range() const //<<<<<<<<<<< here the range will be returned
{
return valuesRange;
}
virtual double value(double x, double y) const
{
vector<double> coords;
coords = vector<double>(dimensions, 0); // create a vector of size "dimensions" containing zeros
if(dimensions > 2){ // if the benchmark function has more dimensions than 2, then...
for(unsigned i=0 ; i < dimensions ; ++i){
coords[i] = fix_vals[i]; // ... copy first all fixed values into vector and then...
}
coords[dim_ind[0]] = x; // replace the values of dimensions to be visualized
coords[dim_ind[1]] = y;
}
else{
coords[dim_ind[0]] = x;
coords[dim_ind[1]] = y;
}
const double result = MybenchFunc( coords);
return result;
}
private:
benchFunc MybenchFunc; // function pointer for benchmark function
QwtDoubleInterval valuesRange;
int dim_ind[2];
unsigned dimensions;
vector<double> fix_vals;
};[/CODE]
| GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT! Jetzt freischalten unter http://movieflat.web.de |
------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
_______________________________________________ qwt-interest mailing list qwt-interest <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qwt-interest
RSS Feed