diff --git a/.buildinfo b/.buildinfo new file mode 100644 index 000000000..2d46e91a6 --- /dev/null +++ b/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file records the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 43e141b2a80358f2f14479b8dd97ab3b +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/_images/graphviz-076766984f34b93a9d82f4bb29530f62cfc702af.png b/_images/graphviz-076766984f34b93a9d82f4bb29530f62cfc702af.png new file mode 100644 index 000000000..97f4dbbfa Binary files /dev/null and b/_images/graphviz-076766984f34b93a9d82f4bb29530f62cfc702af.png differ diff --git a/_images/graphviz-076766984f34b93a9d82f4bb29530f62cfc702af.png.map b/_images/graphviz-076766984f34b93a9d82f4bb29530f62cfc702af.png.map new file mode 100644 index 000000000..e794346f9 --- /dev/null +++ b/_images/graphviz-076766984f34b93a9d82f4bb29530f62cfc702af.png.map @@ -0,0 +1,2 @@ + + diff --git a/_images/graphviz-8034e46f472445428ec0a3908c62f907b47614c3.png b/_images/graphviz-8034e46f472445428ec0a3908c62f907b47614c3.png new file mode 100644 index 000000000..3b6c8883a Binary files /dev/null and b/_images/graphviz-8034e46f472445428ec0a3908c62f907b47614c3.png differ diff --git a/_images/graphviz-8034e46f472445428ec0a3908c62f907b47614c3.png.map b/_images/graphviz-8034e46f472445428ec0a3908c62f907b47614c3.png.map new file mode 100644 index 000000000..807658bd3 --- /dev/null +++ b/_images/graphviz-8034e46f472445428ec0a3908c62f907b47614c3.png.map @@ -0,0 +1,2 @@ + + diff --git a/_images/graphviz-981eacfab8eb2a42215ddeb7564c51358af44bb0.png b/_images/graphviz-981eacfab8eb2a42215ddeb7564c51358af44bb0.png new file mode 100644 index 000000000..459403b57 Binary files /dev/null and b/_images/graphviz-981eacfab8eb2a42215ddeb7564c51358af44bb0.png differ diff --git a/_images/graphviz-981eacfab8eb2a42215ddeb7564c51358af44bb0.png.map b/_images/graphviz-981eacfab8eb2a42215ddeb7564c51358af44bb0.png.map new file mode 100644 index 000000000..c6a81a9b7 --- /dev/null +++ b/_images/graphviz-981eacfab8eb2a42215ddeb7564c51358af44bb0.png.map @@ -0,0 +1,2 @@ + + diff --git a/_images/graphviz-f3da9712e3905cb30d4ae47e7e62c2a1e0fece65.png b/_images/graphviz-f3da9712e3905cb30d4ae47e7e62c2a1e0fece65.png new file mode 100644 index 000000000..ffba694c1 Binary files /dev/null and b/_images/graphviz-f3da9712e3905cb30d4ae47e7e62c2a1e0fece65.png differ diff --git a/_images/graphviz-f3da9712e3905cb30d4ae47e7e62c2a1e0fece65.png.map b/_images/graphviz-f3da9712e3905cb30d4ae47e7e62c2a1e0fece65.png.map new file mode 100644 index 000000000..8be6a309f --- /dev/null +++ b/_images/graphviz-f3da9712e3905cb30d4ae47e7e62c2a1e0fece65.png.map @@ -0,0 +1,2 @@ + + diff --git a/_sources/developer/build.rst.txt b/_sources/developer/build.rst.txt new file mode 100644 index 000000000..1bb4e1ad9 --- /dev/null +++ b/_sources/developer/build.rst.txt @@ -0,0 +1,48 @@ +Building and running the unit tests +=================================== + +x3d2 is in early development phase, and there is no main executable +yet to be built. However, currently implemented functionality is +covered by unit tests, which you can build and run on you development +machine. + +To build x3d2, you will need git, a fortran compiler and CMake, see +:ref:`tooling`. + +Start by configuring the build directory: + +.. code-block:: console + + $ cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug + +To configure the build with the NVIDIA Fortran compiler, you can set +the `FC` environment variable to the compiler executable. If you +specify an relative path, it must be present in your current `PATH`. + +.. code-block:: console + + $ FC=nvfortran cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug + +Setting the Fortran compiler to the NVIDIA Fortran compiler will +automatically include the CUDA Fortran source files into the build +tree, which are ignored by default. + +Once the build directory is configured, the tests can be built and run +as follows: + +.. code-block:: console + + $ cd build + $ make + $ make test + +Note that ``make test`` is only a launcher for the ``ctest`` +executable. By default ``ctest`` does not show the output of test +executables on failure. If one of more tests fail, you probably want +to run the tests with: + +.. code-block:: console + + $ ctest --output-on-failure + +instead of ``make test``. diff --git a/_sources/developer/contributing_guidelines.rst.txt b/_sources/developer/contributing_guidelines.rst.txt new file mode 100644 index 000000000..73c62a3ff --- /dev/null +++ b/_sources/developer/contributing_guidelines.rst.txt @@ -0,0 +1,145 @@ +Contributing guidelines +======================= + +x3d2 is a collaborative project, open to all. In order to enable +effective collaboration, however, we ask that your contribution(s) +comply with a set of ground rules. + +In a nutshell +------------- + +- For any contribution not covered by an existing issue, **open an issue + first**. +- Respect the commit format. (:ref:`Install the git hook! `). +- Only commit changes formatted with `fprettify`, using the project's + configuration. (:ref:`Install the git hook! `). +- Strive to contribute **small and focused Pull Requests with detailed + descriptions**. +- Add (a) unit test(s) covering a new feature, or (a) regression + test(s) for a bug fix. + +Issues first +------------ + +Issues are opened as soon as possible, particularly before any +significant implementation work is carried out or any pull request is +opened. Starting with issues greatly facilitates collaboration: + +- It encourages developers to write (and therefore think) about the + work they plan to achieve. +- It helps maintaining a shared and up to date record of current work + (known bugs, current developments). +- It helps coordination between developers by sign-posting who is + working on what, as well as what is not being worked on. +- It allows discussions between developers on how to best fix the + issue or implement the described improvement(s). + +This doesn't mean that you should forbid yourself from exploratory +prototyping until an issue has been opened. In fact, prototyping is +often helpful to write the content of the issue. On the other hand, +do open an issue before commiting to a particular design or +implementation. + +.. _commit-formatting: + +Format commits accordingly +-------------------------- + +Commits messages are formatted according to the conventional commits +specification (v1.0.0). Commit messages must respect the following +structure:: + + [optional scope]: + + [optional body] + +where `` is one of `fix`, `feat`, `build`, `chore`, `ci`, +`docs`, `style`, `refactor`, `perf` or `test`. + +Breaking changes are specified by adding an `!` before the colon `:`. Example:: + + fix(allocator)!: Return 1D arrays as data blocks + + This is a breaking change because e.g. the allocator used to + return 3D data blocks. + +In addition, commit message header lines must not contain more than 68 +characters. Lines in the commit message body cannot exceed 72 +characters. + +.. note:: + + Commit messages in x3d2 do not use footers as specified in the + conventional commit specs. You are welcome to use footers in your + commit messages, but know that they hold no special place in the + commit format policy. + +A Git hook is provided to prevent you from registering non-conformant +commit messages. See setting up your development environment. + +Fortran code formatting +----------------------- + +Code formatting dictates things like indentation levels, number of +whitespace between operators or use upper/lowercase characters for +keywords. + +Because having to learn such project specific rules isn't terribily +interesting, all Fortran code in x3d2 is formatted automatically using +`fprettify `_. Some non-default +configuraiton options are specified in the project's `.fprettify.ini` +file. + +Note that a a GitHub pull request will not be merged until all the +associated code addtions conform to the formatting. + +The best way to deal with code formatting is to **automate it and +forget about it**. To do so, make sure you install the pre-commit +hook into your local git repository, see . This way, `fprettify` will +run automatically each time you commit new changes. + +Pull requests and code review +------------------------------- + +Code review is a fondamental part of x3d2's collaborative development. +Particularly, GitHub pull requests must be approved by at least two +maintainers before the associated commits are merged. Code review allows for + +- Gatekeeping, by preventing the integration of changes that are not + up to standards, introducing bugs or potentially disruptive to + ongoing and/or future developments. +- Knowledge transfer, by making sure that at least a couple of project + developers have an opportunity to study and understand the code to + be integrated. +- Training, by giving new contributors opportunities to get feedback + and help, as well as chances to review contributions from more + experienced developers. + +Poor quality pull requests can however turn the code review process +into a bottleneck or worse, lead to poor quality reviews. In order to +facilitate the code review process, pull request must be both +**focused and small** and have a **detailed description**. + +1. Pull requests should aim to merge a be coherent body of changes, + targeting a single aspect of an issue. It is much prefereable to + fix an issue through multiple pull requests than one big + contribution. +2. Pull requests should aim to merge a limited number of changes. As + a rule of thumb, pull requests usually become much harder to review + beyond 10 changes. +3. Pull requests should come with a detailed description containing: + + - One or two sentences summing up the motivation for the changes. + - A link to the addressed issue(s). + - A summary of the changes. + - A technical description of the changes. + + The description is important for archiving purposes, but most + importlantl in order to guide the work of reviewers. + +Note that the points above are guidelines as opposed to hard and fast +rules. For a given pull request, the amount of work required to +review the changes will vary across reviewers. Generally, however, +please **empathise with your fellow contributors who are going to spend +time reviewing your code**. Aim to make their work easier, and they +will do the same for you. diff --git a/_sources/developer/contribution_workflow.rst.txt b/_sources/developer/contribution_workflow.rst.txt new file mode 100644 index 000000000..f65ea4cc2 --- /dev/null +++ b/_sources/developer/contribution_workflow.rst.txt @@ -0,0 +1,40 @@ +Overview of the contribution process +==================================== + +The graph below illustrates the general process for contributing code +changes to x3d2: + +.. graphviz:: + + digraph G { + review[shape="diamond", label="Changes approved"] + commit[label="commit changes locally"] + + PR[label="Open/update Pull Request"]; + + Idea -> "Open new issue" -> commit -> PR + PR -> review + review -> merge [label="yes"] + review -> commit [label=" no"] + "Pick existing issue" -> commit + + { + rank=sink; + review; merge + } + } + +Contributions are accepeted in the form of pull requests targeting the +`main` branch on the x3d2 GitHub repository. See `(GitHub docs) +Creating a pull request +`_. + +By default your GitHub account will not be able to push changes to the +x3d2 repo, and you will have to open the pull request from a fork. See +`(GitHub docs) Creating a pull request from a fork +`_. + +Note that the whole process is **driven by issues**. If you found a +bug not currently referenced by an existing issue, or have an idea on +how to improve a part of x3d2, please open a new item on the issue +tracker before opening a pull request. diff --git a/_sources/developer/dev_environment.rst.txt b/_sources/developer/dev_environment.rst.txt new file mode 100644 index 000000000..a2f1034a3 --- /dev/null +++ b/_sources/developer/dev_environment.rst.txt @@ -0,0 +1,35 @@ +.. _devenv-setup: + +Setting up for development +========================== + +0. To begin with, make sure you have the right tools installed by going + through the :ref:`required tooling `. + +1. Download the x3d2 repository from GitHub:: + + $ git clone git@github.com:xcompact3d/x3d2.git + $ cd x3d2/ + + The following commands assume that your shell's current directory is + the root of the `x3d2` repository. + +2. Install the `pre-commit` Git hook into your project-local + configuration:: + + $ cp githooks/pre-commit .git/hooks/ + $ chmod +x .git/hooks/pre-commit + + This Git hook will cause the automatic formatting of all fortran + files staged in your commit, using `fprettify`. + +3. Install the `commit-msg` Git hook into your project-local + configuration:: + + $ cp githooks/commit-msg .git/hooks/ + $ chmod +x .git/hooks/commit-msg + + This Git hook will automatically check your commit message against + the commit message format, based on the conventional commits + specification. See :ref:`the contribution guidelines + `. diff --git a/_sources/developer/index.rst.txt b/_sources/developer/index.rst.txt new file mode 100644 index 000000000..b25996750 --- /dev/null +++ b/_sources/developer/index.rst.txt @@ -0,0 +1,36 @@ +Contributing to x3d2 +==================== + +Fixed a bug? Have an idea for improving x3d2? x3d2 is developed in +the open with a license that allows anyone to: + +- Run the program as they wish, for any purpose. +- Access and study its source code, and making changes to it. +- Redistribute copies (source or binary). +- Distribute copies of your modified versions (source or binary). + +Particularly, we encourage developers to contribute their changes back +to the x3d2 project. The following sections describe the process for +doing so. + +.. toctree:: + :maxdepth: 1 + + contribution_workflow + tooling + dev_environment + build + contributing_guidelines + style + writing_docs + +If you are looking to take part in the project but don't have anything +specific in mind, you could consider: + +- Reporting (a) bug(s), suggest improvement(s) or share a user experience. +- Adding documentation or improving the current one. +- Working on fixing issues or implementing new features. + +In any of the cases above, your entry point should be the `issue +tracker `_ -- either to +pick an existing issue to work on or to create a new one. diff --git a/_sources/developer/style.rst.txt b/_sources/developer/style.rst.txt new file mode 100644 index 000000000..5a8592466 --- /dev/null +++ b/_sources/developer/style.rst.txt @@ -0,0 +1,165 @@ +Fortran style guide +=================== + +Basic formatting +---------------- + +Identation, whitespaces and line length are enforced by `fprettify`. +Project settings are defined in the `.fprettify.ini` located at the +root of the repository. + +In most cases, developers are expected to install the associated +pre-commit git hook. Additionally, it is recommended to configure +your text editor to run fprettify for you (for instance on saving a +file). + +If you want to preview changes without overwriting a file, you can do +so using the `--stdout` option: + +.. code:: console + + $ fprettify --config .fprettify.ini --stdout + +Note: CUDA Fortran chevron syntax is not supported by `fprettify`. +Thus, we use `!&` to deactivate `fprettify` on lines chevron syntax is +used. + +.. code:: fortran + + call gpu_kernel<<>>(args, ...) !& + +Naming conventions +------------------ + +In the following "symbol" is a catch all phrase for variables, +procedures, derived types, type components and interfaces. + +- Symbols are name using the `snake_case` convention. +- Variable declared with the `parameter` are named using UPPER CASE + letters. +- Symbols should, as much as possible, be named after they meaning + rather than their mathematical notation (.e.g `velocity_field` + instead of `u`). + +Procedure definitions +--------------------- + +- Procedure prototypes spanning more than 79 characters should be split + before the first dummy argument is defined, after the opening + parenthese. If the list of dummy arguments spans more than 79 + characters each argument is defined on it own line. + + .. code:: fortran + + subroutine my_long_subroutine( & + argument1, argument3, argument4, argument5, argument5, argument6 & + ) + + subroutine my_very_long_subroutine( & + argument1, & + argument2, & + argument3, & + argument4, & + argument5, & + argument6, & + argument7, & + ) +- Function prototypes indicate the return object type unless the + return object is an array. +- Functions are always defined with the `pure` prefix. A procedure + with side effects must be a `subroutine`. + +Modules +------- + +- Module names end with the `_m` suffix. Examples: + `module allocator_m`, `use allocator_m, only: ...`. +- All module components are `private` by default. +- The module components are always acessed through the `only` keyword: + + .. code:: fortran + + module a_module_m + ! Non compliant + use stencil_m + ! Compliant + use stencil_m, only: stencil_t + +Derived type definitions +------------------------ + +- Derived type names end with the `_t` suffix. Examples: + `allocator_t`, `type(stencil_t) :: s`. +- The `contains` keyword is omitted is the type does not define any + type-bound procedures. +- All type components are `private` by default. + +Custom structure constructors +----------------------------- + +- Are named like `create_[_]` +- Are declared with the `private` attribute +- Are defined at the top of the module's `contains` block. + +Example + +.. code:: fortran + + module square_module + + type :: square_t + real :: size + character(:), allocatable :: color + end type square_t + + interface square_t + module procedure create_square_from_square + module procedure create_square_default_color + end interface square_t + + contains + + type(square_t) function create_square_from_square(sq_in) + type(square), intent(in) :: sq_in + ! ... + end function create_square_from_square + + type(square_t) function create_square_default_color(sq_size) + real, intent(in) :: sq_size + ! ... + end function create_square_default_color + +.. _in-code-docs: + +In-code documentation +--------------------- + +The body of modules, public types, public procedures and public +type-bound methods MUST be preceded of one or more documentation +paragraphs. Optionally, the body of private symbols MAY be +preceded by documentation paragraph. + +Procedure dummy arguments, interface components and type-bound +procedures declarations MAY be documented using an inline comment +either on the same line directly following the statement (using the +docmark `!!`) or on the line directly above the statement (using the +predocmark `!>`). + +x3d2 uses `ford `_ to +extract in-code documentation and generate HTML pages. The syntax for +in-code documentation follows ford's syntax for comments. See +`(ford)Writing documentation +`_ + +.. code:: fortran + + subroutine add(a, b, c) + !! This is the first paragraph of the procedures + !! documentation. Note that it starts with TWO !. + real, intent(in) :: a, b !! Optional documentation for dummy argument. + real, intent(out) :: c !! The result of a + b + + ! The line below is a regular comment. + ! Make use of the well-known the addition algorithm. + c = a + b + end subroutine diff --git a/_sources/developer/tooling.rst.txt b/_sources/developer/tooling.rst.txt new file mode 100644 index 000000000..82b67e974 --- /dev/null +++ b/_sources/developer/tooling.rst.txt @@ -0,0 +1,80 @@ +.. _tooling: + +Required tools +============== + +To contribute to x3d2 you need a few things on your toolbelt + +- A Fortran 2003 compiler (e.g. gfortran) +- The `NVIDA HPC Fortran compiler `_ [optional] +- The CMake build system +- The fprettify auto-formatter +- The FORD and Sphinx documentation generators. + +The above tools can all be installed via you distribution's package +manager or the Python package pamanger `pip`. + +.. note:: + + We strongly recommend to use the `pipx` wrapper around `pip` to + ensure installed Python packages are installed into isolated + virtual environments. + +Fortran compiler +---------------- + +You can get started with the GNU Fortran compiler + +.. code:: console + + $ sudo apt install gfortran + +CMake +----- + +CMake is used to configure the build. This means, among other things, +finding the location of the required compiler and libraries, as well +as resolving the links between different components of the software. + +To configure and build x3d2 you will need CMake version 3.18 and +above. At the time of writing the currently distributed version of +CMake in Debain stable is 3.18, so you should be able to install CMake +from your distribution's package manager, for instance + +.. code:: console + + sudo apt install cmake + +Recent CMake versions are packaged for a variety of package managers, +including `pipx`: + +.. code:: console + + $ pipx install cmake + +fprettify +--------- + +Auto-formatter for fortran 90 and above. + +.. code:: console + + $ pipx install fprettify + +FORD +---- + +Documentation generator for fortran 90 and above. + +.. code:: console + + $ pipx install ford + +Sphinx +------ + +.. code:: console + + $ pipx install sphinx + + diff --git a/_sources/developer/writing_docs.rst.txt b/_sources/developer/writing_docs.rst.txt new file mode 100644 index 000000000..419101365 --- /dev/null +++ b/_sources/developer/writing_docs.rst.txt @@ -0,0 +1,47 @@ +Contributing documentation +========================== + +x3d2 uses both `Sphinx `_ and `ford +`_ for documentation. Sphinx is +used to generate the user and developer guides (i.e. this website). +ford is used to generate the API documentation website by extraction +in-code documentation. + +Building the documentation +-------------------------- + +To build the user and developer docs (Sphinx): + +.. code:: console + + # From the repository root + $ cd docs && make html + +The above command generate hmtl pages in `docs/build/html`. You can +display the user and developer docs by opening +`docs/build/html/index.html` with a web browser. + + +To build the API docs (ford): + +.. code:: console + + # From the repository root + $ ford ford.md -o api_docs + +You can display the API docs by opening `api_docs/index.html` with a +web browser. + +Writing user or developer documentation +--------------------------------------- + +Documentation sources are located under `docs/sources/`. They consist +in a hierachy of reStructuredText files. reStructuredText (rST) is a +light markup language similar to markdown. For an introduction to +rST, see `(Sphinx)ReStructuredText primer +`_. + +In-code documentation +--------------------- + +See :ref:`in-code-docs`. diff --git a/_sources/index.rst.txt b/_sources/index.rst.txt new file mode 100644 index 000000000..452f23943 --- /dev/null +++ b/_sources/index.rst.txt @@ -0,0 +1,21 @@ +.. x3d2 documentation master file, created by + sphinx-quickstart on Mon Feb 27 14:46:56 2023. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +**x3d2** is the current codename for what is to become Xcompact3d +version 2.0. This project is a rewrite of Xcompact3d leading to + +- Improved serial and parallel performance. +- Support for NVIDIA GPU accelerators (using CUDA Fortran). +- Improved modularity and testability. + +Contents: + +.. toctree:: + :maxdepth: 2 + + report_a_bug + internals/index + developer/index + API reference diff --git a/_sources/internals/allocator.rst.txt b/_sources/internals/allocator.rst.txt new file mode 100644 index 000000000..0d6101bbb --- /dev/null +++ b/_sources/internals/allocator.rst.txt @@ -0,0 +1,110 @@ +Memory management +================= + +The parallel processing carried out in x3d2 requires that the +computational domain is sliced into slabs along a specific direction +of space. + +Data slabs (instances of the derived type `slab_t`) hold a pointer to +an `allocator_t` instance that is responsible for the allocation and +dispatching of memory blocks to data slabs. See `(API)allocator_t +`_. Whenever +data slabs are no longer required, the associated memory blocks can be +released to the allocator, ready to be dispatched to other slabs or +objects who might need them. + +An instance of `allocator_t` maintains a linked list of memory blocks, +which each element in the list labelled with a unique identifier: + +.. graphviz:: + + digraph freelist { + rank=LR; + memblock1 [label="memory block\lid: 1"]; + memblock2 [label="memory block\lid: 2"]; + memblock3 [label="memory block\lid: 3"]; + + memblock1 -> memblock2 -> memblock3; + } + +Each memory block is an instance of the `memblock_t` derived type +(`(API)memblock_t +`_). In +addition to its integer identifier, a instance of the `memblock_t` +type holds a 3D data array and a pointer to the next block in the +list. + +All memory blocks in an allocator's list have the same size. An +allocator can be created by passing in the dimension of the memory +blocks: + +.. code:: fortran + + allocator = allocator_t([32 16 32]) + +Given an `allocator_t` instance, memory blocks can requested using the +`get_block` function. + +.. code:: fortran + + use m_allocator, only: memory_block_t, allocator_t + ! ... + type(memory_block_t), pointer :: memblock_ptr + ! .. + ptr => allocator%get_block() + +Note that `get_block` returns a *pointer* to a memory block instead of +a copy. In practice, the head of the block list is detached from the +list (pop operation): + +.. graphviz:: + + digraph allocation { + + memblock1 [label="memory block\lid: 1"]; + memblock2 [label="memory block\lid: 2"]; + memblock3 [label="memory block\lid: 3"]; + ptr [shape=box, label="memblock_ptr"] + + memblock2 -> memblock3; + ptr -> memblock1; + } + +Dispatched memory blocks ban be released to the allocator by calling +the `release_block` subroutine: + +.. code:: fortran + + ! Request two blocks and release the first one, which becomes the + ! head of the free block list + ptr1 => allocator%get_block() + ptr2 => allocator%get_block() + call allocator%release_block(ptr1) + +Released blocks are pushed on top of the allocator's free blocks list: + +.. graphviz:: + + digraph release { + + memblock1 [label="memory block\lid: 1"]; + memblock2 [label="memory block\lid: 2"]; + memblock3 [label="memory block\lid: 3"]; + ptr1 [shape=box] + ptr2 [shape=box] + null [shape=box] + + memblock1 -> memblock3; + ptr2 -> memblock2; + ptr1 -> null + } + +Memory block allocation +----------------------- + +If a request is made to an allocator whose free block list is empty, a +new block is allocated before it is immediately dispacted to the +requesting object. As a consequence the memory footprint of a program +is expected to grow in early stages of a program's lifetime, before +reaching maximum where enough memory has been allocated and some can +be reused. diff --git a/_sources/internals/index.rst.txt b/_sources/internals/index.rst.txt new file mode 100644 index 000000000..f13bb806e --- /dev/null +++ b/_sources/internals/index.rst.txt @@ -0,0 +1,13 @@ +Internals +========= + +The following section describe various internals of the library. They +are aimed at developers willing to learn about the algorithmns and +data structures used, or users curious about how things are +implemented. + +.. toctree:: + :maxdepth: 1 + + momentum_rhs_calculation.rst + allocator.rst diff --git a/_sources/internals/momentum_rhs_calculation.rst.txt b/_sources/internals/momentum_rhs_calculation.rst.txt new file mode 100644 index 000000000..2642055d7 --- /dev/null +++ b/_sources/internals/momentum_rhs_calculation.rst.txt @@ -0,0 +1,88 @@ +Computing the spatial contribution to the momentum equation +=========================================================== + +The first stage of solving the momentum equation at a given time-step +:math:`k` is to evaluate the spatial contribution + +.. math:: + :label: rhs + + \mathbf{F}^k = - \frac{1}{2}[\nabla (\mathbf{u}^k \otimes \mathbf{u}^k) + + (\mathbf{u}^k \cdot \nabla) \mathbf{u}^k] + \nu \nabla^2\mathbf{u}^k + +This term involves spatial derivatives along the three directions +:math:`\hat{\mathbf{x}}`, :math:`\hat{\mathbf{y}}` and +:math:`\hat{\mathbf{z}}`. In order to reduce the number of +communications between MPI processes, the computation is performed in +three stages corresponding to three different data configurations: + +- In the x-configuration, the process has access to a data slab + covering the x-y plane. This a 1D domain decomposition along the + :math:`\hat{\mathbf{z}}` direction. Derivatives along + :math:`\hat{\mathbf{x}}` can be computed without communications. +- In the z-configuration, a process has access to a data slab + covering the y-z plane. This a 1D domain decomposition along the + :math:`\hat{\mathbf{x}}` direction. Derivatives along + :math:`\hat{\mathbf{z}}` can be computed without communications. +- In the y-configuration, a process has access to a data slab + covering the x-y plane. This a 1D domain decomposition along the + :math:`\hat{\mathbf{z}}` direction. Derivatives along + :math:`\hat{\mathbf{y}}` can be computed without communications. + +In the i-configuration, field data (e.g. the x-component of the +velocity field) is stored in a three-dimensional array of dimension +``dimension(SZ, N, M)`` where ``N`` is the size of the domain in the i +direction. This data layout decomposes slab data into ``M * SZ`` ` 1D +arrays (called pencils) of size ``N``. Pencils are processed in +batches of size ``SZ`` allowing for vectorised operations. + +The algorithm for computing :math:numref:`rhs` then becomes: + +.. code:: fortran + + ! Instances of type slab_t have access to slab data + ! and can compute derivatives and contributions to + ! momentum equation along a specific direction. + type(slab_t) :: xslab, yslab, zslab + + ! ... + + ! Perform necesseary communications across processes + ! asynchonously + call async_rotate_x_to_z(xslab, z_comm_buffer) + + ! Meanwhile, compute the contribution in the x direction + x_contrib = x_slab%transport() + + ! Assuming x to z transfer is done, arrange field data + ! in the correct z-configuration layout and compute + ! z contribution + call from_comms_buffer(z_comm_buffer, z_slab) + z_dir_contrib = z_slab%transport() + + ! Transfer the result back + call async_rotate_z_to_x(z_dir_contrib, x_slab_z) + + ! Meanwhile, switch from x-config to y-config + ! (no communications needed, only data reshuffling) + call rotate_x_to_y(x_slab, y_slab) + y_dir_contrib = yslab%transport() + + F = x_dir_contrib%data + y_dir_contrib%data + z_dir_contrib%data + +The ``slab3d_t`` type +--------------------- + +Computation of :math:numref:`rhs` is supported by instances of the +``slab3d_t`` derived type. These hold data for the three components +of a 3D vector in 3D space (thinks :math:`u_x`, :math:`u_y` and +:math:`u_z`) within a single data slab in the x, y or z- + +The purpose of ``slab3d_t`` instances is to compute spatial +derivatives along a given direction referred to as the slab's primary +direction. More precisely, user code is given access to type-bound +procedures such as ``transport`` or ``divergence`` which compute +contributions to physical quantities coming from spatial derivatives +in the slab's primary direction. + +For more details, see the API docs. diff --git a/_sources/report_a_bug.rst.txt b/_sources/report_a_bug.rst.txt new file mode 100644 index 000000000..d50b87007 --- /dev/null +++ b/_sources/report_a_bug.rst.txt @@ -0,0 +1,11 @@ +Report a bug +============ + +You can do so by adding a new issue to the x3d2 issue tracker on +GitHub. See `(GitHub docs) Creating an issue `_. + +If you are reporting a bug, be sure to include + +- The version of x3d2 you are using +- Information about your operating system. +- Every information required to reproduce the bug (e.g. input files). diff --git a/_static/alabaster.css b/_static/alabaster.css new file mode 100644 index 000000000..7e75bf8f9 --- /dev/null +++ b/_static/alabaster.css @@ -0,0 +1,663 @@ +/* -- page layout ----------------------------------------------------------- */ + +body { + font-family: Georgia, serif; + font-size: 17px; + background-color: #fff; + color: #000; + margin: 0; + padding: 0; +} + + +div.document { + width: 940px; + margin: 30px auto 0 auto; +} + +div.documentwrapper { + float: left; + width: 100%; +} + +div.bodywrapper { + margin: 0 0 0 220px; +} + +div.sphinxsidebar { + width: 220px; + font-size: 14px; + line-height: 1.5; +} + +hr { + border: 1px solid #B1B4B6; +} + +div.body { + background-color: #fff; + color: #3E4349; + padding: 0 30px 0 30px; +} + +div.body > .section { + text-align: left; +} + +div.footer { + width: 940px; + margin: 20px auto 30px auto; + font-size: 14px; + color: #888; + text-align: right; +} + +div.footer a { + color: #888; +} + +p.caption { + font-family: inherit; + font-size: inherit; +} + + +div.relations { + display: none; +} + + +div.sphinxsidebar { + max-height: 100%; + overflow-y: auto; +} + +div.sphinxsidebar a { + color: #444; + text-decoration: none; + border-bottom: 1px dotted #999; +} + +div.sphinxsidebar a:hover { + border-bottom: 1px solid #999; +} + +div.sphinxsidebarwrapper { + padding: 18px 10px; +} + +div.sphinxsidebarwrapper p.logo { + padding: 0; + margin: -10px 0 0 0px; + text-align: center; +} + +div.sphinxsidebarwrapper h1.logo { + margin-top: -10px; + text-align: center; + margin-bottom: 5px; + text-align: left; +} + +div.sphinxsidebarwrapper h1.logo-name { + margin-top: 0px; +} + +div.sphinxsidebarwrapper p.blurb { + margin-top: 0; + font-style: normal; +} + +div.sphinxsidebar h3, +div.sphinxsidebar h4 { + font-family: Georgia, serif; + color: #444; + font-size: 24px; + font-weight: normal; + margin: 0 0 5px 0; + padding: 0; +} + +div.sphinxsidebar h4 { + font-size: 20px; +} + +div.sphinxsidebar h3 a { + color: #444; +} + +div.sphinxsidebar p.logo a, +div.sphinxsidebar h3 a, +div.sphinxsidebar p.logo a:hover, +div.sphinxsidebar h3 a:hover { + border: none; +} + +div.sphinxsidebar p { + color: #555; + margin: 10px 0; +} + +div.sphinxsidebar ul { + margin: 10px 0; + padding: 0; + color: #000; +} + +div.sphinxsidebar ul li.toctree-l1 > a { + font-size: 120%; +} + +div.sphinxsidebar ul li.toctree-l2 > a { + font-size: 110%; +} + +div.sphinxsidebar input { + border: 1px solid #CCC; + font-family: Georgia, serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox { + margin: 1em 0; +} + +div.sphinxsidebar .search > div { + display: table-cell; +} + +div.sphinxsidebar hr { + border: none; + height: 1px; + color: #AAA; + background: #AAA; + + text-align: left; + margin-left: 0; + width: 50%; +} + +div.sphinxsidebar .badge { + border-bottom: none; +} + +div.sphinxsidebar .badge:hover { + border-bottom: none; +} + +/* To address an issue with donation coming after search */ +div.sphinxsidebar h3.donation { + margin-top: 10px; +} + +/* -- body styles ----------------------------------------------------------- */ + +a { + color: #004B6B; + text-decoration: underline; +} + +a:hover { + color: #6D4100; + text-decoration: underline; +} + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: Georgia, serif; + font-weight: normal; + margin: 30px 0px 10px 0px; + padding: 0; +} + +div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } +div.body h2 { font-size: 180%; } +div.body h3 { font-size: 150%; } +div.body h4 { font-size: 130%; } +div.body h5 { font-size: 100%; } +div.body h6 { font-size: 100%; } + +a.headerlink { + color: #DDD; + padding: 0 4px; + text-decoration: none; +} + +a.headerlink:hover { + color: #444; + background: #EAEAEA; +} + +div.body p, div.body dd, div.body li { + line-height: 1.4em; +} + +div.admonition { + margin: 20px 0px; + padding: 10px 30px; + background-color: #EEE; + border: 1px solid #CCC; +} + +div.admonition tt.xref, div.admonition code.xref, div.admonition a tt { + background-color: #FBFBFB; + border-bottom: 1px solid #fafafa; +} + +div.admonition p.admonition-title { + font-family: Georgia, serif; + font-weight: normal; + font-size: 24px; + margin: 0 0 10px 0; + padding: 0; + line-height: 1; +} + +div.admonition p.last { + margin-bottom: 0; +} + +dt:target, .highlight { + background: #FAF3E8; +} + +div.warning { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.danger { + background-color: #FCC; + border: 1px solid #FAA; + -moz-box-shadow: 2px 2px 4px #D52C2C; + -webkit-box-shadow: 2px 2px 4px #D52C2C; + box-shadow: 2px 2px 4px #D52C2C; +} + +div.error { + background-color: #FCC; + border: 1px solid #FAA; + -moz-box-shadow: 2px 2px 4px #D52C2C; + -webkit-box-shadow: 2px 2px 4px #D52C2C; + box-shadow: 2px 2px 4px #D52C2C; +} + +div.caution { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.attention { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.important { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.note { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.tip { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.hint { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.seealso { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.topic { + background-color: #EEE; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +pre, tt, code { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; + font-size: 0.9em; +} + +.hll { + background-color: #FFC; + margin: 0 -12px; + padding: 0 12px; + display: block; +} + +img.screenshot { +} + +tt.descname, tt.descclassname, code.descname, code.descclassname { + font-size: 0.95em; +} + +tt.descname, code.descname { + padding-right: 0.08em; +} + +img.screenshot { + -moz-box-shadow: 2px 2px 4px #EEE; + -webkit-box-shadow: 2px 2px 4px #EEE; + box-shadow: 2px 2px 4px #EEE; +} + +table.docutils { + border: 1px solid #888; + -moz-box-shadow: 2px 2px 4px #EEE; + -webkit-box-shadow: 2px 2px 4px #EEE; + box-shadow: 2px 2px 4px #EEE; +} + +table.docutils td, table.docutils th { + border: 1px solid #888; + padding: 0.25em 0.7em; +} + +table.field-list, table.footnote { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} + +table.footnote { + margin: 15px 0; + width: 100%; + border: 1px solid #EEE; + background: #FDFDFD; + font-size: 0.9em; +} + +table.footnote + table.footnote { + margin-top: -15px; + border-top: none; +} + +table.field-list th { + padding: 0 0.8em 0 0; +} + +table.field-list td { + padding: 0; +} + +table.field-list p { + margin-bottom: 0.8em; +} + +/* Cloned from + * https://github.com/sphinx-doc/sphinx/commit/ef60dbfce09286b20b7385333d63a60321784e68 + */ +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +table.footnote td.label { + width: .1px; + padding: 0.3em 0 0.3em 0.5em; +} + +table.footnote td { + padding: 0.3em 0.5em; +} + +dl { + margin-left: 0; + margin-right: 0; + margin-top: 0; + padding: 0; +} + +dl dd { + margin-left: 30px; +} + +blockquote { + margin: 0 0 0 30px; + padding: 0; +} + +ul, ol { + /* Matches the 30px from the narrow-screen "li > ul" selector below */ + margin: 10px 0 10px 30px; + padding: 0; +} + +pre { + background: unset; + padding: 7px 30px; + margin: 15px 0px; + line-height: 1.3em; +} + +div.viewcode-block:target { + background: #ffd; +} + +dl pre, blockquote pre, li pre { + margin-left: 0; + padding-left: 30px; +} + +tt, code { + background-color: #ecf0f3; + color: #222; + /* padding: 1px 2px; */ +} + +tt.xref, code.xref, a tt { + background-color: #FBFBFB; + border-bottom: 1px solid #fff; +} + +a.reference { + text-decoration: none; + border-bottom: 1px dotted #004B6B; +} + +a.reference:hover { + border-bottom: 1px solid #6D4100; +} + +/* Don't put an underline on images */ +a.image-reference, a.image-reference:hover { + border-bottom: none; +} + +a.footnote-reference { + text-decoration: none; + font-size: 0.7em; + vertical-align: top; + border-bottom: 1px dotted #004B6B; +} + +a.footnote-reference:hover { + border-bottom: 1px solid #6D4100; +} + +a:hover tt, a:hover code { + background: #EEE; +} + +@media screen and (max-width: 940px) { + + body { + margin: 0; + padding: 20px 30px; + } + + div.documentwrapper { + float: none; + background: #fff; + margin-left: 0; + margin-top: 0; + margin-right: 0; + margin-bottom: 0; + } + + div.sphinxsidebar { + display: block; + float: none; + width: unset; + margin: 50px -30px -20px -30px; + padding: 10px 20px; + background: #333; + color: #FFF; + } + + div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, + div.sphinxsidebar h3 a { + color: #fff; + } + + div.sphinxsidebar a { + color: #AAA; + } + + div.sphinxsidebar p.logo { + display: none; + } + + div.document { + width: 100%; + margin: 0; + } + + div.footer { + display: none; + } + + div.bodywrapper { + margin: 0; + } + + div.body { + min-height: 0; + min-width: auto; /* fixes width on small screens, breaks .hll */ + padding: 0; + } + + .hll { + /* "fixes" the breakage */ + width: max-content; + } + + .rtd_doc_footer { + display: none; + } + + .document { + width: auto; + } + + .footer { + width: auto; + } + + .github { + display: none; + } + + ul { + margin-left: 0; + } + + li > ul { + /* Matches the 30px from the "ul, ol" selector above */ + margin-left: 30px; + } +} + + +/* misc. */ + +.revsys-inline { + display: none!important; +} + +/* Hide ugly table cell borders in ..bibliography:: directive output */ +table.docutils.citation, table.docutils.citation td, table.docutils.citation th { + border: none; + /* Below needed in some edge cases; if not applied, bottom shadows appear */ + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} + + +/* relbar */ + +.related { + line-height: 30px; + width: 100%; + font-size: 0.9rem; +} + +.related.top { + border-bottom: 1px solid #EEE; + margin-bottom: 20px; +} + +.related.bottom { + border-top: 1px solid #EEE; +} + +.related ul { + padding: 0; + margin: 0; + list-style: none; +} + +.related li { + display: inline; +} + +nav#rellinks { + float: right; +} + +nav#rellinks li+li:before { + content: "|"; +} + +nav#breadcrumbs li+li:before { + content: "\00BB"; +} + +/* Hide certain items when printing */ +@media print { + div.related { + display: none; + } +} + +img.github { + position: absolute; + top: 0; + border: 0; + right: 0; +} \ No newline at end of file diff --git a/_static/basic.css b/_static/basic.css new file mode 100644 index 000000000..d9846dacb --- /dev/null +++ b/_static/basic.css @@ -0,0 +1,914 @@ +/* + * Sphinx stylesheet -- basic theme. + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +div.section::after { + display: block; + content: ''; + clear: left; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin-top: 10px; +} + +ul.search li { + padding: 5px 0; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li p.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: inherit; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +a:visited { + color: #551A8B; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, figure.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, figure.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, figure.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +img.align-default, figure.align-default, .figure.align-default { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-default { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar, +aside.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px; + background-color: #ffe; + width: 40%; + float: right; + clear: right; + overflow-x: auto; +} + +p.sidebar-title { + font-weight: bold; +} + +nav.contents, +aside.topic, +div.admonition, div.topic, blockquote { + clear: left; +} + +/* -- topics ---------------------------------------------------------------- */ + +nav.contents, +aside.topic, +div.topic { + border: 1px solid #ccc; + padding: 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- content of sidebars/topics/admonitions -------------------------------- */ + +div.sidebar > :last-child, +aside.sidebar > :last-child, +nav.contents > :last-child, +aside.topic > :last-child, +div.topic > :last-child, +div.admonition > :last-child { + margin-bottom: 0; +} + +div.sidebar::after, +aside.sidebar::after, +nav.contents::after, +aside.topic::after, +div.topic::after, +div.admonition::after, +blockquote::after { + display: block; + content: ''; + clear: both; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + margin-top: 10px; + margin-bottom: 10px; + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table.align-default { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +th > :first-child, +td > :first-child { + margin-top: 0px; +} + +th > :last-child, +td > :last-child { + margin-bottom: 0px; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure, figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption, figcaption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number, +figcaption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text, +figcaption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist { + margin: 1em 0; +} + +table.hlist td { + vertical-align: top; +} + +/* -- object description styles --------------------------------------------- */ + +.sig { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; +} + +.sig-name, code.descname { + background-color: transparent; + font-weight: bold; +} + +.sig-name { + font-size: 1.1em; +} + +code.descname { + font-size: 1.2em; +} + +.sig-prename, code.descclassname { + background-color: transparent; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.sig-param.n { + font-style: italic; +} + +/* C++ specific styling */ + +.sig-inline.c-texpr, +.sig-inline.cpp-texpr { + font-family: unset; +} + +.sig.c .k, .sig.c .kt, +.sig.cpp .k, .sig.cpp .kt { + color: #0033B3; +} + +.sig.c .m, +.sig.cpp .m { + color: #1750EB; +} + +.sig.c .s, .sig.c .sc, +.sig.cpp .s, .sig.cpp .sc { + color: #067D17; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +:not(li) > ol > li:first-child > :first-child, +:not(li) > ul > li:first-child > :first-child { + margin-top: 0px; +} + +:not(li) > ol > li:last-child > :last-child, +:not(li) > ul > li:last-child > :last-child { + margin-bottom: 0px; +} + +ol.simple ol p, +ol.simple ul p, +ul.simple ol p, +ul.simple ul p { + margin-top: 0; +} + +ol.simple > li:not(:first-child) > p, +ul.simple > li:not(:first-child) > p { + margin-top: 0; +} + +ol.simple p, +ul.simple p { + margin-bottom: 0; +} + +aside.footnote > span, +div.citation > span { + float: left; +} +aside.footnote > span:last-of-type, +div.citation > span:last-of-type { + padding-right: 0.5em; +} +aside.footnote > p { + margin-left: 2em; +} +div.citation > p { + margin-left: 4em; +} +aside.footnote > p:last-of-type, +div.citation > p:last-of-type { + margin-bottom: 0em; +} +aside.footnote > p:last-of-type:after, +div.citation > p:last-of-type:after { + content: ""; + clear: both; +} + +dl.field-list { + display: grid; + grid-template-columns: fit-content(30%) auto; +} + +dl.field-list > dt { + font-weight: bold; + word-break: break-word; + padding-left: 0.5em; + padding-right: 5px; +} + +dl.field-list > dd { + padding-left: 0.5em; + margin-top: 0em; + margin-left: 0em; + margin-bottom: 0em; +} + +dl { + margin-bottom: 15px; +} + +dd > :first-child { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +.sig dd { + margin-top: 0px; + margin-bottom: 0px; +} + +.sig dl { + margin-top: 0px; + margin-bottom: 0px; +} + +dl > dd:last-child, +dl > dd:last-child > :last-child { + margin-bottom: 0; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +.classifier:before { + font-style: normal; + margin: 0 0.5em; + content: ":"; + display: inline-block; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +.translated { + background-color: rgba(207, 255, 207, 0.2) +} + +.untranslated { + background-color: rgba(255, 207, 207, 0.2) +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +pre, div[class*="highlight-"] { + clear: both; +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; + white-space: nowrap; +} + +div[class*="highlight-"] { + margin: 1em 0; +} + +td.linenos pre { + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + display: block; +} + +table.highlighttable tbody { + display: block; +} + +table.highlighttable tr { + display: flex; +} + +table.highlighttable td { + margin: 0; + padding: 0; +} + +table.highlighttable td.linenos { + padding-right: 0.5em; +} + +table.highlighttable td.code { + flex: 1; + overflow: hidden; +} + +.highlight .hll { + display: block; +} + +div.highlight pre, +table.highlighttable pre { + margin: 0; +} + +div.code-block-caption + div { + margin-top: 0; +} + +div.code-block-caption { + margin-top: 1em; + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +table.highlighttable td.linenos, +span.linenos, +div.highlight span.gp { /* gp: Generic.Prompt */ + user-select: none; + -webkit-user-select: text; /* Safari fallback only */ + -webkit-user-select: none; /* Chrome/Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+ */ +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + margin: 1em 0; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: absolute; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/_static/custom.css b/_static/custom.css new file mode 100644 index 000000000..2a924f1d6 --- /dev/null +++ b/_static/custom.css @@ -0,0 +1 @@ +/* This file intentionally left blank. */ diff --git a/_static/doctools.js b/_static/doctools.js new file mode 100644 index 000000000..0398ebb9f --- /dev/null +++ b/_static/doctools.js @@ -0,0 +1,149 @@ +/* + * Base JavaScript utilities for all Sphinx HTML documentation. + */ +"use strict"; + +const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ + "TEXTAREA", + "INPUT", + "SELECT", + "BUTTON", +]); + +const _ready = (callback) => { + if (document.readyState !== "loading") { + callback(); + } else { + document.addEventListener("DOMContentLoaded", callback); + } +}; + +/** + * Small JavaScript module for the documentation. + */ +const Documentation = { + init: () => { + Documentation.initDomainIndexTable(); + Documentation.initOnKeyListeners(); + }, + + /** + * i18n support + */ + TRANSLATIONS: {}, + PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), + LOCALE: "unknown", + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext: (string) => { + const translated = Documentation.TRANSLATIONS[string]; + switch (typeof translated) { + case "undefined": + return string; // no translation + case "string": + return translated; // translation exists + default: + return translated[0]; // (singular, plural) translation tuple exists + } + }, + + ngettext: (singular, plural, n) => { + const translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated !== "undefined") + return translated[Documentation.PLURAL_EXPR(n)]; + return n === 1 ? singular : plural; + }, + + addTranslations: (catalog) => { + Object.assign(Documentation.TRANSLATIONS, catalog.messages); + Documentation.PLURAL_EXPR = new Function( + "n", + `return (${catalog.plural_expr})` + ); + Documentation.LOCALE = catalog.locale; + }, + + /** + * helper function to focus on search bar + */ + focusSearchBar: () => { + document.querySelectorAll("input[name=q]")[0]?.focus(); + }, + + /** + * Initialise the domain index toggle buttons + */ + initDomainIndexTable: () => { + const toggler = (el) => { + const idNumber = el.id.substr(7); + const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); + if (el.src.substr(-9) === "minus.png") { + el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; + toggledRows.forEach((el) => (el.style.display = "none")); + } else { + el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; + toggledRows.forEach((el) => (el.style.display = "")); + } + }; + + const togglerElements = document.querySelectorAll("img.toggler"); + togglerElements.forEach((el) => + el.addEventListener("click", (event) => toggler(event.currentTarget)) + ); + togglerElements.forEach((el) => (el.style.display = "")); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); + }, + + initOnKeyListeners: () => { + // only install a listener if it is really needed + if ( + !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && + !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS + ) + return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.altKey || event.ctrlKey || event.metaKey) return; + + if (!event.shiftKey) { + switch (event.key) { + case "ArrowLeft": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const prevLink = document.querySelector('link[rel="prev"]'); + if (prevLink && prevLink.href) { + window.location.href = prevLink.href; + event.preventDefault(); + } + break; + case "ArrowRight": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const nextLink = document.querySelector('link[rel="next"]'); + if (nextLink && nextLink.href) { + window.location.href = nextLink.href; + event.preventDefault(); + } + break; + } + } + + // some keyboard layouts may need Shift to get / + switch (event.key) { + case "/": + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; + Documentation.focusSearchBar(); + event.preventDefault(); + } + }); + }, +}; + +// quick alias for translations +const _ = Documentation.gettext; + +_ready(Documentation.init); diff --git a/_static/documentation_options.js b/_static/documentation_options.js new file mode 100644 index 000000000..7e4c114f2 --- /dev/null +++ b/_static/documentation_options.js @@ -0,0 +1,13 @@ +const DOCUMENTATION_OPTIONS = { + VERSION: '', + LANGUAGE: 'en', + COLLAPSE_INDEX: false, + BUILDER: 'html', + FILE_SUFFIX: '.html', + LINK_SUFFIX: '.html', + HAS_SOURCE: true, + SOURCELINK_SUFFIX: '.txt', + NAVIGATION_WITH_KEYS: false, + SHOW_SEARCH_SUMMARY: true, + ENABLE_SEARCH_SHORTCUTS: true, +}; \ No newline at end of file diff --git a/_static/file.png b/_static/file.png new file mode 100644 index 000000000..a858a410e Binary files /dev/null and b/_static/file.png differ diff --git a/_static/github-banner.svg b/_static/github-banner.svg new file mode 100644 index 000000000..c47d9dc0c --- /dev/null +++ b/_static/github-banner.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/_static/graphviz.css b/_static/graphviz.css new file mode 100644 index 000000000..30f3837b6 --- /dev/null +++ b/_static/graphviz.css @@ -0,0 +1,12 @@ +/* + * Sphinx stylesheet -- graphviz extension. + */ + +img.graphviz { + border: 0; + max-width: 100%; +} + +object.graphviz { + max-width: 100%; +} diff --git a/_static/language_data.js b/_static/language_data.js new file mode 100644 index 000000000..c7fe6c6fa --- /dev/null +++ b/_static/language_data.js @@ -0,0 +1,192 @@ +/* + * This script contains the language-specific data used by searchtools.js, + * namely the list of stopwords, stemmer, scorer and splitter. + */ + +var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; + + +/* Non-minified version is copied as a separate JS file, if available */ + +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} + diff --git a/_static/minus.png b/_static/minus.png new file mode 100644 index 000000000..d96755fda Binary files /dev/null and b/_static/minus.png differ diff --git a/_static/plus.png b/_static/plus.png new file mode 100644 index 000000000..7107cec93 Binary files /dev/null and b/_static/plus.png differ diff --git a/_static/pygments.css b/_static/pygments.css new file mode 100644 index 000000000..9392ddcb4 --- /dev/null +++ b/_static/pygments.css @@ -0,0 +1,84 @@ +pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #f8f8f8; } +.highlight .c { color: #8F5902; font-style: italic } /* Comment */ +.highlight .err { color: #A40000; border: 1px solid #EF2929 } /* Error */ +.highlight .g { color: #000 } /* Generic */ +.highlight .k { color: #004461; font-weight: bold } /* Keyword */ +.highlight .l { color: #000 } /* Literal */ +.highlight .n { color: #000 } /* Name */ +.highlight .o { color: #582800 } /* Operator */ +.highlight .x { color: #000 } /* Other */ +.highlight .p { color: #000; font-weight: bold } /* Punctuation */ +.highlight .ch { color: #8F5902; font-style: italic } /* Comment.Hashbang */ +.highlight .cm { color: #8F5902; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #8F5902 } /* Comment.Preproc */ +.highlight .cpf { color: #8F5902; font-style: italic } /* Comment.PreprocFile */ +.highlight .c1 { color: #8F5902; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #8F5902; font-style: italic } /* Comment.Special */ +.highlight .gd { color: #A40000 } /* Generic.Deleted */ +.highlight .ge { color: #000; font-style: italic } /* Generic.Emph */ +.highlight .ges { color: #000 } /* Generic.EmphStrong */ +.highlight .gr { color: #EF2929 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #888 } /* Generic.Output */ +.highlight .gp { color: #745334 } /* Generic.Prompt */ +.highlight .gs { color: #000; font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #A40000; font-weight: bold } /* Generic.Traceback */ +.highlight .kc { color: #004461; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #004461; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #004461; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #004461; font-weight: bold } /* Keyword.Pseudo */ +.highlight .kr { color: #004461; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #004461; font-weight: bold } /* Keyword.Type */ +.highlight .ld { color: #000 } /* Literal.Date */ +.highlight .m { color: #900 } /* Literal.Number */ +.highlight .s { color: #4E9A06 } /* Literal.String */ +.highlight .na { color: #C4A000 } /* Name.Attribute */ +.highlight .nb { color: #004461 } /* Name.Builtin */ +.highlight .nc { color: #000 } /* Name.Class */ +.highlight .no { color: #000 } /* Name.Constant */ +.highlight .nd { color: #888 } /* Name.Decorator */ +.highlight .ni { color: #CE5C00 } /* Name.Entity */ +.highlight .ne { color: #C00; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #000 } /* Name.Function */ +.highlight .nl { color: #F57900 } /* Name.Label */ +.highlight .nn { color: #000 } /* Name.Namespace */ +.highlight .nx { color: #000 } /* Name.Other */ +.highlight .py { color: #000 } /* Name.Property */ +.highlight .nt { color: #004461; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #000 } /* Name.Variable */ +.highlight .ow { color: #004461; font-weight: bold } /* Operator.Word */ +.highlight .pm { color: #000; font-weight: bold } /* Punctuation.Marker */ +.highlight .w { color: #F8F8F8 } /* Text.Whitespace */ +.highlight .mb { color: #900 } /* Literal.Number.Bin */ +.highlight .mf { color: #900 } /* Literal.Number.Float */ +.highlight .mh { color: #900 } /* Literal.Number.Hex */ +.highlight .mi { color: #900 } /* Literal.Number.Integer */ +.highlight .mo { color: #900 } /* Literal.Number.Oct */ +.highlight .sa { color: #4E9A06 } /* Literal.String.Affix */ +.highlight .sb { color: #4E9A06 } /* Literal.String.Backtick */ +.highlight .sc { color: #4E9A06 } /* Literal.String.Char */ +.highlight .dl { color: #4E9A06 } /* Literal.String.Delimiter */ +.highlight .sd { color: #8F5902; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #4E9A06 } /* Literal.String.Double */ +.highlight .se { color: #4E9A06 } /* Literal.String.Escape */ +.highlight .sh { color: #4E9A06 } /* Literal.String.Heredoc */ +.highlight .si { color: #4E9A06 } /* Literal.String.Interpol */ +.highlight .sx { color: #4E9A06 } /* Literal.String.Other */ +.highlight .sr { color: #4E9A06 } /* Literal.String.Regex */ +.highlight .s1 { color: #4E9A06 } /* Literal.String.Single */ +.highlight .ss { color: #4E9A06 } /* Literal.String.Symbol */ +.highlight .bp { color: #3465A4 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #000 } /* Name.Function.Magic */ +.highlight .vc { color: #000 } /* Name.Variable.Class */ +.highlight .vg { color: #000 } /* Name.Variable.Global */ +.highlight .vi { color: #000 } /* Name.Variable.Instance */ +.highlight .vm { color: #000 } /* Name.Variable.Magic */ +.highlight .il { color: #900 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/_static/searchtools.js b/_static/searchtools.js new file mode 100644 index 000000000..2c774d17a --- /dev/null +++ b/_static/searchtools.js @@ -0,0 +1,632 @@ +/* + * Sphinx JavaScript utilities for the full-text search. + */ +"use strict"; + +/** + * Simple result scoring code. + */ +if (typeof Scorer === "undefined") { + var Scorer = { + // Implement the following function to further tweak the score for each result + // The function takes a result array [docname, title, anchor, descr, score, filename] + // and returns the new score. + /* + score: result => { + const [docname, title, anchor, descr, score, filename, kind] = result + return score + }, + */ + + // query matches the full name of an object + objNameMatch: 11, + // or matches in the last dotted part of the object name + objPartialMatch: 6, + // Additive scores depending on the priority of the object + objPrio: { + 0: 15, // used to be importantResults + 1: 5, // used to be objectResults + 2: -5, // used to be unimportantResults + }, + // Used when the priority is not in the mapping. + objPrioDefault: 0, + + // query found in title + title: 15, + partialTitle: 7, + // query found in terms + term: 5, + partialTerm: 2, + }; +} + +// Global search result kind enum, used by themes to style search results. +class SearchResultKind { + static get index() { return "index"; } + static get object() { return "object"; } + static get text() { return "text"; } + static get title() { return "title"; } +} + +const _removeChildren = (element) => { + while (element && element.lastChild) element.removeChild(element.lastChild); +}; + +/** + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping + */ +const _escapeRegExp = (string) => + string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string + +const _displayItem = (item, searchTerms, highlightTerms) => { + const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; + const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; + const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; + const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + const contentRoot = document.documentElement.dataset.content_root; + + const [docName, title, anchor, descr, score, _filename, kind] = item; + + let listItem = document.createElement("li"); + // Add a class representing the item's type: + // can be used by a theme's CSS selector for styling + // See SearchResultKind for the class names. + listItem.classList.add(`kind-${kind}`); + let requestUrl; + let linkUrl; + if (docBuilder === "dirhtml") { + // dirhtml builder + let dirname = docName + "/"; + if (dirname.match(/\/index\/$/)) + dirname = dirname.substring(0, dirname.length - 6); + else if (dirname === "index/") dirname = ""; + requestUrl = contentRoot + dirname; + linkUrl = requestUrl; + } else { + // normal html builders + requestUrl = contentRoot + docName + docFileSuffix; + linkUrl = docName + docLinkSuffix; + } + let linkEl = listItem.appendChild(document.createElement("a")); + linkEl.href = linkUrl + anchor; + linkEl.dataset.score = score; + linkEl.innerHTML = title; + if (descr) { + listItem.appendChild(document.createElement("span")).innerHTML = + " (" + descr + ")"; + // highlight search terms in the description + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + } + else if (showSearchSummary) + fetch(requestUrl) + .then((responseData) => responseData.text()) + .then((data) => { + if (data) + listItem.appendChild( + Search.makeSearchSummary(data, searchTerms, anchor) + ); + // highlight search terms in the summary + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + }); + Search.output.appendChild(listItem); +}; +const _finishSearch = (resultCount) => { + Search.stopPulse(); + Search.title.innerText = _("Search Results"); + if (!resultCount) + Search.status.innerText = Documentation.gettext( + "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." + ); + else + Search.status.innerText = Documentation.ngettext( + "Search finished, found one page matching the search query.", + "Search finished, found ${resultCount} pages matching the search query.", + resultCount, + ).replace('${resultCount}', resultCount); +}; +const _displayNextItem = ( + results, + resultCount, + searchTerms, + highlightTerms, +) => { + // results left, load the summary and display it + // this is intended to be dynamic (don't sub resultsCount) + if (results.length) { + _displayItem(results.pop(), searchTerms, highlightTerms); + setTimeout( + () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), + 5 + ); + } + // search finished, update title and status message + else _finishSearch(resultCount); +}; +// Helper function used by query() to order search results. +// Each input is an array of [docname, title, anchor, descr, score, filename, kind]. +// Order the results by score (in opposite order of appearance, since the +// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically. +const _orderResultsByScoreThenName = (a, b) => { + const leftScore = a[4]; + const rightScore = b[4]; + if (leftScore === rightScore) { + // same score: sort alphabetically + const leftTitle = a[1].toLowerCase(); + const rightTitle = b[1].toLowerCase(); + if (leftTitle === rightTitle) return 0; + return leftTitle > rightTitle ? -1 : 1; // inverted is intentional + } + return leftScore > rightScore ? 1 : -1; +}; + +/** + * Default splitQuery function. Can be overridden in ``sphinx.search`` with a + * custom function per language. + * + * The regular expression works by splitting the string on consecutive characters + * that are not Unicode letters, numbers, underscores, or emoji characters. + * This is the same as ``\W+`` in Python, preserving the surrogate pair area. + */ +if (typeof splitQuery === "undefined") { + var splitQuery = (query) => query + .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) + .filter(term => term) // remove remaining empty strings +} + +/** + * Search Module + */ +const Search = { + _index: null, + _queued_query: null, + _pulse_status: -1, + + htmlToText: (htmlString, anchor) => { + const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); + for (const removalQuery of [".headerlink", "script", "style"]) { + htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() }); + } + if (anchor) { + const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`); + if (anchorContent) return anchorContent.textContent; + + console.warn( + `Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.` + ); + } + + // if anchor not specified or not found, fall back to main content + const docContent = htmlElement.querySelector('[role="main"]'); + if (docContent) return docContent.textContent; + + console.warn( + "Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template." + ); + return ""; + }, + + init: () => { + const query = new URLSearchParams(window.location.search).get("q"); + document + .querySelectorAll('input[name="q"]') + .forEach((el) => (el.value = query)); + if (query) Search.performSearch(query); + }, + + loadIndex: (url) => + (document.body.appendChild(document.createElement("script")).src = url), + + setIndex: (index) => { + Search._index = index; + if (Search._queued_query !== null) { + const query = Search._queued_query; + Search._queued_query = null; + Search.query(query); + } + }, + + hasIndex: () => Search._index !== null, + + deferQuery: (query) => (Search._queued_query = query), + + stopPulse: () => (Search._pulse_status = -1), + + startPulse: () => { + if (Search._pulse_status >= 0) return; + + const pulse = () => { + Search._pulse_status = (Search._pulse_status + 1) % 4; + Search.dots.innerText = ".".repeat(Search._pulse_status); + if (Search._pulse_status >= 0) window.setTimeout(pulse, 500); + }; + pulse(); + }, + + /** + * perform a search for something (or wait until index is loaded) + */ + performSearch: (query) => { + // create the required interface elements + const searchText = document.createElement("h2"); + searchText.textContent = _("Searching"); + const searchSummary = document.createElement("p"); + searchSummary.classList.add("search-summary"); + searchSummary.innerText = ""; + const searchList = document.createElement("ul"); + searchList.setAttribute("role", "list"); + searchList.classList.add("search"); + + const out = document.getElementById("search-results"); + Search.title = out.appendChild(searchText); + Search.dots = Search.title.appendChild(document.createElement("span")); + Search.status = out.appendChild(searchSummary); + Search.output = out.appendChild(searchList); + + const searchProgress = document.getElementById("search-progress"); + // Some themes don't use the search progress node + if (searchProgress) { + searchProgress.innerText = _("Preparing search..."); + } + Search.startPulse(); + + // index already loaded, the browser was quick! + if (Search.hasIndex()) Search.query(query); + else Search.deferQuery(query); + }, + + _parseQuery: (query) => { + // stem the search terms and add them to the correct list + const stemmer = new Stemmer(); + const searchTerms = new Set(); + const excludedTerms = new Set(); + const highlightTerms = new Set(); + const objectTerms = new Set(splitQuery(query.toLowerCase().trim())); + splitQuery(query.trim()).forEach((queryTerm) => { + const queryTermLower = queryTerm.toLowerCase(); + + // maybe skip this "word" + // stopwords array is from language_data.js + if ( + stopwords.indexOf(queryTermLower) !== -1 || + queryTerm.match(/^\d+$/) + ) + return; + + // stem the word + let word = stemmer.stemWord(queryTermLower); + // select the correct list + if (word[0] === "-") excludedTerms.add(word.substr(1)); + else { + searchTerms.add(word); + highlightTerms.add(queryTermLower); + } + }); + + if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js + localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" ")) + } + + // console.debug("SEARCH: searching for:"); + // console.info("required: ", [...searchTerms]); + // console.info("excluded: ", [...excludedTerms]); + + return [query, searchTerms, excludedTerms, highlightTerms, objectTerms]; + }, + + /** + * execute search (requires search index to be loaded) + */ + _performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + const allTitles = Search._index.alltitles; + const indexEntries = Search._index.indexentries; + + // Collect multiple result groups to be sorted separately and then ordered. + // Each is an array of [docname, title, anchor, descr, score, filename, kind]. + const normalResults = []; + const nonMainIndexResults = []; + + _removeChildren(document.getElementById("search-progress")); + + const queryLower = query.toLowerCase().trim(); + for (const [title, foundTitles] of Object.entries(allTitles)) { + if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) { + for (const [file, id] of foundTitles) { + const score = Math.round(Scorer.title * queryLower.length / title.length); + const boost = titles[file] === title ? 1 : 0; // add a boost for document titles + normalResults.push([ + docNames[file], + titles[file] !== title ? `${titles[file]} > ${title}` : title, + id !== null ? "#" + id : "", + null, + score + boost, + filenames[file], + SearchResultKind.title, + ]); + } + } + } + + // search for explicit entries in index directives + for (const [entry, foundEntries] of Object.entries(indexEntries)) { + if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { + for (const [file, id, isMain] of foundEntries) { + const score = Math.round(100 * queryLower.length / entry.length); + const result = [ + docNames[file], + titles[file], + id ? "#" + id : "", + null, + score, + filenames[file], + SearchResultKind.index, + ]; + if (isMain) { + normalResults.push(result); + } else { + nonMainIndexResults.push(result); + } + } + } + } + + // lookup as object + objectTerms.forEach((term) => + normalResults.push(...Search.performObjectSearch(term, objectTerms)) + ); + + // lookup as search terms in fulltext + normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms)); + + // let the scorer override scores with a custom scoring function + if (Scorer.score) { + normalResults.forEach((item) => (item[4] = Scorer.score(item))); + nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item))); + } + + // Sort each group of results by score and then alphabetically by name. + normalResults.sort(_orderResultsByScoreThenName); + nonMainIndexResults.sort(_orderResultsByScoreThenName); + + // Combine the result groups in (reverse) order. + // Non-main index entries are typically arbitrary cross-references, + // so display them after other results. + let results = [...nonMainIndexResults, ...normalResults]; + + // remove duplicate search results + // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept + let seen = new Set(); + results = results.reverse().reduce((acc, result) => { + let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(','); + if (!seen.has(resultStr)) { + acc.push(result); + seen.add(resultStr); + } + return acc; + }, []); + + return results.reverse(); + }, + + query: (query) => { + const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query); + const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms); + + // for debugging + //Search.lastresults = results.slice(); // a copy + // console.info("search results:", Search.lastresults); + + // print the results + _displayNextItem(results, results.length, searchTerms, highlightTerms); + }, + + /** + * search for object names + */ + performObjectSearch: (object, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const objects = Search._index.objects; + const objNames = Search._index.objnames; + const titles = Search._index.titles; + + const results = []; + + const objectSearchCallback = (prefix, match) => { + const name = match[4] + const fullname = (prefix ? prefix + "." : "") + name; + const fullnameLower = fullname.toLowerCase(); + if (fullnameLower.indexOf(object) < 0) return; + + let score = 0; + const parts = fullnameLower.split("."); + + // check for different match types: exact matches of full name or + // "last name" (i.e. last dotted part) + if (fullnameLower === object || parts.slice(-1)[0] === object) + score += Scorer.objNameMatch; + else if (parts.slice(-1)[0].indexOf(object) > -1) + score += Scorer.objPartialMatch; // matches in last name + + const objName = objNames[match[1]][2]; + const title = titles[match[0]]; + + // If more than one term searched for, we require other words to be + // found in the name/title/description + const otherTerms = new Set(objectTerms); + otherTerms.delete(object); + if (otherTerms.size > 0) { + const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase(); + if ( + [...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0) + ) + return; + } + + let anchor = match[3]; + if (anchor === "") anchor = fullname; + else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname; + + const descr = objName + _(", in ") + title; + + // add custom score for some objects according to scorer + if (Scorer.objPrio.hasOwnProperty(match[2])) + score += Scorer.objPrio[match[2]]; + else score += Scorer.objPrioDefault; + + results.push([ + docNames[match[0]], + fullname, + "#" + anchor, + descr, + score, + filenames[match[0]], + SearchResultKind.object, + ]); + }; + Object.keys(objects).forEach((prefix) => + objects[prefix].forEach((array) => + objectSearchCallback(prefix, array) + ) + ); + return results; + }, + + /** + * search for full-text terms in the index + */ + performTermsSearch: (searchTerms, excludedTerms) => { + // prepare search + const terms = Search._index.terms; + const titleTerms = Search._index.titleterms; + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + + const scoreMap = new Map(); + const fileMap = new Map(); + + // perform the search on the required terms + searchTerms.forEach((word) => { + const files = []; + const arr = [ + { files: terms[word], score: Scorer.term }, + { files: titleTerms[word], score: Scorer.title }, + ]; + // add support for partial matches + if (word.length > 2) { + const escapedWord = _escapeRegExp(word); + if (!terms.hasOwnProperty(word)) { + Object.keys(terms).forEach((term) => { + if (term.match(escapedWord)) + arr.push({ files: terms[term], score: Scorer.partialTerm }); + }); + } + if (!titleTerms.hasOwnProperty(word)) { + Object.keys(titleTerms).forEach((term) => { + if (term.match(escapedWord)) + arr.push({ files: titleTerms[term], score: Scorer.partialTitle }); + }); + } + } + + // no match but word was a required one + if (arr.every((record) => record.files === undefined)) return; + + // found search word in contents + arr.forEach((record) => { + if (record.files === undefined) return; + + let recordFiles = record.files; + if (recordFiles.length === undefined) recordFiles = [recordFiles]; + files.push(...recordFiles); + + // set score for the word in each file + recordFiles.forEach((file) => { + if (!scoreMap.has(file)) scoreMap.set(file, {}); + scoreMap.get(file)[word] = record.score; + }); + }); + + // create the mapping + files.forEach((file) => { + if (!fileMap.has(file)) fileMap.set(file, [word]); + else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word); + }); + }); + + // now check if the files don't contain excluded terms + const results = []; + for (const [file, wordList] of fileMap) { + // check if all requirements are matched + + // as search terms with length < 3 are discarded + const filteredTermCount = [...searchTerms].filter( + (term) => term.length > 2 + ).length; + if ( + wordList.length !== searchTerms.size && + wordList.length !== filteredTermCount + ) + continue; + + // ensure that none of the excluded terms is in the search result + if ( + [...excludedTerms].some( + (term) => + terms[term] === file || + titleTerms[term] === file || + (terms[term] || []).includes(file) || + (titleTerms[term] || []).includes(file) + ) + ) + break; + + // select one (max) score for the file. + const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w])); + // add result to the result list + results.push([ + docNames[file], + titles[file], + "", + null, + score, + filenames[file], + SearchResultKind.text, + ]); + } + return results; + }, + + /** + * helper function to return a node containing the + * search summary for a given text. keywords is a list + * of stemmed words. + */ + makeSearchSummary: (htmlText, keywords, anchor) => { + const text = Search.htmlToText(htmlText, anchor); + if (text === "") return null; + + const textLower = text.toLowerCase(); + const actualStartPosition = [...keywords] + .map((k) => textLower.indexOf(k.toLowerCase())) + .filter((i) => i > -1) + .slice(-1)[0]; + const startWithContext = Math.max(actualStartPosition - 120, 0); + + const top = startWithContext === 0 ? "" : "..."; + const tail = startWithContext + 240 < text.length ? "..." : ""; + + let summary = document.createElement("p"); + summary.classList.add("context"); + summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; + + return summary; + }, +}; + +_ready(Search.init); diff --git a/_static/sphinx_highlight.js b/_static/sphinx_highlight.js new file mode 100644 index 000000000..8a96c69a1 --- /dev/null +++ b/_static/sphinx_highlight.js @@ -0,0 +1,154 @@ +/* Highlighting utilities for Sphinx HTML documentation. */ +"use strict"; + +const SPHINX_HIGHLIGHT_ENABLED = true + +/** + * highlight a given string on a node by wrapping it in + * span elements with the given class name. + */ +const _highlight = (node, addItems, text, className) => { + if (node.nodeType === Node.TEXT_NODE) { + const val = node.nodeValue; + const parent = node.parentNode; + const pos = val.toLowerCase().indexOf(text); + if ( + pos >= 0 && + !parent.classList.contains(className) && + !parent.classList.contains("nohighlight") + ) { + let span; + + const closestNode = parent.closest("body, svg, foreignObject"); + const isInSVG = closestNode && closestNode.matches("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.classList.add(className); + } + + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + const rest = document.createTextNode(val.substr(pos + text.length)); + parent.insertBefore( + span, + parent.insertBefore( + rest, + node.nextSibling + ) + ); + node.nodeValue = val.substr(0, pos); + /* There may be more occurrences of search term in this node. So call this + * function recursively on the remaining fragment. + */ + _highlight(rest, addItems, text, className); + + if (isInSVG) { + const rect = document.createElementNS( + "http://www.w3.org/2000/svg", + "rect" + ); + const bbox = parent.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute("class", className); + addItems.push({ parent: parent, target: rect }); + } + } + } else if (node.matches && !node.matches("button, select, textarea")) { + node.childNodes.forEach((el) => _highlight(el, addItems, text, className)); + } +}; +const _highlightText = (thisNode, text, className) => { + let addItems = []; + _highlight(thisNode, addItems, text, className); + addItems.forEach((obj) => + obj.parent.insertAdjacentElement("beforebegin", obj.target) + ); +}; + +/** + * Small JavaScript module for the documentation. + */ +const SphinxHighlight = { + + /** + * highlight the search words provided in localstorage in the text + */ + highlightSearchWords: () => { + if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight + + // get and clear terms from localstorage + const url = new URL(window.location); + const highlight = + localStorage.getItem("sphinx_highlight_terms") + || url.searchParams.get("highlight") + || ""; + localStorage.removeItem("sphinx_highlight_terms") + url.searchParams.delete("highlight"); + window.history.replaceState({}, "", url); + + // get individual terms from highlight string + const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); + if (terms.length === 0) return; // nothing to do + + // There should never be more than one element matching "div.body" + const divBody = document.querySelectorAll("div.body"); + const body = divBody.length ? divBody[0] : document.querySelector("body"); + window.setTimeout(() => { + terms.forEach((term) => _highlightText(body, term, "highlighted")); + }, 10); + + const searchBox = document.getElementById("searchbox"); + if (searchBox === null) return; + searchBox.appendChild( + document + .createRange() + .createContextualFragment( + '" + ) + ); + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords: () => { + document + .querySelectorAll("#searchbox .highlight-link") + .forEach((el) => el.remove()); + document + .querySelectorAll("span.highlighted") + .forEach((el) => el.classList.remove("highlighted")); + localStorage.removeItem("sphinx_highlight_terms") + }, + + initEscapeListener: () => { + // only install a listener if it is really needed + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; + if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { + SphinxHighlight.hideSearchWords(); + event.preventDefault(); + } + }); + }, +}; + +_ready(() => { + /* Do not call highlightSearchWords() when we are on the search page. + * It will highlight words from the *previous* search query. + */ + if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); + SphinxHighlight.initEscapeListener(); +}); diff --git a/developer/build.html b/developer/build.html new file mode 100644 index 000000000..4a43cfd63 --- /dev/null +++ b/developer/build.html @@ -0,0 +1,156 @@ + + + + + + + + Building and running the unit tests — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Building and running the unit tests

