Skip to content

Commit

Permalink
unify some example output
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhei committed Dec 4, 2023
1 parent c1ddcf4 commit 53a23b6
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 64 deletions.
110 changes: 55 additions & 55 deletions examples/step-14/doc/results.dox
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,40 @@ it out, by changing the settings in the main program. Here, we start
by simply letting it run, unmodified:
@code
Refinement cycle: 0
Number of degrees of freedom=72
Point value=0.03243
Estimated error=0.000702385
Number of degrees of freedom: 72
Point value: 0.03243
Estimated error: 0.000702385
Refinement cycle: 1
Number of degrees of freedom=67
Point value=0.0324827
Estimated error=0.000888953
Number of degrees of freedom: 67
Point value: 0.0324827
Estimated error: 0.000888953
Refinement cycle: 2
Number of degrees of freedom=130
Point value=0.0329619
Estimated error=0.000454606
Number of degrees of freedom: 130
Point value: 0.0329619
Estimated error: 0.000454606
Refinement cycle: 3
Number of degrees of freedom=307
Point value=0.0331934
Estimated error=0.000241254
Number of degrees of freedom: 307
Point value: 0.0331934
Estimated error: 0.000241254
Refinement cycle: 4
Number of degrees of freedom=718
Point value=0.0333675
Estimated error=7.4912e-05
Number of degrees of freedom: 718
Point value: 0.0333675
Estimated error: 7.4912e-05
Refinement cycle: 5
Number of degrees of freedom=1665
Point value=0.0334083
Estimated error=3.69111e-05
Number of degrees of freedom: 1665
Point value: 0.0334083
Estimated error: 3.69111e-05
Refinement cycle: 6
Number of degrees of freedom=3975
Point value=0.033431
Estimated error=1.54218e-05
Number of degrees of freedom: 3975
Point value: 0.033431
Estimated error: 1.54218e-05
Refinement cycle: 7
Number of degrees of freedom=8934
Point value=0.0334406
Estimated error=6.28359e-06
Number of degrees of freedom: 8934
Point value: 0.0334406
Estimated error: 6.28359e-06
Refinement cycle: 8
Number of degrees of freedom=21799
Point value=0.0334444
Number of degrees of freedom: 21799
Point value: 0.0334444
@endcode


Expand Down Expand Up @@ -183,44 +183,44 @@ program compute these quantities, simply replace the two occurrences of
<code>PointXDerivativeEvaluation</code>, and let the program run:
@code
Refinement cycle: 0
Number of degrees of freedom=72
Point x-derivative=-0.0719397
Estimated error=-0.0126173
Number of degrees of freedom: 72
Point x-derivative: -0.0719397
Estimated error: -0.0126173
Refinement cycle: 1
Number of degrees of freedom=61
Point x-derivative=-0.0707956
Estimated error=-0.00774316
Number of degrees of freedom: 61
Point x-derivative: -0.0707956
Estimated error: -0.00774316
Refinement cycle: 2
Number of degrees of freedom=131
Point x-derivative=-0.0568671
Estimated error=-0.00313426
Number of degrees of freedom: 131
Point x-derivative: -0.0568671
Estimated error: -0.00313426
Refinement cycle: 3
Number of degrees of freedom=247
Point x-derivative=-0.053033
Estimated error=-0.00136114
Number of degrees of freedom: 247
Point x-derivative: -0.053033
Estimated error: -0.00136114
Refinement cycle: 4
Number of degrees of freedom=532
Point x-derivative=-0.0526429
Estimated error=-0.000558868
Number of degrees of freedom: 532
Point x-derivative: -0.0526429
Estimated error: -0.000558868
Refinement cycle: 5
Number of degrees of freedom=1267
Point x-derivative=-0.0526955
Estimated error=-0.000220116
Number of degrees of freedom: 1267
Point x-derivative: -0.0526955
Estimated error: -0.000220116
Refinement cycle: 6
Number of degrees of freedom=2864
Point x-derivative=-0.0527495
Estimated error=-9.46731e-05
Number of degrees of freedom: 2864
Point x-derivative: -0.0527495
Estimated error: -9.46731e-05
Refinement cycle: 7
Number of degrees of freedom=6409
Point x-derivative=-0.052785
Estimated error=-4.21543e-05
Number of degrees of freedom: 6409
Point x-derivative: -0.052785
Estimated error: -4.21543e-05
Refinement cycle: 8
Number of degrees of freedom=14183
Point x-derivative=-0.0528028
Estimated error=-2.04241e-05
Number of degrees of freedom: 14183
Point x-derivative: -0.0528028
Estimated error: -2.04241e-05
Refinement cycle: 9
Number of degrees of freedom=29902
Point x-derivative=-0.052814
Number of degrees of freedom: 29902
Point x-derivative: -0.052814
@endcode


