Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
285 changes: 271 additions & 14 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,19 +1,148 @@
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: WebKit
ColumnLimit: 80
AlignTrailingComments: true
FixNamespaceComments: true
ReflowComments: true
BinPackParameters: false
AllowAllParametersOfDeclarationOnNextLine: true
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: true
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseArrows: false
AlignCaseColons: false
AlignConsecutiveTableGenBreakingDAGArgColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveTableGenCondOperatorColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveTableGenDefinitionColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionDeclarations: false
AlignFunctionPointers: false
PadOperators: false
AlignEscapedNewlines: Right
AlignOperands: DontAlign
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Always
AllowShortCaseExpressionOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AllowShortNamespacesOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: false
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterJavaFieldAnnotations: false
BreakAfterReturnType: None
BreakArrays: false
BreakBeforeBinaryOperators: NonAssignment
SortIncludes: true
CommentPragmas: '^@.+'
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Custom
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakBinaryOperations: Never
BreakConstructorInitializers: BeforeComma
BreakFunctionDefinitionParameters: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: false
PackConstructorInitializers: CurrentLine
# Regroup includes with a priority system
IncludeBlocks: Regroup
BreakTemplateDeclarations: MultiLine
ColumnLimit: 80
CommentPragmas: '^@.+'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- RANGES_FOR
- FOREACH
IfMacros:
- IF
IncludeBlocks: Regroup
IncludeCategories:
# by default, the main header of a cpp will get priority 0
# regex here are sorted by search pattern, not by sort priority
Expand All @@ -36,4 +165,132 @@ IncludeCategories:
- Regex: ".*" # catch-all for internal files
Priority: 1 # internal file group
SortPriority: 1
CaseSensitive: true
CaseSensitive: true
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExportBlock: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLines:
AtEndOfFile: false
AtStartOfBlock: true
AtStartOfFile: true
KeepFormFeed: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MainIncludeChar: Quote
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: CurrentLine
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakBeforeMemberAccess: 150
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakScopeResolution: 500
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: Always
RemoveBracesLLVM: false
RemoveEmptyLinesInUnwrappedLines: true
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: CaseInsensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: true
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
ExceptDoubleParentheses: false
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TableGenBreakInsideDAGArg: DontBreak
TabWidth: 8
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
WrapNamespaceBodyWithEmptyLines: Leave
...
4 changes: 2 additions & 2 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: clang-format style check
uses: jidicula/clang-format-action@v4.13.0
uses: jidicula/clang-format-action@v4.15.0
with:
clang-format-version: '18'
clang-format-version: '20'
check-path: ${{ matrix.path }}
11 changes: 5 additions & 6 deletions python/src/barrier/adaptive_stiffness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ void define_adaptive_stiffness(py::module_& m)
m.def(
"semi_implicit_stiffness",
static_cast<double (*)(
const CollisionStencil&, const std::array<long, 4>&,
Eigen::ConstRef<VectorMax12d>, Eigen::ConstRef<VectorMax4d>,
Eigen::ConstRef<MatrixMax12d>, const double)>(
&semi_implicit_stiffness),
const CollisionStencil&, Eigen::ConstRef<VectorMax12d>,
Eigen::ConstRef<VectorMax4d>, Eigen::ConstRef<MatrixMax12d>,
const double)>(&semi_implicit_stiffness),
R"ipc_Qu8mg5v7(
Compute the semi-implicit stiffness for a single collision.

Expand All @@ -92,8 +91,8 @@ void define_adaptive_stiffness(py::module_& m)
Returns:
The semi-implicit stiffness.
)ipc_Qu8mg5v7",
py::arg("stencil"), py::arg("vertex_ids"), py::arg("vertices"),
py::arg("mass"), py::arg("local_hess"), py::arg("dmin"));
py::arg("stencil"), py::arg("vertices"), py::arg("mass"),
py::arg("local_hess"), py::arg("dmin"));

m.def(
"semi_implicit_stiffness",
Expand Down
9 changes: 6 additions & 3 deletions python/src/candidates/edge_edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ using namespace ipc;
void define_edge_edge_candidate(py::module_& m)
{
py::class_<EdgeEdgeCandidate, CollisionStencil>(m, "EdgeEdgeCandidate")
.def(py::init<long, long>(), py::arg("edge0_id"), py::arg("edge1_id"))
.def(
py::init([](std::tuple<long, long> edge_ids) {
py::init<index_t, index_t>(), py::arg("edge0_id"),
py::arg("edge1_id"))
.def(
py::init([](std::tuple<index_t, index_t> edge_ids) {
return std::make_unique<EdgeEdgeCandidate>(
std::get<0>(edge_ids), std::get<1>(edge_ids));
}),
Expand All @@ -37,5 +39,6 @@ void define_edge_edge_candidate(py::module_& m)
.def_readwrite(
"edge1_id", &EdgeEdgeCandidate::edge1_id, "ID of the second edge.");

py::implicitly_convertible<std::tuple<long, long>, EdgeEdgeCandidate>();
py::implicitly_convertible<
std::tuple<index_t, index_t>, EdgeEdgeCandidate>();
}
9 changes: 6 additions & 3 deletions python/src/candidates/edge_face.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ using namespace ipc;
void define_edge_face_candidate(py::module_& m)
{
py::class_<EdgeFaceCandidate>(m, "EdgeFaceCandidate")
.def(py::init<long, long>(), py::arg("edge_id"), py::arg("face_id"))
.def(
py::init([](std::tuple<long, long> edge_and_face_id) {
py::init<index_t, index_t>(), py::arg("edge_id"),
py::arg("face_id"))
.def(
py::init([](std::tuple<index_t, index_t> edge_and_face_id) {
return std::make_unique<EdgeFaceCandidate>(
std::get<0>(edge_and_face_id),
std::get<1>(edge_and_face_id));
Expand All @@ -37,5 +39,6 @@ void define_edge_face_candidate(py::module_& m)
.def_readwrite(
"face_id", &EdgeFaceCandidate::face_id, "ID of the face");

py::implicitly_convertible<std::tuple<long, long>, EdgeFaceCandidate>();
py::implicitly_convertible<
std::tuple<index_t, index_t>, EdgeFaceCandidate>();
}
9 changes: 6 additions & 3 deletions python/src/candidates/edge_vertex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ using namespace ipc;
void define_edge_vertex_candidate(py::module_& m)
{
py::class_<EdgeVertexCandidate, CollisionStencil>(m, "EdgeVertexCandidate")
.def(py::init<long, long>(), py::arg("edge_id"), py::arg("vertex_id"))
.def(
py::init([](std::tuple<long, long> edge_and_vertex_id) {
py::init<index_t, index_t>(), py::arg("edge_id"),
py::arg("vertex_id"))
.def(
py::init([](std::tuple<index_t, index_t> edge_and_vertex_id) {
return std::make_unique<EdgeVertexCandidate>(
std::get<0>(edge_and_vertex_id),
std::get<1>(edge_and_vertex_id));
Expand Down Expand Up @@ -39,5 +41,6 @@ void define_edge_vertex_candidate(py::module_& m)
.def_readwrite(
"vertex_id", &EdgeVertexCandidate::vertex_id, "ID of the vertex");

py::implicitly_convertible<std::tuple<long, long>, EdgeVertexCandidate>();
py::implicitly_convertible<
std::tuple<index_t, index_t>, EdgeVertexCandidate>();
}
Loading