本文整理汇总了C++中timer::tic方法的典型用法代码示例。如果您正苦于以下问题:C++ timer::tic方法的具体用法?C++ timer::tic怎么用?C++ timer::tic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timer
的用法示例。
在下文中一共展示了timer::tic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
pressure.print();
//
// In these case, the boundary conditions are calculated in
// the numerical scheme (the adaptor BLES1).
//
TwoPhaseEquation< BLES5<double, 3> > saturation(Sw, A, b, mesh.getDeltas());
saturation.setDeltaTime(dt);
saturation.setPermeability(permeability);
saturation.setPorosity(porosity);
saturation.setSrw(Srw);
saturation.setSro(Sro);
saturation.setViscosity_w(mu_w);
saturation.setViscosity_o(mu_o);
saturation.applyBounds(1, Sw.ubound(firstDim)-1);// just to move the indexes
saturation.setNeumann(TOP_WALL);
saturation.setNeumann(BOTTOM_WALL);
saturation.setNeumann(FRONT_WALL);
saturation.setNeumann(BACK_WALL);
saturation.setPressure(p);
saturation.print();
ofstream error_fp("./DataBL3D/error"),
residual_fp("./DataBL3D/residual");
int iteration = 0, idprint = 0;
double t = dt;
double error = 1.0;
double residual = 1.0;
int pausa;
int bi = saturation.get_bi(), ei = saturation.get_ei();
int bj = saturation.get_bj(), ej = saturation.get_ej();
int bk = saturation.get_bk(), ek = saturation.get_ek();
frequency *= (86400 / dt);
double total_time = 0, pres_time = 0, sat_time = 0;
while (t <= Tmax) {
if ( !(iteration % idt_p) ) {
crono.tic();
pressure.calcCoefficients();
Solver::TDMA3D(pressure, tolerance, 20, 1);
pres_time += crono.toc();
residual = pressure.calcResidual();
error = pressure.calcErrorL1();
error_fp << iteration << "\t" << error << std::endl;
residual_fp << iteration << "\t" << residual << std::endl;
pressure.update();
}
crono.tic();
saturation.calcCoefficients();
Solver::solExplicit3D(saturation);
sat_time += crono.toc();
error = saturation.calcErrorL1();
saturation.update();
/** **/
for(int kk = 0; kk <= (ek+1); ++kk)
for(int j = 0; j <= (ej+1); ++j)
for(int i = 0; i <= (ei+1); ++i) {
if ( Sw(i,j,kk) > Sw_in) Sw(i,j,kk) = Sw_in;
if ( Sw(i,j,kk) < Srw) Sw(i,j,kk) = Srw;
}
saturation.updatePhi(Sw);
/** **/
++iteration;
t += dt;
if ( !(iteration % frequency) ) {
idprint++;
NumUtils::interpolateToNodes(p_n, p);
InOut::writeToFile_DX(p_n, idprint, "./DataBL3D/pres.",dx, dy, dz);
NumUtils::interpolateToNodes(Sw_n, Sw);
InOut::writeToFile_DX(Sw_n, idprint, "./DataBL3D/satu.",dx, dy, dz);
std::cout << "\n ---- Iteration " << iteration
<< "\t time = " << t
<< "\t Res = " << residual
<< "\t Err = " << error
<< "\n ---- ID print " << idprint;
}
}
cout << "\n\n Presure Elapsed time = " << pres_time << " segs \n";
cout << "\n Saturation Elapsed time = " << sat_time << " segs \n";
std::cout << "\n\n NOTE: The data were written in the [./DataBL3D] directory \n\n";
return 0;
}
示例2: main
//.........这里部分代码省略.........
saturation.applyBounds(1, Sw.ubound(firstDim)-1);// just to move the indexes
saturation.setNeumann(TOP_WALL);
saturation.setNeumann(BOTTOM_WALL);
saturation.setPressure(p);
saturation.print();
ofstream error_fp, residual_fp;
if (rank == 0){
error_fp.open("./DataBL/00/error");
residual_fp.open ("./DataBL/00/residual");
}
if (rank == 1) {
error_fp.open("./DataBL/01/error");
residual_fp.open("./DataBL/01/residual");
}
int iteration = 1, idprint = 1;
double t = dt;
double error = 1.0;
double residual = 1.0;
// int pausa;
int bi = saturation.get_bi(), bj = saturation.get_bj();
int ei = saturation.get_ei(), ej = saturation.get_ej();
frequency *= (86400 / dt);
double total_time = 0, pres_time = 0, sat_time = 0;
while (t <= Tmax) {
if ( !(iteration % idt_p) ) {
crono.tic();
pressure.calcCoefficients();
Solver::TDMA2DX(pressure, tolerance, tdma_iter, 1.0);
pres_time += crono.toc();
residual = pressure.calcResidual();
error = pressure.calcErrorL1();
error_fp << iteration << "\t" << error << std::endl;
residual_fp << iteration << "\t" << residual << std::endl;
pressure.update();
}
crono.tic();
saturation.calcCoefficients();
Solver::solExplicit2D(saturation);
sat_time += crono.toc();
error = saturation.calcErrorL1();
saturation.update();
/* */
// just to avoid go out of boundary conditions.
for(int j = 0; j <= (ej+1); ++j)
for(int i = 0; i <= (ei+0); ++i) {
if ( Sw(i,j) > Sw_in) Sw(i,j) = Sw_in;
if ( Sw(i,j) <= 0 ) {
Sw(i+1,j) = 0.0;
}
}
示例3: tic
void tic(std::string key){
globalTimer.tic(key);
}