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


C++ Vec::dim方法代码示例

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


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

示例1: tr

GlobalDaeDef::GlobalDaeDef(ResFunction residualIn, const real& t0In,
                           const Vec& y0In, const Vec& y0primeIn,DataCollector* dataIn):
    DaeDefinition(y0In.dim(),dataIn),
    t0(&t0In),
    y0(&y0In),
    y0prime(&y0primeIn),
    resGlobal(residualIn),
    yPrimeGlobal(0),
    indexResGlobal(0)
{
    Tracer tr("GlobalDaeDef::GlobalDaeDef(ResFunction residualIn, const real& t0, const Vec& y0, const Vec& y0prime)");
}
开发者ID:erdc-cm,项目名称:daetk,代码行数:12,代码来源:GlobalDaeDef.cpp

示例2: includeSolution

void FullDataFile::includeSolution(const real& tout,const Vec& solution)
{    
  runTime = clock.elapsed();
  clock.reset();
  if (totalStepsTaken)
    avgCondition/=totalStepsTaken;
  else
    avgCondition=0.0;
  fout<<endl
      <<"Data over the interval ["<<tlast<<","<<tout<<"]"<<endl
      <<"------------------------------"<<endl
      <<"Jacobian Evaluations:-------"<<totalJacobianEvaluations<<endl
      <<"Function Evaluations:-------"<<totalFunctionEvaluations<<endl
      <<"Steps Taken:----------------"<<totalStepsTaken<<endl
      <<"Steps Failed:---------------"<<totalStepsFailed<<endl
      <<"Error Failures:-------------"<<totalErrorFailures<<endl
      <<"Nonlinear Solver Iterations:"<<totalNonlinearSolverIterations<<endl
      <<"Nonlinear Solver Failures:--"<<totalNonlinearSolverFailures<<endl
      <<"Linear Solver Iterations:---"<<totalLinearSolverIterations<<endl
      <<"Linear Solver Failures:-----"<<totalLinearSolverFailures<<endl
      <<"Average Condition Number:---"<<avgCondition<<endl
      <<"Line Searches:--------------"<<totalLinesearches<<endl
      <<"Order 1 steps:--------------"<<orderOneStepsTaken<<endl
      <<"Order 2 steps:--------------"<<orderTwoStepsTaken<<endl
      <<"Order 3 steps:--------------"<<orderThreeStepsTaken<<endl
      <<"Order 4 steps:--------------"<<orderFourStepsTaken<<endl
      <<"Order 5 steps:--------------"<<orderFiveStepsTaken<<endl
      <<"Wall Clock Time:------------"<<runTime<<endl
      <<endl;
  int neq = solution.dim();
  if (analyticSolutionAvailable)
    {
      real rnorm;
      Vec r(solution.dim());
      analyticSolution(tout,r);
      fout<<"Solution at t="<<tout<<"   Analytic Solution"<<endl<<endl;
      for (int i=0;i<neq;i++)
	{
	  fout<<setw(14)<<solution(i)<<setw(3)<<" "<<setw(14)<<r(i)<<endl;
	}
      rnorm = nrm2(r);
      r-=solution;
      fout<<endl<<"Relative error= "<<(norm(r)/rnorm)<<endl<<endl;
    }
  else
    {
      if (INCLUDE_SOLUTION)
        {
          fout<<setw(1)<<"Solution at t="<<tout<<endl
              <<solution<<endl;
        }
    }
  fout<<"============================================================================="<<endl
      <<" k |  Step Size    |      tn       |errf|nlsf|ilsf|func|jacs|NLit|L_IT|linS|"<<endl;

  globalJacobianEvaluations+=totalJacobianEvaluations;
  globalFunctionEvaluations+=totalFunctionEvaluations;
  globalStepsTaken+=totalStepsTaken;
  globalNonlinearSolverIterations+=totalNonlinearSolverIterations;
  globalNonlinearSolverFailures+=totalNonlinearSolverFailures;
  globalLinearSolverIterations+=totalLinearSolverIterations;
  globalLinearSolverFailures+=totalLinearSolverFailures;
  globalLinesearches+=totalLinesearches;
  globalErrorFailures+=totalErrorFailures;
  globalStepsFailed+=totalStepsFailed;
  globalOrderOneStepsTaken+=orderOneStepsTaken;
  globalOrderTwoStepsTaken+=orderTwoStepsTaken;
  globalOrderThreeStepsTaken+=orderThreeStepsTaken;
  globalOrderFourStepsTaken+=orderFourStepsTaken;
  globalOrderFiveStepsTaken+=orderFiveStepsTaken;

  avgCondition =0;
  totalJacobianEvaluations=0;
  totalFunctionEvaluations=0;
  totalStepsTaken=0;
  totalNonlinearSolverIterations=0;
  totalNonlinearSolverFailures=0;
  totalLinearSolverIterations=0;
  totalLinearSolverFailures=0;
  totalLinesearches=0;
  totalErrorFailures=0;
  totalStepsFailed=0;
  tlast=tout; 
  orderOneStepsTaken=0;
  orderTwoStepsTaken=0;
  orderThreeStepsTaken=0;
  orderFourStepsTaken=0;
  orderFiveStepsTaken=0;
}
开发者ID:erdc-cm,项目名称:daetk,代码行数:89,代码来源:FullDataFile.cpp


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