Skip to content

Commit 6ecfcde

Browse files
committed
clang-format source + precommit hook
1 parent f1b2e16 commit 6ecfcde

File tree

4 files changed

+68
-5
lines changed

4 files changed

+68
-5
lines changed

.clang-format

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
AlignAfterOpenBracket: true
2+
AlignConsecutiveAssignments: false
3+
AlignEscapedNewlines: Right
4+
AlignOperands: true
5+
AlignTrailingComments: false
6+
AllowAllParametersOfDeclarationOnNextLine: true
7+
AllowShortBlocksOnASingleLine: false
8+
AllowShortCaseLabelsOnASingleLine: false
9+
AllowShortFunctionsOnASingleLine: Empty
10+
AllowShortIfStatementsOnASingleLine: false
11+
AllowShortLoopsOnASingleLine: false
12+
AlwaysBreakAfterDefinitionReturnType: None
13+
AlwaysBreakAfterReturnType: None
14+
AlwaysBreakBeforeMultilineStrings: false
15+
AlwaysBreakTemplateDeclarations: true
16+
BasedOnStyle: Mozilla
17+
BinPackArguments: false
18+
BinPackParameters: false
19+
BreakBeforeBinaryOperators: NonAssignment
20+
BraceWrapping:
21+
SplitEmptyFunction: false
22+
SplitEmptyRecord: false
23+
BreakBeforeTernaryOperators: true
24+
BreakConstructorInitializers: BeforeComma
25+
ColumnLimit: 120
26+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
27+
ConstructorInitializerIndentWidth: 2
28+
ContinuationIndentWidth: 4
29+
Cpp11BracedListStyle: true
30+
DerivePointerAlignment: false
31+
ExperimentalAutoDetectBinPacking: false
32+
FixNamespaceComments: true
33+
IndentCaseLabels: true
34+
IndentPPDirectives: AfterHash
35+
IndentWidth: 2
36+
IndentWrappedFunctionNames: false
37+
KeepEmptyLinesAtTheStartOfBlocks: true
38+
Language: Cpp
39+
MaxEmptyLinesToKeep: 2
40+
NamespaceIndentation: None
41+
PenaltyBreakComment: 60
42+
PenaltyBreakFirstLessLess: 120
43+
PenaltyBreakString: 1000
44+
PenaltyExcessCharacter: 1000000
45+
PenaltyReturnTypeOnItsOwnLine: 60
46+
PointerAlignment: Left
47+
SortIncludes: false
48+
SpaceAfterCStyleCast: false
49+
SpaceAfterTemplateKeyword: true
50+
SpaceBeforeAssignmentOperators: true
51+
SpaceBeforeParens: ControlStatements
52+
SpaceInEmptyParentheses: false
53+
SpacesBeforeTrailingComments: 1
54+
SpacesInAngles: false
55+
SpacesInCStyleCastParentheses: false
56+
SpacesInParentheses: false
57+
SpacesInSquareBrackets: false
58+
Standard: Cpp11
59+
TabWidth: 2
60+
UseTab: Never

.pre-commit-config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ repos:
1616
rev: 3.9.2
1717
hooks:
1818
- id: flake8
19-
19+
- repo: https://github.com/pre-commit/mirrors-clang-format
20+
rev: 'v13.0.0'
21+
hooks:
22+
- id: clang-format
23+
exclude: "^lib/pybind11"

lib/bindings.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Copyright 2013-2018 pyMOR developers and contributors. All rights reserved.
33
// License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
44

5-
65
#include <deal.II/lac/dynamic_sparsity_pattern.h>
76
#include <deal.II/lac/precondition.h>
87
#include <deal.II/lac/solver_cg.h>
@@ -145,7 +144,7 @@ void bind_sparse_matrix(pybind11::module& module) {
145144
.def("vmult", &Matrix::template vmult<Vector, Vector>)
146145
.def("Tvmult", &Matrix::template Tvmult<Vector, Vector>)
147146
.def("get_sparsity_pattern", &Matrix::get_sparsity_pattern, py::return_value_policy::reference)
148-
.def("add", (void (Matrix::*)(Number, const Matrix&)) & Matrix::template add<Number>)
147+
.def("add", (void(Matrix::*)(Number, const Matrix&)) & Matrix::template add<Number>)
149148
.def("copy_from", (Matrix & (Matrix::*)(const Matrix&)) & Matrix::template copy_from<Number>)
150149
.def("cg_solve", cg_solve);
151150
}

lib/rhs.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ inline void RightHandSide<dim>::vector_value(const Point<dim>& p, Vector<double>
9898
// If now the point <code>p</code> is in a circle (sphere) of radius 0.2
9999
// around one of these points, then set the force in x-direction to one,
100100
// otherwise to zero:
101-
if ((static_cast<Point<dim>>(p - point_1).square() < 0.2 * 0.2)
102-
|| (static_cast<Point<dim>>(p - point_2).norm_square() < 0.2 * 0.2))
101+
if ((static_cast<Point<dim>>(p - point_1).square() < 0.2 * 0.2) ||
102+
(static_cast<Point<dim>>(p - point_2).norm_square() < 0.2 * 0.2))
103103
values(0) = 1;
104104
else
105105
values(0) = 0;

0 commit comments

Comments
 (0)