本文整理汇总了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)");
}
示例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;
}