当前位置: 首页>>代码示例>>C++>>正文


C++ VertexEnumerator::cell方法代码示例

本文整理汇总了C++中peano::grid::VertexEnumerator::cell方法的典型用法代码示例。如果您正苦于以下问题:C++ VertexEnumerator::cell方法的具体用法?C++ VertexEnumerator::cell怎么用?C++ VertexEnumerator::cell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在peano::grid::VertexEnumerator的用法示例。


在下文中一共展示了VertexEnumerator::cell方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: logTraceIn

void particles::pidt::mappings::MoveParticles::ascend(
  particles::pidt::Cell * const         fineGridCells,
  particles::pidt::Vertex * const       fineGridVertices,
  const peano::grid::VertexEnumerator&  fineGridVerticesEnumerator,
  particles::pidt::Vertex * const       coarseGridVertices,
  const peano::grid::VertexEnumerator&  coarseGridVerticesEnumerator,
  particles::pidt::Cell&                coarseGridCell
) {
  logTraceIn( "ascend(...)" );

  dfor3(i)
    coarseGridCell.restrictMaxVComponent( fineGridCells[ fineGridVerticesEnumerator.cell(i) ] );
  enddforx

  logTraceOut( "ascend(...)" );
}
开发者ID:POWER-Morzh,项目名称:particles2,代码行数:16,代码来源:MoveParticles.cpp

示例2: computeMaxRelativeError

void particles::pit::myfunctions::CoordinatesRepresentationChange::ascend(
  particles::pit::Cell * const    fineGridCells,
  particles::pit::Vertex * const  fineGridVertices,
  const peano::grid::VertexEnumerator&          fineGridVerticesEnumerator,
  particles::pit::Vertex * const  coarseGridVertices,
  const peano::grid::VertexEnumerator&          coarseGridVerticesEnumerator,
  particles::pit::Cell&           coarseGridCell
) {

  dfor3(k)
	particles::pit::Cell fineGridCell = fineGridCells[ fineGridVerticesEnumerator.cell(k) ];
    const tarch::la::Vector<DIMENSIONS,double> cellOffset     = fineGridVerticesEnumerator.getVertexPosition(k);
    const tarch::la::Vector<DIMENSIONS,double> MeanCoordinate = fineGridCell.getMeanCoordinate();
    bool isLeaf = fineGridCell.isLeaf();
    const int cellIndex = fineGridCell.getCellIndex();
    const int NumberOfParticles = ParticleHeap::getInstance().getData(cellIndex).size();

    if( isLeaf && NumberOfParticles>1 ) {
      // Compute Max-Norm
      double maxRelativeError = computeMaxRelativeError( fineGridCell );
      // Save maximal maxRelativeError in _globalMaxRelativeError
      if (_globalMaxRelativeError < maxRelativeError) {
        _globalMaxRelativeError = maxRelativeError;
      }
      double maxError = computeMaxError( fineGridCell );
      if(_global_max_error < maxError) {
          _global_max_error = maxError;
      }
      double maxOffset = computeMaxOffset( fineGridCell );
      // Compute RMSD
      tarch::la::Vector<DIMENSIONS,double> rmsd = computeRMSD( fineGridCell );
      // Computer L2-Norm
      tarch::la::Vector<DIMENSIONS,double> l2ErrorNorm = computeL2ErrorNorm( fineGridCell );
      tarch::la::Vector<DIMENSIONS,double> l2Norm = computeL2Norm( fineGridCell );

      // Save maximal l2ErrorNorm in _globalMaxL2ErrorNorm
      for(int d = 0; d<DIMENSIONS; d++) {
        if(_globalMaxL2ErrorNorm < l2ErrorNorm[d]) {
          _globalMaxL2ErrorNorm = l2ErrorNorm[d];
        }
      }
      // Add l2Norm to _globalL2Norm
      _globalL2ErrorNorm += l2ErrorNorm;
      // Don't forget to increment _globalNormAdditions to divide _globalL2Norm by it
      // at the end of iteration before writing it in the file!
      ++_globalNormAdditions;
      //std::cout << "_globalNormAdditions: " << _globalNormAdditions << std::endl;

      // Output for checking
      //printParticlesInfo( fineGridCell, "maxError", maxError );

      _maxRelativeErrorOut << maxRelativeError << " ";
      _maxErrorOut << maxError << " ";
      _maxOffsetOut << maxOffset << " ";

      // Histogram process
      l2_error_norm_histogram_->processHistogram(l2ErrorNorm);
      max_error_norm_histogram_->processHistogram(maxError);
      max_offset_norm_histogram_->processHistogram(maxOffset);

      for(int d=0; d<DIMENSIONS; d++) {
        _RMSDOut << rmsd[d] << " ";
        _L2ErrorNormOut << l2ErrorNorm[d] << " ";
        _L2NormOut << l2Norm[d] << " ";
        _MeanCoordinateOut << MeanCoordinate[d] << " ";
      }
      for(int d=0; d<DIMENSIONS; d++) {
        _maxRelativeErrorOut << cellOffset[d] << " ";
    	_maxErrorOut << cellOffset[d] << " ";
        _maxOffsetOut << cellOffset[d] << " ";
        _RMSDOut << cellOffset[d] << " ";
        _L2ErrorNormOut << cellOffset[d] << " ";
        _L2NormOut << cellOffset[d] << " ";
        _MeanCoordinateOut << cellOffset[d] << " ";
      }
      _maxRelativeErrorOut << std::endl;
      _maxErrorOut << std::endl;
      _maxOffsetOut << std::endl;
      _RMSDOut << std::endl;
      _L2ErrorNormOut << std::endl;
      _L2NormOut << std::endl;
      _MeanCoordinateOut << std::endl;
    }
  enddforx
}
开发者ID:POWER-Morzh,项目名称:particles,代码行数:85,代码来源:CoordinatesRepresentationChange.cpp

