Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
855c01b
make configure_for_rtd.sh callable from everywhere
sandro-elsweijer Feb 24, 2026
d362435
move t8indent_ignore.sh to internal/
sandro-elsweijer Feb 24, 2026
6ff81ad
move check_macros.sh to internal/
sandro-elsweijer Feb 24, 2026
7d84416
make check_all_test_binaries_valgrind.sh executable
sandro-elsweijer Feb 24, 2026
4653aa1
make file checking prettier
sandro-elsweijer Feb 24, 2026
2e2bd52
make check_valgrind.sh executable
sandro-elsweijer Feb 24, 2026
6ab04cd
make find_all_test_binary_paths.sh executable
sandro-elsweijer Feb 24, 2026
e8f3e2f
read exit code of subscript
sandro-elsweijer Feb 24, 2026
e229af0
make valgrind check not assume any folder structures
sandro-elsweijer Feb 24, 2026
b0e3b20
move find_all_test_binary_paths.sh to internal/
sandro-elsweijer Feb 24, 2026
60a3eb4
make license prettier
sandro-elsweijer Feb 24, 2026
0fdb769
move find_all_source_files.sh to internal/
sandro-elsweijer Feb 24, 2026
544b1a1
update path
sandro-elsweijer Feb 24, 2026
6258001
update readme to new folder structure
sandro-elsweijer Feb 24, 2026
749d42c
fix argument of valgrind action
sandro-elsweijer Feb 24, 2026
5cf2f1b
rename t8indent to indent to match other scripts
sandro-elsweijer Feb 24, 2026
d939d8d
rename t8spell_check_and_indent.sh to spell_check_and_indent.sh to ma…
sandro-elsweijer Feb 24, 2026
f4222a5
rename other occurences of t8indent to indent
sandro-elsweijer Feb 24, 2026
d7d8d3b
make indent_ignore not executable, since it isnt a script
sandro-elsweijer Feb 24, 2026
7f8df0e
remove hard coded folder
sandro-elsweijer Feb 24, 2026
02f48e8
let script return to old wd
sandro-elsweijer Feb 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/spell_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: check macros
run: |
for file in $(git diff --name-only --diff-filter=A); do
./scripts/check_macros.sh "$file" &>> check_macros.txt
./scripts/internal/check_macros.sh "$file" &>> check_macros.txt
done
- name: Archive script output
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ jobs:
# Execute script that runs a Valgrind check for all test binaries.
# We use 4 parallel processes to run the binaries in parallel with MPI.
- name: Valgrind check
run: cd scripts && bash ./check_all_test_binaries_valgrind.sh --ntasks=4
run: cd scripts && bash ./check_all_test_binaries_valgrind.sh ../build/test/ --ntasks=4
2 changes: 1 addition & 1 deletion .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ eles = "eles"
packageid = "packageid"

