Skip to content

Commit

Permalink
test examples: support loading files
Browse files Browse the repository at this point in the history
- add symlink (thank you @tamiko) to support loading input files
- add step-5
  • Loading branch information
tjhei committed Jan 14, 2024
1 parent cf40acf commit b500779
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ For development of new examples, we suggest first creating an empty

To modify the source code, go into ``build/tests/examples/source/``
and edit the .cc file there. Afterwards, you can update the .diff
files by running the ``update_diffs`` target in that folder.
files by running the ``update_diffs`` target in the folder
``build/tests/examples``, i.e., by running ``make update_diffs``.

To support loading files from the ./examples/step-XY/ directory, we
automatically create a symlink such that
```
SOURCE_DIR "/step-5/"
```
compiles to an absolute path pointing at ``./examples/step-5/``.
4 changes: 4 additions & 0 deletions tests/examples/step-5.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
327c327
< std::ifstream input_file("circle-grid.inp");
---
> std::ifstream input_file(SOURCE_DIR "/step-5/circle-grid.inp");
30 changes: 30 additions & 0 deletions tests/examples/step-5.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Cycle 0:
Number of active cells: 20
Total number of cells: 20
Number of degrees of freedom: 25
13 CG iterations needed to obtain convergence.
Cycle 1:
Number of active cells: 80
Total number of cells: 100
Number of degrees of freedom: 89
17 CG iterations needed to obtain convergence.
Cycle 2:
Number of active cells: 320
Total number of cells: 420
Number of degrees of freedom: 337
29 CG iterations needed to obtain convergence.
Cycle 3:
Number of active cells: 1280
Total number of cells: 1700
Number of degrees of freedom: 1313
51 CG iterations needed to obtain convergence.
Cycle 4:
Number of active cells: 5120
Total number of cells: 6820
Number of degrees of freedom: 5185
94 CG iterations needed to obtain convergence.
Cycle 5:
Number of active cells: 20480
Total number of cells: 27300
Number of degrees of freedom: 20609
180 CG iterations needed to obtain convergence.

0 comments on commit b500779

Please sign in to comment.