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


C++ MatrixView::sum方法代码示例

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


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

示例1: CombCPPSizing

//##ModelId=40A1898902EF
bool LoadBasedScreen1::CalculateModel( PFlowStream1 FeedStream )
  {
  // Local Variables
  int i = 0;
  int j = 0;
  double ScaleFactor = 0.00;
  double Denom = 0.00;

  Vector CombCPPSizing ( nSize );
  CubicSpline FeedSpline;    

  MatrixView FeedSolids      = FeedStream->AccessSolidsMatrix( );

  MatrixView OversizeSolids  = Oversize->AccessSolidsMatrix( );

  MatrixView UndersizeSolids = Undersize->AccessSolidsMatrix( );

  // Ensure correct shape feed matrix

  if( FeedSolids.rowCount() != nSize )
    goto calcFailed;

  if( FeedSolids.columnCount() != nType ) 
    goto calcFailed;

  // Calculate total feed flow rate (solids)

  QF = FeedSolids.sum( );

  // Convert feed matrix into single component size distribution

  for( i = 0; i < nSize; i++ )
    CombRetSizing[ i ] = (FeedSolids.row(i)).sum();

  if (fabs(QF)<1e-8)
    ScaleFactor = 0.00;
  else 
    ScaleFactor = 1/QF;

  // Scale single component distribution to cumulative sizing
  //  scaled to fraction basis: ie. 1 passes top-size

  CombCPPSizing[ nSize - 1 ] = 0;
  for( i = nSize - 2; i >=0; i-- )
    CombCPPSizing[ i ] = CombCPPSizing[i + 1] + ( CombRetSizing[i + 1] * ScaleFactor );

  // Construct cubic spline passing through cumulative curve    

  FeedSpline.SetSpline( Sizes, CombCPPSizing );

  // Use cubic spline to get fraction passing half apperture size

  Feed_HS = FeedSpline.CalculateY( S/2 );

  // Use spline to get fraction passing apperture size    

  U = Feed_US = FeedSpline.CalculateY( S );
  Feed_OS = 1 - Feed_US;

  // Calculate area factors for this screen

  A = CalculateA( S );
  B = CalculateB( Feed_OS );
  C = CalculateC( Feed_HS );
  D = CalculateD( DL );
  E = CalculateE( WS, S );
  H = CalculateH( OT );
  J = CalculateJ( ST, S, OA );
  K = CalculateK( FT );
  L = CalculateL();
  X = CalculateX( CF );

  // Calculate denominator of load equation - ensure not zero

  Denom = A * B * C * D * E * F * H * J * K * L * AF * X;
  if (fabs(Denom)<1e-8)
    Denom = 1e-8;

  // Calculate load

  V = ( 90 * QF * U ) / ( Denom );

  // Calculate efficiency that matches this load

  T = CalculateT( V );

  // Calculate factor G

  G = ( V * T ) / 90;

  // calculate flow to undersize at this efficiency

  QU = QF * U * T;

  // Solve for D50 that matches the undersize flow

  D50 = zbrent( S * 0.1, S * 0.99, TOLERANCE );

  // Calculate splitting of feed water to products
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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