Expand Down
6 changes: 3 additions & 3 deletions examples/step-14/step-14.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ namespace Step14
AssertThrow(evaluation_point_found,
ExcEvaluationPointNotFound(evaluation_point));

std::cout << " Point value=" << point_value << std::endl;
std::cout << " Point value: " << point_value << std::endl;
}


Expand Down Expand Up @@ -2238,7 +2238,7 @@ namespace Step14
}
++present_cell;
}
std::cout << " Estimated error="
std::cout << " Estimated error: "
<< std::accumulate(error_indicators.begin(),
error_indicators.end(),
0.)
Expand Down Expand Up @@ -2778,7 +2778,7 @@ namespace Step14
solver->solve_problem();
solver->output_solution();

std::cout << " Number of degrees of freedom=" << solver->n_dofs()
std::cout << " Number of degrees of freedom: " << solver->n_dofs()
<< std::endl;

for (const auto &evaluator : descriptor.evaluator_list)
Expand Down
6 changes: 4 additions & 2 deletions examples/step-3/doc/results.dox
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ Number of active cells: 1024
Number of degrees of freedom: 1089
DEAL:cg::Starting value 0.121094
DEAL:cg::Convergence step 36 value 7.07761e-08
Output written to solution.vtk
@endcode

The first two lines is what we wrote to <code>std::cout</code>. The last
The first two lines is what we wrote to <code>std::cout</code>. The next
two lines were generated by the CG solver because we called
`deallog.depth_console(2);` in the `main()` function -- see
the lengthy discussion there. These two lines prefixed by `DEAL:cg:` state
Expand All @@ -21,7 +22,8 @@ norm of the right hand side vector; the starting value is (here) this
norm of the right hand side vector, and there is indeed more than a
factor of $10^{-6}$ between the two values shown.

Apart from the output shown above, the program generated the file
The last line is the output we generated at the bottom of the
`output_results()` function. The program also generated the file
<code>solution.vtk</code>, which is in the VTK format that is widely
used by many visualization programs today -- including the two
heavy-weights <a href="https://www.llnl.gov/visit">VisIt</a> and
Expand Down
4 changes: 3 additions & 1 deletion examples/step-3/step-3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,10 @@ void Step3::output_results() const
// functions in the DataOut class we are using here that can write the
// data in postscript, AVS, GMV, Gnuplot, or some other file
// formats):
std::ofstream output("solution.vtk");
const std::string filename = "solution.vtk";
std::ofstream output(filename);
data_out.write_vtk(output);
std::cout << "Output written to " << filename << std::endl;
}


Expand Down
10 changes: 7 additions & 3 deletions examples/step-9/step-9.cc
Original file line number Diff line number Diff line change
Expand Up @@ -828,9 +828,11 @@ namespace Step9
void AdvectionProblem<dim>::output_results(const unsigned int cycle) const
{
{
GridOut grid_out;
std::ofstream output("grid-" + std::to_string(cycle) + ".vtu");
GridOut grid_out;
const std::string filename = "grid-" + std::to_string(cycle) + ".vtu";
std::ofstream output(filename);
grid_out.write_vtu(triangulation, output);
std::cout << "Grid written to " << filename << std::endl;
}

{
Expand All @@ -846,8 +848,10 @@ namespace Step9
vtk_flags.compression_level = DataOutBase::CompressionLevel::best_speed;
data_out.set_flags(vtk_flags);

std::ofstream output("solution-" + std::to_string(cycle) + ".vtu");
const std::string filename = "solution-" + std::to_string(cycle) + ".vtu";
std::ofstream output(filename);
data_out.write_vtu(output);
std::cout << "Solution written to " << filename << std::endl;
}
}

Expand Down

0 comments on commit 53a23b6

Please sign in to comment.