Style Guide¶
This document provides a guide to the style used in this project.
Code Formatting¶
We utilize ClangFormat to automate code formatting. Please format your code before pushing and/or creating a pull request.
Additionally, ensure that your code adheres to the project’s linting rules. Use the provided linting tools to check for any issues before committing your changes.
Naming conventions¶
General¶
In general, we stick to the following naming conventions:
snake_case
for variables, functions, and filenamesPascalCase
for classes and structsALL_CAPS
for constants and enum membersm_
prefix for class member variables (if the member is not public)member()
to get a class member variable (if the member is not public)set_member()
to set a class member variable (if the member is not public)
Specific¶
Vertex positions:
vertices
orpositions
Vertex displacements:
displacements
Vertex rest positions/material coordinates:
rest_positions
Vertex velocities:
velocities
Mesh edge matrix:
edges
Mesh face matrix:
faces
Element vertices: Use a numeral suffix (e.g.,
e0
ande1
for the end-points of an edge).Edge-edge pairings: Use suffixes
a
andb
.Continuous collision detection pairs: Use the suffix
_t0
for starting values and_t1
for end values.Favor the term “collision” over “contact” (but this is not a hard rule).
Prefer the term “potential” over “constraint” when referring to collisions and friction.
Documentation¶
We use Doxygen to generate documentation. Please document your code before pushing and/or creating a pull request.