Skip to content

Commit d23709b

Browse files
LLVM formating
1 parent 1d5bfe6 commit d23709b

25 files changed

+3314
-2930
lines changed

.clang-format

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlinesLeft: false
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: Empty
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: false
21+
BinPackArguments: true
22+
BinPackParameters: true
23+
BraceWrapping:
24+
AfterClass: false
25+
AfterControlStatement: false
26+
AfterEnum: false
27+
AfterFunction: false
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: false
31+
AfterUnion: false
32+
BeforeCatch: false
33+
BeforeElse: false
34+
IndentBraces: false
35+
BreakBeforeBinaryOperators: None
36+
BreakBeforeBraces: Allman
37+
BreakBeforeTernaryOperators: true
38+
BreakConstructorInitializersBeforeComma: false
39+
BreakAfterJavaFieldAnnotations: false
40+
BreakStringLiterals: true
41+
ColumnLimit: 100
42+
CommentPragmas: "^ IWYU pragma:"
43+
BreakBeforeInheritanceComma: false
44+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
45+
ConstructorInitializerIndentWidth: 4
46+
ContinuationIndentWidth: 4
47+
Cpp11BracedListStyle: true
48+
DerivePointerAlignment: false
49+
DisableFormat: false
50+
ExperimentalAutoDetectBinPacking: false
51+
FixNamespaceComments: true
52+
ForEachMacros: [foreach, Q_FOREACH, BOOST_FOREACH]
53+
IncludeCategories:
54+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
55+
Priority: 2
56+
- Regex: '^(<|"(gtest|isl|json)/)'
57+
Priority: 3
58+
- Regex: ".*"
59+
Priority: 1
60+
IncludeIsMainRegex: "$"
61+
IndentCaseLabels: false
62+
IndentWidth: 4
63+
IndentWrappedFunctionNames: false
64+
JavaScriptQuotes: Leave
65+
JavaScriptWrapImports: true
66+
KeepEmptyLinesAtTheStartOfBlocks: true
67+
MacroBlockBegin: ""
68+
MacroBlockEnd: ""
69+
MaxEmptyLinesToKeep: 1
70+
NamespaceIndentation: None
71+
ObjCBlockIndentWidth: 2
72+
ObjCSpaceAfterProperty: false
73+
ObjCSpaceBeforeProtocolList: true
74+
PenaltyBreakBeforeFirstCallParameter: 19
75+
PenaltyBreakComment: 300
76+
PenaltyBreakFirstLessLess: 120
77+
PenaltyBreakString: 1000
78+
PenaltyExcessCharacter: 1000000
79+
PenaltyReturnTypeOnItsOwnLine: 60
80+
PointerAlignment: Left
81+
ReflowComments: true
82+
SortIncludes: true
83+
SpaceAfterCStyleCast: false
84+
SpaceAfterTemplateKeyword: true
85+
SpaceBeforeAssignmentOperators: true
86+
SpaceBeforeParens: ControlStatements
87+
SpaceInEmptyParentheses: false
88+
SpacesBeforeTrailingComments: 1
89+
SpacesInAngles: false
90+
SpacesInContainerLiterals: true
91+
SpacesInCStyleCastParentheses: false
92+
SpacesInParentheses: false
93+
SpacesInSquareBrackets: false
94+
Standard: Cpp11
95+
TabWidth: 4
96+
UseTab: Never

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
hooks:
1818
- id: clang-format
1919
name: Run clang-format
20-
entry: clang-format --style google -i
20+
entry: clang-format -i
2121
types: [text]
2222
files: '.*\.cpp$|.*\.h$|.*\.cu$|.*\.hpp$'
2323
language: system