+

x3d2 is in early development phase, and there is no main executable +yet to be built. However, currently implemented functionality is +covered by unit tests, which you can build and run on you development +machine.

+

To build x3d2, you will need git, a fortran compiler and CMake, see +Required tools.

+

Start by configuring the build directory:

+
$ cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
+
+
+

To configure the build with the NVIDIA Fortran compiler, you can set +the FC environment variable to the compiler executable. If you +specify an relative path, it must be present in your current PATH.

+
$ FC=nvfortran cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
+
+
+

Setting the Fortran compiler to the NVIDIA Fortran compiler will +automatically include the CUDA Fortran source files into the build +tree, which are ignored by default.

+

Once the build directory is configured, the tests can be built and run +as follows:

+
$ cd build
+$ make
+$ make test
+
+
+

Note that make test is only a launcher for the ctest +executable. By default ctest does not show the output of test +executables on failure. If one of more tests fail, you probably want +to run the tests with:

+
$ ctest --output-on-failure
+
+
+

instead of make test.

+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/developer/contributing_guidelines.html b/developer/contributing_guidelines.html new file mode 100644 index 000000000..cb8b5c61e --- /dev/null +++ b/developer/contributing_guidelines.html @@ -0,0 +1,255 @@ + + + + + + + + Contributing guidelines — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Contributing guidelines

