From baacfd11f44c4574f64d12eac4b5fc4257268116 Mon Sep 17 00:00:00 2001 From: pelesh Date: Wed, 17 Dec 2025 14:11:27 -0500 Subject: [PATCH 1/2] Update CONTRIBUTING.md --- CONTRIBUTING.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 36ba1ea9..e5ab0507 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -249,17 +249,6 @@ For consistency, use the same name everywhere the same type is used. template ; // No, `_type` used in a template parameter name ``` -### Enums (enumerated types) - -Always define `enum`s inside `GridKit` namespace. Type names should be -capitalized and the constant names should be uppercase with underscores -(but there is no underscore at the end!). - -```c++ - enum ExampleEnum { CONST_ONE = 0, - CONST_TWO = 8, - YET_ANOTHER_CONST = 17 }; -``` ### Constants From 2f2863dcd160e3743b9ff1146b469f9708cf453d Mon Sep 17 00:00:00 2001 From: pelesh Date: Thu, 18 Dec 2025 15:58:50 -0500 Subject: [PATCH 2/2] Add specific guidelines for enums --- CONTRIBUTING.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e5ab0507..72aa3a7a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -263,6 +263,23 @@ name. Use all caps (screaming snake case). constexpr double EXP = 2.7183 // Yes ``` +### Enums (enumerated types) + +Always define `enum`s inside `GridKit` namespace. The `enum` name should +be upper camel case, same as class names. The `enum` element names should +match symbol for physics quantity they represent or they should be uppercase +(same as names for constants) if they do not represent a physics quantity. +For example, enum element for real component of voltage $V_r$ should be `Vr`. +A name for `enum` element for a "fast mode", for example, should be something +like `FAST_MODE`, capitalized with underscores separating words (but no +underscore at the end!). + +```c++ + enum ExampleEnum { Vr, // Yes, it matches symbol for real voltage component + VR, // No, the element name should match the physics symbol + FAST_MODE}; // Yes, element name is all caps. +``` + ### Pointers and references The pointer `*` or reference `&` belong to the type and there should be no space between them and the type name.