Skip to content

Sort includes using clang-format #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 5, 2024
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
27 changes: 26 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,32 @@ BinPackParameters: false
AllowAllParametersOfDeclarationOnNextLine: true
AlignAfterOpenBracket: AlwaysBreak
BreakBeforeBinaryOperators: NonAssignment
SortIncludes: false
SortIncludes: true
CommentPragmas: '^@.+'
BreakStringLiterals: false
PackConstructorInitializers: CurrentLine
# Regroup includes with a priority system
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
- Regex: "^<ipc\/[^/]*>" # this libraries
Priority: 2 # internal library group
SortPriority: 2
CaseSensitive: true
- Regex: "^<ipc\/.*\/.*>" # this libraries
Priority: 2 # internal library group
SortPriority: 3
CaseSensitive: true
- Regex: "^<(.*\\.h[px]*)|(Eigen\/.*)>"
Priority: 4 # libraries (because they end in .h)
SortPriority: 4
CaseSensitive: false
- Regex: "^<.*"
Priority: 5 # system (without .h, because that is captured by the other group)
SortPriority: 5
CaseSensitive: false
- Regex: ".*" # catch-all for internal files
Priority: 1 # internal file group
SortPriority: 1
CaseSensitive: true
2 changes: 2 additions & 0 deletions python/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BasedOnStyle: InheritParentConfig
SortIncludes: false
4 changes: 4 additions & 0 deletions python/src/utils/eigen_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ void define_eigen_ext(py::module_& m)
{
m.def(
"project_to_pd",
// clang-format off
&project_to_pd<
double, Eigen::Dynamic, Eigen::Dynamic,
Eigen::ColMajor | Eigen::AutoAlign, Eigen::Dynamic, Eigen::Dynamic>,
// clang-format on
R"ipc_Qu8mg5v7(
Matrix projection onto positive definite cone

Expand All @@ -35,9 +37,11 @@ void define_eigen_ext(py::module_& m)

m.def(
"project_to_psd",
// clang-format off
&project_to_psd<
double, Eigen::Dynamic, Eigen::Dynamic,
Eigen::ColMajor | Eigen::AutoAlign, Eigen::Dynamic, Eigen::Dynamic>,
// clang-format on
R"ipc_Qu8mg5v7(
Matrix projection onto positive semi-definite cone

Expand Down
2 changes: 1 addition & 1 deletion src/ipc/broad_phase/aabb.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "aabb.hpp"

#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>

#include <cfenv>

Expand Down
5 changes: 2 additions & 3 deletions src/ipc/broad_phase/broad_phase.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#include "broad_phase.hpp"

#include <ipc/config.hpp>
#include <ipc/broad_phase/brute_force.hpp>
#include <ipc/broad_phase/bvh.hpp>
#include <ipc/broad_phase/spatial_hash.hpp>
#include <ipc/broad_phase/hash_grid.hpp>
#include <ipc/broad_phase/spatial_hash.hpp>
#include <ipc/broad_phase/sweep_and_prune.hpp>
#include <ipc/broad_phase/sweep_and_tiniest_queue.hpp>
#include <ipc/candidates/candidates.hpp>

#include <ipc/config.hpp>

namespace ipc {

void BroadPhase::build(
Expand Down
2 changes: 1 addition & 1 deletion src/ipc/broad_phase/brute_force.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <ipc/utils/merge_thread_local.hpp>

#include <tbb/blocked_range2d.h>
#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <tbb/blocked_range2d.h>

#include <algorithm> // std::min/max

Expand Down
2 changes: 1 addition & 1 deletion src/ipc/broad_phase/bvh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <ipc/utils/merge_thread_local.hpp>

#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>

using namespace std::placeholders;

Expand Down
4 changes: 2 additions & 2 deletions src/ipc/broad_phase/hash_grid.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "hash_grid.hpp"

#include <ipc/broad_phase/voxel_size_heuristic.hpp>
#include <ipc/utils/merge_thread_local.hpp>
#include <ipc/utils/logger.hpp>
#include <ipc/utils/merge_thread_local.hpp>

#include <tbb/enumerable_thread_specific.h>
#include <tbb/blocked_range2d.h>
#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_sort.h>

Expand Down
5 changes: 2 additions & 3 deletions src/ipc/broad_phase/spatial_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
// Originally created by Minchen Li.
#include "spatial_hash.hpp"

#include <ipc/ccd/aabb.hpp>
#include <ipc/config.hpp>
#include <ipc/broad_phase/voxel_size_heuristic.hpp>
#include <ipc/ccd/aabb.hpp>
#include <ipc/utils/merge_thread_local.hpp>

#include <ipc/config.hpp>

#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_sort.h>
Expand Down
2 changes: 1 addition & 1 deletion src/ipc/broad_phase/spatial_hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#pragma once

#include <ipc/broad_phase/broad_phase.hpp>
#include <ipc/utils/unordered_map_and_set.hpp>
#include <ipc/utils/eigen_ext.hpp>
#include <ipc/utils/unordered_map_and_set.hpp>

#include <vector>

Expand Down
1 change: 1 addition & 0 deletions src/ipc/broad_phase/sweep_and_tiniest_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifdef IPC_TOOLKIT_WITH_CUDA

#include <ipc/broad_phase/broad_phase.hpp>

#include <scalable_ccd/cuda/broad_phase/broad_phase.cuh>

namespace ipc {
Expand Down
9 changes: 4 additions & 5 deletions src/ipc/candidates/candidates.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#include "candidates.hpp"

#include <ipc/config.hpp>
#include <ipc/ipc.hpp>
#include <ipc/utils/save_obj.hpp>
#include <ipc/utils/eigen_ext.hpp>

#include <ipc/config.hpp>
#include <ipc/utils/save_obj.hpp>

#include <igl/remove_unreferenced.h>
#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
#include <shared_mutex>
#include <tbb/parallel_for.h>

#include <fstream>
#include <shared_mutex>

namespace ipc {

Expand Down
4 changes: 2 additions & 2 deletions src/ipc/candidates/candidates.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include <ipc/broad_phase/broad_phase.hpp>
#include <ipc/candidates/vertex_vertex.hpp>
#include <ipc/candidates/edge_vertex.hpp>
#include <ipc/candidates/edge_edge.hpp>
#include <ipc/candidates/edge_vertex.hpp>
#include <ipc/candidates/face_vertex.hpp>
#include <ipc/candidates/vertex_vertex.hpp>

#include <Eigen/Core>

Expand Down
4 changes: 2 additions & 2 deletions src/ipc/candidates/continuous_collision_candidate.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include <ipc/ccd/default_narrow_phase_ccd.hpp>
#include <ipc/candidates/collision_stencil.hpp>
#include <ipc/ccd/default_narrow_phase_ccd.hpp>

#include <vector>
#include <ostream>
#include <vector>

namespace ipc {

Expand Down
4 changes: 2 additions & 2 deletions src/ipc/ccd/additive_ccd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

#include "additive_ccd.hpp"

#include <ipc/distance/point_point.hpp>
#include <ipc/distance/edge_edge.hpp>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/point_point.hpp>
#include <ipc/distance/point_triangle.hpp>
#include <ipc/distance/edge_edge.hpp>

namespace ipc {

Expand Down
4 changes: 2 additions & 2 deletions src/ipc/ccd/inexact_ccd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#ifdef IPC_TOOLKIT_WITH_INEXACT_CCD

#include <ipc/ccd/check_initial_distance.hpp>
#include <ipc/distance/point_point.hpp>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/edge_edge.hpp>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/point_point.hpp>
#include <ipc/distance/point_triangle.hpp>

#include <CTCD.h>
Expand Down
4 changes: 2 additions & 2 deletions src/ipc/ccd/nonlinear_ccd.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "nonlinear_ccd.hpp"

#include <ipc/ccd/check_initial_distance.hpp>
#include <ipc/distance/point_point.hpp>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/edge_edge.hpp>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/point_point.hpp>
#include <ipc/distance/point_triangle.hpp>

#include <tight_inclusion/ccd.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/ipc/ccd/nonlinear_ccd.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include <ipc/config.hpp>

#include <ipc/ccd/tight_inclusion_ccd.hpp>
#ifdef IPC_TOOLKIT_WITH_FILIB
#include <ipc/utils/interval.hpp>
Expand Down
4 changes: 2 additions & 2 deletions src/ipc/ccd/tight_inclusion_ccd.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "tight_inclusion_ccd.hpp"

#include <ipc/ccd/check_initial_distance.hpp>
#include <ipc/distance/point_point.hpp>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/edge_edge.hpp>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/point_point.hpp>
#include <ipc/distance/point_triangle.hpp>

#include <tight_inclusion/ccd.hpp>
Expand Down
6 changes: 3 additions & 3 deletions src/ipc/collision_mesh.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "collision_mesh.hpp"

#include <ipc/utils/unordered_map_and_set.hpp>
#include <ipc/utils/logger.hpp>
#include <ipc/utils/area_gradient.hpp>
#include <ipc/utils/eigen_ext.hpp>
#include <ipc/utils/local_to_global.hpp>
#include <ipc/utils/area_gradient.hpp>
#include <ipc/utils/logger.hpp>
#include <ipc/utils/unordered_map_and_set.hpp>

namespace ipc {

Expand Down
10 changes: 5 additions & 5 deletions src/ipc/collisions/collisions.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#include "collisions.hpp"

#include <ipc/collisions/collisions_builder.hpp>
#include <ipc/distance/point_point.hpp>
#include <ipc/distance/point_line.hpp>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/edge_edge.hpp>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/point_line.hpp>
#include <ipc/distance/point_plane.hpp>
#include <ipc/distance/point_point.hpp>
#include <ipc/utils/local_to_global.hpp>

#include <tbb/blocked_range.h>
#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_reduce.h>
#include <tbb/parallel_sort.h>
#include <tbb/blocked_range.h>
#include <tbb/enumerable_thread_specific.h>

#include <stdexcept> // std::out_of_range

Expand Down
8 changes: 4 additions & 4 deletions src/ipc/collisions/collisions.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#pragma once

#include <ipc/collision_mesh.hpp>
#include <ipc/broad_phase/broad_phase.hpp>
#include <ipc/candidates/candidates.hpp>
#include <ipc/collisions/collision.hpp>
#include <ipc/collisions/vertex_vertex.hpp>
#include <ipc/collisions/edge_vertex.hpp>
#include <ipc/collisions/edge_edge.hpp>
#include <ipc/collisions/edge_vertex.hpp>
#include <ipc/collisions/face_vertex.hpp>
#include <ipc/collisions/plane_vertex.hpp>
#include <ipc/broad_phase/broad_phase.hpp>
#include <ipc/candidates/candidates.hpp>
#include <ipc/collisions/vertex_vertex.hpp>

#include <Eigen/Core>

Expand Down
4 changes: 2 additions & 2 deletions src/ipc/collisions/collisions_builder.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "collisions_builder.hpp"

#include <ipc/distance/distance_type.hpp>
#include <ipc/distance/point_point.hpp>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/edge_edge.hpp>
#include <ipc/distance/edge_edge_mollifier.hpp>
#include <ipc/distance/point_edge.hpp>
#include <ipc/distance/point_point.hpp>
#include <ipc/distance/point_triangle.hpp>

namespace ipc {
Expand Down
3 changes: 1 addition & 2 deletions src/ipc/collisions/collisions_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
#include <ipc/collision_mesh.hpp>
#include <ipc/collisions/collisions.hpp>

#include <tbb/enumerable_thread_specific.h>

#include <Eigen/Core>
#include <tbb/enumerable_thread_specific.h>

namespace ipc {

Expand Down
4 changes: 2 additions & 2 deletions src/ipc/distance/edge_edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include "edge_edge.hpp"

#include <ipc/distance/point_point.hpp>
#include <ipc/distance/point_line.hpp>
#include <ipc/distance/line_line.hpp>
#include <ipc/distance/point_line.hpp>
#include <ipc/distance/point_point.hpp>

#include <stdexcept> // std::invalid_argument

Expand Down
1 change: 1 addition & 0 deletions src/ipc/distance/point_plane.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "point_plane.hpp"

#include <ipc/utils/eigen_ext.hpp>

#include <Eigen/Geometry>

namespace ipc {
Expand Down
2 changes: 1 addition & 1 deletion src/ipc/friction/closest_point.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "closest_point.hpp"

#include <Eigen/Core>
#include <Eigen/Cholesky>
#include <Eigen/Core>

namespace ipc {

Expand Down
2 changes: 1 addition & 1 deletion src/ipc/friction/collisions/edge_edge.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "edge_edge.hpp"

#include <ipc/distance/edge_edge.hpp>
#include <ipc/friction/closest_point.hpp>
#include <ipc/friction/relative_velocity.hpp>
#include <ipc/friction/tangent_basis.hpp>
#include <ipc/distance/edge_edge.hpp>

namespace ipc {

Expand Down
2 changes: 1 addition & 1 deletion src/ipc/friction/collisions/edge_edge.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <ipc/friction/collisions/friction_collision.hpp>
#include <ipc/candidates/edge_edge.hpp>
#include <ipc/friction/collisions/friction_collision.hpp>
#include <ipc/utils/eigen_ext.hpp>

namespace ipc {
Expand Down
Loading
Loading