Commit 0fdfa612 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

Merge branch 'feature/examples-automate-readme' into 'master'

Feature/examples automate readme

Closes #824

See merge request !1888
parents 3dd7a69a 4c48d6f0
doc/intro.md
spatialparams_1p.hh
problem_1p.hh
spatialparams_tracer.hh
problem_tracer.hh
main.cc
doc/results.md
doc/intro.md
spatialparams.hh
problem.hh
main.cc
doc/results.md
......@@ -571,6 +571,7 @@ The file dumuxmessage.hh contains the class defining the start and end message o
we include the linear solver to be used to solve the linear system
```cpp
#include <dumux/linear/amgbackend.hh>
#include <dumux/linear/linearsolvertraits.hh>
```
we include the nonlinear Newton's method
```cpp
......@@ -785,7 +786,7 @@ we set the assembler with the time loop because we have an instationary problem
```
we set the linear solver
```cpp
using LinearSolver = AMGBackend<TypeTag>;
using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>;
auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper());
```
additionally we set the non-linear solver.
......
#!/usr/bin/env python3
import os
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--directory", help="The folder to look for examples", default=".")
parser.add_argument("-m", "--markdowngenerator", help="The markdown generator script taking a list of files", default="../bin/doc/cpp_to_md.sh")
args = vars(parser.parse_args())
def convertToMarkdownAndMerge(dir, includeList):
script = os.path.join(os.path.abspath(args["markdowngenerator"]))
with open(os.path.join(dir, "README.md"), "w") as readme:
for include in includeList:
if os.path.splitext(include)[1] == ".md":
with open(include, "r") as markdown:
readme.write(markdown.read())
else:
readme.write("\n\n## The file `{}`\n\n".format(os.path.split(include)[1]))
markdown = subprocess.check_output(["bash", script, include], encoding="utf-8")
readme.write(markdown + "\n")
def generateReadme(dir):
includeList = None
try:
configname = os.path.join(dir, ".doc_config")
with open(configname, 'r') as config:
includeList = [os.path.join(dir, include) for include in config.read().splitlines()]
except FileNotFoundError:
print("Error: The example directory {} does not contain a .doc_config file! Could not generate README.md!".format(dir))
raise
if includeList is not None:
convertToMarkdownAndMerge(dir, includeList)
for path in os.listdir(args["directory"]):
abspath = os.path.join(os.path.abspath(args["directory"]), path)
if os.path.isdir(abspath):
generateReadme(abspath)
doc/intro.md
spatialparams.hh
problem.hh
main.cc
doc/results.md
......@@ -613,6 +613,7 @@ The gridmanager constructs a grid from the information in the input or grid file
We include the linear solver to be used to solve the linear system
```cpp
#include <dumux/linear/amgbackend.hh>
#include <dumux/linear/linearsolvertraits.hh>
```
We include the nonlinear newtons method
```cpp
......@@ -721,7 +722,7 @@ we set the assembler with the time loop because we have an instationary problem.
```
We set the linear solver.
```cpp
using LinearSolver = Dumux::AMGBackend<TypeTag>;
using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>;
auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper());
```
Additionaly, we set the non-linear solver.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment