# Developer Notes ## Style Guide Please check your code for style issues by running `make format` In addition to those automatically enforced style rules, libCEED tends to follow the following code style conventions: - Variable names: `snake_case` - Strut members: `snake_case` - Function and method names: `PascalCase` or language specific style - Type names: `PascalCase` or language specific style - Constant names: `CAPS_SNAKE_CASE` or language specific style Also, documentation files should have one sentence per line to help make git diffs clearer and less disruptive. ## Clang-tidy Please check your code for common issues by running `make tidy` which uses the `clang-tidy` utility included in recent releases of Clang. This tool is much slower than actual compilation (`make -j8` parallelism helps). To run on a single file, use `make interface/ceed.c.tidy` for example. All issues reported by `make tidy` should be fixed. ## Include-What-You-Use Header inclusion for source files should follow the principal of 'include what you use' rather than relying upon transitive `#include` to define all symbols. Every symbol that is used in the source file `foo.c` should be defined in `foo.c`, `foo.h`, or in a header file `#include`d in one of these two locations. Please check your code by running the tool [`include-what-you-use`](https://include-what-you-use.org/) to see recommendations for changes to your source. Most issues reported by `include-what-you-use` should be fixed; however this rule is flexible to account for differences in header file organization in external libraries. If you have `include-what-you-use` installed in a sibling directory to libCEED or set the environment variable `IWYU_CC`, then you can use the makefile target `make iwyu`. Header files should be listed in alphabetical order, with installed headers preceding local headers and `ceed` headers being listed first. The `ceed-f64.h` and `ceed-f32.h` headers should only be included in `ceed.h`. ```c #include #include #include #include #include "ceed-avx.h" ``` ## Shape Backends often manipulate tensors of dimension greater than 2. It is awkward to pass fully-specified multi-dimensional arrays using C99 and certain operations will flatten/reshape the tensors for computational convenience. We frequently use comments to document shapes using a lexicographic ordering. For example, the comment ```c // u has shape [dim, num_comp, Q, num_elem] ``` means that it can be traversed as ```c for (d=0; d