[files]
extend-exclude = ["scripts/t8indent.sh", "thirdparty/", "t8code_logo.png", "cmake/FindOpenCASCADE.cmake", "src/t8_misc/t8_with_macro_error.h", "doc/Doxyfile.in"]
extend-exclude = ["scripts/indent.sh", "thirdparty/", "t8code_logo.png", "cmake/FindOpenCASCADE.cmake", "src/t8_misc/t8_with_macro_error.h", "doc/Doxyfile.in"]
2 changes: 1 addition & 1 deletion pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ If the Pull request introduces code that is not covered by the github action (fo
- [ ] Should this use case be added to the github action?
- [ ] If not, does the specific use case compile and all tests pass (check manually).
#### Scripts and Wiki
- [ ] If a new directory with source files is added, it must be covered by the `script/find_all_source_files.scp` to check the indentation of these files.
- [ ] If a new directory with source files is added, it must be covered by the `scripts/find_all_source_files.scp` to check the indentation of these files.
- [ ] If this PR introduces a new feature, it must be covered in an example or tutorial and a Wiki article.
#### License
- [ ] The author added a BSD statement to `doc/` (or already has one).
32 changes: 10 additions & 22 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,21 @@ This folder contains several scripts that are useful for t8code users and develo

The purpose of the indentation scripts is to help t8code developers to indent their code according to the t8code [indentation guidelines](https://github.com/DLR-AMR/t8code/wiki/Coding-Guideline#indentation). Please read these guidelines before using these scripts.

#### t8indent.sh
#### indent.sh

Apply this script to a `.c`, `.cxx`, `.h` or `.hxx` file to indent it according to the guidelines.
You can also provide a list of files and all will get indented.

This script uses the `clang-format` program with t8code specific settings.
Sometimes `t8indent.sh` does produce undesired results. Therefore, after indenting use `git add -p` or similar to check all changes before committing. You can protect code lines from being changed by the script by enclosing them in `/* clang-format off */` and `/* clang-format on */` comments.
Sometimes `indent.sh` does produce undesired results. Therefore, after indenting use `git add -p` or similar to check all changes before committing. You can protect code lines from being changed by the script by enclosing them in `/* clang-format off */` and `/* clang-format on */` comments.

#### internal/indent_ignore

#### t8indent_ignore.sh

A list of files that will be ignored by `t8indent.sh`.

#### pre-commit

This script should be copied to your `.git/hooks` folder. `git` then automatically checks the indentation of committed files and prevents you from committing wrongly indented files. See [Git indentation workflow](https://github.com/DLR-AMR/t8code/wiki/Coding-Guideline#git-indentation-workflow).
A list of files that will be ignored by `indent.sh`.

#### check_if_file_indented.sh

Check for a single source file whether it is indented according to `t8indent.sh`.
Check for a single source file whether it is indented according to `indent.sh`.

#### check_if_all_files_indented.sh

Expand All @@ -35,30 +30,23 @@ Check whether all t8code source files are properly indented.

This script indents all t8code source files at once. This script should only be used by the main developers of t8code. Handle with care.

#### find_all_source_files.sh
## Software development

#### pre-commit

List all source files of t8code in the `src/`, `example/` and `test/` subfolders.
This script should be copied to your `.git/hooks` folder. `git` then automatically checks the indentation of committed files and prevents you from committing wrongly indented files. See [Git indentation workflow](https://github.com/DLR-AMR/t8code/wiki/Coding-Guideline#git-indentation-workflow).

#### check_valgrind.sh

This script runs Valgrind on a binary path provided as a parameter with specified memory leak detection flags. The Valgrind output is parsed. Using `--supp=[FILE]`, you can provide a path to a suppression file that is used by Valgrind to suppress certain errors (e.g. [valgrind_suppressions_file](valgrind_suppressions_file.supp)). With `--ntasks=[NUMBER]`, you can provide the number of processes to use with mpi (default is 1).

#### find_all_test_binary_paths.sh

This file lists all paths to test binaries that exist in the build/test directory.
The paths are relative paths assuming an execution from the test/ folder in the build directory.

#### check_all_test_binaries_valgrind.sh

This script performs a valgrind check on each test binary found by [find_all_test_binary_paths.sh](find_all_test_binary_paths.sh).
This script performs a valgrind check on each test binary found by [find_all_test_binary_paths.sh](internal/find_all_test_binary_paths.sh).
The valgrind check is done by [check_valgrind.sh](check_valgrind.sh). It is assumed that the build folder ../build/test/ with the correct test binaries exists. With `--ntasks=[NUMBER]`, you can provide the number of processes to use with mpi for parallel tests (default is 1).

## Others

#### su2_mesh_to_gmsh.py

Used to convert coarse meshes from an su2 format into msh format.

#### create_todo_list.sh

Parses through the code and collects comments containing the `TODO` keyword.
49 changes: 35 additions & 14 deletions scripts/check_all_test_binaries_valgrind.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# t8code is a C library to manage a collection (a forest) of multiple
# connected adaptive space-trees of general element classes in parallel.
#
# Copyright (C) 2025 the developers
# Copyright (C) 2026 the developers
#
# t8code is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -23,16 +23,35 @@
#
# This script performs a valgrind check on each test binary given by find_all_test_binary_paths.sh.
# The valgrind check is done by the check_valgrind.sh script.
# The script returns 1 if an error is found and 0 otherwise.
# The script returns 1 if an error is found and 0 otherwise.
# This script must be executed from the scripts/ folder.
# It is assumed that the build folder ../build/test/ with the correct test binaries exists.
# With "--ntasks=[NUMBER]", you can provide the number of processes to use with MPI for parallel tests (default is 1).
#

USAGE="\nUSAGE: This script executes valgrind in parallel on each test binary available. Use the syntax \n
$0 --ntasks=[NUM_TASKS]\n
$0 [TEST_BINARY_PATH] --ntasks=[NUM_TASKS]\n
Providing the number of parallel processes to use with MPI for parallel tests is optional.\n"

# Check directory exists
if [ -z "$1" ]; then
echo "ERROR: Need to provide a directory as first argument."
echo -e "$USAGE"
exit 1
fi

# Check if it is a directory
if [ -d "$1" ]; then
TEST_BINARY_PATH="$1"
else
echo "ERROR: Directory does not exist: $1"
echo -e "$USAGE"
exit 1
fi

#convert to abspath
TEST_BINARY_ABSPATH=$(realpath $TEST_BINARY_PATH)

# Check if a number of processes is provided. If not, set to 1.
num_procs=1
for arg in "$@"; do
Expand Down Expand Up @@ -61,20 +80,22 @@ if [ `basename $PWD` != scripts ]; then
fi

# Find all test binary paths.
test_bin_paths=`bash ./find_all_test_binary_paths.sh`
num_paths=$(echo $test_bin_paths | wc -w)
test_bin_paths=$(bash ./find_all_test_binary_paths.sh "$TEST_BINARY_ABSPATH")
status=$?

# This is necessary because some tests use test files specified by relative paths.
# These tests only work when run from the build/test/ directory.
if [ -d ../build/test ]; then
# The directory stack is automatically reset on script exit.
pushd ../build/test/ > /dev/null
else
echo "ERROR: Couldn't find a the directory ../build/test/."
echo -e "$USAGE"
exit 1
if [ $status -ne 0 ]; then
echo "$test_bin_paths"
echo "Failed to collect test binaries."
exit $status
fi

num_paths=$(echo $test_bin_paths | wc -w)

# This is necessary because some tests use test files specified by relative paths.
# These tests only work when run from the test directory.
# The directory stack is automatically reset on script exit.
pushd $TEST_BINARY_ABSPATH > /dev/null

status=0
counter=0
valgrind_suppressions_file=../../scripts/valgrind_suppressions_file.supp
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_if_all_files_indented.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fi

# Find all files with the appropriate suffix.
# Excluding the sc/ and p4est/ subfolders.
files=`./find_all_source_files.sh`
files=`./internal/find_all_source_files.sh`

notallindented=0
for file in $files
Expand Down
8 changes: 4 additions & 4 deletions scripts/check_if_file_indented.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

#
# This script checks if a given file is correctly indented according to the t8indent.sh script.
#
# This script checks if a given file is correctly indented according to the indent.sh script.
#

GIT_REPO_PATH=$(git rev-parse --show-toplevel)

INDENT_SCRIPT=${GIT_REPO_PATH}/scripts/t8indent.sh
INDENT_SCRIPT=${GIT_REPO_PATH}/scripts/indent.sh

usage="USAGE:$0 [FILE_TO_CHECK]\n\nWill check if [FILE_TO_CHECK] is correctly indentend according to the script t8indent.sh."
usage="USAGE:$0 [FILE_TO_CHECK]\n\nWill check if [FILE_TO_CHECK] is correctly indentend according to the script indent.sh."

# Check if first argument given
if [ ${1-x} = x ]
Expand Down
4 changes: 2 additions & 2 deletions scripts/check_valgrind.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

#
# This script runs Valgrind on an input binary paths with specified memory leak detection flags.
# This script runs Valgrind on an input binary paths with specified memory leak detection flags.
# The Valgrind output is parsed. If any errors are found, they are printed and the script exits with a status of 1.
# If errors are found, the Valgrind output is kept in the file valgrind-output.log for further inspection.
# Using "--supp=[FILE]", you can provide a path to a suppression file that is used by Valgrind to suppress certain errors.
Expand All @@ -32,7 +32,7 @@ $0 [FILE] --supp=[SUPPRESSION_FILE] --ntasks=[NUM_TASKS]\n
to run valgrind on FILE. Optionally you can provide a suppression file and the number of parallel processes to use with MPI.\n"

# Check that an argument is given and that the argument is a file.
if [ ${1-x} = x ]; then
if [ -z "$1" ]; then
echo "ERROR: Need to provide a file as first argument."
echo -e "$USAGE"
exit 1
Expand Down
2 changes: 2 additions & 0 deletions scripts/configure_for_rtd.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# along with t8code; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

pushd "$(git rev-parse --show-toplevel)" > /dev/null

git submodule init
git submodule update

Expand Down
39 changes: 19 additions & 20 deletions scripts/find_disabled_tests.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
#!/bin/bash


#This file is part of t8code.
#t8code is a C library to manage a collection (a forest) of multiple
#connected adaptive space-trees of general element classes in parallel.

#Copyright (C) 2024 the developers

#t8code is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.

#t8code is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with t8code; if not, write to the Free Software Foundation, Inc.,
#51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# This file is part of t8code.
# t8code is a C library to manage a collection (a forest) of multiple
# connected adaptive space-trees of general element classes in parallel.
#
# Copyright (C) 2024 the developers
#
# t8code is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# t8code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with t8code; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.



Expand Down
8 changes: 4 additions & 4 deletions scripts/t8indent.sh → scripts/indent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ fi
#
# Parsing of input files and throwing out files to be ignored
#
# Read all lines from the IGNORE_FILE
# Read all lines from the IGNORE_FILE
# that are not empty and are not comments (i.e. start with '#').
# Determine base directory of git repo
GIT_REPO_PATH=$(git rev-parse --show-toplevel)

IGNORE_FILE=${GIT_REPO_PATH}/scripts/t8indent_ignore.sh
IGNORE_FILE=${GIT_REPO_PATH}/scripts/internal/indent_ignore
files_to_ignore=()
while read line; do
if [[ ${line:0:1} != "#" ]] && [[ $line != "" ]]
Expand Down Expand Up @@ -112,7 +112,7 @@ do
do
echo Checking "$arg" against "${GIT_REPO_PATH}/$ignore_file"
if [[ "$arg" -ef "${GIT_REPO_PATH}/$ignore_file" ]]
then
then
# arg matches and will be ignored
echo The file \"$arg\" will be ignored by indentation as specified in \"$IGNORE_FILE\".
ignore_arg=1
Expand All @@ -136,7 +136,7 @@ then
else
$FORMAT $FORMAT_OPTIONS ${newargs[@]}
status=$?
fi
fi

# If the file content was not changed, the return
# value determines whether or not the file was
Expand Down
10 changes: 5 additions & 5 deletions scripts/indent_all_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ fi

# Find all files with the appropriate suffix.
# Excluding the sc/ and p4est/ subfolders.
files=`./find_all_source_files.sh`
files=`./internal/find_all_source_files.sh`

notallindented=0

INDENT=./t8indent.sh
INDENT=./indent.sh

echo This script will change all source files found in
echo This script will change all source files found in
echo $PWD/../src/
echo $PWD/../example/
echo $PWD/../test/
Expand All @@ -72,14 +72,14 @@ then
then
$INDENT $file
status=$?
if test $status -ne 0
if test $status -ne 0
then
echo "File $file is not indented."
notallindented=1
fi
fi
done

if test $notallindented -eq 0
then
echo All files are indented.
Expand Down
12 changes: 6 additions & 6 deletions scripts/check_macros.sh → scripts/internal/check_macros.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ then
exit 0
fi

#
# This script searches for lines containing a macro definition in the style of '#ifdef T8_ENABLE_'
#
# This script searches for lines containing a macro definition in the style of '#ifdef T8_ENABLE_'
# in the specified file and processes each matching line.
# It uses 'grep' to find all occurrences of '#ifdef T8_ENABLE_' in the file located
# at the path stored in the variable 'file_path'. The '-n' option with 'grep'
# It uses 'grep' to find all occurrences of '#ifdef T8_ENABLE_' in the file located
# at the path stored in the variable 'file_path'. The '-n' option with 'grep'
# ensures that the line numbers of the matching lines are included in the output.
# The output of 'grep' is then piped into a 'while' loop, which reads each line
# The output of 'grep' is then piped into a 'while' loop, which reads each line
# and splits it into the line number and the line content using ':' as the delimiter.
# Variables:
# - file_path: The path to the file to be searched.
# - line_number: The line number where the macro definition is found.
# - line: The content of the line where the macro definition is found.
#
#

found_macros=FALSE

Expand Down
Loading