+

x3d2 is a collaborative project, open to all. In order to enable +effective collaboration, however, we ask that your contribution(s) +comply with a set of ground rules.

+
+

In a nutshell

+
    +
  • For any contribution not covered by an existing issue, open an issue +first.

  • +
  • Respect the commit format. (Install the git hook!).

  • +
  • Only commit changes formatted with fprettify, using the project’s +configuration. (Install the git hook!).

  • +
  • Strive to contribute small and focused Pull Requests with detailed +descriptions.

  • +
  • Add (a) unit test(s) covering a new feature, or (a) regression +test(s) for a bug fix.

  • +
+
+
+

Issues first

+

Issues are opened as soon as possible, particularly before any +significant implementation work is carried out or any pull request is +opened. Starting with issues greatly facilitates collaboration:

+
    +
  • It encourages developers to write (and therefore think) about the +work they plan to achieve.

  • +
  • It helps maintaining a shared and up to date record of current work +(known bugs, current developments).

  • +
  • It helps coordination between developers by sign-posting who is +working on what, as well as what is not being worked on.

  • +
  • It allows discussions between developers on how to best fix the +issue or implement the described improvement(s).

  • +
+

This doesn’t mean that you should forbid yourself from exploratory +prototyping until an issue has been opened. In fact, prototyping is +often helpful to write the content of the issue. On the other hand, +do open an issue before commiting to a particular design or +implementation.

