/// This method rescales each statistic and combines all the results
void MultiGrid2D::reduceStatistics(){
    std::vector<BlockStatistics*> levelStatistics(this->getNumLevels());
    std::vector<int> dimensionsX, dimensionsT;
    
    dimensionsX = statsSubscriber.getDimensionsX();
    dimensionsT = statsSubscriber.getDimensionsT();
    
    for (plint iLevel=0; iLevel<this->getNumLevels(); ++iLevel) {
          int dxScale = this->getReferenceLevel() - iLevel;
          int dtScale = dxScale;  // TODO: here, we assume convective scaling; general case should be considered.
          std::vector<double> scales(dimensionsX.size());
          for (pluint iScale=0; iScale<scales.size(); ++iScale) {
              scales[iScale] = scaleToReference(dxScale, dimensionsX[iScale], dtScale, dimensionsT[iScale]);
          }
          // copy the statistics
          levelStatistics[iLevel] =  new BlockStatistics(getComponent(iLevel).getInternalStatistics()); 
          // rescale the statistics to the reference level
          levelStatistics[iLevel]->rescale(scales); 
    }
    combine(levelStatistics, getInternalStatistics() );
    
    internalStatistics.incrementStats();
    
    for (plint iLevel=0; iLevel<this->getNumLevels(); ++iLevel){
        delete levelStatistics[iLevel];
    }
}
Exemple #2
0
void AtomicBlock2D::evaluateStatistics() {
    getInternalStatistics().evaluate();
}