---
Language: Cpp
Standard: c++20

# Indentation
TabWidth: 4
IndentWidth: 4
UseTab: Never
IndentPPDirectives: None
IndentWrappedFunctionNames: false
NamespaceIndentation: None

# Empty lines
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1

# Line length
ColumnLimit: 100

# Line endings
DeriveLineEnding: false
LineEnding: LF

# Breaking and Penalties
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: false

PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60

# Spacing and padding
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceAfterLogicalNot: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesBeforeTrailingComments: 1
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeSquareBrackets: false
SpacesInSquareBrackets: false
SpaceBeforeCaseColon: false

# Brace placement
BraceWrapping:
  AfterClass: false
  AfterControlStatement: false
  AfterEnum: false
  AfterFunction: false
  AfterNamespace: false
  AfterStruct: false
  AfterUnion: false
  BeforeCatch: false
  BeforeElse: false
  IndentBraces: false
  SplitEmptyFunction: false
  SplitEmptyRecord: false
  SplitEmptyNamespace: false
Cpp11BracedListStyle: true

# Function definitions
# BreakAfterReturnType: AllDefinitions
AlwaysBreakAfterDefinitionReturnType: All

AttributeMacros:
  - __host__
  - __device__
  - __hostdev__
  - __global__
  - __forceinline__
  - __shared__
  - __launch_bounds__

# Alignment
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments:
  Kind: Always
  OverEmptyLines: 2

# Single line allowances
BinPackParameters: false
BinPackArguments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: true
AllowShortLoopsOnASingleLine: false

# Sorting
IncludeBlocks: Regroup
IncludeIsMainRegex: "$"
IncludeCategories:
  - Regex:           '^"' # quoted includes
    Priority:        1
  - Regex:           '^<fvdb/' # fvdb includes
    Priority:        2
  - Regex:           '^<nanovdb/' # nanovdb includes
    Priority:        3
  - Regex:           '^<(torch|c10|THC|ATen)/' # torch includes
    Priority:        4
  - Regex:           '^<(thrust|cub|cuda)/' # CCCL includes
    Priority:        5
  - Regex:           '^<(cooperative_groups|cuco|cuda.h|cuda_|device_types|math_constants|nvtx3|cute)' # CUDA includes
    Priority:        6
  - Regex:           '^<.*\..*' # other system includes (e.g. with a '.')
    Priority:        7
  - Regex:           '^<[^.]+' # STL includes (no '.')
    Priority:        8
IncludeIsMainSourceRegex: "$"
SortIncludes: true
SortUsingDeclarations: true

