diff --git a/examples/EnvSetup/EnvSetup.md b/examples/EnvSetup/EnvSetup.md index 7088ef48d5fcfe1c83265d7c6cd06688943f0489..c42f46a1726387caacb77dcef2fd8d117563e169 100644 --- a/examples/EnvSetup/EnvSetup.md +++ b/examples/EnvSetup/EnvSetup.md @@ -1,4 +1,4 @@ -(env_setup)= +(EnvSetup)= # Environment and Project Setup This chapter attempts to briefly explain the necessary steps to get next-gen code generation diff --git a/examples/GeneratorScriptBasics/BasicCodegen.py b/examples/GeneratorScriptBasics/BasicCodegen.py index 3151d551cf0c539ddc00f539967d8e1d52848f22..86ff253100201ffa23ea4aa9b115dc758201d1d5 100644 --- a/examples/GeneratorScriptBasics/BasicCodegen.py +++ b/examples/GeneratorScriptBasics/BasicCodegen.py @@ -1,7 +1,6 @@ from pystencilssfg import SourceFileGenerator with SourceFileGenerator() as sfg: - sfg.include("core/DataTypes.h") + sfg.include("<cstdint>") sfg.namespace("gen") - sfg.code("constexpr walberla::uint_t MAGIC_NUMBER = 0xcafe;") - + sfg.code("constexpr uint64_t MAGIC_NUMBER = 0xcafe;") diff --git a/examples/GeneratorScriptBasics/GeneratorScriptBasics.md b/examples/GeneratorScriptBasics/GeneratorScriptBasics.md index 32b0680cb2f1c82e3b22b1b60e4b9da510ff2ffd..f0577069ae5cf79de01ddeafaf49ca2dd9439178 100644 --- a/examples/GeneratorScriptBasics/GeneratorScriptBasics.md +++ b/examples/GeneratorScriptBasics/GeneratorScriptBasics.md @@ -8,6 +8,9 @@ In the course of this guide, we will - register that script with CMake; - and include the generated files into a simple *Hello World*-like application. +This guide assumes that you already have a CMake project and Python environment correctly +set up, as described in [](EnvSetup). + :::{dropdown} Get The Files {download}`GeneratorScriptBasics.zip </zipped-examples/GeneratorScriptBasics.zip>`. @@ -22,10 +25,11 @@ This example comprises the following files: ## Our First Generator Script -Create and open the file `BasicCodegen.py` and populate it with the following basic code: +Create and open the file `BasicCodegen.py` and populate it with the following code: ```{literalinclude} BasicCodegen.py :caption: BasicCodegen.py +:lineno-start: 1 ``` Let's take this apart. @@ -45,6 +49,7 @@ Create both the `BasicCodegenApp.cpp` and `CMakeLists.txt` files, open up `CMake :::{literalinclude} CMakeLists.txt :language: CMake :caption: CMakeLists.txt +:lineno-start: 1 :emphasize-lines: 4-6 ::: @@ -61,12 +66,13 @@ To observe this, add the following to your `BasicCodegenApp.cpp`: ```{literalinclude} BasicCodegenApp.cpp :caption: BasicCodegenApp.cpp +:lineno-start: 1 ``` Don't worry if your IDE tells you `BasicCodegen.hpp` does not exist yet; the file will be generated in a moment. -Use CMake to build the application `Ex_GeneratorScriptBasics` and run it, and you should see it print `51966` -to stdout. +Use CMake to build the application `Ex_GeneratorScriptBasics` and run it, +and you should see it print `51966` to stdout. Let's take a look at what is happening during the build. Your CMake build output should contain a line somewhat like this: @@ -77,8 +83,8 @@ Generating sfg_sources/gen/Ex_GeneratorScriptBasics/BasicCodegen.hpp, sfg_source This indicates that the generator script was executed and produced exactly two files below the `sfg_sources` directory: - a header file `gen/Ex_GeneratorScriptBasics/BasicCodegen.hpp`, which is the one we included into our application, and -- a source file ``gen/Ex_GeneratorScriptBasics/BasicCodegen.cpp`, which at this time is still empty - because we haven't yet defined any kernels or functions. +- a source file `gen/Ex_GeneratorScriptBasics/BasicCodegen.cpp`, which at this time is still empty + because we haven't defined any kernels or functions yet. The `walberla_generate_sources` CMake command made sure that the `sfg_sources` directory was placed in your target's include path, so you can include the generated files. diff --git a/examples/SimpleK b/examples/SimpleK new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/examples/index.md b/examples/index.md index c0dc6d13d1a5efeca903f4adcd7816b9ada7e7b9..6544b6e6395b65d88f4c04daa1bc84c67759b36a 100644 --- a/examples/index.md +++ b/examples/index.md @@ -12,7 +12,7 @@ This project is still unstable and immature, but growing steadily. Until the next-gen code generators are stabilized and merged with the waLBerla master, setting up a build system and development environment for working with them is slightly more complicated. Since you will need such an environment to follow along with the examples -in this book, start by reading the chapter [](env_setup). +in this book, start by reading the chapter [](EnvSetup). Afterward, you are free to explore the remainder of the book. ## Table of Contents