这篇教程C++ AMnDIndex类代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AMnDIndex类的典型用法代码示例。如果您正苦于以下问题:C++ AMnDIndex类的具体用法?C++ AMnDIndex怎么用?C++ AMnDIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。 在下文中一共展示了AMnDIndex类的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: setStatevoid AMNormalizationAB::reviewState(){ // Are there data sources? if(sources_.isEmpty()){ setState(AMDataSource::InvalidFlag); return; } // Are all the data sources the same size? AMnDIndex firstSize = sources_.first()->size(); for (int i = 0, size = firstSize.rank(); i < size; i++) foreach (AMDataSource *dataSource, sources_) if(firstSize.at(i) != dataSource->size(i)){ setState(AMDataSource::InvalidFlag); return; } // Validity check on all data sources. bool valid = true; for (int i = 0; i < sources_.size(); i++) valid = valid && sources_.at(i)->isValid(); if (valid) setState(0); else setState(AMDataSource::InvalidFlag);}
开发者ID:acquaman,项目名称:acquaman,代码行数:31,
示例2: AMNumberAMNumber CLSQE65000Detector::reading(const AMnDIndex &indexes) const{ if( (!isConnected()) || (indexes.rank() != 1) || (indexes.i() > 1024) ) return AMNumber(AMNumber::DimensionError); AMReadOnlyPVControl *tmpControl = qobject_cast<AMReadOnlyPVControl*>(spectrumControl_); return tmpControl->readPV()->lastIntegerValues().at(indexes.i());}
开发者ID:Cpppro,项目名称:acquaman,代码行数:7,
示例3: // Connected to be called when the values of the input data source changevoid AM2DDeadTimeAB::onInputSourceValuesChanged(const AMnDIndex& start, const AMnDIndex& end){ if (start.rank() == axes_.size() && end.rank() == axes_.size()) emitValuesChanged(start, end); else emitValuesChanged();}
开发者ID:anukat2015,项目名称:acquaman,代码行数:9,
示例4: onInputSourceValuesChanged// Connected to be called when the values of the input data source changevoid AMDeadTimeAB::onInputSourceValuesChanged(const AMnDIndex& start, const AMnDIndex& end){ if (start.isValid() && end.isValid()) emitValuesChanged(start, end); else emitValuesChanged();}
开发者ID:acquaman,项目名称:acquaman,代码行数:9,
示例5: AMnDIndexAMnDIndex AMDetector::size() const{ AMnDIndex index = AMnDIndex(axes_.size(), AMnDIndex::DoNotInit); for (int i = 0, size = index.rank(); i < size; i++) index[i] = axes_.at(i).size; return index;}
开发者ID:anukat2015,项目名称:acquaman,代码行数:9,
示例6: AMnDIndexvoid AM3DAdditionAB::computeCachedValues() const{ AMnDIndex start = AMnDIndex(); AMnDIndex end = AMnDIndex(); if (dirtyIndices_.isEmpty()){ start = AMnDIndex(rank(), AMnDIndex::DoInit); end = size()-1; } else { start = dirtyIndices_.first(); end = dirtyIndices_.last(); end[rank()-1] = size(rank()-1); } int totalSize = start.totalPointsTo(end); int flatStartIndex = start.flatIndexInArrayOfSize(size()); QVector<double> data = QVector<double>(totalSize); sources_.at(0)->values(start, end, data.data()); // Do the first data source separately to initialize the values. memcpy(cachedData_.data()+flatStartIndex, data.constData(), totalSize*sizeof(double)); cachedData_ = data; // Iterate through the rest of the sources. for (int i = 1, count = sources_.size(); i < count; i++){ sources_.at(i)->values(start, end, data.data()); for (int j = 0; j < totalSize; j++) cachedData_[flatStartIndex+j] += data.at(j); } if (dirtyIndices_.isEmpty()) cachedDataRange_ = AMUtility::rangeFinder(cachedData_); else{ AMRange cachedRange = AMUtility::rangeFinder(cachedData_.mid(flatStartIndex, totalSize)); if (cachedDataRange_.minimum() > cachedRange.minimum()) cachedDataRange_.setMinimum(cachedRange.minimum()); if (cachedDataRange_.maximum() < cachedRange.maximum()) cachedDataRange_.setMaximum(cachedRange.maximum()); } cacheUpdateRequired_ = false; dirtyIndices_.clear();}
开发者ID:acquaman,项目名称:acquaman,代码行数:52,
示例7: AMNumber// Returns the dependent value at a (complete) set of axis indexes. Returns an invalid AMNumber if the indexes are insuffient or any are out of range, or if the data is not ready.AMNumber AM1DExpressionAB::value(const AMnDIndex& indexes) const { if(!isValid()) // will catch most invalid situations: non matching sizes, invalid inputs, invalid expressions. return AMNumber(AMNumber::InvalidError); if(indexes.rank() != 1) return AMNumber(AMNumber::DimensionError);#ifdef AM_ENABLE_BOUNDS_CHECKING if(indexes.i() < 0 || indexes.i() >= size_) return AMNumber(AMNumber::OutOfBoundsError);#endif // can we get it directly? Single-value expressions don't require the parser. if(direct_) { // info on which variable to use is contained in directVar_. if(directVar_.useAxisValue) return sources_.at(directVar_.sourceIndex)->axisValue(0, indexes.i()); else return sources_.at(directVar_.sourceIndex)->value(indexes); } // otherwise we need the parser else { // copy the new input data values into parser storage for(int i=0; i<usedVariables_.count(); i++) { AMParserVariable* usedVar = usedVariables_.at(i); if(usedVar->useAxisValue) usedVar->value = sources_.at(usedVar->sourceIndex)->axisValue(0, indexes.i()); else usedVar->value = sources_.at(usedVar->sourceIndex)->value(indexes); } // evaluate using the parser: double rv; try { rv = parser_.Eval(); } catch(mu::Parser::exception_type& e) { QString explanation = QString("AM1DExpressionAB Analysis Block: error evaluating value: %1: '%2'. We found '%3' at position %4.").arg(QString::fromStdString(e.GetMsg()), QString::fromStdString(e.GetExpr()), QString::fromStdString(e.GetToken())).arg(e.GetPos()); AMErrorMon::report(AMErrorReport(this, AMErrorReport::Debug, e.GetCode(), explanation)); return AMNumber(AMNumber::InvalidError); } if (rv == std::numeric_limits<qreal>::infinity() || rv == -std::numeric_limits<qreal>::infinity() || rv == std::numeric_limits<qreal>::quiet_NaN()) return 0; return rv; }}
开发者ID:Cpppro,项目名称:acquaman,代码行数:51,
示例8: valuesImplementationRecursive// Helper function to implement the base-class version of values() when rank > 4.void AMDataSource::valuesImplementationRecursive(const AMnDIndex &indexStart, const AMnDIndex &indexEnd, AMnDIndex current, int dimension, double **outputValues) const{ if(dimension == current.rank()-1) { // base case: final dimension for(int i=indexStart.at(dimension); i<=indexEnd.at(dimension); ++i) { current[dimension] = i; *((*outputValues)++) = double(value(current)); } } else { for(int i=indexStart.at(dimension); i<indexEnd.at(dimension); ++i) { current[dimension] = i; valuesImplementationRecursive(indexStart, indexEnd, current, dimension+1, outputValues); } }}
开发者ID:anukat2015,项目名称:acquaman,代码行数:16,
示例9: AMNumberAMNumber AMDeadTimeAB::value(const AMnDIndex &indexes) const{ if(indexes.rank() != 1) return AMNumber(AMNumber::DimensionError); if(!isValid()) return AMNumber(AMNumber::InvalidError); if (indexes.i() >= spectra_->size(0)) return AMNumber(AMNumber::OutOfBoundsError); if ((int)spectra_->value(indexes.i()) == 0) return 0; else return double(icr_->value(AMnDIndex()))/double(ocr_->value(AMnDIndex()))*(int)spectra_->value(indexes.i());}
开发者ID:acquaman,项目名称:acquaman,代码行数:16,
示例10: valueAMNumber REIXSXESImageInterpolationAB::value(const AMnDIndex &indexes) const{ if((indexes.rank() != 1)) return AMNumber(AMNumber::DimensionError); if(!isValid()) return AMNumber(AMNumber::InvalidError); if(((unsigned long)indexes.i() >= (unsigned long)axes_.at(0).size)) return AMNumber(AMNumber::OutOfBoundsError); if(cacheUpdateRequired_) computeCachedValues(); return AMNumber(cachedData_.at(indexes.i()));}
开发者ID:acquaman,项目名称:acquaman,代码行数:16,
示例11: AMNumberAMNumber AM1DInterpolationAB::value(const AMnDIndex& indexes) const{ if(indexes.rank() != 1) return AMNumber(AMNumber::DimensionError); if(!isValid()) return AMNumber(AMNumber::InvalidError);#ifdef AM_ENABLE_BOUNDS_CHECKING if((unsigned)indexes.i() >= (unsigned)axes_.at(0).size) return AMNumber(AMNumber::OutOfBoundsError);#endif int index = indexes.i(); return inputSource_->value(index);}
开发者ID:Cpppro,项目名称:acquaman,代码行数:16,
示例12: bool AM1DInterpolationAB::values(const AMnDIndex &indexStart, const AMnDIndex &indexEnd, double *outputValues) const{ if(indexStart.rank() != 1 || indexEnd.rank() != 1) return false; if(!isValid()) return false;#ifdef AM_ENABLE_BOUNDS_CHECKING if((unsigned)indexEnd.i() >= (unsigned)axes_.at(0).size || (unsigned)indexStart.i() > (unsigned)indexEnd.i()) return false;#endif inputSource_->values(indexStart, indexEnd, outputValues); return true;}
开发者ID:Cpppro,项目名称:acquaman,代码行数:16,
示例13: valueAMNumber AMNormalizationAB::value(const AMnDIndex &indexes) const{ if(indexes.rank() != rank()) return AMNumber(AMNumber::DimensionError); if(!isValid()) return AMNumber(AMNumber::InvalidError); for (int i = 0, size = indexes.rank(); i < size; i++) if((unsigned)indexes.at(i) >= (unsigned)axes_.at(i).size) return AMNumber(AMNumber::OutOfBoundsError); if (cacheUpdateRequired_) computeCachedValues(); return cachedData_.at(indexes.flatIndexInArrayOfSize(size()));}
开发者ID:acquaman,项目名称:acquaman,代码行数:17,
示例14: AMNumberAMNumber AM2DDeadTimeCorrectionAB::value(const AMnDIndex &indexes) const{ if(indexes.rank() != 2) return AMNumber(AMNumber::DimensionError); if(!isValid()) return AMNumber(AMNumber::InvalidError); if (indexes.i() >= spectra_->size(0) || indexes.j() >= spectra_->size(1)) return AMNumber(AMNumber::OutOfBoundsError); if ((int)spectra_->value(indexes) == 0 || double(ocr_->value(indexes)) == 0) return 0; else return double(icr_->value(indexes))/double(ocr_->value(indexes))*(int)spectra_->value(indexes);}
开发者ID:acquaman,项目名称:acquaman,代码行数:17,
示例15: readingAMNumber AMMockDetector::reading(const AMnDIndex &indexes) const{ // We want an "invalid" AMnDIndex for this 0D detector if (indexes.isValid()) { return AMNumber(AMNumber::DimensionError); } return generateRandomNumber();}
开发者ID:acquaman,项目名称:acquaman,代码行数:9,
示例16: valueAMNumber AMnDDeadTimeAB::value(const AMnDIndex &indexes) const{ if(indexes.rank() != rank()) return AMNumber(AMNumber::DimensionError); if(!isValid()) return AMNumber(AMNumber::InvalidError);#ifdef AM_ENABLE_BOUNDS_CHECKING for (int i = 0, size = axes_.size(); i < size; i++) if (indexes.at(i) >= axes_.at(i).size) return AMNumber(AMNumber::OutOfBoundsError);#endif if ((int)spectrum_->value(indexes) == 0 || double(outputCounts_->value(indexes.i())) == 0) return 0; else return double(inputCounts_->value(indexes.i()))/double(outputCounts_->value(indexes.i()))*(int)spectrum_->value(indexes);}
开发者ID:anukat2015,项目名称:acquaman,代码行数:19,
示例17: copyAxisValuesvoid AMExternalScanDataSourceAB::copyAxisValues(int dataSourceIndex){ AMDataSource* ds = scan_->dataSourceAt(dataSourceIndex); const AMnDIndex size = ds->size(); axisValues_.clear(); for(int mu=0; mu<size.rank(); mu++) { // for each axis QVector<AMNumber> av; if(!axes_.at(mu).isUniform) { int axisLength = size.at(mu); for(int i=0; i<axisLength; i++) // copy all the axis values av << axisValue(mu, i); } axisValues_ << av; }}
开发者ID:Cpppro,项目名称:acquaman,代码行数:19,
示例18: readingbool AMDetector::reading1D(const AMnDIndex &startIndex, const AMnDIndex &endIndex, double *outputValues) const { if(!checkValid(startIndex, endIndex)) return false; if (endIndex.i() < startIndex.i()) return false; for (int i = startIndex.i(); i <= endIndex.i(); i++) { AMNumber retVal = reading(i); if(!retVal.isValid()) return false; outputValues[i] = double(retVal); } return true;}
开发者ID:anukat2015,项目名称:acquaman,代码行数:19,
示例19: AMNumberAMNumber AMScalerTimeControlDetector::reading(const AMnDIndex &indexes) const{ if(!isConnected()) return AMNumber(AMNumber::Null); // We want an "invalid" AMnDIndex for this 0D detector if(indexes.isValid()) return AMNumber(AMNumber::DimensionError); return control_->value()/1000;}
开发者ID:acquaman,项目名称:acquaman,代码行数:10,
示例20: AMNumberAMNumber AM1DSummingAB::value(const AMnDIndex &indexes) const{ if(indexes.rank() != 1) return AMNumber(AMNumber::DimensionError); if(!isValid()) return AMNumber(AMNumber::InvalidError);#ifdef AM_ENABLE_BOUNDS_CHECKING for (int i = 0; i < sources_.size(); i++) if (indexes.i() >= sources_.at(i)->size(0)) return AMNumber(AMNumber::OutOfBoundsError);#endif double val = 0; for (int i = 0; i < sources_.size(); i++) val += (double)sources_.at(i)->value(indexes.i()); return val;}
开发者ID:Cpppro,项目名称:acquaman,代码行数:21,
示例21: readingNDbool AMDetector::readingND(const AMnDIndex &startIndex, const AMnDIndex &endIndex, double *outputValues) const { switch(startIndex.rank()) { case 0: return reading0D(startIndex, endIndex, outputValues); case 1: return reading1D(startIndex, endIndex, outputValues); case 2: return reading2D(startIndex, endIndex, outputValues); default: return false; }}
开发者ID:anukat2015,项目名称:acquaman,代码行数:12,
示例22: AMNumberAMNumber AM1DRunningAverageFilterAB::value(const AMnDIndex& indexes) const{ if(indexes.rank() != 1) return AMNumber(AMNumber::DimensionError); if(!isValid()) return AMNumber(AMNumber::InvalidError);#ifdef AM_ENABLE_BOUNDS_CHECKING if((unsigned)indexes.i() >= (unsigned)axes_.at(0).size) return AMNumber(AMNumber::OutOfBoundsError);#endif int index = indexes.i(); double runningAverage = 0; int numAvgPoints = 1; runningAverage += (double)inputSource_->value(index); for(int x = 1; x <= (filterSize_-1)/2; x++){ if( (index-x) >= 0 ){ runningAverage += (double)inputSource_->value(index-x); numAvgPoints++; } if( (index+x) < axes_.at(0).size ){ runningAverage += (double)inputSource_->value(index+x); numAvgPoints++; } } return runningAverage/((double)numAvgPoints);}
开发者ID:Cpppro,项目名称:acquaman,代码行数:37,
示例23: doublebool AMDeadTimeAB::values(const AMnDIndex &indexStart, const AMnDIndex &indexEnd, double *outputValues) const{ if(indexStart.rank() != 1 || indexEnd.rank() != 1) return false; if(!isValid()) return false; if((unsigned)indexEnd.i() >= (unsigned)axes_.at(0).size || (unsigned)indexStart.i() > (unsigned)indexEnd.i()) return false; int totalSize = indexStart.totalPointsTo(indexEnd); QVector<double> data = QVector<double>(totalSize); spectra_->values(indexStart, indexEnd, data.data()); double icr = double(icr_->value(AMnDIndex())); double ocr = double(ocr_->value(AMnDIndex())); // If ocr is equal to 0 then that will cause division by zero. Since these are both count rates, they should both be greater than zero. if (icr <= 0 || ocr <= 0){ for (int i = 0; i < totalSize; i++) outputValues[i] = 0; } else { double factor = icr/ocr; for (int i = 0; i < totalSize; i++) outputValues[i] = data.at(i)*factor; } return true;}
开发者ID:acquaman,项目名称:acquaman,代码行数:36,
示例24: AMnDIndexvoid AMAdditionAB::computeCachedValues() const{ AMnDIndex start = AMnDIndex(rank(), AMnDIndex::DoInit, 0); AMnDIndex end = size()-1; int totalSize = start.totalPointsTo(end); QVector<double> data = QVector<double>(totalSize); sources_.at(0)->values(start, end, data.data()); // Do the first data source separately to initialize the values. cachedData_ = data; // Iterate through the rest of the sources. for (int i = 1, count = sources_.size(); i < count; i++) { sources_.at(i)->values(start, end, data.data()); for (int j = 0; j < totalSize; j++) cachedData_[j] += data.at(j); } cachedDataRange_ = AMUtility::rangeFinder(cachedData_); cacheUpdateRequired_ = false;}
开发者ID:anukat2015,项目名称:acquaman,代码行数:24,
注:本文中的AMnDIndex类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ANPLogInterfaceV0类代码示例 C++ AMDataSource类代码示例 |