From 77cd30ec39736c58727836c3a15c94f448dd55ce Mon Sep 17 00:00:00 2001 From: beomki-yeo <63090140+beomki-yeo@users.noreply.github.com> Date: Thu, 23 Sep 2021 01:49:31 -0700 Subject: [PATCH] Add Formatting (#101) Add clang-format check --- .clang-format | 13 + .github/check_format.sh | 46 + .github/workflows/builds.yml | 2 +- .github/workflows/checks.yml | 21 + .../apps/common/display_bin_association.inl | 176 +-- .../include/apps/common/display_layers.inl | 130 +- .../apps/common/display_volumes_rz.inl | 242 ++-- .../eigen/eigen_display_bin_association.cpp | 6 +- apps/src/eigen/eigen_display_layers.cpp | 6 +- apps/src/eigen/eigen_display_volumes_rz.cpp | 6 +- core/include/core/detector.hpp | 1108 +++++++++-------- core/include/core/intersection.hpp | 110 +- core/include/core/surface_base.hpp | 158 ++- core/include/core/track.hpp | 34 +- core/include/core/transform_store.hpp | 350 +++--- core/include/core/volume_connector.hpp | 548 ++++---- core/include/grids/associator.hpp | 262 ++-- core/include/grids/axis.hpp | 860 +++++++------ core/include/grids/grid2.hpp | 446 +++---- core/include/grids/populator.hpp | 381 +++--- core/include/grids/serializer2.hpp | 108 +- core/include/masks/annulus2.hpp | 380 +++--- core/include/masks/cylinder3.hpp | 295 +++-- core/include/masks/mask_identifier.hpp | 26 +- core/include/masks/masks.hpp | 4 +- core/include/masks/rectangle2.hpp | 276 ++-- core/include/masks/ring2.hpp | 273 ++-- core/include/masks/single3.hpp | 252 ++-- core/include/masks/trapezoid2.hpp | 278 ++--- core/include/masks/unmasked.hpp | 113 +- core/include/tools/bin_association.hpp | 450 +++---- .../tools/concentric_cylinder_intersector.hpp | 248 ++-- core/include/tools/cylinder_intersector.hpp | 192 ++- core/include/tools/intersection_kernel.hpp | 344 +++-- core/include/tools/line_stepper.hpp | 92 +- core/include/tools/local_object_finder.hpp | 175 ++- core/include/tools/navigator.hpp | 909 +++++++------- core/include/tools/planar_intersector.hpp | 172 ++- core/include/tools/propagator.hpp | 121 +- core/include/utils/c_step.hpp | 43 +- core/include/utils/containers.hpp | 28 +- core/include/utils/enumerate.hpp | 307 +++-- core/include/utils/generators.hpp | 578 +++++---- core/include/utils/indexing.hpp | 17 +- core/include/utils/quadratic_equation.hpp | 70 +- core/include/utils/unbound.hpp | 54 +- core/include/utils/utils_enumerate.cpp | 24 +- display/include/style/styles.hpp | 26 +- display/include/view/draw.hpp | 432 ++++--- display/include/view/views.hpp | 280 ++--- .../plugins/algebra/array_definitions.hpp | 32 +- .../plugins/algebra/eigen_definitions.hpp | 26 +- .../plugins/algebra/smatrix_definitions.hpp | 24 +- .../plugins/algebra/vc_array_definitions.hpp | 32 +- tests/benchmarks/array/array_find_volume.cpp | 4 +- .../benchmarks/array/array_intersect_all.cpp | 4 +- .../array/array_intersect_surfaces.cpp | 4 +- tests/benchmarks/array/array_masks.cpp | 4 +- tests/benchmarks/core/benchmark_grids.cpp | 185 ++- tests/benchmarks/eigen/eigen_find_volume.cpp | 4 +- .../benchmarks/eigen/eigen_intersect_all.cpp | 5 +- .../eigen/eigen_intersect_surfaces.cpp | 5 +- tests/benchmarks/eigen/eigen_masks.cpp | 4 +- .../smatrix/smatrix_find_volume.cpp | 4 +- .../smatrix/smatrix_intersect_all.cpp | 5 +- .../smatrix/smatrix_intersect_surfaces.cpp | 5 +- tests/benchmarks/smatrix/smatrix_masks.cpp | 4 +- tests/benchmarks/vc/vc_array_find_volume.cpp | 4 +- .../benchmarks/vc/vc_array_intersect_all.cpp | 4 +- .../vc/vc_array_intersect_surfaces.cpp | 4 +- tests/benchmarks/vc/vc_array_masks.cpp | 4 +- .../tests/common/benchmark_find_volume.inl | 115 +- .../tests/common/benchmark_intersect_all.inl | 178 +-- .../common/benchmark_intersect_surfaces.inl | 316 +++-- .../include/tests/common/benchmark_masks.inl | 515 ++++---- .../include/tests/common/core_detector.inl | 16 +- .../tests/common/core_transform_store.inl | 27 +- .../include/tests/common/display_masks.inl | 28 +- .../include/tests/common/io_read_detector.inl | 32 +- .../include/tests/common/masks_annulus2.inl | 67 +- .../include/tests/common/masks_containers.inl | 26 +- .../include/tests/common/masks_cylinder3.inl | 33 +- .../include/tests/common/masks_rectangle2.inl | 30 +- .../include/tests/common/masks_ring2.inl | 40 +- .../include/tests/common/masks_single3.inl | 57 +- .../include/tests/common/masks_trapezoid2.inl | 29 +- .../include/tests/common/masks_unmasked.inl | 17 +- .../common/include/tests/common/test_core.inl | 28 +- .../common/include/tests/common/test_defs.hpp | 49 +- .../include/tests/common/test_surfaces.hpp | 478 +++---- .../common/tools_cylinder_intersection.inl | 60 +- .../common/tools_intersection_kernel.inl | 90 +- .../tests/common/tools_line_stepper.inl | 21 +- .../include/tests/common/tools_navigator.inl | 115 +- .../common/tools_planar_intersection.inl | 40 +- .../include/tests/common/tools_propagator.inl | 31 +- tests/unit_tests/array/array_annulus2.cpp | 4 +- tests/unit_tests/array/array_core.cpp | 4 +- tests/unit_tests/array/array_cylinder3.cpp | 4 +- .../array/array_cylinder_intersection.cpp | 4 +- tests/unit_tests/array/array_detector.cpp | 4 +- .../unit_tests/array/array_display_masks.cpp | 4 +- .../array/array_intersection_kernel.cpp | 4 +- tests/unit_tests/array/array_line_stepper.cpp | 4 +- .../array/array_masks_container.cpp | 4 +- tests/unit_tests/array/array_navigator.cpp | 4 +- .../array/array_planar_intersection.cpp | 4 +- tests/unit_tests/array/array_propagator.cpp | 4 +- .../unit_tests/array/array_read_detector.cpp | 4 +- tests/unit_tests/array/array_rectangle2.cpp | 4 +- tests/unit_tests/array/array_ring2.cpp | 4 +- tests/unit_tests/array/array_single3.cpp | 4 +- .../array/array_transform_store.cpp | 4 +- tests/unit_tests/array/array_trapezoid2.cpp | 4 +- tests/unit_tests/array/array_unmasked.cpp | 4 +- tests/unit_tests/core/grids_axis.cpp | 23 +- tests/unit_tests/core/grids_grid2.cpp | 110 +- tests/unit_tests/core/grids_populator.cpp | 32 +- tests/unit_tests/core/grids_serializer.cpp | 20 +- tests/unit_tests/core/utils_enumerate.cpp | 43 +- .../core/utils_local_object_finder.cpp | 41 +- .../core/utils_quadratic_equation.cpp | 20 +- tests/unit_tests/eigen/eigen_annulus2.cpp | 4 +- tests/unit_tests/eigen/eigen_core.cpp | 4 +- tests/unit_tests/eigen/eigen_cylinder3.cpp | 4 +- .../eigen/eigen_cylinder_intersection.cpp | 4 +- tests/unit_tests/eigen/eigen_detector.cpp | 4 +- .../unit_tests/eigen/eigen_display_masks.cpp | 4 +- .../eigen/eigen_intersection_kernel.cpp | 4 +- tests/unit_tests/eigen/eigen_line_stepper.cpp | 4 +- .../eigen/eigen_masks_container.cpp | 4 +- tests/unit_tests/eigen/eigen_navigator.cpp | 4 +- .../eigen/eigen_planar_intersection.cpp | 4 +- tests/unit_tests/eigen/eigen_propagator.cpp | 4 +- .../unit_tests/eigen/eigen_read_detector.cpp | 4 +- tests/unit_tests/eigen/eigen_rectangle2.cpp | 4 +- tests/unit_tests/eigen/eigen_ring2.cpp | 4 +- tests/unit_tests/eigen/eigen_single3.cpp | 4 +- .../eigen/eigen_transform_store.cpp | 4 +- tests/unit_tests/eigen/eigen_trapezoid2.cpp | 4 +- tests/unit_tests/eigen/eigen_unmasked.cpp | 4 +- tests/unit_tests/smatrix/smatrix_annulus2.cpp | 4 +- tests/unit_tests/smatrix/smatrix_core.cpp | 4 +- .../unit_tests/smatrix/smatrix_cylinder3.cpp | 4 +- .../smatrix/smatrix_cylinder_intersection.cpp | 4 +- tests/unit_tests/smatrix/smatrix_detector.cpp | 4 +- .../smatrix/smatrix_intersection_kernel.cpp | 4 +- .../smatrix/smatrix_line_stepper.cpp | 4 +- .../smatrix/smatrix_masks_container.cpp | 4 +- .../unit_tests/smatrix/smatrix_navigator.cpp | 4 +- .../smatrix/smatrix_planar_intersection.cpp | 4 +- .../unit_tests/smatrix/smatrix_propagator.cpp | 4 +- .../smatrix/smatrix_read_detector.cpp | 4 +- .../unit_tests/smatrix/smatrix_rectangle2.cpp | 4 +- tests/unit_tests/smatrix/smatrix_ring2.cpp | 4 +- tests/unit_tests/smatrix/smatrix_single3.cpp | 4 +- .../smatrix_single_layer_components.cpp | 4 +- .../smatrix/smatrix_transform_store.cpp | 4 +- .../unit_tests/smatrix/smatrix_trapezoid2.cpp | 4 +- tests/unit_tests/smatrix/smatrix_unmasked.cpp | 4 +- tests/unit_tests/vc/vc_array_annulus2.cpp | 4 +- tests/unit_tests/vc/vc_array_core.cpp | 4 +- tests/unit_tests/vc/vc_array_cylinder3.cpp | 4 +- .../vc/vc_array_cylinder_intersection.cpp | 4 +- tests/unit_tests/vc/vc_array_detector.cpp | 4 +- .../unit_tests/vc/vc_array_display_masks.cpp | 4 +- .../vc/vc_array_intersection_kernel.cpp | 4 +- tests/unit_tests/vc/vc_array_line_stepper.cpp | 4 +- .../vc/vc_array_masks_container.cpp | 4 +- tests/unit_tests/vc/vc_array_navigator.cpp | 4 +- .../vc/vc_array_planar_intersection.cpp | 4 +- tests/unit_tests/vc/vc_array_propagator.cpp | 4 +- .../unit_tests/vc/vc_array_read_detector.cpp | 4 +- tests/unit_tests/vc/vc_array_rectangle2.cpp | 4 +- tests/unit_tests/vc/vc_array_ring2.cpp | 4 +- tests/unit_tests/vc/vc_array_single3.cpp | 4 +- .../vc/vc_array_transform_store.cpp | 4 +- tests/unit_tests/vc/vc_array_trapezoid2.cpp | 4 +- tests/unit_tests/vc/vc_array_unmasked.cpp | 4 +- 179 files changed, 7366 insertions(+), 7504 deletions(-) create mode 100644 .clang-format create mode 100755 .github/check_format.sh create mode 100644 .github/workflows/checks.yml diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..3e9dc9f270 --- /dev/null +++ b/.clang-format @@ -0,0 +1,13 @@ +--- +BasedOnStyle: Google +IndentWidth: 4 +Language: Cpp +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +PointerAlignment: Left +ColumnLimit: 80 +AccessModifierOffset: 0 +KeepEmptyLinesAtTheStartOfBlocks: true \ No newline at end of file diff --git a/.github/check_format.sh b/.github/check_format.sh new file mode 100755 index 0000000000..b5c5e20e6f --- /dev/null +++ b/.github/check_format.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# check that all code complies w/ the clang-format specification +# +# if all is well, returns w/o errors and does not print anything. +# otherwise, return an error and print offending changes + +set -e # abort on error + +INCLUDE_DIRS=("apps core display plugins tests") + +if [ $# -ne 1 ]; then + echo "wrong number of arguments" + echo "" + echo "usage: check_format