cpu/include/ball_query.h

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
#pragma once
22
#include <torch/extension.h>
3-
std::pair<at::Tensor, at::Tensor> ball_query(at::Tensor query,
4-
at::Tensor support, float radius,
3+
std::pair<at::Tensor, at::Tensor> ball_query(at::Tensor query, at::Tensor support, float radius,
54
int max_num, int mode);
65

7-
std::pair<at::Tensor, at::Tensor> batch_ball_query(
8-
at::Tensor query, at::Tensor support, at::Tensor query_batch,
9-
at::Tensor support_batch, float radius, int max_num, int mode);
6+
std::pair<at::Tensor, at::Tensor> batch_ball_query(at::Tensor query, at::Tensor support,
7+
at::Tensor query_batch, at::Tensor support_batch,
8+
float radius, int max_num, int mode);
109

11-
std::pair<at::Tensor, at::Tensor> dense_ball_query(at::Tensor query,
12-
at::Tensor support,
13-
float radius, int max_num,
14-
int mode);
10+
std::pair<at::Tensor, at::Tensor> dense_ball_query(at::Tensor query, at::Tensor support,
11+
float radius, int max_num, int mode);

cpu/include/cloud.h

+62-51
Original file line numberDiff line numberDiff line change
@@ -29,62 +29,73 @@
2929

3030
#include <time.h>
3131

32-
template <typename scalar_t>
33-
struct PointCloud {
34-
struct PointXYZ {
35-
scalar_t x, y, z;
36-
};
32+
template <typename scalar_t> struct PointCloud
33+
{
34+
struct PointXYZ
35+
{
36+
scalar_t x, y, z;
37+
};
3738

38-
std::vector<PointXYZ> pts;
39+
std::vector<PointXYZ> pts;
3940

40-
void set(const std::vector<scalar_t>& new_pts) {
41-
pts.clear();
42-
pts.resize(new_pts.size()/3);
43-
for (unsigned int i = 0; i < new_pts.size(); i++) {
44-
if (i % 3 == 0) {
45-
PointXYZ point;
46-
point.x = new_pts[i];
47-
point.y = new_pts[i + 1];
48-
point.z = new_pts[i + 2];
49-
pts[i / 3] = point;
50-
}
41+
void set(const std::vector<scalar_t>& new_pts)
42+
{
43+
pts.clear();
44+
pts.resize(new_pts.size() / 3);
45+
for (unsigned int i = 0; i < new_pts.size(); i++)
46+
{
47+
if (i % 3 == 0)
48+
{
49+
PointXYZ point;
50+
point.x = new_pts[i];
51+
point.y = new_pts[i + 1];
52+
point.z = new_pts[i + 2];
53+
pts[i / 3] = point;
54+
}
55+
}
5156
}
52-
}
53-
void set_batch(const std::vector<scalar_t>& new_pts, int begin, int size) {
54-
pts.clear();
55-
pts.resize(size);
56-
for (int i = 0; i < size; i++) {
57-
PointXYZ point;
58-
point.x = new_pts[3 * (begin + i)];
59-
point.y = new_pts[3 * (begin + i) + 1];
60-
point.z = new_pts[3 * (begin + i) + 2];
61-
pts[i] = point;
57+
void set_batch(const std::vector<scalar_t>& new_pts, int begin, int end)
58+
{
59+
int size = end - begin;
60+
pts.clear();
61+
pts.resize(size);
62+
for (int i = 0; i < size; i++)
63+
{
64+
PointXYZ point;
65+
point.x = new_pts[3 * (begin + i)];
66+
point.y = new_pts[3 * (begin + i) + 1];
67+
point.z = new_pts[3 * (begin + i) + 2];
68+
pts[i] = point;
69+
}
6270
}
63-
}
6471

65-
// Must return the number of data points
66-
inline size_t kdtree_get_point_count() const { return pts.size(); }
72+
// Must return the number of data points
73+
inline size_t kdtree_get_point_count() const
74+
{
75+
return pts.size();
76+
}
6777

68-
// Returns the dim'th component of the idx'th point in the class:
69-
// Since this is inlined and the "dim" argument is typically an immediate
70-
// value, the
71-
// "if/else's" are actually solved at compile time.
72-
inline scalar_t kdtree_get_pt(const size_t idx, const size_t dim) const {
73-
if (dim == 0)
74-
return pts[idx].x;
75-
else if (dim == 1)
76-
return pts[idx].y;
77-
else
78-
return pts[idx].z;
79-
}
78+
// Returns the dim'th component of the idx'th point in the class:
79+
// Since this is inlined and the "dim" argument is typically an immediate
80+
// value, the
81+
// "if/else's" are actually solved at compile time.
82+
inline scalar_t kdtree_get_pt(const size_t idx, const size_t dim) const
83+
{
84+
if (dim == 0)
85+
return pts[idx].x;
86+
else if (dim == 1)
87+
return pts[idx].y;
88+
else
89+
return pts[idx].z;
90+
}
8091

81-
// Optional bounding-box computation: return false to default to a standard
82-
// bbox computation loop.
83-
// Return true if the BBOX was already computed by the class and returned in
84-
// "bb" so it can be avoided to redo it again. Look at bb.size() to find out
85-
// the expected dimensionality (e.g. 2 or 3 for point clouds)
86-
template <class BBOX>
87-
bool kdtree_get_bbox(BBOX& /* bb */) const {
88-
return false;
89-
}
92+
// Optional bounding-box computation: return false to default to a standard
93+
// bbox computation loop.
94+
// Return true if the BBOX was already computed by the class and returned in
95+
// "bb" so it can be avoided to redo it again. Look at bb.size() to find out
96+
// the expected dimensionality (e.g. 2 or 3 for point clouds)
97+
template <class BBOX> bool kdtree_get_bbox(BBOX& /* bb */) const
98+
{
99+
return false;
100+
}
90101
};

0 commit comments

Comments
 (0)