+
+
+

Format commits accordingly

+

Commits messages are formatted according to the conventional commits +specification (v1.0.0). Commit messages must respect the following +structure:

+
<type>[optional scope]: <description>
+
+[optional body]
+
+
+

where <type> is one of fix, feat, build, chore, ci, +docs, style, refactor, perf or test.

+

Breaking changes are specified by adding an ! before the colon :. Example:

+
fix(allocator)!: Return 1D arrays as data blocks
+
+This is a breaking change because e.g. the allocator used to
+return 3D data blocks.
+
+
+

In addition, commit message header lines must not contain more than 68 +characters. Lines in the commit message body cannot exceed 72 +characters.

+
+

Note

+

Commit messages in x3d2 do not use footers as specified in the +conventional commit specs. You are welcome to use footers in your +commit messages, but know that they hold no special place in the +commit format policy.

+
+

A Git hook is provided to prevent you from registering non-conformant +commit messages. See setting up your development environment.

+
+
+

Fortran code formatting

+

Code formatting dictates things like indentation levels, number of +whitespace between operators or use upper/lowercase characters for +keywords.

+

Because having to learn such project specific rules isn’t terribily +interesting, all Fortran code in x3d2 is formatted automatically using +fprettify. Some non-default +configuraiton options are specified in the project’s .fprettify.ini +file.