示例3: computeMaxRelativeError

void particles::pit::myfunctions::RepresentationChange::ascend(
  particles::pit::Cell * const    fineGridCells,
  particles::pit::Vertex * const  fineGridVertices,
  const peano::grid::VertexEnumerator&          fineGridVerticesEnumerator,
  particles::pit::Vertex * const  coarseGridVertices,
  const peano::grid::VertexEnumerator&          coarseGridVerticesEnumerator,
  particles::pit::Cell&           coarseGridCell
) {
  particles::pit::myfunctions::CoordinatesRepresentationChange::ascend(
    fineGridCells,
    fineGridVertices,
    fineGridVerticesEnumerator,
    coarseGridVertices,
    coarseGridVerticesEnumerator,
    coarseGridCell);

  dfor3(k)
    particles::pit::Cell fineGridCell = fineGridCells[ fineGridVerticesEnumerator.cell(k) ];
    const tarch::la::Vector<DIMENSIONS,double> cellOffset     = fineGridVerticesEnumerator.getVertexPosition(k);
    const tarch::la::Vector<DIMENSIONS,double> meanVelocity = fineGridCell.getMeanVelocity();
    bool isLeaf = fineGridCell.isLeaf();
    const int cellIndex = fineGridCell.getCellIndex();
    const int NumberOfParticles = ParticleHeap::getInstance().getData(cellIndex).size();

    if( isLeaf && NumberOfParticles>1 ) {
      // Compute Max-Norm
      double maxRelativeError = computeMaxRelativeError( fineGridCell );
      // Save maximal maxRelativeError in _globalMaxRelativeError
      if (_globalMaxRelativeError < maxRelativeError) {
        _globalMaxRelativeError = maxRelativeError;
      }
      double maxError = computeMaxError( fineGridCell );
      if(_global_max_error < maxError) {
          _global_max_error = maxError;
      }
      double maxOffset = computeMaxOffset( fineGridCell );
      double minOffset = computeMinOffset( fineGridCell );
      if(_globalMaxOffset < maxOffset) {
        _globalMaxOffset = maxOffset;
      }
      // Compute RMSD
      tarch::la::Vector<DIMENSIONS,double> rmsd = computeRMSD( fineGridCell );
      // Computer L2-Norm
      tarch::la::Vector<DIMENSIONS,double>
        l2ErrorNorm = computeL2ErrorNorm( fineGridCell );
      tarch::la::Vector<DIMENSIONS,double>
        l2Norm = computeL2Norm( fineGridCell );
      //std::cout << "ascend() l2ErrorNorm: " << l2ErrorNorm << std::endl;


      // Save maximal l2ErrorNorm in _globalMaxL2ErrorNorm
      for(int d = 0; d<DIMENSIONS; d++) {
        if(_globalMaxL2ErrorNorm < l2ErrorNorm[d]) {
          _globalMaxL2ErrorNorm = l2ErrorNorm[d];
        }
      }
      // Add l2ErrorNorm to _globalL2ErrorNorm
      _globalL2ErrorNorm += l2ErrorNorm;
      // Add l2Norm to _globalL2OffsetNorm
      _globalL2OffsetNorm += l2Norm;
      // Don't forget to increment _globalNormAdditions to divide _globalL2Norm
      //by it at the end of iteration before writing it in the file!
      ++_globalNormAdditions;


      // Output for checking
      if(VERBOSE) {
          printParticlesInfo( fineGridCell, "l2ErrorNorm", l2ErrorNorm );
      }

      /* All computations put in output */
      _maxRelativeErrorOut << maxRelativeError << " ";
      _maxErrorOut << maxError << " ";
      _maxOffsetOut << maxOffset << " ";
      _minOffsetOut << minOffset << " ";

      // Histogram process
      l2_error_norm_histogram_->processHistogram(l2ErrorNorm);
      max_error_norm_histogram_->processHistogram(maxError);
      max_offset_norm_histogram_->processHistogram(maxOffset);

      for(int d=0; d<DIMENSIONS; d++) {
        _RMSDOut << rmsd[d] << " ";
        _L2ErrorNormOut << l2ErrorNorm[d] << " ";
        _L2NormOut << l2Norm[d] << " ";
        _meanVelocityOut << meanVelocity[d] << " ";
      }
      /* Write coordinates of each cell near the value of the Norm(offset) */
      for(int d=0; d<DIMENSIONS; d++) {
        _maxRelativeErrorOut << cellOffset[d] << " ";
    	_maxErrorOut << cellOffset[d] << " ";
        _maxOffsetOut << cellOffset[d] << " ";
        _minOffsetOut << cellOffset[d] << " ";
        _RMSDOut << cellOffset[d] << " ";
        _L2ErrorNormOut << cellOffset[d] << " ";
        _L2NormOut << cellOffset[d] << " ";
        _meanVelocityOut << cellOffset[d] << " ";
      }
      /* Put the new line character to have one cell per line */
      _maxRelativeErrorOut << std::endl;
//.........这里部分代码省略.........
开发者ID:POWER-Morzh,项目名称:particles,代码行数:101,代码来源:RepresentationChange.cpp


注:本文中的peano::grid::VertexEnumerator::cell方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。