Admin message

Attention: i10git will shutdown soon!

This i10git GitLab server was migrated to gitos.rrze.fau.de due to hardware issues with the current host. This affects all production repositories, including waLBerla, lbmpy, pystencils and HyTeG.

Login: Gitos supports DFN-AAI and eduGAIN. If your institution does not support either, please use our GitHub mirrors.

Onboarding: All repositories belonging to groups were migrated. To regain access, first log in to gitos.rrze.fau.de once to activate your account. Then email cs10-admin@fau.de with your old i10git and your new gitos.rrze username (the @) as shown on your respective user profiles. We will reassign your accordingly. Note: Repositories from former courses (e.g. advpt) were not migrated.

Personal repositories in individual user namespaces were not migrated. Please export these yourself before the old server is shut down.

Expected shutdown by the end of 2026. Until then, the old i10git server will still be reachable with all repositories archived (read only). However, due to the ongoing hardware issues, it may remain unreliable and will receive no further maintenance.

The parent group is archived. This project and its data are read-only.
Constness in generated code
The way pystencils determines constness and placement of `const` keywords is very intransparent and at times misleading. Things that should be const are often printed non-const. While we may expect compilers to detect constness by themselves, this makes integration into other code frameworks more tedious, and still may impact performance. Luckily, so far, I have not observed the opposite (non-const values printed const) which would just not compile. ## Constness Constness is introduced in the following places (maybe I've missed something): - In the type system: - `BasicType` and `StructType`: An object type may be `const`-qualified. That is how it should be in a C code generator. - `PointerType`: A pointer may be `const`-qualified, and its pointed-to type may also be; so theoretically, all four possible combinations of constness on pointers can be realized. This does not hold for the recently introduced double pointers (pycodegen/pystencils!356), though; see below. - In the AST: `SympyAssignment` has a member `is_const` for constant declarations. While it is perfectly sensible to const-qualify types, annotating assignments with context has the potential for vast confusions; what if the type of the LHS is non-const? How to print it if it is const? ## Problems ### Field Access Resolution In `transformations.py` ([here](https://i10git.cs.fau.de/pycodegen/pystencils/-/blob/master/pystencils/transformations.py#L557)), the data pointer for a field access is created with `const=True` if the field is read-only; however this creates a const pointer, not a pointer to const. The pointed-to data type is still non-const. ### Code Printer The code printer handles const `SympyAssignment`s ([here](https://i10git.cs.fau.de/pycodegen/pystencils/-/blob/master/pystencils/backends/cbackend.py#L273)) in a fashion that is clearly problematic: The LHS type is printed, and then all occurences of `const` are removed from it by string operations. Then a leading `const` is added. This breaks down in the presence of pointers (especially now, with the new double pointers): `const` may occur more than once in a pointer type. Also, if the declaration LHS is of pointer type, the `const` keyword must not be added to the left, but to the right of the type string. ## Solutions Constness should exclusively be a part of the type, and the type system should respect it. I've tried several avenues of fixing this, without success; even though constness only occurs at very few places in the code, the way they are spread across the code makes changing them extremely challenging. The constness issue should enter consideration of the design of the new backend (pycodegen/pystencils#73), where it can then be solved as a 'by-the-way', simply by clean integration of constness in the type system.
issue