+

Note that a a GitHub pull request will not be merged until all the +associated code addtions conform to the formatting.

+

The best way to deal with code formatting is to automate it and +forget about it. To do so, make sure you install the pre-commit +hook into your local git repository, see . This way, fprettify will +run automatically each time you commit new changes.

+
+
+

Pull requests and code review

+

Code review is a fondamental part of x3d2’s collaborative development. +Particularly, GitHub pull requests must be approved by at least two +maintainers before the associated commits are merged. Code review allows for

+
    +
  • Gatekeeping, by preventing the integration of changes that are not +up to standards, introducing bugs or potentially disruptive to +ongoing and/or future developments.

  • +
  • Knowledge transfer, by making sure that at least a couple of project +developers have an opportunity to study and understand the code to +be integrated.

  • +
  • Training, by giving new contributors opportunities to get feedback +and help, as well as chances to review contributions from more +experienced developers.

  • +
+

Poor quality pull requests can however turn the code review process +into a bottleneck or worse, lead to poor quality reviews. In order to +facilitate the code review process, pull request must be both +focused and small and have a detailed description.

+
    +
  1. Pull requests should aim to merge a be coherent body of changes, +targeting a single aspect of an issue. It is much prefereable to +fix an issue through multiple pull requests than one big +contribution.

  2. +
  3. Pull requests should aim to merge a limited number of changes. As +a rule of thumb, pull requests usually become much harder to review +beyond 10 changes.

  4. +
  5. Pull requests should come with a detailed description containing:

    +
      +
    • One or two sentences summing up the motivation for the changes.

    • +
    • A link to the addressed issue(s).

    • +
    • A summary of the changes.

    • +
    • A technical description of the changes.

    • +
    +

    The description is important for archiving purposes, but most +importlantl in order to guide the work of reviewers.

    +
  6. +
+

Note that the points above are guidelines as opposed to hard and fast +rules. For a given pull request, the amount of work required to +review the changes will vary across reviewers. Generally, however, +please empathise with your fellow contributors who are going to spend +time reviewing your code. Aim to make their work easier, and they +will do the same for you.

+
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/developer/contribution_workflow.html b/developer/contribution_workflow.html new file mode 100644 index 000000000..970f504ed --- /dev/null +++ b/developer/contribution_workflow.html @@ -0,0 +1,151 @@ + + + + + + + + Overview of the contribution process — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Overview of the contribution process

+

The graph below illustrates the general process for contributing code +changes to x3d2:

+
digraph G {
+    review[shape="diamond", label="Changes approved"]
+    commit[label="commit changes locally"]
+
+    PR[label="Open/update Pull Request"];
+
+    Idea -> "Open new issue" -> commit -> PR
+    PR -> review
+    review -> merge [label="yes"]
+    review -> commit [label=" no"]
+    "Pick existing issue" -> commit
+
+    {
+        rank=sink;
+        review; merge
+    }
+}
+

Contributions are accepeted in the form of pull requests targeting the +main branch on the x3d2 GitHub repository. See (GitHub docs) +Creating a pull request.

+

By default your GitHub account will not be able to push changes to the +x3d2 repo, and you will have to open the pull request from a fork. See +(GitHub docs) Creating a pull request from a fork.

+

Note that the whole process is driven by issues. If you found a +bug not currently referenced by an existing issue, or have an idea on +how to improve a part of x3d2, please open a new item on the issue +tracker before opening a pull request.

+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/developer/dev_environment.html b/developer/dev_environment.html new file mode 100644 index 000000000..05a970672 --- /dev/null +++ b/developer/dev_environment.html @@ -0,0 +1,157 @@ + + + + + + + + Setting up for development — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Setting up for development

+
    +
  1. To begin with, make sure you have the right tools installed by going +through the required tooling.

  2. +
  3. Download the x3d2 repository from GitHub:

    +
    $ git clone git@github.com:xcompact3d/x3d2.git
    +$ cd x3d2/
    +
    +
    +
  4. +
+
+

The following commands assume that your shell’s current directory is +the root of the x3d2 repository.

+
+
    +
  1. Install the pre-commit Git hook into your project-local +configuration:

    +
    $ cp githooks/pre-commit .git/hooks/
    +$ chmod +x .git/hooks/pre-commit
    +
    +
    +

    This Git hook will cause the automatic formatting of all fortran +files staged in your commit, using fprettify.

    +
  2. +
  3. Install the commit-msg Git hook into your project-local +configuration:

    +
    $ cp githooks/commit-msg .git/hooks/
    +$ chmod +x .git/hooks/commit-msg
    +
    +
    +

    This Git hook will automatically check your commit message against +the commit message format, based on the conventional commits +specification. See the contribution guidelines.

    +
  4. +
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/developer/index.html b/developer/index.html new file mode 100644 index 000000000..fb66d2058 --- /dev/null +++ b/developer/index.html @@ -0,0 +1,152 @@ + + + + + + + + Contributing to x3d2 — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Contributing to x3d2

+

Fixed a bug? Have an idea for improving x3d2? x3d2 is developed in +the open with a license that allows anyone to:

+
    +
  • Run the program as they wish, for any purpose.

  • +
  • Access and study its source code, and making changes to it.

  • +
  • Redistribute copies (source or binary).

  • +
  • Distribute copies of your modified versions (source or binary).

  • +
+

Particularly, we encourage developers to contribute their changes back +to the x3d2 project. The following sections describe the process for +doing so.

+ +

If you are looking to take part in the project but don’t have anything +specific in mind, you could consider:

+
    +
  • Reporting (a) bug(s), suggest improvement(s) or share a user experience.

  • +
  • Adding documentation or improving the current one.

  • +
  • Working on fixing issues or implementing new features.

  • +
+

In any of the cases above, your entry point should be the issue +tracker – either to +pick an existing issue to work on or to create a new one.

+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/developer/style.html b/developer/style.html new file mode 100644 index 000000000..997345ee5 --- /dev/null +++ b/developer/style.html @@ -0,0 +1,274 @@ + + + + + + + + Fortran style guide — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Fortran style guide

+
+

Basic formatting

+

Identation, whitespaces and line length are enforced by fprettify. +Project settings are defined in the .fprettify.ini located at the +root of the repository.

+

In most cases, developers are expected to install the associated +pre-commit git hook. Additionally, it is recommended to configure +your text editor to run fprettify for you (for instance on saving a +file).

+

If you want to preview changes without overwriting a file, you can do +so using the –stdout option:

+
$ fprettify --config .fprettify.ini --stdout
+
+
+

Note: CUDA Fortran chevron syntax is not supported by fprettify. +Thus, we use !& to deactivate fprettify on lines chevron syntax is +used.

+
call gpu_kernel<<<blocks, threads>>>(args, ...) !&
+
+
+
+
+

Naming conventions

+

In the following “symbol” is a catch all phrase for variables, +procedures, derived types, type components and interfaces.

+
    +
  • Symbols are name using the snake_case convention.

  • +
  • Variable declared with the parameter are named using UPPER CASE +letters.

  • +
  • Symbols should, as much as possible, be named after they meaning +rather than their mathematical notation (.e.g velocity_field +instead of u).

  • +
+
+
+

Procedure definitions

+
    +
  • Procedure prototypes spanning more than 79 characters should be split +before the first dummy argument is defined, after the opening +parenthese. If the list of dummy arguments spans more than 79 +characters each argument is defined on it own line.

    +
    subroutine my_long_subroutine( &
    +   argument1, argument3, argument4, argument5, argument5, argument6 &
    +   )
    +
    +subroutine my_very_long_subroutine( &
    +   argument1, &
    +   argument2, &
    +   argument3, &
    +   argument4, &
    +   argument5, &
    +   argument6, &
    +   argument7, &
    +   )
    +
    +
    +
  • +
  • Function prototypes indicate the return object type unless the +return object is an array.

  • +
  • Functions are always defined with the pure prefix. A procedure +with side effects must be a subroutine.

  • +
+
+
+

Modules

+
    +
  • Module names end with the _m suffix. Examples: +module allocator_m, use allocator_m, only: ….

  • +
  • All module components are private by default.

  • +
  • The module components are always acessed through the only keyword:

    +
    module a_module_m
    +   ! Non compliant
    +   use stencil_m
    +   ! Compliant
    +   use stencil_m, only: stencil_t
    +
    +
    +
  • +
+
+
+

Derived type definitions

+
    +
  • Derived type names end with the _t suffix. Examples: +allocator_t, type(stencil_t) :: s.

  • +
  • The contains keyword is omitted is the type does not define any +type-bound procedures.

  • +
  • All type components are private by default.

  • +
+
+
+

Custom structure constructors

+
    +
  • Are named like create_<type_root_name>[_<suffix>]

  • +
  • Are declared with the private attribute

  • +
  • Are defined at the top of the module’s contains block.

  • +
+

Example

+
module square_module
+
+   type :: square_t
+      real :: size
+      character(:), allocatable :: color
+   end type square_t
+
+   interface square_t
+      module procedure create_square_from_square
+      module procedure create_square_default_color
+   end interface square_t
+
+contains
+
+   type(square_t) function create_square_from_square(sq_in)
+      type(square), intent(in) :: sq_in
+      ! ...
+   end function create_square_from_square
+
+   type(square_t) function create_square_default_color(sq_size)
+      real, intent(in) :: sq_size
+      ! ...
+   end function create_square_default_color
+
+
+
+
+

In-code documentation

+

The body of modules, public types, public procedures and public +type-bound methods MUST be preceded of one or more documentation +paragraphs. Optionally, the body of private symbols MAY be +preceded by documentation paragraph.

+

Procedure dummy arguments, interface components and type-bound +procedures declarations MAY be documented using an inline comment +either on the same line directly following the statement (using the +docmark !!) or on the line directly above the statement (using the +predocmark !>).

+

x3d2 uses ford to +extract in-code documentation and generate HTML pages. The syntax for +in-code documentation follows ford’s syntax for comments. See +(ford)Writing documentation

+
subroutine add(a, b, c)
+    !! This is the first paragraph of the procedures
+    !! documentation.  Note that it starts with TWO !.
+    real, intent(in) :: a, b !! Optional documentation for dummy argument.
+    real, intent(out) :: c !! The result of a + b
+
+    ! The line below is a regular comment.
+    ! Make use of the well-known the addition algorithm.
+    c = a + b
+end subroutine
+
+
+
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/developer/tooling.html b/developer/tooling.html new file mode 100644 index 000000000..a9393715a --- /dev/null +++ b/developer/tooling.html @@ -0,0 +1,183 @@ + + + + + + + + Required tools — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Required tools

+

To contribute to x3d2 you need a few things on your toolbelt

+
    +
  • A Fortran 2003 compiler (e.g. gfortran)

  • +
  • The NVIDA HPC Fortran compiler [optional]

  • +
  • The CMake build system

  • +
  • The fprettify auto-formatter

  • +
  • The FORD and Sphinx documentation generators.

  • +
+

The above tools can all be installed via you distribution’s package +manager or the Python package pamanger pip.

+
+

Note

+

We strongly recommend to use the pipx wrapper around pip to +ensure installed Python packages are installed into isolated +virtual environments.

+
+
+

Fortran compiler

+

You can get started with the GNU Fortran compiler

+
$ sudo apt install gfortran
+
+
+
+
+

CMake

+

CMake is used to configure the build. This means, among other things, +finding the location of the required compiler and libraries, as well +as resolving the links between different components of the software.

+

To configure and build x3d2 you will need CMake version 3.18 and +above. At the time of writing the currently distributed version of +CMake in Debain stable is 3.18, so you should be able to install CMake +from your distribution’s package manager, for instance

+
sudo apt install cmake
+
+
+

Recent CMake versions are packaged for a variety of package managers, +including pipx:

+
$ pipx install cmake
+
+
+
+
+

fprettify

+

Auto-formatter for fortran 90 and above.

+
$ pipx install fprettify
+
+
+
+
+

FORD

+

Documentation generator for fortran 90 and above.

+
$ pipx install ford
+
+
+
+
+

Sphinx

+
$ pipx install sphinx
+
+
+
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/developer/writing_docs.html b/developer/writing_docs.html new file mode 100644 index 000000000..5ba3fbd6d --- /dev/null +++ b/developer/writing_docs.html @@ -0,0 +1,153 @@ + + + + + + + + Contributing documentation — x3d2 documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Contributing documentation

+

x3d2 uses both Sphinx and ford for documentation. Sphinx is +used to generate the user and developer guides (i.e. this website). +ford is used to generate the API documentation website by extraction +in-code documentation.

+
+

Building the documentation

+

To build the user and developer docs (Sphinx):

+
# From the repository root
+$ cd docs && make html
+
+
+

The above command generate hmtl pages in docs/build/html. You can +display the user and developer docs by opening +docs/build/html/index.html with a web browser.

+

To build the API docs (ford):

+
# From the repository root
+$ ford ford.md -o api_docs
+
+
+

You can display the API docs by opening api_docs/index.html with a +web browser.

+
+
+

Writing user or developer documentation

+

Documentation sources are located under docs/sources/. They consist +in a hierachy of reStructuredText files. reStructuredText (rST) is a +light markup language similar to markdown. For an introduction to +rST, see (Sphinx)ReStructuredText primer.

+
+
+

In-code documentation

+

See In-code documentation.

+
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/genindex.html b/genindex.html new file mode 100644 index 000000000..e035653bd --- /dev/null +++ b/genindex.html @@ -0,0 +1,106 @@ + + + + + + + Index — x3d2 documentation + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ + +

Index

+ +
+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 000000000..57cab4662 --- /dev/null +++ b/index.html @@ -0,0 +1,136 @@ + + + + + + + + <no title> — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

x3d2 is the current codename for what is to become Xcompact3d +version 2.0. This project is a rewrite of Xcompact3d leading to

+
    +
  • Improved serial and parallel performance.

  • +
  • Support for NVIDIA GPU accelerators (using CUDA Fortran).

  • +
  • Improved modularity and testability.

  • +
+

Contents:

+ + + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/internals/allocator.html b/internals/allocator.html new file mode 100644 index 000000000..7657e5092 --- /dev/null +++ b/internals/allocator.html @@ -0,0 +1,201 @@ + + + + + + + + Memory management — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Memory management

+

The parallel processing carried out in x3d2 requires that the +computational domain is sliced into slabs along a specific direction +of space.

+

Data slabs (instances of the derived type slab_t) hold a pointer to +an allocator_t instance that is responsible for the allocation and +dispatching of memory blocks to data slabs. See (API)allocator_t. Whenever +data slabs are no longer required, the associated memory blocks can be +released to the allocator, ready to be dispatched to other slabs or +objects who might need them.

+

An instance of allocator_t maintains a linked list of memory blocks, +which each element in the list labelled with a unique identifier:

+
digraph freelist {
+     rank=LR;
+     memblock1 [label="memory block\lid: 1"];
+     memblock2 [label="memory block\lid: 2"];
+     memblock3 [label="memory block\lid: 3"];
+
+     memblock1 -> memblock2 -> memblock3;
+}
+

Each memory block is an instance of the memblock_t derived type +((API)memblock_t). In +addition to its integer identifier, a instance of the memblock_t +type holds a 3D data array and a pointer to the next block in the +list.

+

All memory blocks in an allocator’s list have the same size. An +allocator can be created by passing in the dimension of the memory +blocks:

+
allocator = allocator_t([32 16 32])
+
+
+

Given an allocator_t instance, memory blocks can requested using the +get_block function.

+
use m_allocator, only: memory_block_t, allocator_t
+! ...
+type(memory_block_t), pointer :: memblock_ptr
+! ..
+ptr => allocator%get_block()
+
+
+

Note that get_block returns a pointer to a memory block instead of +a copy. In practice, the head of the block list is detached from the +list (pop operation):

+
digraph allocation {
+
+ memblock1 [label="memory block\lid: 1"];
+ memblock2 [label="memory block\lid: 2"];
+ memblock3 [label="memory block\lid: 3"];
+ ptr [shape=box, label="memblock_ptr"]
+
+ memblock2 -> memblock3;
+ ptr -> memblock1;
+}
+

Dispatched memory blocks ban be released to the allocator by calling +the release_block subroutine:

+
! Request two blocks and release the first one, which becomes the
+! head of the free block list
+ptr1 => allocator%get_block()
+ptr2 => allocator%get_block()
+call allocator%release_block(ptr1)
+
+
+

Released blocks are pushed on top of the allocator’s free blocks list:

+
digraph release {
+
+ memblock1 [label="memory block\lid: 1"];
+ memblock2 [label="memory block\lid: 2"];
+ memblock3 [label="memory block\lid: 3"];
+ ptr1 [shape=box]
+ ptr2 [shape=box]
+ null [shape=box]
+
+ memblock1 -> memblock3;
+ ptr2 -> memblock2;
+ ptr1 -> null
+}
+
+

Memory block allocation

+

If a request is made to an allocator whose free block list is empty, a +new block is allocated before it is immediately dispacted to the +requesting object. As a consequence the memory footprint of a program +is expected to grow in early stages of a program’s lifetime, before +reaching maximum where enough memory has been allocated and some can +be reused.

+
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/internals/index.html b/internals/index.html new file mode 100644 index 000000000..2f854a793 --- /dev/null +++ b/internals/index.html @@ -0,0 +1,126 @@ + + + + + + + + Internals — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Internals

+

The following section describe various internals of the library. They +are aimed at developers willing to learn about the algorithmns and +data structures used, or users curious about how things are +implemented.

+ +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/internals/momentum_rhs_calculation.html b/internals/momentum_rhs_calculation.html new file mode 100644 index 000000000..611e8f28d --- /dev/null +++ b/internals/momentum_rhs_calculation.html @@ -0,0 +1,194 @@ + + + + + + + + Computing the spatial contribution to the momentum equation — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Computing the spatial contribution to the momentum equation

+

The first stage of solving the momentum equation at a given time-step +\(k\) is to evaluate the spatial contribution

+
+(1)\[\mathbf{F}^k = - \frac{1}{2}[\nabla (\mathbf{u}^k \otimes \mathbf{u}^k) ++ (\mathbf{u}^k \cdot \nabla) \mathbf{u}^k] + \nu \nabla^2\mathbf{u}^k\]
+

This term involves spatial derivatives along the three directions +\(\hat{\mathbf{x}}\), \(\hat{\mathbf{y}}\) and +\(\hat{\mathbf{z}}\). In order to reduce the number of +communications between MPI processes, the computation is performed in +three stages corresponding to three different data configurations:

+
    +
  • In the x-configuration, the process has access to a data slab +covering the x-y plane. This a 1D domain decomposition along the +\(\hat{\mathbf{z}}\) direction. Derivatives along +\(\hat{\mathbf{x}}\) can be computed without communications.

  • +
  • In the z-configuration, a process has access to a data slab +covering the y-z plane. This a 1D domain decomposition along the +\(\hat{\mathbf{x}}\) direction. Derivatives along +\(\hat{\mathbf{z}}\) can be computed without communications.

  • +
  • In the y-configuration, a process has access to a data slab +covering the x-y plane. This a 1D domain decomposition along the +\(\hat{\mathbf{z}}\) direction. Derivatives along +\(\hat{\mathbf{y}}\) can be computed without communications.

  • +
+

In the i-configuration, field data (e.g. the x-component of the +velocity field) is stored in a three-dimensional array of dimension +dimension(SZ, N, M) where N is the size of the domain in the i +direction. This data layout decomposes slab data into M * SZ ` 1D +arrays (called pencils) of size N. Pencils are processed in +batches of size SZ allowing for vectorised operations.

+

The algorithm for computing (1) then becomes:

+
! Instances of type slab_t have access to slab data
+! and can compute derivatives and contributions to
+! momentum equation along a specific direction.
+type(slab_t) :: xslab, yslab, zslab
+
+! ...
+
+! Perform necesseary communications across processes
+! asynchonously
+call async_rotate_x_to_z(xslab, z_comm_buffer)
+
+! Meanwhile, compute the contribution in the x direction
+x_contrib = x_slab%transport()
+
+! Assuming x to z transfer is done, arrange field data
+! in the correct z-configuration layout and compute
+! z contribution
+call from_comms_buffer(z_comm_buffer, z_slab)
+z_dir_contrib = z_slab%transport()
+
+! Transfer the result back
+call async_rotate_z_to_x(z_dir_contrib, x_slab_z)
+
+! Meanwhile, switch from x-config to y-config
+! (no communications needed, only data reshuffling)
+call rotate_x_to_y(x_slab, y_slab)
+y_dir_contrib = yslab%transport()
+
+F = x_dir_contrib%data + y_dir_contrib%data + z_dir_contrib%data
+
+
+
+

The slab3d_t type

+

Computation of (1) is supported by instances of the +slab3d_t derived type. These hold data for the three components +of a 3D vector in 3D space (thinks \(u_x\), \(u_y\) and +\(u_z\)) within a single data slab in the x, y or z-

+

The purpose of slab3d_t instances is to compute spatial +derivatives along a given direction referred to as the slab’s primary +direction. More precisely, user code is given access to type-bound +procedures such as transport or divergence which compute +contributions to physical quantities coming from spatial derivatives +in the slab’s primary direction.

+

For more details, see the API docs.

+
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/objects.inv b/objects.inv new file mode 100644 index 000000000..7a60dabe7 Binary files /dev/null and b/objects.inv differ diff --git a/report_a_bug.html b/report_a_bug.html new file mode 100644 index 000000000..9b49eddd5 --- /dev/null +++ b/report_a_bug.html @@ -0,0 +1,119 @@ + + + + + + + + Report a bug — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+

Report a bug

+

You can do so by adding a new issue to the x3d2 issue tracker on +GitHub. See (GitHub docs) Creating an issue.

+

If you are reporting a bug, be sure to include

+
    +
  • The version of x3d2 you are using

  • +
  • Information about your operating system.

  • +
  • Every information required to reproduce the bug (e.g. input files).

  • +
+
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/search.html b/search.html new file mode 100644 index 000000000..1dd943b30 --- /dev/null +++ b/search.html @@ -0,0 +1,124 @@ + + + + + + + Search — x3d2 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Search

+ + + + +

+ Searching for multiple words only shows matches that contain + all words. +

+ + +
+ + + +
+ + +
+ + +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/searchindex.js b/searchindex.js new file mode 100644 index 000000000..63db0c0a5 --- /dev/null +++ b/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({"alltitles": {"Basic formatting": [[5, "basic-formatting"]], "Building and running the unit tests": [[0, null]], "Building the documentation": [[7, "building-the-documentation"]], "CMake": [[6, "cmake"]], "Computing the spatial contribution to the momentum equation": [[11, null]], "Contributing documentation": [[7, null]], "Contributing guidelines": [[1, null]], "Contributing to x3d2": [[4, null]], "Custom structure constructors": [[5, "custom-structure-constructors"]], "Derived type definitions": [[5, "derived-type-definitions"]], "FORD": [[6, "ford"]], "Format commits accordingly": [[1, "format-commits-accordingly"]], "Fortran code formatting": [[1, "fortran-code-formatting"]], "Fortran compiler": [[6, "fortran-compiler"]], "Fortran style guide": [[5, null]], "In a nutshell": [[1, "in-a-nutshell"]], "In-code documentation": [[5, "in-code-documentation"], [7, "in-code-documentation"]], "Internals": [[10, null]], "Issues first": [[1, "issues-first"]], "Memory block allocation": [[9, "memory-block-allocation"]], "Memory management": [[9, null]], "Modules": [[5, "modules"]], "Naming conventions": [[5, "naming-conventions"]], "Overview of the contribution process": [[2, null]], "Procedure definitions": [[5, "procedure-definitions"]], "Pull requests and code review": [[1, "pull-requests-and-code-review"]], "Report a bug": [[12, null]], "Required tools": [[6, null]], "Setting up for development": [[3, null]], "Sphinx": [[6, "sphinx"]], "The slab3d_t type": [[11, "the-slab3d-t-type"]], "Writing user or developer documentation": [[7, "writing-user-or-developer-documentation"]], "fprettify": [[6, "fprettify"]]}, "docnames": ["developer/build", "developer/contributing_guidelines", "developer/contribution_workflow", "developer/dev_environment", "developer/index", "developer/style", "developer/tooling", "developer/writing_docs", "index", "internals/allocator", "internals/index", "internals/momentum_rhs_calculation", "report_a_bug"], "envversion": {"sphinx": 64, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["developer/build.rst", "developer/contributing_guidelines.rst", "developer/contribution_workflow.rst", "developer/dev_environment.rst", "developer/index.rst", "developer/style.rst", "developer/tooling.rst", "developer/writing_docs.rst", "index.rst", "internals/allocator.rst", "internals/index.rst", "internals/momentum_rhs_calculation.rst", "report_a_bug.rst"], "indexentries": {}, "objects": {}, "objnames": {}, "objtypes": {}, "terms": {"": [0, 1, 3, 4, 5, 6, 9, 11], "0": [1, 8], "1": 11, "10": 1, "16": 9, "18": 6, "1d": [1, 11], "2": [8, 11], "2003": 6, "3": 6, "32": 9, "3d": [1, 9, 11], "68": 1, "72": 1, "79": 5, "90": 6, "A": [1, 5, 6], "As": [1, 9], "At": 6, "By": [0, 2], "For": [1, 7, 11], "If": [0, 2, 4, 5, 9, 12], "In": [4, 9, 11], "It": 1, "On": 1, "One": 1, "The": [1, 2, 3, 4, 5, 6, 7, 9, 10, 12], "These": 11, "To": [0, 1, 3, 6, 7], "_": 5, "_m": 5, "_t": 5, "a_module_m": 5, "abl": [2, 6], "about": [1, 10, 12], "abov": [1, 4, 5, 6, 7], "acceler": 8, "accepet": 2, "access": [4, 11], "accord": 1, "account": 2, "acess": 5, "achiev": 1, "across": [1, 11], "ad": [1, 4, 12], "add": [1, 5], "addit": [1, 5, 9], "addition": 5, "address": 1, "addtion": 1, "after": 5, "against": 3, "aim": [1, 10], "algorithm": [5, 11], "algorithmn": 10, "all": [1, 3, 5, 6, 9], "alloc": 1, "allocat": 5, "allocator_m": 5, "allocator_t": [5, 9], "allow": [1, 4, 11], "along": [9, 11], "alwai": 5, "among": 6, "amount": 1, "an": [0, 1, 2, 4, 5, 7, 9, 12], "ani": [1, 4, 5], "anyon": 4, "anyth": 4, "api": [7, 8, 9, 11], "api_doc": 7, "approv": 1, "apt": 6, "ar": [0, 1, 2, 4, 5, 6, 7, 9, 10, 11, 12], "archiv": 1, "arg": 5, "argument": 5, "argument1": 5, "argument2": 5, "argument3": 5, "argument4": 5, "argument5": 5, "argument6": 5, "argument7": 5, "around": 6, "arrai": [1, 5, 9, 11], "arrang": 11, "ask": 1, "aspect": 1, "associ": [1, 5, 9], "assum": [3, 11], "async_rotate_x_to_z": 11, "async_rotate_z_to_x": 11, "asynchon": 11, "attribut": 5, "auto": 6, "autom": 1, "automat": [0, 1, 3], "b": [0, 5], "back": [4, 11], "ban": 9, "base": 3, "batch": 11, "becaus": 1, "becom": [1, 8, 9, 11], "been": [1, 9], "befor": [1, 2, 5, 9], "begin": 3, "being": 1, "below": [2, 5], "best": 1, "between": [1, 6, 11], "beyond": 1, "big": 1, "binari": 4, "block": [1, 5], "bodi": [1, 5], "both": [1, 7], "bottleneck": 1, "bound": [5, 11], "branch": 2, "break": 1, "browser": 7, "bug": [1, 2, 4, 8], "build": [1, 4, 6, 8], "built": 0, "c": 5, "call": [5, 9, 11], "can": [0, 1, 5, 6, 7, 9, 11, 12], "cannot": 1, "carri": [1, 9], "case": [4, 5], "catch": 5, "caus": 3, "cd": [0, 3, 7], "cdot": 11, "chanc": 1, "chang": [1, 2, 4, 5], "charact": [1, 5], "check": 3, "chevron": 5, "chmod": 3, "chore": 1, "ci": 1, "clone": 3, "cmake": 0, "code": [2, 4, 11], "codenam": 8, "coher": 1, "collabor": 1, "colon": 1, "color": 5, "com": 3, "come": [1, 11], "command": [3, 7], "comment": 5, "commit": [3, 5], "commun": 11, "compil": 0, "compli": 1, "compliant": 5, "compon": [5, 6, 11], "comput": [8, 9, 10], "config": [5, 11], "configur": [0, 1, 3, 5, 6, 11], "configuraiton": 1, "conform": 1, "consequ": 9, "consid": 4, "consist": 7, "contain": [1, 5], "content": [1, 8], "contribut": [3, 6, 8, 10], "contributor": 1, "convent": [1, 3], "coordin": 1, "copi": [4, 9], "correct": 11, "correspond": 11, "could": 4, "coupl": 1, "cover": [0, 1, 11], "cp": 3, "creat": [2, 4, 9, 12], "create_": 5, "create_square_default_color": 5, "create_square_from_squar": 5, "ctest": 0, "cuda": [0, 5, 8], "curiou": 10, "current": [0, 1, 2, 3, 4, 6, 8], "data": [1, 9, 10, 11], "date": 1, "dcmake_build_typ": 0, "deactiv": 5, "deal": 1, "debain": 6, "debug": 0, "declar": 5, "decompos": 11, "decomposit": 11, "default": [0, 1, 2, 5], "defin": 5, "deriv": [9, 11], "describ": [1, 4, 10], "descript": 1, "design": 1, "detach": 9, "detail": [1, 11], "develop": [0, 1, 4, 5, 8, 10], "dictat": 1, "differ": [6, 11], "dimens": [9, 11], "dimension": 11, "direct": [9, 11], "directli": 5, "directori": [0, 3], "discuss": 1, "dispact": 9, "dispatch": 9, "displai": 7, "disrupt": 1, "distribut": [4, 6], "diverg": 11, "do": [1, 4, 5, 12], "doc": [1, 2, 7, 11, 12], "docmark": 5, "document": [4, 6, 8], "doe": [0, 5], "doesn": 1, "domain": [9, 11], "don": 4, "done": 11, "download": 3, "driven": 2, "dummi": 5, "e": [1, 5, 6, 7, 11, 12], "each": [1, 5, 9], "earli": [0, 9], "easier": 1, "editor": 5, "effect": [1, 5], "either": [4, 5], "element": 9, "empathis": 1, "empti": 9, "enabl": 1, "encourag": [1, 4], "end": 5, "enforc": 5, "enough": 9, "ensur": 6, "entri": 4, "environ": [0, 1, 6], "equat": [8, 10], "evalu": 11, "everi": 12, "exampl": [1, 5], "exce": 1, "execut": 0, "exist": [1, 2, 4], "expect": [5, 9], "experi": 4, "experienc": 1, "exploratori": 1, "extract": [5, 7], "f": 11, "facilit": 1, "fact": 1, "fail": 0, "failur": 0, "fast": 1, "fc": 0, "feat": 1, "featur": [1, 4], "feedback": 1, "fellow": 1, "few": 6, "field": 11, "file": [0, 1, 3, 5, 7, 12], "find": 6, "first": [5, 9, 11], "fix": [1, 4], "focus": 1, "follow": [0, 1, 3, 4, 5, 10], "fondament": 1, "footer": 1, "footprint": 9, "forbid": 1, "ford": [5, 7], "forget": 1, "fork": 2, "form": 2, "format": 3, "formatt": 6, "fortran": [0, 3, 4, 8], "found": 2, "fprettifi": [1, 3, 5], "frac": 11, "free": 9, "from": [1, 2, 3, 6, 7, 9, 11], "from_comms_buff": 11, "function": [0, 5, 9], "futur": 1, "g": [1, 5, 6, 11, 12], "gatekeep": 1, "gener": [1, 2, 5, 6, 7], "get": [1, 6], "get_block": 9, "gfortran": 6, "git": [0, 1, 3, 5], "githook": 3, "github": [1, 2, 3, 12], "give": 1, "given": [1, 9, 11], "gnu": 6, "go": [1, 3], "gpu": 8, "gpu_kernel": 5, "graph": 2, "greatli": 1, "ground": 1, "grow": 9, "guid": [1, 4, 7, 8], "guidelin": [3, 4, 8], "ha": [1, 9, 11], "hand": 1, "hard": 1, "harder": 1, "hat": 11, "have": [1, 2, 3, 4, 9, 11], "head": 9, "header": 1, "help": 1, "hierachi": 7, "hmtl": 7, "hold": [1, 9, 11], "hook": [1, 3, 5], "how": [1, 2, 10], "howev": [0, 1], "hpc": 6, "html": [5, 7], "i": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11], "idea": [2, 4], "ident": 5, "identifi": 9, "ignor": 0, "illustr": 2, "immedi": 9, "implement": [0, 1, 4, 10], "import": 1, "importlantl": 1, "improv": [1, 2, 4, 8], "includ": [0, 6, 12], "indent": 1, "index": 7, "indic": 5, "inform": 12, "ini": [1, 5], "inlin": 5, "input": 12, "instal": [1, 3, 5, 6], "instanc": [5, 6, 9, 11], "instead": [0, 5, 9], "integ": 9, "integr": 1, "intent": 5, "interest": 1, "interfac": 5, "intern": 8, "introduc": 1, "introduct": 7, "involv": 11, "isn": 1, "isol": 6, "issu": [2, 4, 12], "item": 2, "its": [4, 9], "k": 11, "keyword": [1, 5], "know": 1, "knowledg": 1, "known": [1, 5], "label": 9, "languag": 7, "launcher": 0, "layout": 11, "lead": [1, 8], "learn": [1, 10], "least": 1, "length": 5, "letter": 5, "level": 1, "librari": [6, 10], "licens": 4, "lifetim": 9, "light": 7, "like": [1, 5], "limit": 1, "line": [1, 5], "link": [1, 6, 9], "list": [5, 9], "local": [1, 3], "locat": [5, 6, 7], "longer": 9, "look": 4, "lowercas": 1, "m": 11, "m_alloc": 9, "machin": 0, "made": 9, "mai": 5, "main": [0, 2], "maintain": [1, 9], "make": [0, 1, 3, 4, 5, 7], "manag": [6, 8, 10], "markdown": 7, "markup": 7, "mathbf": 11, "mathemat": 5, "maximum": 9, "md": 7, "mean": [1, 5, 6], "meanwhil": 11, "memblock_ptr": 9, "memblock_t": 9, "memori": [8, 10], "memory_block_t": 9, "merg": 1, "messag": [1, 3], "method": 5, "might": 9, "mind": 4, "modifi": 4, "modular": 8, "momentum": [8, 10], "more": [0, 1, 5, 11], "most": [1, 5], "motiv": 1, "mpi": 11, "msg": 3, "much": [1, 5], "multipl": 1, "must": [0, 1, 5], "my_long_subroutin": 5, "my_very_long_subroutin": 5, "n": 11, "nabla": 11, "necesseari": 11, "need": [0, 6, 9, 11], "new": [1, 2, 4, 9, 12], "next": 9, "non": [1, 5], "notat": 5, "note": [0, 1, 2, 5, 9], "nu": 11, "number": [1, 11], "nvfortran": 0, "nvida": 6, "nvidia": [0, 8], "o": 7, "object": [5, 9], "often": 1, "omit": 5, "onc": 0, "one": [0, 1, 4, 5, 9], "ongo": 1, "onli": [0, 1, 5, 9, 11], "open": [1, 2, 4, 5, 7], "oper": [1, 9, 11, 12], "opportun": 1, "oppos": 1, "option": [1, 5, 6], "order": [1, 11], "other": [1, 6, 9], "otim": 11, "out": [1, 5, 9], "output": 0, "overview": [4, 8], "overwrit": 5, "own": 5, "packag": 6, "page": [5, 7], "pamang": 6, "paragraph": 5, "parallel": [8, 9], "paramet": 5, "parenthes": 5, "part": [1, 2, 4], "particular": 1, "particularli": [1, 4], "pass": 9, "path": 0, "pencil": 11, "perf": 1, "perform": [8, 11], "phase": 0, "phrase": 5, "physic": 11, "pick": 4, "pip": 6, "pipx": 6, "place": 1, "plan": 1, "plane": 11, "pleas": [1, 2], "point": [1, 4], "pointer": 9, "polici": 1, "poor": 1, "pop": 9, "possibl": [1, 5], "post": 1, "potenti": 1, "practic": 9, "pre": [1, 3, 5], "preced": 5, "precis": 11, "predocmark": 5, "prefer": 1, "prefix": 5, "present": 0, "prevent": 1, "preview": 5, "primari": 11, "primer": 7, "privat": 5, "probabl": 0, "procedur": 11, "process": [1, 4, 8, 9, 11], "program": [4, 9], "project": [1, 3, 4, 5, 8], "prototyp": [1, 5], "provid": 1, "ptr": 9, "ptr1": 9, "ptr2": 9, "public": 5, "pull": 2, "pure": 5, "purpos": [1, 4, 11], "push": [2, 9], "python": 6, "qualiti": 1, "quantiti": 11, "rather": 5, "reach": 9, "readi": 9, "real": 5, "recent": 6, "recommend": [5, 6], "record": 1, "redistribut": 4, "reduc": 11, "refactor": 1, "refer": [8, 11], "referenc": 2, "regist": 1, "regress": 1, "regular": 5, "rel": 0, "releas": 9, "release_block": 9, "repo": 2, "report": [4, 8], "repositori": [1, 2, 3, 5, 7], "reproduc": 12, "request": [2, 9], "requir": [0, 1, 3, 4, 8, 9, 12], "reshuffl": 11, "resolv": 6, "respect": 1, "respons": 9, "restructuredtext": 7, "result": [5, 11], "return": [1, 5, 9], "reus": 9, "rewrit": 8, "right": 3, "root": [3, 5, 7], "rotate_x_to_i": 11, "rst": 7, "rule": 1, "run": [1, 4, 5, 8], "same": [1, 5, 9], "save": 5, "scope": 1, "section": [4, 10], "see": [0, 1, 2, 3, 5, 7, 9, 11, 12], "sentenc": 1, "serial": 8, "set": [0, 1, 4, 5, 8], "share": [1, 4], "shell": 3, "should": [1, 4, 5, 6], "show": 0, "side": 5, "sign": 1, "signific": 1, "similar": 7, "singl": [1, 11], "size": [5, 9, 11], "slab": [9, 11], "slab_t": [9, 11], "slice": 9, "small": 1, "snake_cas": 5, "so": [1, 4, 5, 6, 12], "softwar": 6, "solv": 11, "some": [1, 9], "soon": 1, "sourc": [0, 4, 7], "space": [9, 11], "span": 5, "spatial": [8, 10], "spec": 1, "special": 1, "specif": [1, 3, 4, 9, 11], "specifi": [0, 1], "spend": 1, "sphinx": 7, "split": 5, "sq_in": 5, "sq_size": 5, "squar": 5, "square_modul": 5, "square_t": 5, "stabl": 6, "stage": [3, 9, 11], "standard": 1, "start": [0, 1, 5, 6], "statement": 5, "stdout": 5, "stencil_m": 5, "stencil_t": 5, "step": 11, "store": 11, "strive": 1, "strongli": 6, "structur": [1, 10], "studi": [1, 4], "style": [1, 4, 8], "subroutin": [5, 9], "sudo": 6, "suffix": 5, "suggest": 4, "sum": 1, "summari": 1, "support": [5, 8, 11], "sure": [1, 3, 12], "switch": 11, "symbol": 5, "syntax": 5, "system": [6, 12], "sz": 11, "t": [1, 4], "take": 4, "target": [1, 2], "technic": 1, "term": 11, "terribili": 1, "test": [1, 4, 8], "testabl": 8, "text": 5, "than": [1, 5], "thei": [1, 4, 5, 7, 10], "them": 9, "therefor": 1, "thi": [1, 3, 5, 6, 7, 8, 11], "thing": [1, 6, 10], "think": [1, 11], "thread": 5, "three": 11, "through": [1, 3, 5], "thu": 5, "thumb": 1, "time": [1, 6, 11], "tool": [0, 3, 4, 8], "toolbelt": 6, "top": [5, 9], "tracker": [2, 4, 12], "train": 1, "transfer": [1, 11], "transport": 11, "tree": 0, "turn": 1, "two": [1, 5, 9], "type": [1, 9], "type_root_nam": 5, "u": [5, 11], "u_i": 11, "u_x": 11, "u_z": 11, "under": 7, "understand": 1, "uniqu": 9, "unit": [1, 4, 8], "unless": 5, "until": 1, "up": [1, 4, 8], "upper": [1, 5], "us": [1, 3, 5, 6, 7, 8, 9, 10, 12], "user": [4, 10, 11], "usual": 1, "v1": 1, "vari": 1, "variabl": [0, 5], "varieti": 6, "variou": 10, "vector": 11, "vectoris": 11, "veloc": 11, "velocity_field": 5, "version": [4, 6, 8, 12], "via": 6, "virtual": 6, "wai": 1, "want": [0, 5], "we": [1, 4, 5, 6], "web": 7, "websit": 7, "welcom": 1, "well": [1, 5, 6], "what": [1, 8], "whenev": 9, "where": [1, 9, 11], "which": [0, 9, 11], "whitespac": [1, 5], "who": [1, 9], "whole": 2, "whose": 9, "willing": 10, "wish": 4, "within": 11, "without": [5, 11], "work": [1, 4], "wors": 1, "wrapper": 6, "write": [1, 5, 6], "x": [3, 11], "x3d2": [0, 1, 2, 3, 5, 6, 7, 8, 9, 12], "x_contrib": 11, "x_dir_contrib": 11, "x_slab": 11, "x_slab_z": 11, "xcompact3d": [3, 8], "xslab": 11, "y": 11, "y_dir_contrib": 11, "y_slab": 11, "yet": 0, "you": [0, 1, 2, 3, 4, 5, 6, 7, 12], "your": [0, 1, 2, 3, 4, 5, 6, 12], "yourself": 1, "yslab": 11, "z": 11, "z_comm_buff": 11, "z_dir_contrib": 11, "z_slab": 11, "zslab": 11}, "titles": ["Building and running the unit tests", "Contributing guidelines", "Overview of the contribution process", "Setting up for development", "Contributing to x3d2", "Fortran style guide", "Required tools", "Contributing documentation", "<no title>", "Memory management", "Internals", "Computing the spatial contribution to the momentum equation", "Report a bug"], "titleterms": {"In": [1, 5, 7], "The": 11, "accordingli": 1, "alloc": 9, "basic": 5, "block": 9, "bug": 12, "build": [0, 7], "cmake": 6, "code": [1, 5, 7], "commit": 1, "compil": 6, "comput": 11, "constructor": 5, "contribut": [1, 2, 4, 7, 11], "convent": 5, "custom": 5, "definit": 5, "deriv": 5, "develop": [3, 7], "document": [5, 7], "equat": 11, "first": 1, "ford": 6, "format": [1, 5], "fortran": [1, 5, 6], "fprettifi": 6, "guid": 5, "guidelin": 1, "intern": 10, "issu": 1, "manag": 9, "memori": 9, "modul": 5, "momentum": 11, "name": 5, "nutshel": 1, "overview": 2, "procedur": 5, "process": 2, "pull": 1, "report": 12, "request": 1, "requir": 6, "review": 1, "run": 0, "set": 3, "slab3d_t": 11, "spatial": 11, "sphinx": 6, "structur": 5, "style": 5, "test": 0, "tool": 6, "type": [5, 11], "unit": 0, "up": 3, "user": 7, "write": 7, "x3d2": 4}}) \ No newline at end of file