From 6f8f1c03b3a3e933d861943a28c9be77eb48313e Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 18 Nov 2025 13:59:27 +0100 Subject: [PATCH 01/63] add-code-rules --- .github/workflows/ci_tests.yml | 264 +++++++++++----------- scripts/ci_build_and_test_in_container.sh | 16 +- 2 files changed, 146 insertions(+), 134 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 08bdcaa0f9c..71313671db6 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -114,7 +114,7 @@ jobs: - name: Check that submodules are up to date run: "scripts/test_submodule_updated.sh" - check_code_style_and_documentation: + check_code_standards: name: ${{ matrix.name }} needs: [is_not_draft_pull_request] strategy: @@ -127,6 +127,8 @@ jobs: # Validates that the documentation generated using doxygen has no hole. - name: Check documentation BUILD_AND_TEST_ARGS: --test-documentation + - name: Check code rules + BUILD_AND_TEST_ARGS: --test-code-rules uses: ./.github/workflows/build_and_test.yml with: BUILD_AND_TEST_CLI_ARGS: ${{ matrix.BUILD_AND_TEST_ARGS }} @@ -147,62 +149,62 @@ jobs: fail-fast : false matrix: include: - - name: Ubuntu (20.04, gcc 9.4.0, open-mpi 4.0.3) - CMAKE_BUILD_TYPE: Release - DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9 - BUILD_SHARED_LIBS: ON - ENABLE_HYPRE: OFF - ENABLE_TRILINOS: ON - GEOS_ENABLE_BOUNDS_CHECK: ON - HOST_CONFIG: /spack-generated.cmake + # - name: Ubuntu (20.04, gcc 9.4.0, open-mpi 4.0.3) + # CMAKE_BUILD_TYPE: Release + # DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9 + # BUILD_SHARED_LIBS: ON + # ENABLE_HYPRE: OFF + # ENABLE_TRILINOS: ON + # GEOS_ENABLE_BOUNDS_CHECK: ON + # HOST_CONFIG: /spack-generated.cmake - - name: Ubuntu debug (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces - CMAKE_BUILD_TYPE: Debug - DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10 - BUILD_SHARED_LIBS: ON - ENABLE_HYPRE: OFF - ENABLE_TRILINOS: ON - GEOS_ENABLE_BOUNDS_CHECK: ON - HOST_CONFIG: /spack-generated.cmake + # - name: Ubuntu debug (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces + # CMAKE_BUILD_TYPE: Debug + # DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10 + # BUILD_SHARED_LIBS: ON + # ENABLE_HYPRE: OFF + # ENABLE_TRILINOS: ON + # GEOS_ENABLE_BOUNDS_CHECK: ON + # HOST_CONFIG: /spack-generated.cmake - - name: Ubuntu (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces - CMAKE_BUILD_TYPE: Release - DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10 - BUILD_SHARED_LIBS: ON - ENABLE_HYPRE: OFF - ENABLE_TRILINOS: ON - GEOS_ENABLE_BOUNDS_CHECK: ON - HOST_CONFIG: /spack-generated.cmake + # - name: Ubuntu (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces + # CMAKE_BUILD_TYPE: Release + # DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10 + # BUILD_SHARED_LIBS: ON + # ENABLE_HYPRE: OFF + # ENABLE_TRILINOS: ON + # GEOS_ENABLE_BOUNDS_CHECK: ON + # HOST_CONFIG: /spack-generated.cmake - - name: Ubuntu (22.04, gcc 11.4.0, open-mpi 4.1.2) - CMAKE_BUILD_TYPE: Release - DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc11 - ENABLE_HYPRE: ON - ENABLE_TRILINOS: OFF - BUILD_SHARED_LIBS: ON - GEOS_ENABLE_BOUNDS_CHECK: OFF - GCP_BUCKET: geosx/ubuntu22.04-gcc11 - HOST_CONFIG: /spack-generated.cmake + # - name: Ubuntu (22.04, gcc 11.4.0, open-mpi 4.1.2) + # CMAKE_BUILD_TYPE: Release + # DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc11 + # ENABLE_HYPRE: ON + # ENABLE_TRILINOS: OFF + # BUILD_SHARED_LIBS: ON + # GEOS_ENABLE_BOUNDS_CHECK: OFF + # GCP_BUCKET: geosx/ubuntu22.04-gcc11 + # HOST_CONFIG: /spack-generated.cmake - - name: Ubuntu (22.04, gcc 12.3.0, open-mpi 4.1.2) - CMAKE_BUILD_TYPE: Release - DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc12 - GCP_BUCKET: geosx/ubuntu22.04-gcc12 - ENABLE_HYPRE: ON - ENABLE_TRILINOS: OFF - BUILD_SHARED_LIBS: ON - GEOS_ENABLE_BOUNDS_CHECK: ON - HOST_CONFIG: /spack-generated.cmake + # - name: Ubuntu (22.04, gcc 12.3.0, open-mpi 4.1.2) + # CMAKE_BUILD_TYPE: Release + # DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc12 + # GCP_BUCKET: geosx/ubuntu22.04-gcc12 + # ENABLE_HYPRE: ON + # ENABLE_TRILINOS: OFF + # BUILD_SHARED_LIBS: ON + # GEOS_ENABLE_BOUNDS_CHECK: ON + # HOST_CONFIG: /spack-generated.cmake - - name: Ubuntu (22.04, gcc 12.3.0, open-mpi 4.1.2) - NO BOUNDS CHECK - CMAKE_BUILD_TYPE: Release - DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc12 - GCP_BUCKET: geosx/ubuntu22.04-gcc12 - ENABLE_HYPRE: ON - ENABLE_TRILINOS: OFF - BUILD_SHARED_LIBS: ON - GEOS_ENABLE_BOUNDS_CHECK: OFF - HOST_CONFIG: /spack-generated.cmake + # - name: Ubuntu (22.04, gcc 12.3.0, open-mpi 4.1.2) - NO BOUNDS CHECK + # CMAKE_BUILD_TYPE: Release + # DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc12 + # GCP_BUCKET: geosx/ubuntu22.04-gcc12 + # ENABLE_HYPRE: ON + # ENABLE_TRILINOS: OFF + # BUILD_SHARED_LIBS: ON + # GEOS_ENABLE_BOUNDS_CHECK: OFF + # HOST_CONFIG: /spack-generated.cmake #- name: Ubuntu (22.04, clang 15.0.7, open-mpi 4.1.2) # CMAKE_BUILD_TYPE: Release @@ -319,86 +321,86 @@ jobs: fail-fast : false matrix: include: - - name: Ubuntu CUDA debug (20.04, clang 10.0.0 + gcc 9.4.0, open-mpi 4.0.3, cuda-11.8.89) - BUILD_AND_TEST_CLI_ARGS: "--build-exe-only --no-install-schema" - CMAKE_BUILD_TYPE: Debug - BUILD_GENERATOR: "--ninja" - DOCKER_REPOSITORY: geosx/ubuntu20.04-clang10.0.0-cuda11.8.89 - ENABLE_HYPRE_DEVICE: CUDA - ENABLE_HYPRE: ON - ENABLE_TRILINOS: OFF - GEOS_ENABLE_BOUNDS_CHECK: OFF - RUNS_ON: streak2 - NPROC: 8 - DOCKER_RUN_ARGS: "--cpus=8 --memory=128g --runtime=nvidia -v /etc/pki/ca-trust/source/anchors/:/usr/local/share/ca-certificates/llnl:ro" - DOCKER_CERTS_DIR: "/usr/local/share/ca-certificates" - DOCKER_CERTS_UPDATE_COMMAND: "update-ca-certificates" - HOST_CONFIG: /spack-generated.cmake + # - name: Ubuntu CUDA debug (20.04, clang 10.0.0 + gcc 9.4.0, open-mpi 4.0.3, cuda-11.8.89) + # BUILD_AND_TEST_CLI_ARGS: "--build-exe-only --no-install-schema" + # CMAKE_BUILD_TYPE: Debug + # BUILD_GENERATOR: "--ninja" + # DOCKER_REPOSITORY: geosx/ubuntu20.04-clang10.0.0-cuda11.8.89 + # ENABLE_HYPRE_DEVICE: CUDA + # ENABLE_HYPRE: ON + # ENABLE_TRILINOS: OFF + # GEOS_ENABLE_BOUNDS_CHECK: OFF + # RUNS_ON: streak2 + # NPROC: 8 + # DOCKER_RUN_ARGS: "--cpus=8 --memory=128g --runtime=nvidia -v /etc/pki/ca-trust/source/anchors/:/usr/local/share/ca-certificates/llnl:ro" + # DOCKER_CERTS_DIR: "/usr/local/share/ca-certificates" + # DOCKER_CERTS_UPDATE_COMMAND: "update-ca-certificates" + # HOST_CONFIG: /spack-generated.cmake - - name: Ubuntu CUDA (20.04, clang 10.0.0 + gcc 9.4.0, open-mpi 4.0.3, cuda-11.8.89) - BUILD_AND_TEST_CLI_ARGS: "--no-run-unit-tests --no-install-schema" - CMAKE_BUILD_TYPE: Release - BUILD_GENERATOR: "--ninja" - DOCKER_REPOSITORY: geosx/ubuntu20.04-clang10.0.0-cuda11.8.89 - ENABLE_HYPRE_DEVICE: CUDA - ENABLE_HYPRE: ON - ENABLE_TRILINOS: OFF - GEOS_ENABLE_BOUNDS_CHECK: OFF - RUNS_ON: streak2 - NPROC: 8 - DOCKER_RUN_ARGS: "--cpus=8 --memory=256g --runtime=nvidia -v /etc/pki/ca-trust/source/anchors/:/usr/local/share/ca-certificates/llnl:ro" - DOCKER_CERTS_DIR: "/usr/local/share/ca-certificates" - DOCKER_CERTS_UPDATE_COMMAND: "update-ca-certificates" - HOST_CONFIG: /spack-generated.cmake + # - name: Ubuntu CUDA (20.04, clang 10.0.0 + gcc 9.4.0, open-mpi 4.0.3, cuda-11.8.89) + # BUILD_AND_TEST_CLI_ARGS: "--no-run-unit-tests --no-install-schema" + # CMAKE_BUILD_TYPE: Release + # BUILD_GENERATOR: "--ninja" + # DOCKER_REPOSITORY: geosx/ubuntu20.04-clang10.0.0-cuda11.8.89 + # ENABLE_HYPRE_DEVICE: CUDA + # ENABLE_HYPRE: ON + # ENABLE_TRILINOS: OFF + # GEOS_ENABLE_BOUNDS_CHECK: OFF + # RUNS_ON: streak2 + # NPROC: 8 + # DOCKER_RUN_ARGS: "--cpus=8 --memory=256g --runtime=nvidia -v /etc/pki/ca-trust/source/anchors/:/usr/local/share/ca-certificates/llnl:ro" + # DOCKER_CERTS_DIR: "/usr/local/share/ca-certificates" + # DOCKER_CERTS_UPDATE_COMMAND: "update-ca-certificates" + # HOST_CONFIG: /spack-generated.cmake - - name: Rockylinux CUDA (8, clang 17.0.6, cuda 12.9.1) - BUILD_AND_TEST_CLI_ARGS: "--no-install-schema" - CMAKE_BUILD_TYPE: Release - BUILD_GENERATOR: "--ninja" - ENABLE_HYPRE_DEVICE: CUDA - ENABLE_HYPRE: ON - ENABLE_TRILINOS: OFF - GEOS_ENABLE_BOUNDS_CHECK: OFF - DOCKER_REPOSITORY: geosx/rockylinux8-clang17-cuda12.9.1 - RUNS_ON: streak - NPROC: 8 - DOCKER_RUN_ARGS: "--cpus=8 --memory=256g --runtime=nvidia --gpus all -v /etc/pki/ca-trust/source/anchors/:/usr/local/share/ca-certificates/llnl:ro" - DOCKER_CERTS_DIR: "/usr/local/share/ca-certificates" - DOCKER_CERTS_UPDATE_COMMAND: "update-ca-trust" - HOST_CONFIG: /spack-generated.cmake + # - name: Rockylinux CUDA (8, clang 17.0.6, cuda 12.9.1) + # BUILD_AND_TEST_CLI_ARGS: "--no-install-schema" + # CMAKE_BUILD_TYPE: Release + # BUILD_GENERATOR: "--ninja" + # ENABLE_HYPRE_DEVICE: CUDA + # ENABLE_HYPRE: ON + # ENABLE_TRILINOS: OFF + # GEOS_ENABLE_BOUNDS_CHECK: OFF + # DOCKER_REPOSITORY: geosx/rockylinux8-clang17-cuda12.9.1 + # RUNS_ON: streak + # NPROC: 8 + # DOCKER_RUN_ARGS: "--cpus=8 --memory=256g --runtime=nvidia --gpus all -v /etc/pki/ca-trust/source/anchors/:/usr/local/share/ca-certificates/llnl:ro" + # DOCKER_CERTS_DIR: "/usr/local/share/ca-certificates" + # DOCKER_CERTS_UPDATE_COMMAND: "update-ca-trust" + # HOST_CONFIG: /spack-generated.cmake - - name: Rockylinux CUDA (8, gcc 13.3, cuda 12.9.1) - BUILD_AND_TEST_CLI_ARGS: "--no-run-unit-tests --no-install-schema" - CMAKE_BUILD_TYPE: Release - BUILD_GENERATOR: "--ninja" - ENABLE_HYPRE_DEVICE: CUDA - ENABLE_HYPRE: ON - ENABLE_TRILINOS: OFF - GEOS_ENABLE_BOUNDS_CHECK: OFF - DOCKER_REPOSITORY: geosx/rockylinux8-gcc13-cuda12.9.1 - RUNS_ON: streak2 - NPROC: 8 - DOCKER_RUN_ARGS: "--cpus=8 --memory=128g --runtime=nvidia -v /etc/pki/ca-trust/source/anchors/:/etc/pki/ca-trust/source/anchors/llnl:ro" - DOCKER_CERTS_DIR: "/etc/pki/ca-trust/source/anchors" - DOCKER_CERTS_UPDATE_COMMAND: "update-ca-trust" - HOST_CONFIG: /spack-generated.cmake + # - name: Rockylinux CUDA (8, gcc 13.3, cuda 12.9.1) + # BUILD_AND_TEST_CLI_ARGS: "--no-run-unit-tests --no-install-schema" + # CMAKE_BUILD_TYPE: Release + # BUILD_GENERATOR: "--ninja" + # ENABLE_HYPRE_DEVICE: CUDA + # ENABLE_HYPRE: ON + # ENABLE_TRILINOS: OFF + # GEOS_ENABLE_BOUNDS_CHECK: OFF + # DOCKER_REPOSITORY: geosx/rockylinux8-gcc13-cuda12.9.1 + # RUNS_ON: streak2 + # NPROC: 8 + # DOCKER_RUN_ARGS: "--cpus=8 --memory=128g --runtime=nvidia -v /etc/pki/ca-trust/source/anchors/:/etc/pki/ca-trust/source/anchors/llnl:ro" + # DOCKER_CERTS_DIR: "/etc/pki/ca-trust/source/anchors" + # DOCKER_CERTS_UPDATE_COMMAND: "update-ca-trust" + # HOST_CONFIG: /spack-generated.cmake - - name: Pangea 3 CUDA (AlmaLinux 8.8, gcc 9.4.0, open-mpi 4.1.2, cuda 11.5.0, openblas 0.3.10) - BUILD_AND_TEST_CLI_ARGS: "--build-exe-only --no-install-schema" - CMAKE_BUILD_TYPE: Release - BUILD_GENERATOR: "--makefile" - DOCKER_REPOSITORY: geosx/pangea3-almalinux8-gcc9.4-openmpi4.1.2-cuda11.5.0-openblas0.3.18 - ENABLE_HYPRE_DEVICE: CUDA - ENABLE_HYPRE: ON - ENABLE_TRILINOS: OFF - GEOS_ENABLE_BOUNDS_CHECK: OFF - HOST_ARCH: ppc64le - RUNS_ON: streak2 - NPROC: 8 - DOCKER_RUN_ARGS: "--cpus=8 --memory=128g -v /etc/pki/ca-trust/source/anchors/:/etc/pki/ca-trust/source/anchors/llnl:ro" - DOCKER_CERTS_DIR: "/etc/pki/ca-trust/source/anchors" - DOCKER_CERTS_UPDATE_COMMAND: "update-ca-trust" - HOST_CONFIG: /spack-generated-wave-solver-only.cmake + # - name: Pangea 3 CUDA (AlmaLinux 8.8, gcc 9.4.0, open-mpi 4.1.2, cuda 11.5.0, openblas 0.3.10) + # BUILD_AND_TEST_CLI_ARGS: "--build-exe-only --no-install-schema" + # CMAKE_BUILD_TYPE: Release + # BUILD_GENERATOR: "--makefile" + # DOCKER_REPOSITORY: geosx/pangea3-almalinux8-gcc9.4-openmpi4.1.2-cuda11.5.0-openblas0.3.18 + # ENABLE_HYPRE_DEVICE: CUDA + # ENABLE_HYPRE: ON + # ENABLE_TRILINOS: OFF + # GEOS_ENABLE_BOUNDS_CHECK: OFF + # HOST_ARCH: ppc64le + # RUNS_ON: streak2 + # NPROC: 8 + # DOCKER_RUN_ARGS: "--cpus=8 --memory=128g -v /etc/pki/ca-trust/source/anchors/:/etc/pki/ca-trust/source/anchors/llnl:ro" + # DOCKER_CERTS_DIR: "/etc/pki/ca-trust/source/anchors" + # DOCKER_CERTS_UPDATE_COMMAND: "update-ca-trust" + # HOST_CONFIG: /spack-generated-wave-solver-only.cmake #- name: Sherlock GPU (centos 7.9.2009, gcc 10.1.0, open-mpi 4.1.2, openblas 0.3.10, cuda 12.4.0,) # BUILD_AND_TEST_CLI_ARGS: "--no-run-unit-tests --no-install-schema" @@ -447,7 +449,7 @@ jobs: needs: - if_not_unassigned_pull_request - are_submodules_in_sync - - check_code_style_and_documentation + - check_code_standards - cpu_builds - cuda_builds - run_integrated_tests @@ -456,14 +458,14 @@ jobs: - run: | echo "if_not_unassigned_pull_request: ${{needs.if_not_unassigned_pull_request.result}}" echo "are_submodules_in_sync: ${{needs.are_submodules_in_sync.result}}" - echo "check_code_style_and_documentation: ${{needs.check_code_style_and_documentation.result}}" + echo "check_code_standards: ${{needs.check_code_standards.result}}" echo "cpu_builds: ${{needs.cpu_builds.result}}" echo "cuda_builds: ${{needs.cuda_builds.result}}" echo "run_integrated_tests: ${{needs.run_integrated_tests.result}} " ${{ needs.if_not_unassigned_pull_request.result == 'success' && needs.are_submodules_in_sync.result == 'success' && - needs.check_code_style_and_documentation.result == 'success' && + needs.check_code_standards.result == 'success' && needs.cpu_builds.result == 'success' && needs.cuda_builds.result == 'success' && needs.run_integrated_tests.result == 'success' diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 2fea08d275f..1b5f4a4f228 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -70,6 +70,8 @@ Usage: $0 Basename of the json credentials file to connect to the sccache cloud cache. --test-code-style --test-documentation + --test-code-rules + Validates code rules compliance -h | --help EOF exit 1 @@ -79,7 +81,7 @@ exit 1 # Then we'll move to the build dir. or_die cd $(dirname $0)/.. -args=$(or_die getopt -a -o h --long build-exe-only,cmake-build-type:,code-coverage,data-basename:,geos-enable-bounds-check:,enable-hypre:,enable-hypre-device:,enable-trilinos:,exchange-dir:,host-config:,install-dir-basename:,makefile,ninja,no-install-schema,no-run-unit-tests,nproc:,repository:,run-integrated-tests,sccache-credentials:,test-code-style,test-documentation,help -- "$@") +args=$(or_die getopt -a -o h --long build-exe-only,cmake-build-type:,code-coverage,data-basename:,geos-enable-bounds-check:,enable-hypre:,enable-hypre-device:,enable-trilinos:,exchange-dir:,host-config:,install-dir-basename:,makefile,ninja,no-install-schema,no-run-unit-tests,nproc:,repository:,run-integrated-tests,sccache-credentials:,test-code-style,test-documentation,test-code-rules,help -- "$@") # Variables with default values BUILD_EXE_ONLY=false @@ -140,6 +142,8 @@ do --test-code-style) TEST_CODE_STYLE=true; shift;; --test-documentation) TEST_DOCUMENTATION=true; shift;; -h | --help) usage; shift;; + --test-code-rules) TEST_CODE_RULES=true; shift;; + # -- means the end of the arguments; drop this, and break out of the while loop --) shift; break;; *) >&2 echo Unsupported option: $1 @@ -277,6 +281,12 @@ if [[ "${TEST_DOCUMENTATION}" = true ]]; then exit 0 fi +# Documentation check +if [[ "${TEST_CODE_RULES}" = true ]]; then + echo "Test if the build workds" + exit 0 +fi + # Performing the requested build. if [[ "${BUILD_EXE_ONLY}" = true ]]; then or_die cmake --build . -j $NPROC --target geosx @@ -310,9 +320,9 @@ fi # Run the unit tests (excluding previously ran checks). if [[ "${RUN_UNIT_TESTS}" = true ]]; then if [ ${HOSTNAME} == 'streak.llnl.gov' ] || [ ${HOSTNAME} == 'streak2.llnl.gov' ]; then - or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck|testExternalSolvers" + or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck|testCodeRules|testExternalSolvers" else - or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck" + or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck|testCodeRules" fi fi From 243af070611406d62b9b97b1f57cc708c17dc72b Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 18 Nov 2025 14:23:46 +0100 Subject: [PATCH 02/63] comment jobs not needed --- .github/workflows/ci_tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 71313671db6..074c8d4aff1 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -450,9 +450,9 @@ jobs: - if_not_unassigned_pull_request - are_submodules_in_sync - check_code_standards - - cpu_builds - - cuda_builds - - run_integrated_tests + # - cpu_builds + # - cuda_builds + # - run_integrated_tests if: ${{ always() }} steps: - run: | From 7754898c7593502bddf2373d4f31f0d23b458ca9 Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 18 Nov 2025 14:40:35 +0100 Subject: [PATCH 03/63] try this --- .github/workflows/ci_tests.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 074c8d4aff1..fc3844660f7 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -459,14 +459,10 @@ jobs: echo "if_not_unassigned_pull_request: ${{needs.if_not_unassigned_pull_request.result}}" echo "are_submodules_in_sync: ${{needs.are_submodules_in_sync.result}}" echo "check_code_standards: ${{needs.check_code_standards.result}}" - echo "cpu_builds: ${{needs.cpu_builds.result}}" - echo "cuda_builds: ${{needs.cuda_builds.result}}" echo "run_integrated_tests: ${{needs.run_integrated_tests.result}} " ${{ needs.if_not_unassigned_pull_request.result == 'success' && needs.are_submodules_in_sync.result == 'success' && needs.check_code_standards.result == 'success' && - needs.cpu_builds.result == 'success' && - needs.cuda_builds.result == 'success' && needs.run_integrated_tests.result == 'success' }} From 29f0ed6d7fa9e672792d40daceb225f0cd51189c Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 18 Nov 2025 14:49:23 +0100 Subject: [PATCH 04/63] remove ctest testcoderule --- scripts/ci_build_and_test_in_container.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 1b5f4a4f228..98636466bc1 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -96,6 +96,7 @@ RUN_INTEGRATED_TESTS=false UPLOAD_TEST_BASELINES=false TEST_CODE_STYLE=false TEST_DOCUMENTATION=false +TEST_CODE_RULES=false ENABLE_TRILINOS=OFF CODE_COVERAGE=false NPROC="$(nproc)" @@ -320,9 +321,9 @@ fi # Run the unit tests (excluding previously ran checks). if [[ "${RUN_UNIT_TESTS}" = true ]]; then if [ ${HOSTNAME} == 'streak.llnl.gov' ] || [ ${HOSTNAME} == 'streak2.llnl.gov' ]; then - or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck|testCodeRules|testExternalSolvers" + or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck|testExternalSolvers" else - or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck|testCodeRules" + or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck" fi fi From 3d2782adf946fc19fba6709c0d9f58bdf74d78e3 Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 18 Nov 2025 14:54:01 +0100 Subject: [PATCH 05/63] try to add some target --- .github/workflows/ci_tests.yml | 56 +++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index fc3844660f7..3ccba022b94 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -149,14 +149,14 @@ jobs: fail-fast : false matrix: include: - # - name: Ubuntu (20.04, gcc 9.4.0, open-mpi 4.0.3) - # CMAKE_BUILD_TYPE: Release - # DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9 - # BUILD_SHARED_LIBS: ON - # ENABLE_HYPRE: OFF - # ENABLE_TRILINOS: ON - # GEOS_ENABLE_BOUNDS_CHECK: ON - # HOST_CONFIG: /spack-generated.cmake + - name: Ubuntu (20.04, gcc 9.4.0, open-mpi 4.0.3) + CMAKE_BUILD_TYPE: Release + DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9 + BUILD_SHARED_LIBS: ON + ENABLE_HYPRE: OFF + ENABLE_TRILINOS: ON + GEOS_ENABLE_BOUNDS_CHECK: ON + HOST_CONFIG: /spack-generated.cmake # - name: Ubuntu debug (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces # CMAKE_BUILD_TYPE: Debug @@ -385,22 +385,22 @@ jobs: # DOCKER_CERTS_UPDATE_COMMAND: "update-ca-trust" # HOST_CONFIG: /spack-generated.cmake - # - name: Pangea 3 CUDA (AlmaLinux 8.8, gcc 9.4.0, open-mpi 4.1.2, cuda 11.5.0, openblas 0.3.10) - # BUILD_AND_TEST_CLI_ARGS: "--build-exe-only --no-install-schema" - # CMAKE_BUILD_TYPE: Release - # BUILD_GENERATOR: "--makefile" - # DOCKER_REPOSITORY: geosx/pangea3-almalinux8-gcc9.4-openmpi4.1.2-cuda11.5.0-openblas0.3.18 - # ENABLE_HYPRE_DEVICE: CUDA - # ENABLE_HYPRE: ON - # ENABLE_TRILINOS: OFF - # GEOS_ENABLE_BOUNDS_CHECK: OFF - # HOST_ARCH: ppc64le - # RUNS_ON: streak2 - # NPROC: 8 - # DOCKER_RUN_ARGS: "--cpus=8 --memory=128g -v /etc/pki/ca-trust/source/anchors/:/etc/pki/ca-trust/source/anchors/llnl:ro" - # DOCKER_CERTS_DIR: "/etc/pki/ca-trust/source/anchors" - # DOCKER_CERTS_UPDATE_COMMAND: "update-ca-trust" - # HOST_CONFIG: /spack-generated-wave-solver-only.cmake + - name: Pangea 3 CUDA (AlmaLinux 8.8, gcc 9.4.0, open-mpi 4.1.2, cuda 11.5.0, openblas 0.3.10) + BUILD_AND_TEST_CLI_ARGS: "--build-exe-only --no-install-schema" + CMAKE_BUILD_TYPE: Release + BUILD_GENERATOR: "--makefile" + DOCKER_REPOSITORY: geosx/pangea3-almalinux8-gcc9.4-openmpi4.1.2-cuda11.5.0-openblas0.3.18 + ENABLE_HYPRE_DEVICE: CUDA + ENABLE_HYPRE: ON + ENABLE_TRILINOS: OFF + GEOS_ENABLE_BOUNDS_CHECK: OFF + HOST_ARCH: ppc64le + RUNS_ON: streak2 + NPROC: 8 + DOCKER_RUN_ARGS: "--cpus=8 --memory=128g -v /etc/pki/ca-trust/source/anchors/:/etc/pki/ca-trust/source/anchors/llnl:ro" + DOCKER_CERTS_DIR: "/etc/pki/ca-trust/source/anchors" + DOCKER_CERTS_UPDATE_COMMAND: "update-ca-trust" + HOST_CONFIG: /spack-generated-wave-solver-only.cmake #- name: Sherlock GPU (centos 7.9.2009, gcc 10.1.0, open-mpi 4.1.2, openblas 0.3.10, cuda 12.4.0,) # BUILD_AND_TEST_CLI_ARGS: "--no-run-unit-tests --no-install-schema" @@ -449,10 +449,10 @@ jobs: needs: - if_not_unassigned_pull_request - are_submodules_in_sync - - check_code_standards - # - cpu_builds - # - cuda_builds - # - run_integrated_tests + - check_code_style_and_documentation + - cpu_builds + - cuda_builds + - run_integrated_tests if: ${{ always() }} steps: - run: | From 38748b0f6a3e48cdf493f88dfe552d7472342872 Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 18 Nov 2025 14:58:38 +0100 Subject: [PATCH 06/63] relaunch ci --- .github/workflows/ci_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 3ccba022b94..f79d4503d5b 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -450,7 +450,7 @@ jobs: - if_not_unassigned_pull_request - are_submodules_in_sync - check_code_style_and_documentation - - cpu_builds + - cpu_builds - cuda_builds - run_integrated_tests if: ${{ always() }} From 21956b3133dca40b0010a2c1883d2c66da641079 Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 18 Nov 2025 15:34:16 +0100 Subject: [PATCH 07/63] forget 1 target --- .github/workflows/ci_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index f79d4503d5b..fe23c5375da 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -449,7 +449,7 @@ jobs: needs: - if_not_unassigned_pull_request - are_submodules_in_sync - - check_code_style_and_documentation + - check_code_standards - cpu_builds - cuda_builds - run_integrated_tests From 183262c9de3ed8542bc1841b8cac8170a7588fda Mon Sep 17 00:00:00 2001 From: arng40 Date: Tue, 18 Nov 2025 17:21:16 +0100 Subject: [PATCH 08/63] test code for detecting std::map --- scripts/ci_build_and_test_in_container.sh | 55 ++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 98636466bc1..4a7f8ed0a6d 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -284,7 +284,60 @@ fi # Documentation check if [[ "${TEST_CODE_RULES}" = true ]]; then - echo "Test if the build workds" + FILE_PATTERNS=( + "src/coreComponents/codingUtilities/*" + "src/coreComponents/dataRepository/*" + "src/coreComponents/denseLinearAlgebra/*" + "src/coreComponents/discretizationMethods/*" + "src/coreComponents/events/*" + "src/coreComponents/fieldSpecification/*" + "src/coreComponents/fileIO/*" + "src/coreComponents/finiteElement/*" + "src/coreComponents/finiteVolume/*" + "src/coreComponents/functions/*" + "src/coreComponents/linearAlgebra/*" + "src/coreComponents/mainInterface/*" + "src/coreComponents/mesh/*" + "src/coreComponents/physicsSolvers/*" + ) + + EXCLUDE_PATTERNS=( + "src/coreComponents/common/Datatype.hpp" + "src/coreComponents/common/StdContaienrWrappers.hpp" + ) + + echo "Test if the build works" + FIND_CMD="find" + for pattern in "${FILE_PATTERNS[@]}"; do + FIND_CMD="$FIND_CMD -path '$pattern' -o" + done + FIND_CMD="${FIND_CMD% -o}" + + VIOLATIONS_FOUND=0 + + FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); + + for file in $FILES; do + SKIP=0 + for exclude in "${EXCLUDE_PATTERNS[@]}"; do + if [[ "$file" == *"$exclude"* ]]; then + SKIP=1 + break + fi + done + + if [ $SKIP -eq 1 ]; then + continue + fi + + if grep -n "std::map\s*<" "$file" ; then + echo "Found forbidden std::map usage in: $file" + grep -n "std::map\s*<" "$file" | while read line; do + echo " Line: $line" + done + VIOLATIONS_FOUND=1 + fi + done exit 0 fi From 1a50cc922b20b00a427d06c14b19e7163634da21 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 09:27:50 +0100 Subject: [PATCH 09/63] force to true --- scripts/ci_build_and_test_in_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 4a7f8ed0a6d..c1f5dc26fc6 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -96,7 +96,7 @@ RUN_INTEGRATED_TESTS=false UPLOAD_TEST_BASELINES=false TEST_CODE_STYLE=false TEST_DOCUMENTATION=false -TEST_CODE_RULES=false +TEST_CODE_RULES=true ENABLE_TRILINOS=OFF CODE_COVERAGE=false NPROC="$(nproc)" From 4004d126e268e66e56805e6db1f1a4b92824f8f5 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 09:49:22 +0100 Subject: [PATCH 10/63] log --- scripts/ci_build_and_test_in_container.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index c1f5dc26fc6..69c415d2f3a 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -281,9 +281,10 @@ if [[ "${TEST_DOCUMENTATION}" = true ]]; then or_die ctest --output-on-failure -R "testDoxygenCheck" exit 0 fi - +echo "DEBUG -- code_rules : ${TEST_CODE_RULES}" # Documentation check if [[ "${TEST_CODE_RULES}" = true ]]; then + echo "Test code rules" FILE_PATTERNS=( "src/coreComponents/codingUtilities/*" "src/coreComponents/dataRepository/*" From 42d6f5b7166d575ade9e6aab9b6c5ae7cd98f965 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 10:01:11 +0100 Subject: [PATCH 11/63] more log --- scripts/ci_build_and_test_in_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 69c415d2f3a..cf258020a60 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -313,7 +313,7 @@ if [[ "${TEST_CODE_RULES}" = true ]]; then FIND_CMD="$FIND_CMD -path '$pattern' -o" done FIND_CMD="${FIND_CMD% -o}" - + echo "FIND_CMD ${FIND_CMD} " VIOLATIONS_FOUND=0 FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); @@ -330,7 +330,7 @@ if [[ "${TEST_CODE_RULES}" = true ]]; then if [ $SKIP -eq 1 ]; then continue fi - + echo "file ${file} " if grep -n "std::map\s*<" "$file" ; then echo "Found forbidden std::map usage in: $file" grep -n "std::map\s*<" "$file" | while read line; do From 6a8769938474b95ce4f2ca8e4536849fb38bbd37 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 10:15:01 +0100 Subject: [PATCH 12/63] print pwd --- scripts/ci_build_and_test_in_container.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index cf258020a60..2df438e49f1 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -308,6 +308,7 @@ if [[ "${TEST_CODE_RULES}" = true ]]; then ) echo "Test if the build works" + eval pwd FIND_CMD="find" for pattern in "${FILE_PATTERNS[@]}"; do FIND_CMD="$FIND_CMD -path '$pattern' -o" From 3ae12c4c4be1e941e0f2a3101e7e009834130a9c Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 10:31:10 +0100 Subject: [PATCH 13/63] test with regex --- scripts/ci_build_and_test_in_container.sh | 58 ++++++++++++----------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 2df438e49f1..421543a7ccd 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -309,37 +309,39 @@ if [[ "${TEST_CODE_RULES}" = true ]]; then echo "Test if the build works" eval pwd - FIND_CMD="find" - for pattern in "${FILE_PATTERNS[@]}"; do - FIND_CMD="$FIND_CMD -path '$pattern' -o" - done - FIND_CMD="${FIND_CMD% -o}" - echo "FIND_CMD ${FIND_CMD} " - VIOLATIONS_FOUND=0 - - FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); - - for file in $FILES; do - SKIP=0 - for exclude in "${EXCLUDE_PATTERNS[@]}"; do - if [[ "$file" == *"$exclude"* ]]; then - SKIP=1 - break - fi - done + + FIND_CMD="find" + for pattern in "${FILE_PATTERNS[@]}"; do + FILE_PATH_PATERN=${GEOS_BUILD_DIR}/${pattern} + FIND_CMD="$FIND_CMD $FILE_PATH_PATERN -regex ".*\\(cpp\|hpp\)" + done + FIND_CMD="${FIND_CMD% -o}" + + echo "FIND_CMD ${FIND_CMD} " + VIOLATIONS_FOUND=0 + FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); - if [ $SKIP -eq 1 ]; then - continue - fi - echo "file ${file} " - if grep -n "std::map\s*<" "$file" ; then - echo "Found forbidden std::map usage in: $file" - grep -n "std::map\s*<" "$file" | while read line; do - echo " Line: $line" - done - VIOLATIONS_FOUND=1 + for file in $FILES; do + SKIP=0 + for exclude in "${EXCLUDE_PATTERNS[@]}"; do + if [[ "$file" == *"$exclude"* ]]; then + SKIP=1 + break fi done + + if [ $SKIP -eq 1 ]; then + continue + fi + echo "file ${file} " + if grep -n "std::map\s*<" "$file" ; then + echo "Found forbidden std::map usage in: $file" + grep -n "std::map\s*<" "$file" | while read line; do + echo " Line: $line" + done + VIOLATIONS_FOUND=1 + fi + done exit 0 fi From 06b6d8f5ff06b51eebb1b631bc9f7789d0db07a2 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 10:37:49 +0100 Subject: [PATCH 14/63] fix --- scripts/ci_build_and_test_in_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 421543a7ccd..451f0d57e4c 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -313,7 +313,7 @@ if [[ "${TEST_CODE_RULES}" = true ]]; then FIND_CMD="find" for pattern in "${FILE_PATTERNS[@]}"; do FILE_PATH_PATERN=${GEOS_BUILD_DIR}/${pattern} - FIND_CMD="$FIND_CMD $FILE_PATH_PATERN -regex ".*\\(cpp\|hpp\)" + FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' -regex ".*\.(cpp|hpp)" -o' done FIND_CMD="${FIND_CMD% -o}" From 9f65bda43cb8c2bf1d7c51c9d260ab242f70571e Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 10:55:40 +0100 Subject: [PATCH 15/63] update find --- scripts/ci_build_and_test_in_container.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 451f0d57e4c..543eace5f8d 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -312,10 +312,9 @@ if [[ "${TEST_CODE_RULES}" = true ]]; then FIND_CMD="find" for pattern in "${FILE_PATTERNS[@]}"; do - FILE_PATH_PATERN=${GEOS_BUILD_DIR}/${pattern} - FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' -regex ".*\.(cpp|hpp)" -o' + FILE_PATH_PATERN=${GEOS_BUILD_DIR}/${pattern}" " done - FIND_CMD="${FIND_CMD% -o}" + FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' echo "FIND_CMD ${FIND_CMD} " VIOLATIONS_FOUND=0 From e519b2982108071ba70bcf100a3f32062273ac72 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 11:01:03 +0100 Subject: [PATCH 16/63] update prefix file pattern --- scripts/ci_build_and_test_in_container.sh | 34 +++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 543eace5f8d..f5db5b623e3 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -286,25 +286,25 @@ echo "DEBUG -- code_rules : ${TEST_CODE_RULES}" if [[ "${TEST_CODE_RULES}" = true ]]; then echo "Test code rules" FILE_PATTERNS=( - "src/coreComponents/codingUtilities/*" - "src/coreComponents/dataRepository/*" - "src/coreComponents/denseLinearAlgebra/*" - "src/coreComponents/discretizationMethods/*" - "src/coreComponents/events/*" - "src/coreComponents/fieldSpecification/*" - "src/coreComponents/fileIO/*" - "src/coreComponents/finiteElement/*" - "src/coreComponents/finiteVolume/*" - "src/coreComponents/functions/*" - "src/coreComponents/linearAlgebra/*" - "src/coreComponents/mainInterface/*" - "src/coreComponents/mesh/*" - "src/coreComponents/physicsSolvers/*" + "generatedSrc/coreComponents/codingUtilities/*" + "generatedSrc/coreComponents/dataRepository/*" + "generatedSrc/coreComponents/denseLinearAlgebra/*" + "generatedSrc/coreComponents/discretizationMethods/*" + "generatedSrc/coreComponents/events/*" + "generatedSrc/coreComponents/fieldSpecification/*" + "generatedSrc/coreComponents/fileIO/*" + "generatedSrc/coreComponents/finiteElement/*" + "generatedSrc/coreComponents/finiteVolume/*" + "generatedSrc/coreComponents/functions/*" + "generatedSrc/coreComponents/linearAlgebra/*" + "generatedSrc/coreComponents/mainInterface/*" + "generatedSrc/coreComponents/mesh/*" + "generatedSrc/coreComponents/physicsSolvers/*" ) EXCLUDE_PATTERNS=( - "src/coreComponents/common/Datatype.hpp" - "src/coreComponents/common/StdContaienrWrappers.hpp" + "generatedSrc/coreComponents/common/Datatype.hpp" + "generatedSrc/coreComponents/common/StdContaienrWrappers.hpp" ) echo "Test if the build works" @@ -312,7 +312,7 @@ if [[ "${TEST_CODE_RULES}" = true ]]; then FIND_CMD="find" for pattern in "${FILE_PATTERNS[@]}"; do - FILE_PATH_PATERN=${GEOS_BUILD_DIR}/${pattern}" " + FILE_PATH_PATERN+=${GEOS_BUILD_DIR}/${pattern}" " done FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' From 09cea716e9515f711d07a5f2880206088cc91ea7 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 11:38:25 +0100 Subject: [PATCH 17/63] move to script --- .github/workflows/ci_tests.yml | 19 +++++- scripts/check_code_rules.sh | 63 +++++++++++++++++++ scripts/ci_build_and_test_in_container.sh | 73 +---------------------- 3 files changed, 83 insertions(+), 72 deletions(-) create mode 100644 scripts/check_code_rules.sh diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index fe23c5375da..4dbd100d208 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -127,8 +127,8 @@ jobs: # Validates that the documentation generated using doxygen has no hole. - name: Check documentation BUILD_AND_TEST_ARGS: --test-documentation - - name: Check code rules - BUILD_AND_TEST_ARGS: --test-code-rules + # - name: Check code rules + # BUILD_AND_TEST_ARGS: --test-code-rules uses: ./.github/workflows/build_and_test.yml with: BUILD_AND_TEST_CLI_ARGS: ${{ matrix.BUILD_AND_TEST_ARGS }} @@ -139,6 +139,21 @@ jobs: RUNS_ON: ubuntu-22.04 USE_SCCACHE: false + check_code_rules: + needs: [is_not_draft_pull_request] + runs-on: ubuntu-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v4.2.2 + with: + submodules: false + lfs: false + fetch-depth: 0 + sparse-checkout: | + scripts + - name: Check that the baseline logs are modified if rebaselines are detected + run: "scripts/check_baseline_log.sh" + # Matrix containing all the CPU build. # Those are quite fast and can efficiently benefit from the `sccache' tool to make them even faster. cpu_builds: diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh new file mode 100644 index 00000000000..70684d06dfb --- /dev/null +++ b/scripts/check_code_rules.sh @@ -0,0 +1,63 @@ +#!/bin/bash + echo "Test if the build works" + eval pwd + +if [[ "${TEST_CODE_RULES}" = true ]]; then + echo "Test code rules" + FILE_PATTERNS=( + "src/coreComponents/codingUtilities/*" + "src/coreComponents/dataRepository/*" + "src/coreComponents/denseLinearAlgebra/*" + "src/coreComponents/discretizationMethods/*" + "src/coreComponents/events/*" + "src/coreComponents/fieldSpecification/*" + "src/coreComponents/fileIO/*" + "src/coreComponents/finiteElement/*" + "src/coreComponents/finiteVolume/*" + "src/coreComponents/functions/*" + "src/coreComponents/linearAlgebra/*" + "src/coreComponents/mainInterface/*" + "src/coreComponents/mesh/*" + "src/coreComponents/physicsSolvers/*" + ) + + EXCLUDE_PATTERNS=( + "src/coreComponents/common/Datatype.hpp" + "src/coreComponents/common/StdContaienrWrappers.hpp" + ) + + + + FIND_CMD="find" + for pattern in "${FILE_PATTERNS[@]}"; do + FILE_PATH_PATERN+=${GEOS_BUILD_DIR}/${pattern}" " + done + FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' + + echo "FIND_CMD ${FIND_CMD} " + VIOLATIONS_FOUND=0 + FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); + + for file in $FILES; do + SKIP=0 + for exclude in "${EXCLUDE_PATTERNS[@]}"; do + if [[ "$file" == *"$exclude"* ]]; then + SKIP=1 + break + fi + done + + if [ $SKIP -eq 1 ]; then + continue + fi + echo "file ${file} " + if grep -n "std::map\s*<" "$file" ; then + echo "Found forbidden std::map usage in: $file" + grep -n "std::map\s*<" "$file" | while read line; do + echo " Line: $line" + done + VIOLATIONS_FOUND=1 + fi + done + exit 0 +fi \ No newline at end of file diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index f5db5b623e3..1a36de87bcb 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -70,9 +70,7 @@ Usage: $0 Basename of the json credentials file to connect to the sccache cloud cache. --test-code-style --test-documentation - --test-code-rules - Validates code rules compliance - -h | --help + -h | --help EOF exit 1 } @@ -81,7 +79,7 @@ exit 1 # Then we'll move to the build dir. or_die cd $(dirname $0)/.. -args=$(or_die getopt -a -o h --long build-exe-only,cmake-build-type:,code-coverage,data-basename:,geos-enable-bounds-check:,enable-hypre:,enable-hypre-device:,enable-trilinos:,exchange-dir:,host-config:,install-dir-basename:,makefile,ninja,no-install-schema,no-run-unit-tests,nproc:,repository:,run-integrated-tests,sccache-credentials:,test-code-style,test-documentation,test-code-rules,help -- "$@") +args=$(or_die getopt -a -o h --long build-exe-only,cmake-build-type:,code-coverage,data-basename:,geos-enable-bounds-check:,enable-hypre:,enable-hypre-device:,enable-trilinos:,exchange-dir:,host-config:,install-dir-basename:,makefile,ninja,no-install-schema,no-run-unit-tests,nproc:,repository:,run-integrated-tests,sccache-credentials:,test-code-style,test-documentation,help -- "$@") # Variables with default values BUILD_EXE_ONLY=false @@ -96,7 +94,6 @@ RUN_INTEGRATED_TESTS=false UPLOAD_TEST_BASELINES=false TEST_CODE_STYLE=false TEST_DOCUMENTATION=false -TEST_CODE_RULES=true ENABLE_TRILINOS=OFF CODE_COVERAGE=false NPROC="$(nproc)" @@ -143,9 +140,7 @@ do --test-code-style) TEST_CODE_STYLE=true; shift;; --test-documentation) TEST_DOCUMENTATION=true; shift;; -h | --help) usage; shift;; - --test-code-rules) TEST_CODE_RULES=true; shift;; - - # -- means the end of the arguments; drop this, and break out of the while loop + # -- means the end of the arguments; drop this, and break out of the while loop --) shift; break;; *) >&2 echo Unsupported option: $1 usage;; @@ -281,68 +276,6 @@ if [[ "${TEST_DOCUMENTATION}" = true ]]; then or_die ctest --output-on-failure -R "testDoxygenCheck" exit 0 fi -echo "DEBUG -- code_rules : ${TEST_CODE_RULES}" -# Documentation check -if [[ "${TEST_CODE_RULES}" = true ]]; then - echo "Test code rules" - FILE_PATTERNS=( - "generatedSrc/coreComponents/codingUtilities/*" - "generatedSrc/coreComponents/dataRepository/*" - "generatedSrc/coreComponents/denseLinearAlgebra/*" - "generatedSrc/coreComponents/discretizationMethods/*" - "generatedSrc/coreComponents/events/*" - "generatedSrc/coreComponents/fieldSpecification/*" - "generatedSrc/coreComponents/fileIO/*" - "generatedSrc/coreComponents/finiteElement/*" - "generatedSrc/coreComponents/finiteVolume/*" - "generatedSrc/coreComponents/functions/*" - "generatedSrc/coreComponents/linearAlgebra/*" - "generatedSrc/coreComponents/mainInterface/*" - "generatedSrc/coreComponents/mesh/*" - "generatedSrc/coreComponents/physicsSolvers/*" - ) - - EXCLUDE_PATTERNS=( - "generatedSrc/coreComponents/common/Datatype.hpp" - "generatedSrc/coreComponents/common/StdContaienrWrappers.hpp" - ) - - echo "Test if the build works" - eval pwd - - FIND_CMD="find" - for pattern in "${FILE_PATTERNS[@]}"; do - FILE_PATH_PATERN+=${GEOS_BUILD_DIR}/${pattern}" " - done - FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' - - echo "FIND_CMD ${FIND_CMD} " - VIOLATIONS_FOUND=0 - FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); - - for file in $FILES; do - SKIP=0 - for exclude in "${EXCLUDE_PATTERNS[@]}"; do - if [[ "$file" == *"$exclude"* ]]; then - SKIP=1 - break - fi - done - - if [ $SKIP -eq 1 ]; then - continue - fi - echo "file ${file} " - if grep -n "std::map\s*<" "$file" ; then - echo "Found forbidden std::map usage in: $file" - grep -n "std::map\s*<" "$file" | while read line; do - echo " Line: $line" - done - VIOLATIONS_FOUND=1 - fi - done - exit 0 -fi # Performing the requested build. if [[ "${BUILD_EXE_ONLY}" = true ]]; then From 716ce69d1778d4876ddd55684807e84b5deb76c2 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 11:41:44 +0100 Subject: [PATCH 18/63] fix rule ^^ --- .github/workflows/ci_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 4dbd100d208..7b33618b898 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -151,8 +151,8 @@ jobs: fetch-depth: 0 sparse-checkout: | scripts - - name: Check that the baseline logs are modified if rebaselines are detected - run: "scripts/check_baseline_log.sh" + - name: Check the code rules + run: "scripts/check_code_rules.sh" # Matrix containing all the CPU build. # Those are quite fast and can efficiently benefit from the `sccache' tool to make them even faster. From a7f4a14c9b6e48119b1aef602c73aa4fdf837a99 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 11:54:59 +0100 Subject: [PATCH 19/63] test perm --- scripts/check_code_rules.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 70684d06dfb..4fa32f13ade 100644 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -1,6 +1,5 @@ -#!/bin/bash - echo "Test if the build works" - eval pwd +echo "Test if the build works" +eval pwd if [[ "${TEST_CODE_RULES}" = true ]]; then echo "Test code rules" From fad594490b3ffad0d50aa324f7a617aaa03796d0 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 12:03:07 +0100 Subject: [PATCH 20/63] add write --- scripts/check_code_rules.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 4fa32f13ade..50acc3bb220 100644 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -1,3 +1,4 @@ +#!/bin/bash echo "Test if the build works" eval pwd From d3a6d9cf0f6a0f4bda5c86e16d28464db9b292c1 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 13:28:24 +0100 Subject: [PATCH 21/63] give perm --- scripts/check_code_rules.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/check_code_rules.sh diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh old mode 100644 new mode 100755 From 56eebfc03669471c6273a07d7129440a9cf81bff Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 13:28:36 +0100 Subject: [PATCH 22/63] give perm --- scripts/check_code_rules.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 scripts/check_code_rules.sh diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh old mode 100755 new mode 100644 From 933dcc027c2a090b1d76e6719d6448a583d9c8a4 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 13:35:07 +0100 Subject: [PATCH 23/63] attempt perm --- scripts/check_code_rules.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/check_code_rules.sh diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh old mode 100644 new mode 100755 From fc7867042d9696bada5758639d5693950ef26c6f Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 13:46:09 +0100 Subject: [PATCH 24/63] remove if statement --- scripts/check_code_rules.sh | 106 +++++++++++++++++------------------- 1 file changed, 49 insertions(+), 57 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 50acc3bb220..11c319d517d 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -1,63 +1,55 @@ #!/bin/bash -echo "Test if the build works" -eval pwd - -if [[ "${TEST_CODE_RULES}" = true ]]; then - echo "Test code rules" - FILE_PATTERNS=( - "src/coreComponents/codingUtilities/*" - "src/coreComponents/dataRepository/*" - "src/coreComponents/denseLinearAlgebra/*" - "src/coreComponents/discretizationMethods/*" - "src/coreComponents/events/*" - "src/coreComponents/fieldSpecification/*" - "src/coreComponents/fileIO/*" - "src/coreComponents/finiteElement/*" - "src/coreComponents/finiteVolume/*" - "src/coreComponents/functions/*" - "src/coreComponents/linearAlgebra/*" - "src/coreComponents/mainInterface/*" - "src/coreComponents/mesh/*" - "src/coreComponents/physicsSolvers/*" - ) - EXCLUDE_PATTERNS=( - "src/coreComponents/common/Datatype.hpp" - "src/coreComponents/common/StdContaienrWrappers.hpp" +echo "Test code rules" +eval pwd +FILE_PATTERNS=( + "src/coreComponents/codingUtilities/*" + "src/coreComponents/dataRepository/*" + "src/coreComponents/denseLinearAlgebra/*" + "src/coreComponents/discretizationMethods/*" + "src/coreComponents/events/*" + "src/coreComponents/fieldSpecification/*" + "src/coreComponents/fileIO/*" + "src/coreComponents/finiteElement/*" + "src/coreComponents/finiteVolume/*" + "src/coreComponents/functions/*" + "src/coreComponents/linearAlgebra/*" + "src/coreComponents/mainInterface/*" + "src/coreComponents/mesh/*" + "src/coreComponents/physicsSolvers/*" ) - - - - FIND_CMD="find" - for pattern in "${FILE_PATTERNS[@]}"; do - FILE_PATH_PATERN+=${GEOS_BUILD_DIR}/${pattern}" " - done - FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' - - echo "FIND_CMD ${FIND_CMD} " - VIOLATIONS_FOUND=0 - FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); - - for file in $FILES; do - SKIP=0 - for exclude in "${EXCLUDE_PATTERNS[@]}"; do - if [[ "$file" == *"$exclude"* ]]; then - SKIP=1 - break - fi - done + EXCLUDE_PATTERNS=( + "src/coreComponents/common/Datatype.hpp" + "src/coreComponents/common/StdContaienrWrappers.hpp" + ) +FIND_CMD="find" +for pattern in "${FILE_PATTERNS[@]}"; do + FILE_PATH_PATERN+=${GEOS_BUILD_DIR}/${pattern}" " +done +FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' +echo "FIND_CMD ${FIND_CMD} " +VIOLATIONS_FOUND=0 +FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); - if [ $SKIP -eq 1 ]; then - continue - fi - echo "file ${file} " - if grep -n "std::map\s*<" "$file" ; then - echo "Found forbidden std::map usage in: $file" - grep -n "std::map\s*<" "$file" | while read line; do - echo " Line: $line" - done - VIOLATIONS_FOUND=1 +for file in $FILES; do + SKIP=0 + for exclude in "${EXCLUDE_PATTERNS[@]}"; do + if [[ "$file" == *"$exclude"* ]]; then + SKIP=1 + break fi done - exit 0 -fi \ No newline at end of file + + if [ $SKIP -eq 1 ]; then + continue + fi + echo "file ${file} " + if grep -n "std::map\s*<" "$file" ; then + echo "Found forbidden std::map usage in: $file" + grep -n "std::map\s*<" "$file" | while read line; do + echo " Line: $line" + done + VIOLATIONS_FOUND=1 + fi +done +exit 0 From 3716bf25bb9f9821c7e73f11a4521fbdc9652ab6 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 13:49:51 +0100 Subject: [PATCH 25/63] test ls --- scripts/check_code_rules.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 11c319d517d..7827ceb7b18 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -2,6 +2,7 @@ echo "Test code rules" eval pwd +eval ls FILE_PATTERNS=( "src/coreComponents/codingUtilities/*" "src/coreComponents/dataRepository/*" From d2eddbd351ccea90c8f30e3d26ceea4190783492 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 13:52:06 +0100 Subject: [PATCH 26/63] test another pwd --- scripts/check_code_rules.sh | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 7827ceb7b18..1de543fd866 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -3,25 +3,26 @@ echo "Test code rules" eval pwd eval ls +eval ../ls FILE_PATTERNS=( - "src/coreComponents/codingUtilities/*" - "src/coreComponents/dataRepository/*" - "src/coreComponents/denseLinearAlgebra/*" - "src/coreComponents/discretizationMethods/*" - "src/coreComponents/events/*" - "src/coreComponents/fieldSpecification/*" - "src/coreComponents/fileIO/*" - "src/coreComponents/finiteElement/*" - "src/coreComponents/finiteVolume/*" - "src/coreComponents/functions/*" - "src/coreComponents/linearAlgebra/*" - "src/coreComponents/mainInterface/*" - "src/coreComponents/mesh/*" - "src/coreComponents/physicsSolvers/*" + "../src/coreComponents/codingUtilities/*" + "../src/coreComponents/dataRepository/*" + "../src/coreComponents/denseLinearAlgebra/*" + "../src/coreComponents/discretizationMethods/*" + "../src/coreComponents/events/*" + "../src/coreComponents/fieldSpecification/*" + "../src/coreComponents/fileIO/*" + "../src/coreComponents/finiteElement/*" + "../src/coreComponents/finiteVolume/*" + "../src/coreComponents/functions/*" + "../src/coreComponents/linearAlgebra/*" + "../src/coreComponents/mainInterface/*" + "../src/coreComponents/mesh/*" + "../src/coreComponents/physicsSolvers/*" ) EXCLUDE_PATTERNS=( - "src/coreComponents/common/Datatype.hpp" - "src/coreComponents/common/StdContaienrWrappers.hpp" + "../src/coreComponents/common/Datatype.hpp" + "../src/coreComponents/common/StdContaienrWrappers.hpp" ) FIND_CMD="find" for pattern in "${FILE_PATTERNS[@]}"; do From e59d2f0b6e56f2757d2017a165745a8dc579d8a3 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 13:54:12 +0100 Subject: [PATCH 27/63] fix cd --- scripts/check_code_rules.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 1de543fd866..bb5b7d335e0 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -3,7 +3,7 @@ echo "Test code rules" eval pwd eval ls -eval ../ls +eval ls ../ FILE_PATTERNS=( "../src/coreComponents/codingUtilities/*" "../src/coreComponents/dataRepository/*" From 5c43982cfafc4de832ced3b1318814bf6dfb3aa1 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 14:11:03 +0100 Subject: [PATCH 28/63] add src --- .github/workflows/ci_tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 7b33618b898..afec631c958 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -150,7 +150,8 @@ jobs: lfs: false fetch-depth: 0 sparse-checkout: | - scripts + scripts + src - name: Check the code rules run: "scripts/check_code_rules.sh" From 883ba549c53480ec1bbf7ca7c4a6a29a96c75a42 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 14:13:30 +0100 Subject: [PATCH 29/63] go to src --- scripts/check_code_rules.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index bb5b7d335e0..74e3565de75 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -5,24 +5,24 @@ eval pwd eval ls eval ls ../ FILE_PATTERNS=( - "../src/coreComponents/codingUtilities/*" - "../src/coreComponents/dataRepository/*" - "../src/coreComponents/denseLinearAlgebra/*" - "../src/coreComponents/discretizationMethods/*" - "../src/coreComponents/events/*" - "../src/coreComponents/fieldSpecification/*" - "../src/coreComponents/fileIO/*" - "../src/coreComponents/finiteElement/*" - "../src/coreComponents/finiteVolume/*" - "../src/coreComponents/functions/*" - "../src/coreComponents/linearAlgebra/*" - "../src/coreComponents/mainInterface/*" - "../src/coreComponents/mesh/*" - "../src/coreComponents/physicsSolvers/*" + "src/coreComponents/codingUtilities/*" + "src/coreComponents/dataRepository/*" + "src/coreComponents/denseLinearAlgebra/*" + "src/coreComponents/discretizationMethods/*" + "src/coreComponents/events/*" + "src/coreComponents/fieldSpecification/*" + "src/coreComponents/fileIO/*" + "src/coreComponents/finiteElement/*" + "src/coreComponents/finiteVolume/*" + "src/coreComponents/functions/*" + "src/coreComponents/linearAlgebra/*" + "src/coreComponents/mainInterface/*" + "src/coreComponents/mesh/*" + "src/coreComponents/physicsSolvers/*" ) EXCLUDE_PATTERNS=( - "../src/coreComponents/common/Datatype.hpp" - "../src/coreComponents/common/StdContaienrWrappers.hpp" + "src/coreComponents/common/Datatype.hpp" + "src/coreComponents/common/StdContaienrWrappers.hpp" ) FIND_CMD="find" for pattern in "${FILE_PATTERNS[@]}"; do From 02e26e1b4ce1b106d603aafabbb232a48ca8cbd4 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 14:17:52 +0100 Subject: [PATCH 30/63] remove prefix --- scripts/check_code_rules.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 74e3565de75..fe828d17885 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -2,8 +2,7 @@ echo "Test code rules" eval pwd -eval ls -eval ls ../ +eval ls src/ FILE_PATTERNS=( "src/coreComponents/codingUtilities/*" "src/coreComponents/dataRepository/*" @@ -26,7 +25,7 @@ FILE_PATTERNS=( ) FIND_CMD="find" for pattern in "${FILE_PATTERNS[@]}"; do - FILE_PATH_PATERN+=${GEOS_BUILD_DIR}/${pattern}" " + FILE_PATH_PATERN+=${pattern}" " done FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' echo "FIND_CMD ${FIND_CMD} " From a24ff219d5abc0ef1a62ddb6ba71ef1538ee0e98 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 14:22:18 +0100 Subject: [PATCH 31/63] sabotage code --- src/coreComponents/mesh/generators/VTKUtilities.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/mesh/generators/VTKUtilities.cpp b/src/coreComponents/mesh/generators/VTKUtilities.cpp index 1f21a300d52..ed44ffa4418 100644 --- a/src/coreComponents/mesh/generators/VTKUtilities.cpp +++ b/src/coreComponents/mesh/generators/VTKUtilities.cpp @@ -561,7 +561,7 @@ AllMeshes loadAllMeshes( Path const & filePath, { int const lastRank = MpiWrapper::commSize() - 1; vtkSmartPointer< vtkDataSet > main = loadMesh( filePath, mainBlockName ); - stdMap< string, vtkSmartPointer< vtkDataSet > > faces; + std:map< string, vtkSmartPointer< vtkDataSet > > faces; for( string const & faceBlockName: faceBlockNames ) { From e28b1c2715b4b8a02b35ef82a162f51ffb76b1fc Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 14:26:19 +0100 Subject: [PATCH 32/63] missing : --- src/coreComponents/mesh/generators/VTKUtilities.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/mesh/generators/VTKUtilities.cpp b/src/coreComponents/mesh/generators/VTKUtilities.cpp index ed44ffa4418..3c3a19f58a8 100644 --- a/src/coreComponents/mesh/generators/VTKUtilities.cpp +++ b/src/coreComponents/mesh/generators/VTKUtilities.cpp @@ -561,7 +561,7 @@ AllMeshes loadAllMeshes( Path const & filePath, { int const lastRank = MpiWrapper::commSize() - 1; vtkSmartPointer< vtkDataSet > main = loadMesh( filePath, mainBlockName ); - std:map< string, vtkSmartPointer< vtkDataSet > > faces; + std::map< string, vtkSmartPointer< vtkDataSet > > faces; for( string const & faceBlockName: faceBlockNames ) { From 27657f633cce9ac8258be85113345a2549fee5ea Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 14:55:02 +0100 Subject: [PATCH 33/63] display info at the end --- scripts/check_code_rules.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index fe828d17885..172785de6c8 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -1,8 +1,6 @@ #!/bin/bash echo "Test code rules" -eval pwd -eval ls src/ FILE_PATTERNS=( "src/coreComponents/codingUtilities/*" "src/coreComponents/dataRepository/*" @@ -31,7 +29,8 @@ FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' echo "FIND_CMD ${FIND_CMD} " VIOLATIONS_FOUND=0 FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); - + +ARRAY=() for file in $FILES; do SKIP=0 for exclude in "${EXCLUDE_PATTERNS[@]}"; do @@ -46,11 +45,21 @@ for file in $FILES; do fi echo "file ${file} " if grep -n "std::map\s*<" "$file" ; then - echo "Found forbidden std::map usage in: $file" + STR1="Found forbidden std::map usage in: $file"$'\n' grep -n "std::map\s*<" "$file" | while read line; do - echo " Line: $line" + STR1+=" Line: $line" + ARRAY+="$STR" done VIOLATIONS_FOUND=1 fi done + +for element in "${ARRAY[@]}" +do + echo "$element"; +done + +if (($VIOLATIONS_FOUND == 1)); then + exit 1; +fi exit 0 From f48fc293bd162dd15eb494629f9fbdb756ed43c6 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 15:06:03 +0100 Subject: [PATCH 34/63] check str --- scripts/check_code_rules.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 172785de6c8..730ea8089fe 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -49,6 +49,7 @@ for file in $FILES; do grep -n "std::map\s*<" "$file" | while read line; do STR1+=" Line: $line" ARRAY+="$STR" + echo "$STR1" done VIOLATIONS_FOUND=1 fi From cb5754ee8783de5d15147b57cff51957c918f1b9 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 15:08:02 +0100 Subject: [PATCH 35/63] wrong varaible --- scripts/check_code_rules.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 730ea8089fe..1dbd380edd0 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -48,8 +48,7 @@ for file in $FILES; do STR1="Found forbidden std::map usage in: $file"$'\n' grep -n "std::map\s*<" "$file" | while read line; do STR1+=" Line: $line" - ARRAY+="$STR" - echo "$STR1" + ARRAY+="$STR1" done VIOLATIONS_FOUND=1 fi From 4aeafa3d5ec796f93741760a47f99ce7a446919e Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 15:10:07 +0100 Subject: [PATCH 36/63] echo --- scripts/check_code_rules.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 1dbd380edd0..c6df158b648 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -48,6 +48,7 @@ for file in $FILES; do STR1="Found forbidden std::map usage in: $file"$'\n' grep -n "std::map\s*<" "$file" | while read line; do STR1+=" Line: $line" + echo "$STR1"; ARRAY+="$STR1" done VIOLATIONS_FOUND=1 From e9e58c2252a8b57ec43971ac1452d1f2f9004129 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 15:31:19 +0100 Subject: [PATCH 37/63] simplify --- scripts/check_code_rules.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index c6df158b648..ac19d645336 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -43,12 +43,12 @@ for file in $FILES; do if [ $SKIP -eq 1 ]; then continue fi - echo "file ${file} " - if grep -n "std::map\s*<" "$file" ; then + if [grep -n "std::map\s*<" "$file"] ; then STR1="Found forbidden std::map usage in: $file"$'\n' - grep -n "std::map\s*<" "$file" | while read line; do - STR1+=" Line: $line" - echo "$STR1"; + STR1+= grep -n "std::map\s*<" "$file" + # while read line; do + # STR1+=" Line: $line" + # echo "$STR1"; ARRAY+="$STR1" done VIOLATIONS_FOUND=1 From 0792e8836cf7246d96a3f51ef656d661143c5361 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 15:33:15 +0100 Subject: [PATCH 38/63] remove done --- scripts/check_code_rules.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index ac19d645336..da568586afb 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -50,7 +50,6 @@ for file in $FILES; do # STR1+=" Line: $line" # echo "$STR1"; ARRAY+="$STR1" - done VIOLATIONS_FOUND=1 fi done From 14d9399feed816f55c41b25ff30e01e9ee1f7d64 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 15:35:42 +0100 Subject: [PATCH 39/63] remove bracket --- scripts/check_code_rules.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index da568586afb..e51de655aed 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -43,7 +43,7 @@ for file in $FILES; do if [ $SKIP -eq 1 ]; then continue fi - if [grep -n "std::map\s*<" "$file"] ; then + if grep -n "std::map\s*<" "$file" ; then STR1="Found forbidden std::map usage in: $file"$'\n' STR1+= grep -n "std::map\s*<" "$file" # while read line; do From b7a5e5300e901557afd8fd4fd3aa6d6d23b0af57 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 16:12:47 +0100 Subject: [PATCH 40/63] add more std --- scripts/check_code_rules.sh | 70 +++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 15 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index e51de655aed..bd71a977cff 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -26,11 +26,12 @@ for pattern in "${FILE_PATTERNS[@]}"; do FILE_PATH_PATERN+=${pattern}" " done FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' -echo "FIND_CMD ${FIND_CMD} " -VIOLATIONS_FOUND=0 FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); +VIOLATIONS_FOUND=0 -ARRAY=() +ARRAY_MAP=() +ARRAY_UMAP=() +ARRAY_VECTOR=() for file in $FILES; do SKIP=0 for exclude in "${EXCLUDE_PATTERNS[@]}"; do @@ -43,23 +44,62 @@ for file in $FILES; do if [ $SKIP -eq 1 ]; then continue fi - if grep -n "std::map\s*<" "$file" ; then - STR1="Found forbidden std::map usage in: $file"$'\n' - STR1+= grep -n "std::map\s*<" "$file" - # while read line; do - # STR1+=" Line: $line" - # echo "$STR1"; - ARRAY+="$STR1" + + if grep -q "std::map\s*<" "$file" ; then + STR_MAP=" Found forbidden std::map usage in: $file"$'\n ' + STR_MAP+= grep -n "std::map\s*<" "$file" + ARRAY_MAP+="$STR_MAP" VIOLATIONS_FOUND=1 fi + if grep -q "std::unordered_map\s*<" "$file" ; then + STR_UMAP=" Found forbidden std::unordered_map usage in: $file"$'\n ' + STR_UMAP+= grep -n "std::unordered_map\s*<" "$file" + ARRAY_UMAP+="$STR_UMAP" + VIOLATIONS_FOUND=2 + fi + if grep -q "std::vector\s*<" "$file" ; then + STR_VECTOR=" Found forbidden std::vector usage in: $file"$'\n ' + STR_VECTOR+= grep -n "std::vector\s*<" "$file" + ARRAY_VECTOR+="$STR_VECTOR" + VIOLATIONS_FOUND=3 + fi done -for element in "${ARRAY[@]}" -do - echo "$element"; -done +if (($VIOLATIONS_FOUND != 0)); then + echo "----------------------------------------" + echo "SUMMARY: Code rule violations found" + echo "----------------------------------------" + + if((VIOLATIONS_FOUND == 1 ));then + echo $'\nERROR: Forbidden std::map usage detected\n' + fi + + for element in "${ARRAY_MAP[@]}" + do + echo "$element"; + done -if (($VIOLATIONS_FOUND == 1)); then + if((VIOLATIONS_FOUND == 2 ));then + echo $'\nERROR: Forbidden std::unordered_map usage detected\n' + fi + + for element in "${ARRAY_UMAP[@]}" + do + echo "$element"; + done + + if((VIOLATIONS_FOUND == 3 ));then + echo $'\nERROR: Forbidden std::vector usage detected\n' + fi + + for element in "${ARRAY_VECTOR[@]}" + do + echo "$element"; + done + + echo "" exit 1; fi + +echo "No code rule violations found" exit 0 From 7ed6c89d86bd706684c258280e6a9f69bc404ef8 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 16:30:00 +0100 Subject: [PATCH 41/63] update logic --- scripts/check_code_rules.sh | 43 ++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index bd71a977cff..6c89d4e2a13 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -27,7 +27,10 @@ for pattern in "${FILE_PATTERNS[@]}"; do done FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); -VIOLATIONS_FOUND=0 + +MAP_VIOLATIONS_FOUND=0 +UMAP_VIOLATIONS_FOUND=0 +VECTOR_VIOLATIONS_FOUND=0 ARRAY_MAP=() ARRAY_UMAP=() @@ -46,31 +49,37 @@ for file in $FILES; do fi if grep -q "std::map\s*<" "$file" ; then - STR_MAP=" Found forbidden std::map usage in: $file"$'\n ' - STR_MAP+= grep -n "std::map\s*<" "$file" - ARRAY_MAP+="$STR_MAP" - VIOLATIONS_FOUND=1 + STR_MAP=" Found forbidden std::map usage in: $file"$'\n' + while IFS= read -r line; do + STR_MAP+=" $line"$'\n' + done < <(grep -n "std::map\s*<" "$file") + ARRAY_MAP+=("$STR_MAP") + MAP_VIOLATIONS_FOUND=1 fi if grep -q "std::unordered_map\s*<" "$file" ; then - STR_UMAP=" Found forbidden std::unordered_map usage in: $file"$'\n ' - STR_UMAP+= grep -n "std::unordered_map\s*<" "$file" - ARRAY_UMAP+="$STR_UMAP" - VIOLATIONS_FOUND=2 + STR_UMAP=" Found forbidden std::unordered_map usage in: $file"$'\n' + while IFS= read -r line; do + STR_UMAP+=" $line"$'\n' + done < <(grep -n "std::map\s*<" "$file") + ARRAY_UMAP+=("$STR_UMAP") + UMAP_VIOLATIONS_FOUND=1 fi if grep -q "std::vector\s*<" "$file" ; then - STR_VECTOR=" Found forbidden std::vector usage in: $file"$'\n ' - STR_VECTOR+= grep -n "std::vector\s*<" "$file" - ARRAY_VECTOR+="$STR_VECTOR" - VIOLATIONS_FOUND=3 + STR_VECTOR=" Found forbidden std::vector usage in: $file"$'\n' + while IFS= read -r line; do + STR_VECTOR+=" $line"$'\n' + done < <(grep -n "std::map\s*<" "$file") + ARRAY_VECTOR+=("$STR_VECTOR") + VECTOR_VIOLATIONS_FOUND=1 fi done -if (($VIOLATIONS_FOUND != 0)); then +if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )); then echo "----------------------------------------" echo "SUMMARY: Code rule violations found" echo "----------------------------------------" - if((VIOLATIONS_FOUND == 1 ));then + if((MAP_VIOLATIONS_FOUND == 1 ));then echo $'\nERROR: Forbidden std::map usage detected\n' fi @@ -79,7 +88,7 @@ if (($VIOLATIONS_FOUND != 0)); then echo "$element"; done - if((VIOLATIONS_FOUND == 2 ));then + if((UMAP_VIOLATIONS_FOUND == 1 ));then echo $'\nERROR: Forbidden std::unordered_map usage detected\n' fi @@ -88,7 +97,7 @@ if (($VIOLATIONS_FOUND != 0)); then echo "$element"; done - if((VIOLATIONS_FOUND == 3 ));then + if((MAP_VIOLATIONS_FOUND == 1 ));then echo $'\nERROR: Forbidden std::vector usage detected\n' fi From 1b6654e9e21b894ee525cc62183b5d908b454ae4 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 16:33:51 +0100 Subject: [PATCH 42/63] fix std --- scripts/check_code_rules.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 6c89d4e2a13..9229bfa06ad 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -60,7 +60,7 @@ for file in $FILES; do STR_UMAP=" Found forbidden std::unordered_map usage in: $file"$'\n' while IFS= read -r line; do STR_UMAP+=" $line"$'\n' - done < <(grep -n "std::map\s*<" "$file") + done < <(grep -n "std::unordered_map\s*<" "$file") ARRAY_UMAP+=("$STR_UMAP") UMAP_VIOLATIONS_FOUND=1 fi @@ -68,7 +68,7 @@ for file in $FILES; do STR_VECTOR=" Found forbidden std::vector usage in: $file"$'\n' while IFS= read -r line; do STR_VECTOR+=" $line"$'\n' - done < <(grep -n "std::map\s*<" "$file") + done < <(grep -n "std::vector\s*<" "$file") ARRAY_VECTOR+=("$STR_VECTOR") VECTOR_VIOLATIONS_FOUND=1 fi From a4d11fd84171d03159dae170f7aa67e469d37474 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 16:36:31 +0100 Subject: [PATCH 43/63] style --- scripts/check_code_rules.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 9229bfa06ad..114d5321ae3 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -80,7 +80,8 @@ if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )); then echo "----------------------------------------" if((MAP_VIOLATIONS_FOUND == 1 ));then - echo $'\nERROR: Forbidden std::map usage detected\n' + echo $'ERROR: Forbidden std::map usage detected\n' + echo "==========================================" fi for element in "${ARRAY_MAP[@]}" @@ -90,6 +91,7 @@ if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )); then if((UMAP_VIOLATIONS_FOUND == 1 ));then echo $'\nERROR: Forbidden std::unordered_map usage detected\n' + echo "======================================================" fi for element in "${ARRAY_UMAP[@]}" @@ -99,6 +101,7 @@ if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )); then if((MAP_VIOLATIONS_FOUND == 1 ));then echo $'\nERROR: Forbidden std::vector usage detected\n' + echo "===============================================" fi for element in "${ARRAY_VECTOR[@]}" From 198e8957036b029f29bdc54917d8b8f1b83cebd6 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 16:38:50 +0100 Subject: [PATCH 44/63] remove lr --- scripts/check_code_rules.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 114d5321ae3..9b86b762631 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -80,7 +80,7 @@ if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )); then echo "----------------------------------------" if((MAP_VIOLATIONS_FOUND == 1 ));then - echo $'ERROR: Forbidden std::map usage detected\n' + echo $'ERROR: Forbidden std::map usage detected' echo "==========================================" fi @@ -90,7 +90,7 @@ if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )); then done if((UMAP_VIOLATIONS_FOUND == 1 ));then - echo $'\nERROR: Forbidden std::unordered_map usage detected\n' + echo $'\nERROR: Forbidden std::unordered_map usage detected' echo "======================================================" fi @@ -100,7 +100,7 @@ if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )); then done if((MAP_VIOLATIONS_FOUND == 1 ));then - echo $'\nERROR: Forbidden std::vector usage detected\n' + echo $'\nERROR: Forbidden std::vector usage detected' echo "===============================================" fi From a95fba7b90b0075a9d26b8acad7de18764cb8703 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 16:53:48 +0100 Subject: [PATCH 45/63] set stdUnorderedMap --- scripts/check_code_rules.sh | 4 +++- src/coreComponents/codingUtilities/RTTypes.cpp | 2 +- .../codingUtilities/tests/testGeosxTraits.cpp | 2 +- src/coreComponents/common/TypeDispatch.hpp | 2 +- .../common/unitTests/testDataTypes.cpp | 2 +- .../compositional/parameters/PhaseType.cpp | 2 +- .../constitutive/unitTests/TestFluid.hpp | 4 ++-- .../unitTests/testSoreideWhitsonFlash.cpp | 2 +- src/coreComponents/dataRepository/ObjectCatalog.hpp | 8 ++++---- .../fileIO/vtk/VTKPolyDataWriterInterface.cpp | 2 +- .../mesh/coarsening/SemistructuredPartitioner.cpp | 4 ++-- .../multiscale/msrsb/MsrsbLevelBuilderCoupled.cpp | 6 +++--- .../mesh/generators/CellBlockManager.cpp | 6 +++--- .../mesh/generators/VTKFaceBlockUtilities.cpp | 2 +- src/coreComponents/mesh/generators/VTKUtilities.cpp | 12 ++++++------ .../mesh/mpiCommunications/CommunicationTools.cpp | 2 +- .../solidMechanics/SolidMechanicsMPM.cpp | 2 +- 17 files changed, 33 insertions(+), 31 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 9b86b762631..bae158d66e2 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -20,6 +20,8 @@ FILE_PATTERNS=( EXCLUDE_PATTERNS=( "src/coreComponents/common/Datatype.hpp" "src/coreComponents/common/StdContaienrWrappers.hpp" + "src/coreComponents/dataRepository/BufferOps_inline.hpp" + "src/coreComponents/dataRepository/BufferOps.hpp" ) FIND_CMD="find" for pattern in "${FILE_PATTERNS[@]}"; do @@ -72,7 +74,7 @@ for file in $FILES; do ARRAY_VECTOR+=("$STR_VECTOR") VECTOR_VIOLATIONS_FOUND=1 fi -done + done if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )); then echo "----------------------------------------" diff --git a/src/coreComponents/codingUtilities/RTTypes.cpp b/src/coreComponents/codingUtilities/RTTypes.cpp index 648f94e6b31..a90eabb61d8 100644 --- a/src/coreComponents/codingUtilities/RTTypes.cpp +++ b/src/coreComponents/codingUtilities/RTTypes.cpp @@ -39,7 +39,7 @@ void printTypeSummary() string rtTypes::getTypeName( std::type_index const key ) { - static const std::unordered_map< std::type_index, string > type_names = + static const stdUnorderedMap< std::type_index, string > type_names = { {std::type_index( typeid(integer)), "integer"}, {std::type_index( typeid(real32)), "real32"}, diff --git a/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp b/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp index 7a20ee4238c..121cb4f71de 100644 --- a/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp +++ b/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp @@ -53,7 +53,7 @@ TEST( testGeosxTraits, HasMemberFunction_at ) static_assert( HasMemberFunction_at< stdVector< int > >, "Should be true." ); static_assert( HasMemberFunction_at< stdVector< double > >, "Should be true." ); static_assert( HasMemberFunction_at< stdMap< int, string > >, "Should be true." ); - static_assert( HasMemberFunction_at< std::unordered_map< int, string > >, "Should be true." ); + static_assert( HasMemberFunction_at< stdUnorderedMap< int, string > >, "Should be true." ); static_assert( !HasMemberFunction_at< int >, "Should be false." ); static_assert( !HasMemberFunction_at< stdMap< string, string > >, "Should be false." ); diff --git a/src/coreComponents/common/TypeDispatch.hpp b/src/coreComponents/common/TypeDispatch.hpp index b38b5858066..2e45170d098 100644 --- a/src/coreComponents/common/TypeDispatch.hpp +++ b/src/coreComponents/common/TypeDispatch.hpp @@ -269,7 +269,7 @@ template< typename LIST, std::size_t ... Is > auto const & getTypeMap( LIST, std::integer_sequence< std::size_t, Is... > ) { using KeyType = decltype( createTypeIndexTuple( camp::first< LIST > {} ) ); - static std::unordered_map< KeyType, std::size_t, tuple_hash > const result = { { createTypeIndexTuple( camp::at_t< LIST, camp::num< Is > >{} ), Is } ... }; + static stdUnorderedMap< KeyType, std::size_t, tuple_hash > const result = { { createTypeIndexTuple( camp::at_t< LIST, camp::num< Is > >{} ), Is } ... }; return result; } diff --git a/src/coreComponents/common/unitTests/testDataTypes.cpp b/src/coreComponents/common/unitTests/testDataTypes.cpp index 5c2daf1655a..081487fa943 100644 --- a/src/coreComponents/common/unitTests/testDataTypes.cpp +++ b/src/coreComponents/common/unitTests/testDataTypes.cpp @@ -61,7 +61,7 @@ TEST( testDataTypes, testBoundChecking ) // std::cout <<" sdsfs "<< mapBoundsChecking.get_inserted(0)<< std::endl; // std::cout << mapBoundsChecking.get_inserted(1); - internal::StdMapWrapper< std::unordered_map< integer, integer >, true > unorderedMapBoundsChecking{{0, 1}}; + internal::StdMapWrapper< stdUnorderedMap< integer, integer >, true > unorderedMapBoundsChecking{{0, 1}}; EXPECT_THROW( { try { diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/PhaseType.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/PhaseType.cpp index a86de714834..435b50a6202 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/PhaseType.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/PhaseType.cpp @@ -29,7 +29,7 @@ namespace constitutive namespace compositional { -static std::unordered_map< PhaseType, std::string > const phase_aliases{ +static stdUnorderedMap< PhaseType, std::string > const phase_aliases{ {PhaseType::LIQUID, "liquid,liq,oil"}, {PhaseType::VAPOUR, "gas,vap,vapor,vapour"}, {PhaseType::AQUEOUS, "wat,water,aqueous"} diff --git a/src/coreComponents/constitutive/unitTests/TestFluid.hpp b/src/coreComponents/constitutive/unitTests/TestFluid.hpp index ea6d23fe70b..9be655cfca7 100644 --- a/src/coreComponents/constitutive/unitTests/TestFluid.hpp +++ b/src/coreComponents/constitutive/unitTests/TestFluid.hpp @@ -78,7 +78,7 @@ struct Fluid 7.45513e-02, 1.80000e+07, 3.47000e+03, 6.25000e-04, -1.21200e-01, 3.05992e-05, // KCL (potassium chloride) }; - static std::unordered_map const componentNames; + static stdUnorderedMap const componentNames; /* UNCRUSTIFY-ON */ }; @@ -199,7 +199,7 @@ class TestFluid }; /* UNCRUSTIFY-OFF */ -std::unordered_map const Fluid::componentNames = { +stdUnorderedMap const Fluid::componentNames = { { H2O, "H2O" }, // water { CO2, "CO2" }, // carbon dioxide { N2, "N2" }, // nitrogen diff --git a/src/coreComponents/constitutive/unitTests/testSoreideWhitsonFlash.cpp b/src/coreComponents/constitutive/unitTests/testSoreideWhitsonFlash.cpp index 54645b4207e..87d948828a1 100644 --- a/src/coreComponents/constitutive/unitTests/testSoreideWhitsonFlash.cpp +++ b/src/coreComponents/constitutive/unitTests/testSoreideWhitsonFlash.cpp @@ -64,7 +64,7 @@ TEST_P( SoreideWhitsonSolubilityTestFixture, testSolubility ) /* UNCRUSTIFY-OFF */ // Soreide-Whitson correlations work only with "true" values of component parameters // kij_NA is the binary interation coefficient in the gas phase (see Table 5 Soreide-Whitson (1992)) - std::unordered_map const> const componentDatabase = { + stdUnorderedMap const> const componentDatabase = { // Mw Pc Tc Vc Ac kij_NA {Fluid::H2O, { 1.80153e-02, 2.20640e+07, 6.47096e+02, 5.59480e-05, 3.44300e-01, 0.0000 }}, {Fluid::CO2, { 4.40095e-02, 7.37730e+06, 3.04128e+02, 9.41185e-05, 2.23940e-01, 0.1896 }}, diff --git a/src/coreComponents/dataRepository/ObjectCatalog.hpp b/src/coreComponents/dataRepository/ObjectCatalog.hpp index 2fd0762c97b..10e4cd0ce14 100644 --- a/src/coreComponents/dataRepository/ObjectCatalog.hpp +++ b/src/coreComponents/dataRepository/ObjectCatalog.hpp @@ -22,8 +22,8 @@ * a similar manner to classic virtual factory method, except that it is no * maintained list of derived objects that is required to create new objects. * Instead, the ``ObjectCatalog`` creates a "catalog" of derived objects using - * a ``std::unordered_map``. - * This ``std::unordered_map`` is then statically initialized through the declaration + * a ``stdUnorderedMap``. + * This ``stdUnorderedMap`` is then statically initialized through the declaration * of a */ @@ -71,7 +71,7 @@ class CatalogInterface /// This is the type that will be used for the catalog. The catalog is actually instantiated in the @p BASETYPE. //START_SPHINX_1 - typedef std::unordered_map< std::string, + typedef stdUnorderedMap< std::string, std::unique_ptr< CatalogInterface< BASETYPE, ARGS... > > > CatalogType; //STOP_SPHINX @@ -426,7 +426,7 @@ class CatalogInterface< BASETYPE > public: /// This is the type that will be used for the catalog. The catalog is actually instantiated in the @p BASETYPE. - typedef std::unordered_map< std::string, std::unique_ptr< CatalogInterface< BASETYPE > > > CatalogType; + typedef stdUnorderedMap< std::string, std::unique_ptr< CatalogInterface< BASETYPE > > > CatalogType; /** * @brief Default constructor. diff --git a/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp b/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp index f1539d4d61d..633139a0017 100644 --- a/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp +++ b/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp @@ -362,7 +362,7 @@ getSurface( FaceElementSubRegion const & subRegion, stdVector< int > cellTypes; cellTypes.reserve( subRegion.size() ); - std::unordered_map< localIndex, localIndex > geos2VTKIndexing; + stdUnorderedMap< localIndex, localIndex > geos2VTKIndexing; geos2VTKIndexing.reserve( subRegion.size() * subRegion.numNodesPerElement() ); localIndex nodeIndexInVTK = 0; // FaceElementSubRegion being heterogeneous, the size of the connectivity vector may vary for each element. diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/SemistructuredPartitioner.cpp b/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/SemistructuredPartitioner.cpp index 82c8ab67a29..e7b58e1c508 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/SemistructuredPartitioner.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/SemistructuredPartitioner.cpp @@ -40,7 +40,7 @@ template< typename FUNC > CRSMatrix< int64_t, int64_t, int64_t > buildLayerGraph( multiscale::MeshLevel const & mesh, arrayView1d< localIndex const > const & layerCells, - std::unordered_map< integer, localIndex > const & structIndexToLayerCell, + stdUnorderedMap< integer, localIndex > const & structIndexToLayerCell, integer const layerIndex, integer const minCommonNodes, FUNC && weightFunc ) @@ -151,7 +151,7 @@ localIndex SemistructuredPartitioner::generate( MeshLevel const & mesh, array1d< localIndex > layerCells; layerCells.reserve( numCellsA ); - std::unordered_map< integer, localIndex > indexToLayer; + stdUnorderedMap< integer, localIndex > indexToLayer; indexToLayer.reserve( numCellsA ); forAll< serialPolicy >( numCells, [&]( localIndex const i ) diff --git a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.cpp b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.cpp index dc268a33e17..ae2e3b112c5 100644 --- a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.cpp @@ -126,12 +126,12 @@ void MsrsbLevelBuilderCoupled< LAI >::initializeFineLevel( DomainPartition & dom createSmoothers(); } -std::unordered_map< globalIndex, globalIndex > +stdUnorderedMap< globalIndex, globalIndex > makeGhostDofMap( MeshObjectManager const & manager, string const & oldDofKey, string const & newDofKey ) { - std::unordered_map< globalIndex, globalIndex > ghostDofMap; + stdUnorderedMap< globalIndex, globalIndex > ghostDofMap; arrayView1d< globalIndex const > const oldDofNumber = manager.getReference< array1d< globalIndex > >( oldDofKey ); arrayView1d< globalIndex const > const newDofNumber = manager.getReference< array1d< globalIndex > >( newDofKey ); for( localIndex i = manager.numOwnedObjects(); i < manager.size(); ++i ) @@ -176,7 +176,7 @@ void MsrsbLevelBuilderCoupled< LAI >::buildProlongationStructure( DofManager con integer const numComp = m_dofManager.numComponents( fieldName ); - std::unordered_map< globalIndex, globalIndex > const ghostDofMap = + stdUnorderedMap< globalIndex, globalIndex > const ghostDofMap = makeGhostDofMap( m_builders[blockId]->manager(), dofManager.key( fieldName ), m_dofManager.key( fieldName ) ); auto const mapGhostCol = [numComp, &ghostDofMap]( globalIndex const col ) diff --git a/src/coreComponents/mesh/generators/CellBlockManager.cpp b/src/coreComponents/mesh/generators/CellBlockManager.cpp index 7506e96b77e..d21d2ff7df7 100644 --- a/src/coreComponents/mesh/generators/CellBlockManager.cpp +++ b/src/coreComponents/mesh/generators/CellBlockManager.cpp @@ -1022,7 +1022,7 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, nodeLocalToGlobalNew=nodeLocalToGlobalNew.toView(), numInternalNodesPerEdge, numNodesPerEdge, globalNodeOffset, glCoords, localNodeOffset, order]( localIndex const iter_edge ) { - std::unordered_map< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; + stdUnorderedMap< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; localIndex edgeHeadNode = edgeToNodesMapSource[ iter_edge ][ 0 ]; localIndex edgeEndNode = edgeToNodesMapSource[ iter_edge ][ 1 ]; globalIndex edgeHeadNodeG = nodeLocalToGlobalNew[ edgeHeadNode ]; @@ -1086,7 +1086,7 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, faceLocalToGlobal=faceLocalToGlobal.toView(), nodeLocalToGlobalNew=nodeLocalToGlobalNew.toView() ]( localIndex const iter_face ) { - std::unordered_map< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; + stdUnorderedMap< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; localIndex faceVertID[ numVerticesPerFace ]; globalIndex faceVertGID[ numVerticesPerFace ]; array1d< localIndex > const faceToNodeMapWork( numNodesPerFace ); @@ -1189,7 +1189,7 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, elementLocalToGlobal=elementLocalToGlobal.toView(), nodeLocalToGlobalNew=nodeLocalToGlobalNew.toView() ]( localIndex const iter_elem ) { - std::unordered_map< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; + stdUnorderedMap< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; localIndex elemVertID[ numVerticesPerCell]; array1d< localIndex > const elemToNodeMapWork( numNodesPerCell ); for( localIndex iter_node=0; iter_node < numVerticesPerCell; iter_node++ ) diff --git a/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.cpp b/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.cpp index 7b540945686..9a7b2b59fd0 100644 --- a/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.cpp +++ b/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.cpp @@ -238,7 +238,7 @@ ArrayOfArrays< localIndex > buildFace2dToElems2d( vtkPolyData * edges, { // Each edge is first associated to an hash and to an id. // Then we loop over all the edges of each cell and compute its hash to recover the associated id. - std::unordered_map< std::pair< vtkIdType, vtkIdType >, int, pairHashComputer > face2dIds; + stdUnorderedMap< std::pair< vtkIdType, vtkIdType >, int, pairHashComputer > face2dIds; for( int i = 0; i < edges->GetNumberOfCells(); ++i ) { vtkCell * c = edges->GetCell( i ); diff --git a/src/coreComponents/mesh/generators/VTKUtilities.cpp b/src/coreComponents/mesh/generators/VTKUtilities.cpp index 3c3a19f58a8..93eaf103443 100644 --- a/src/coreComponents/mesh/generators/VTKUtilities.cpp +++ b/src/coreComponents/mesh/generators/VTKUtilities.cpp @@ -561,7 +561,7 @@ AllMeshes loadAllMeshes( Path const & filePath, { int const lastRank = MpiWrapper::commSize() - 1; vtkSmartPointer< vtkDataSet > main = loadMesh( filePath, mainBlockName ); - std::map< string, vtkSmartPointer< vtkDataSet > > faces; + stdMap< string, vtkSmartPointer< vtkDataSet > > faces; for( string const & faceBlockName: faceBlockNames ) { @@ -1516,7 +1516,7 @@ splitCellsByTypeAndAttribute( stdMap< ElementType, stdVector< vtkIdType > > & ty { using ArrayType = TYPEOFPTR( attributeArray ); vtkDataArrayAccessor< ArrayType > attribute( attributeArray ); - std::unordered_map< int, size_t > cellCounts; + stdUnorderedMap< int, size_t > cellCounts; for( vtkIdType c: cells ) { int const region = static_cast< int >( attribute.Get( c, 0 ) ); @@ -1713,7 +1713,7 @@ stdVector< localIndex > getWedgeNodeOrderingFromPolyhedron( vtkCell * const cell stdVector< localIndex > nodeOrder( 6 ); // Generate global to local map - std::unordered_map< localIndex, localIndex > G2L; + stdUnorderedMap< localIndex, localIndex > G2L; for( localIndex iPoint = 0; iPoint < 6; ++iPoint ) { G2L[cell->GetPointId( iPoint )] = iPoint; @@ -1808,7 +1808,7 @@ stdVector< localIndex > getPyramidNodeOrderingFromPolyhedron( vtkCell * const ce stdVector< localIndex > nodeOrder( 5 ); // Generate global to local map - std::unordered_map< localIndex, localIndex > G2L; + stdUnorderedMap< localIndex, localIndex > G2L; for( iPoint = 0; iPoint < 5; ++iPoint ) { G2L[cell->GetPointId( iPoint )] = iPoint; @@ -1882,7 +1882,7 @@ stdVector< localIndex > getPrismNodeOrderingFromPolyhedron( vtkCell * const cell stdVector< localIndex > nodeOrder( 2*NUM_SIDES ); // Generate global to local map - std::unordered_map< localIndex, localIndex > G2L; + stdUnorderedMap< localIndex, localIndex > G2L; for( localIndex iPoint = 0; iPoint < cell->GetNumberOfPoints(); ++iPoint ) { G2L[cell->GetPointId( iPoint )] = iPoint; @@ -2436,7 +2436,7 @@ void writeCells( integer const logLevel, { continue; } - std::unordered_map< int, stdVector< vtkIdType > > const & regionIdToCellIds = typeRegions.second; + stdUnorderedMap< int, stdVector< vtkIdType > > const & regionIdToCellIds = typeRegions.second; for( auto const & regionCells : regionIdToCellIds ) { int const regionId = regionCells.first; diff --git a/src/coreComponents/mesh/mpiCommunications/CommunicationTools.cpp b/src/coreComponents/mesh/mpiCommunications/CommunicationTools.cpp index 5b674816102..4ba010377fe 100644 --- a/src/coreComponents/mesh/mpiCommunications/CommunicationTools.cpp +++ b/src/coreComponents/mesh/mpiCommunications/CommunicationTools.cpp @@ -701,7 +701,7 @@ void fixReceiveLists( ObjectManagerBase & objectManager, stdVector< localIndex > ghostsToFix; /// Map from owning MPI rank to an array of local objects we need to fix. - std::unordered_map< int, stdVector< localIndex > > ghostsBySecondNeighbor; + stdUnorderedMap< int, stdVector< localIndex > > ghostsBySecondNeighbor; arrayView1d< integer > const & ghostRank = objectManager.ghostRank(); diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp index e4fdff69db4..70ee8742f28 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp @@ -2009,7 +2009,7 @@ real64 SolidMechanicsMPM::computeNeighborList( ParticleManager & particleManager // Declare bin key and bins data structure BinKey binKey; - std::unordered_map< BinKey, stdVector< localIndex >, BinKeyHash > bins; + stdUnorderedMap< BinKey, stdVector< localIndex >, BinKeyHash > bins; // Reverse entries in bins based on even distribution of particles in partition - OPTIONAL particleManager.forParticleRegions< ParticleRegion >( [&]( ParticleRegion & region ) // idk why this requires a template argument and the From 239fb10df62ee1b866dcb5313c24d82394b89c14 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 16:56:53 +0100 Subject: [PATCH 46/63] vector rule --- scripts/check_code_rules.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index bae158d66e2..705ba3e82ea 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -101,7 +101,7 @@ if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )); then echo "$element"; done - if((MAP_VIOLATIONS_FOUND == 1 ));then + if((VECTOR_VIOLATIONS_FOUND == 1 ));then echo $'\nERROR: Forbidden std::vector usage detected' echo "===============================================" fi From 87d05fef62e3119134bb6d8eedd5b623a81ff7bc Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 17:02:06 +0100 Subject: [PATCH 47/63] add common --- scripts/check_code_rules.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 705ba3e82ea..405de1b8c72 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -3,6 +3,7 @@ echo "Test code rules" FILE_PATTERNS=( "src/coreComponents/codingUtilities/*" + "src/coreComponents/common/*" "src/coreComponents/dataRepository/*" "src/coreComponents/denseLinearAlgebra/*" "src/coreComponents/discretizationMethods/*" From 010d4bc5a9aa19f63fdfb41c83f5620578734013 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 17:05:48 +0100 Subject: [PATCH 48/63] replace std::vector --- scripts/check_code_rules.sh | 2 +- src/coreComponents/common/MemoryInfos.cpp | 2 +- .../common/StdContainerWrappers.hpp | 12 +- .../common/format/table/TableFormatter.cpp | 6 +- .../common/format/table/TableLayout.hpp | 2 +- .../common/format/table/TableTypes.hpp | 10 +- .../common/logger/ErrorHandling.hpp | 4 +- .../constitutive/ConstitutiveBase.hpp | 4 +- .../parameters/KValueFlashParameters.cpp | 2 +- .../mesh/graphs/RLFGraphColoringMPI.cpp | 22 +-- .../mesh/graphs/RLFGraphColoringMPI.hpp | 8 +- .../mesh/graphs/ZoltanGraphColoring.cpp | 18 +- .../mesh/graphs/ZoltanGraphColoring.hpp | 14 +- .../mpiCommunications/SpatialPartition.cpp | 2 +- .../mesh/unitTests/testGraphColoring.cpp | 14 +- .../mesh/unitTests/testGraphColoringMPI.cpp | 16 +- src/coreComponents/schema/schema.xsd | 154 ++++++++++++++++++ src/coreComponents/schema/schema.xsd.other | 46 ++++++ 18 files changed, 269 insertions(+), 69 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 405de1b8c72..34b1cd2075b 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -20,7 +20,7 @@ FILE_PATTERNS=( ) EXCLUDE_PATTERNS=( "src/coreComponents/common/Datatype.hpp" - "src/coreComponents/common/StdContaienrWrappers.hpp" + "src/coreComponents/common/StdContainerWrappers.hpp" "src/coreComponents/dataRepository/BufferOps_inline.hpp" "src/coreComponents/dataRepository/BufferOps.hpp" ) diff --git a/src/coreComponents/common/MemoryInfos.cpp b/src/coreComponents/common/MemoryInfos.cpp index 7cd91ebeb0e..3a60e9f0854 100644 --- a/src/coreComponents/common/MemoryInfos.cpp +++ b/src/coreComponents/common/MemoryInfos.cpp @@ -139,7 +139,7 @@ void MemoryLogging::memoryStatsReport() const MPI_Comm_size( MPI_COMM_WORLD, &size ); size_t nbRank = (std::size_t)size; // Get a list of all the allocators and sort it so that it's in the same order on each rank. - std::vector< string > allocatorNames = rm.getAllocatorNames(); + stdVector< string > allocatorNames = rm.getAllocatorNames(); std::sort( allocatorNames.begin(), allocatorNames.end() ); // If each rank doesn't have the same number of allocators you can't aggregate them. diff --git a/src/coreComponents/common/StdContainerWrappers.hpp b/src/coreComponents/common/StdContainerWrappers.hpp index afb7506daab..a7e3b91d679 100644 --- a/src/coreComponents/common/StdContainerWrappers.hpp +++ b/src/coreComponents/common/StdContainerWrappers.hpp @@ -46,7 +46,7 @@ namespace internal /** - * Default allocator type for std::vector. + * Default allocator type for stdVector. * This can be specialized if a different allocator is needed. * Required to avoid recursive evaluation in StdVectorWrapper. * @tparam T Type of elements in the vector. @@ -55,7 +55,7 @@ template< typename T > using DefaultAllocator = std::allocator< T >; /** - * Wrapper for std::vector that allows toggling between bounds-checked access + * Wrapper for stdVector that allows toggling between bounds-checked access * (using at()) and unchecked access (using operator[]). * @tparam T Type of elements in the vector. * @tparam Allocator Allocator type for the vector. @@ -65,11 +65,11 @@ using DefaultAllocator = std::allocator< T >; template< typename T, typename Allocator = DefaultAllocator< T >, bool USE_BOUNDS_CHECKING = false > -class StdVectorWrapper : public std::vector< T, Allocator > +class StdVectorWrapper : public stdVector< T, Allocator > { public: - /// Type alias for the base class (i.e., std::vector) - using Base = std::vector< T, Allocator >; + /// Type alias for the base class (i.e., stdVector) + using Base = stdVector< T, Allocator >; /// We have to declare explicitly all constructor because `using Base::Base` causes bugs during compilation /// @cond DO_NOT_DOCUMENT @@ -154,7 +154,7 @@ class StdVectorWrapper : public std::vector< T, Allocator > } /** - * type alias for std::vector + * type alias for stdVector * @tparam T Type of elements in the vector. * @tparam Allocator Allocator type for the vector. */ diff --git a/src/coreComponents/common/format/table/TableFormatter.cpp b/src/coreComponents/common/format/table/TableFormatter.cpp index e34eaa8d37c..1e124595658 100644 --- a/src/coreComponents/common/format/table/TableFormatter.cpp +++ b/src/coreComponents/common/format/table/TableFormatter.cpp @@ -200,7 +200,7 @@ string TableCSVFormatter::toString< TableData >( TableData const & tableData ) c { if( tableData.getErrorsList().hasErrors() ) { - std::vector< string > cpyErrors = tableData.getErrorsList().getErrors(); + stdVector< string > cpyErrors = tableData.getErrorsList().getErrors(); getErrorsList().appendErrors( cpyErrors ); } @@ -518,7 +518,7 @@ void TableTextFormatter::populateErrorCellsLayout( PreparedTableLayout const & t { errorCellsLayout.push_back( { - std::vector< TableLayout::CellLayout >( nbCells, + stdVector< TableLayout::CellLayout >( nbCells, TableLayout::CellLayout( CellType::MergeNext ) ), 1 // subLines count } ); @@ -531,7 +531,7 @@ void TableTextFormatter::populateErrorCellsLayout( PreparedTableLayout const & t errorCellsLayout.push_back( { - std::vector< TableLayout::CellLayout >( nbCells, + stdVector< TableLayout::CellLayout >( nbCells, TableLayout::CellLayout( CellType::Separator ) ), 1 // subLines count } ); diff --git a/src/coreComponents/common/format/table/TableLayout.hpp b/src/coreComponents/common/format/table/TableLayout.hpp index b166f65b198..fcaf7cd590d 100644 --- a/src/coreComponents/common/format/table/TableLayout.hpp +++ b/src/coreComponents/common/format/table/TableLayout.hpp @@ -127,7 +127,7 @@ class TableLayout /** * @return The view on each cell line. */ - std::vector< string_view > & getLines() + stdVector< string_view > & getLines() { return m_lines; } /** diff --git a/src/coreComponents/common/format/table/TableTypes.hpp b/src/coreComponents/common/format/table/TableTypes.hpp index 4565ad92ff8..dd65747aa20 100644 --- a/src/coreComponents/common/format/table/TableTypes.hpp +++ b/src/coreComponents/common/format/table/TableTypes.hpp @@ -62,7 +62,7 @@ class TableErrorListing void clear(); /// The iterator alias for the errors vector of string - using Iterator = std::vector< string >::const_iterator; + using Iterator = stdVector< string >::const_iterator; /** * @return An Iterator pointing to the first element of the errors vector @@ -80,24 +80,24 @@ class TableErrorListing * @brief Append a vector of string to the errors vector. * @param errors A vector of string to append */ - void appendErrors( std::vector< string > & errors ) + void appendErrors( stdVector< string > & errors ) { m_errorList.insert( m_errorList.end(), errors.begin(), errors.end() );} /** * @return A const reference to the errors vector. */ - std::vector< string > const & getErrors() const + stdVector< string > const & getErrors() const { return m_errorList; } /** * @return A reference to the errors vector. */ - std::vector< string > & getErrors() + stdVector< string > & getErrors() { return m_errorList; } private: /// Contain all the errors to display at the end of the table - std::vector< string > m_errorList; + stdVector< string > m_errorList; }; inline void TableErrorListing::addError( string_view text ) diff --git a/src/coreComponents/common/logger/ErrorHandling.hpp b/src/coreComponents/common/logger/ErrorHandling.hpp index a1275433a14..e2fab8a48e5 100644 --- a/src/coreComponents/common/logger/ErrorHandling.hpp +++ b/src/coreComponents/common/logger/ErrorHandling.hpp @@ -114,9 +114,9 @@ class ErrorLogger /// the source location line corresponding to the error in the code (default is 0) integer m_line = 0; /// Additional information about the error in the input file - std::vector< ErrorContext > m_contextsInfo; + stdVector< ErrorContext > m_contextsInfo; /// the stack trace - std::vector< std::string > m_sourceCallStack; + stdVector< std::string > m_sourceCallStack; /** * @brief Construct a default Error Message diff --git a/src/coreComponents/constitutive/ConstitutiveBase.hpp b/src/coreComponents/constitutive/ConstitutiveBase.hpp index 7921ee28a78..b8bd67c2de0 100644 --- a/src/coreComponents/constitutive/ConstitutiveBase.hpp +++ b/src/coreComponents/constitutive/ConstitutiveBase.hpp @@ -170,7 +170,7 @@ class ConstitutiveBase : public dataRepository::Group /** * @return A const vector containing all fields */ - std::vector< std::string > const & getUserFields() const + stdVector< std::string > const & getUserFields() const { return m_userFields; } @@ -189,7 +189,7 @@ class ConstitutiveBase : public dataRepository::Group bool m_isClone; // Vector containing all fields registered with `registerField()` - std::vector< std::string > m_userFields; + stdVector< std::string > m_userFields; }; } diff --git a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp index 3160bf2644b..4b08f78785c 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/compositional/parameters/KValueFlashParameters.cpp @@ -399,7 +399,7 @@ bool KValueFlashParameters< NUM_PHASE >::validateKValues( MultiFluidBase const * if( !tableData.getTableDataRows().empty()) { - std::vector< TableLayout::Column > columns; + stdVector< TableLayout::Column > columns; columns.emplace_back( TableLayout::Column().setName( "Phase" ).setValuesAlignment( TableLayout::Alignment::left ) ); columns.emplace_back( TableLayout::Column().setName( "Pressure" ).setValuesAlignment( TableLayout::Alignment::right ) ); columns.emplace_back( TableLayout::Column().setName( "Temperature" ).setValuesAlignment( TableLayout::Alignment::right ) ); diff --git a/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.cpp b/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.cpp index 314ca4e577c..22238f12224 100644 --- a/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.cpp +++ b/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.cpp @@ -35,23 +35,23 @@ RLFGraphColoringMPI::~RLFGraphColoringMPI() {} -int RLFGraphColoringMPI::colorGraph( const std::vector< camp::idx_t > & localAdjncy ) +int RLFGraphColoringMPI::colorGraph( const stdVector< camp::idx_t > & localAdjncy ) { - std::vector< camp::idx_t > localXadj = createXadjFromAdjncy( localAdjncy, m_comm ); - std::vector< int > localColors = RLFGraphColoringMPI::colorGraph( localXadj, localAdjncy ); + stdVector< camp::idx_t > localXadj = createXadjFromAdjncy( localAdjncy, m_comm ); + stdVector< int > localColors = RLFGraphColoringMPI::colorGraph( localXadj, localAdjncy ); return localColors[0]; } -std::vector< int > RLFGraphColoringMPI::colorGraph( const std::vector< camp::idx_t > & localXadj, - const std::vector< camp::idx_t > & localAdjncy ) +stdVector< int > RLFGraphColoringMPI::colorGraph( const stdVector< camp::idx_t > & localXadj, + const stdVector< camp::idx_t > & localAdjncy ) { int const rank = MpiWrapper::commRank( m_comm ); int const size = MpiWrapper::commSize( m_comm ); // Perform coloring on rank 0 auto [xadj, adjncy] = gatherGraphData( localXadj, localAdjncy, m_comm ); - std::vector< int > colors; + stdVector< int > colors; if( rank == 0 ) { geos::graph::RLFGraphColoring graphColoring; @@ -59,8 +59,8 @@ std::vector< int > RLFGraphColoringMPI::colorGraph( const std::vector< camp::idx } // Scatter colors back to original ranks - std::vector< int > sendCounts; - std::vector< int > displacements; + stdVector< int > sendCounts; + stdVector< int > displacements; if( rank==0 ) { @@ -80,7 +80,7 @@ std::vector< int > RLFGraphColoringMPI::colorGraph( const std::vector< camp::idx } } - std::vector< int > localColors( localNodeCounts ); + stdVector< int > localColors( localNodeCounts ); MpiWrapper::scatterv( colors.data(), sendCounts.data(), displacements.data(), localColors.data(), localNodeCounts, 0, m_comm ); @@ -93,13 +93,13 @@ size_t RLFGraphColoringMPI::getNumberOfColors( const int color ) const return GraphColoringBase::getNumberOfColors( color, m_comm ); } -size_t RLFGraphColoringMPI::getNumberOfColors( const std::vector< int > & colors ) const +size_t RLFGraphColoringMPI::getNumberOfColors( const stdVector< int > & colors ) const { return GraphColoringBase::getNumberOfColors( colors, m_comm ); } -bool RLFGraphColoringMPI::isColoringValid( const std::vector< camp::idx_t > & adjncy, const int color ) const +bool RLFGraphColoringMPI::isColoringValid( const stdVector< camp::idx_t > & adjncy, const int color ) const { return GraphColoringBase::isColoringValid( adjncy, color, m_comm ); } diff --git a/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.hpp b/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.hpp index 93990c8e586..9c3aa934376 100644 --- a/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.hpp +++ b/src/coreComponents/mesh/graphs/RLFGraphColoringMPI.hpp @@ -60,7 +60,7 @@ class RLFGraphColoringMPI : public GraphColoringBase * @param colors Vector of color assignments. * @return Number of unique colors. */ - size_t getNumberOfColors( const std::vector< int > & colors ) const; + size_t getNumberOfColors( const stdVector< int > & colors ) const; /** * @brief Returns the number of distinct colors used, assuming one node per rank. @@ -75,7 +75,7 @@ class RLFGraphColoringMPI : public GraphColoringBase * @param localColor Color assigned to the local node. * @return True if the coloring is valid, false otherwise. */ - bool isColoringValid( const std::vector< camp::idx_t > & localAdjncy, const int localColor ) const; + bool isColoringValid( const stdVector< camp::idx_t > & localAdjncy, const int localColor ) const; /** * @brief Colors a distributed graph. @@ -83,14 +83,14 @@ class RLFGraphColoringMPI : public GraphColoringBase * @param localAdjncy Local adjacency list. * @return A vector of assigned colors. */ - std::vector< int > colorGraph( const std::vector< camp::idx_t > & localXadj, const std::vector< camp::idx_t > & localAdjncy ) override; + stdVector< int > colorGraph( const stdVector< camp::idx_t > & localXadj, const stdVector< camp::idx_t > & localAdjncy ) override; /** * @brief Simplified coloring assuming one node per rank. * @param localAdjncy Local adjacency list. * @return Color of the node. */ - int colorGraph( const std::vector< camp::idx_t > & localAdjncy ) override; + int colorGraph( const stdVector< camp::idx_t > & localAdjncy ) override; }; } // namespace graph diff --git a/src/coreComponents/mesh/graphs/ZoltanGraphColoring.cpp b/src/coreComponents/mesh/graphs/ZoltanGraphColoring.cpp index 03fa9d0f5e5..903bb99086b 100644 --- a/src/coreComponents/mesh/graphs/ZoltanGraphColoring.cpp +++ b/src/coreComponents/mesh/graphs/ZoltanGraphColoring.cpp @@ -58,16 +58,16 @@ ZoltanGraphColoring::~ZoltanGraphColoring() } -int ZoltanGraphColoring::colorGraph( const std::vector< camp::idx_t > & localAdjncy ) +int ZoltanGraphColoring::colorGraph( const stdVector< camp::idx_t > & localAdjncy ) { - std::vector< camp::idx_t > localXadj = createXadjFromAdjncy( localAdjncy, m_comm ); - std::vector< int > colors = colorGraph( localXadj, localAdjncy ); + stdVector< camp::idx_t > localXadj = createXadjFromAdjncy( localAdjncy, m_comm ); + stdVector< int > colors = colorGraph( localXadj, localAdjncy ); return colors[0]; } -std::vector< int > ZoltanGraphColoring::colorGraph( const std::vector< camp::idx_t > & xadj, - const std::vector< camp::idx_t > & adjncy ) +stdVector< int > ZoltanGraphColoring::colorGraph( const stdVector< camp::idx_t > & xadj, + const stdVector< camp::idx_t > & adjncy ) { int const rank = MpiWrapper::commRank( m_comm ); @@ -77,7 +77,7 @@ std::vector< int > ZoltanGraphColoring::colorGraph( const std::vector< camp::idx graph.m_numVertices = xadj.size() - 1; graph.m_rank = rank; - std::vector< int > vertexGID = createVertexGlobalID( xadj, m_comm ); + stdVector< int > vertexGID = createVertexGlobalID( xadj, m_comm ); graph.m_vertexGID.resize( graph.m_numVertices ); for( int i = 0; i < graph.m_numVertices; i++ ) { @@ -103,7 +103,7 @@ std::vector< int > ZoltanGraphColoring::colorGraph( const std::vector< camp::idx std::fill( color, color + graph.m_numVertices, -1 ); GEOS_ZOLTAN_CHECK( m_zz->Color( numGidEntries, numReqObjs, reqObjs, color )); - std::vector< int > coloringVector; + stdVector< int > coloringVector; coloringVector.assign( color, color + graph.m_numVertices ); // Make numbering starts at 0, and not 1. @@ -198,13 +198,13 @@ size_t ZoltanGraphColoring::getNumberOfColors( const int color ) const return GraphColoringBase::getNumberOfColors( color, m_comm ); } -size_t ZoltanGraphColoring::getNumberOfColors( const std::vector< int > & colors ) const +size_t ZoltanGraphColoring::getNumberOfColors( const stdVector< int > & colors ) const { return GraphColoringBase::getNumberOfColors( colors, m_comm ); } -bool ZoltanGraphColoring::isColoringValid( const std::vector< camp::idx_t > & adjncy, const int color ) const +bool ZoltanGraphColoring::isColoringValid( const stdVector< camp::idx_t > & adjncy, const int color ) const { return GraphColoringBase::isColoringValid( adjncy, color, m_comm ); } diff --git a/src/coreComponents/mesh/graphs/ZoltanGraphColoring.hpp b/src/coreComponents/mesh/graphs/ZoltanGraphColoring.hpp index 219934b6471..7d73a15f042 100644 --- a/src/coreComponents/mesh/graphs/ZoltanGraphColoring.hpp +++ b/src/coreComponents/mesh/graphs/ZoltanGraphColoring.hpp @@ -61,7 +61,7 @@ class ZoltanGraphColoring : public GraphColoringBase * @param colors Vector of color assignments. * @return Number of unique colors. */ - size_t getNumberOfColors( const std::vector< int > & colors ) const; + size_t getNumberOfColors( const stdVector< int > & colors ) const; /** * @brief Returns the number of colors assuming one node per rank. @@ -76,7 +76,7 @@ class ZoltanGraphColoring : public GraphColoringBase * @param color Color of the node. * @return True if the coloring is valid, false otherwise. */ - bool isColoringValid( const std::vector< camp::idx_t > & adjncy, const int color ) const; + bool isColoringValid( const stdVector< camp::idx_t > & adjncy, const int color ) const; /** * @brief Colors a graph. @@ -84,14 +84,14 @@ class ZoltanGraphColoring : public GraphColoringBase * @param adjncy Adjacency list. * @return A vector of assigned colors. */ - std::vector< int > colorGraph( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ) override; + stdVector< int > colorGraph( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ) override; /** * @brief Simplified coloring assuming one node per rank. * @param adjncy Local adjacency list. * @return Number of colors used. */ - int colorGraph( const std::vector< camp::idx_t > & adjncy ) override; + int colorGraph( const stdVector< camp::idx_t > & adjncy ) override; private: @@ -100,9 +100,9 @@ class ZoltanGraphColoring : public GraphColoringBase struct ZoltanGraph { int m_numVertices; - std::vector< int > m_vertexGID; - std::vector< int > m_xadj; - std::vector< int > m_adjncy; + stdVector< int > m_vertexGID; + stdVector< int > m_xadj; + stdVector< int > m_adjncy; int m_rank; }; diff --git a/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp b/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp index 5beecb1842c..86734c67f57 100644 --- a/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp +++ b/src/coreComponents/mesh/mpiCommunications/SpatialPartition.cpp @@ -118,7 +118,7 @@ int SpatialPartition::getColor() else { // External partitioner such as ParMetis or PTScotch (for VTK external mesh) - std::vector< camp::idx_t > adjncy; + stdVector< camp::idx_t > adjncy; adjncy.reserve( m_metisNeighborList.size()); std::copy( m_metisNeighborList.begin(), m_metisNeighborList.end(), std::back_inserter( adjncy )); #ifdef GEOS_USE_TRILINOS diff --git a/src/coreComponents/mesh/unitTests/testGraphColoring.cpp b/src/coreComponents/mesh/unitTests/testGraphColoring.cpp index db16eb574b0..6f0e60787e6 100644 --- a/src/coreComponents/mesh/unitTests/testGraphColoring.cpp +++ b/src/coreComponents/mesh/unitTests/testGraphColoring.cpp @@ -27,7 +27,7 @@ using namespace geos; using namespace graph; TEST( GraphColoringTest, CountPositiveDistinctColors ) { - std::vector< int > colors = {1, -1, 3, 2, 1, 4, 5, 3, -1, 0}; + stdVector< int > colors = {1, -1, 3, 2, 1, 4, 5, 3, -1, 0}; EXPECT_EQ( GraphColoringBase::getNumberOfColors( colors ), 6 ); } @@ -37,7 +37,7 @@ TEST( GraphColoringTest, CartesianDecomposition3D6 ) idx_t const nx = 3, ny = 4, nz = 3; auto [xadj, adjncy] = generateGraphCartPartitionning3D6( nx, ny, nz ); geos::graph::RLFGraphColoring graphColoring; - std::vector< int > colors = graphColoring.colorGraph( xadj, adjncy ); + stdVector< int > colors = graphColoring.colorGraph( xadj, adjncy ); EXPECT_TRUE( graphColoring.isColoringValid( xadj, adjncy, colors )); EXPECT_EQ( graphColoring.getNumberOfColors( colors ), 2 ); @@ -49,7 +49,7 @@ TEST( GraphColoringTest, CartesianDecomposition3D26 ) idx_t const nx = 3, ny = 4, nz = 3; auto [xadj, adjncy] = generateGraphCartPartitionning3D26( nx, ny, nz ); geos::graph::RLFGraphColoring graphColoring; - std::vector< int > colors = graphColoring.colorGraph( xadj, adjncy ); + stdVector< int > colors = graphColoring.colorGraph( xadj, adjncy ); EXPECT_TRUE( graphColoring.isColoringValid( xadj, adjncy, colors )); EXPECT_EQ( graphColoring.getNumberOfColors( colors ), 8 ); } @@ -64,7 +64,7 @@ TEST( GraphColoringTest, RandomGraphs ) size_t num_edges = rand() % (num_nodes * 6 + 1) + num_nodes; // between num_nodes and num_nodes * 6 auto [xadj, adjncy] = generateGraphRandom( num_nodes, num_edges ); geos::graph::RLFGraphColoring graphColoring; - std::vector< int > colors = graphColoring.colorGraph( xadj, adjncy ); + stdVector< int > colors = graphColoring.colorGraph( xadj, adjncy ); EXPECT_TRUE( graphColoring.isColoringValid( xadj, adjncy, colors )); } } @@ -73,11 +73,11 @@ TEST( GraphColoringTest, RandomGraphs ) TEST( GraphColoringTest, InvalidColoring ) { // Create a simple graph with 4 nodes and 3 edges - std::vector< idx_t > xadj = {0, 1, 2, 3, 3}; - std::vector< idx_t > adjncy = {1, 0, 2, 1}; + stdVector< idx_t > xadj = {0, 1, 2, 3, 3}; + stdVector< idx_t > adjncy = {1, 0, 2, 1}; // Intentionally create an invalid coloring where two adjacent nodes have the same color - std::vector< int > colors = {0, 0, 1, 1}; + stdVector< int > colors = {0, 0, 1, 1}; // Check if the coloring is valid (should fail) EXPECT_FALSE( GraphColoringBase::isColoringValid( xadj, adjncy, colors )); diff --git a/src/coreComponents/mesh/unitTests/testGraphColoringMPI.cpp b/src/coreComponents/mesh/unitTests/testGraphColoringMPI.cpp index 65bdaf0aa77..9b28880b841 100644 --- a/src/coreComponents/mesh/unitTests/testGraphColoringMPI.cpp +++ b/src/coreComponents/mesh/unitTests/testGraphColoringMPI.cpp @@ -47,7 +47,7 @@ class GraphColoringTest : public ::testing::Test }; -void runColoringTest( GraphColoringBase & graphColoring, const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy, int expectedNumberOfColors ) +void runColoringTest( GraphColoringBase & graphColoring, const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy, int expectedNumberOfColors ) { auto [localXadj, localAdjncy] = scatterGraphData( xadj, adjncy, MPI_COMM_GEOS ); int color = graphColoring.colorGraph( localAdjncy ); @@ -67,8 +67,8 @@ TEST_F( GraphColoringTest, CartesianDecomposition3D6 ) #endif RLFGraphColoringMPI rlfColoringMPI; - std::vector< camp::idx_t > xadj; - std::vector< camp::idx_t > adjncy; + stdVector< camp::idx_t > xadj; + stdVector< camp::idx_t > adjncy; if( rank == 0 ) { @@ -90,8 +90,8 @@ TEST_F( GraphColoringTest, CartesianDecomposition3D26 ) #endif RLFGraphColoringMPI rlfColoringMPI; - std::vector< camp::idx_t > xadj; - std::vector< camp::idx_t > adjncy; + stdVector< camp::idx_t > xadj; + stdVector< camp::idx_t > adjncy; if( rank == 0 ) { @@ -116,8 +116,8 @@ TEST_F( GraphColoringTest, RandomGraphs ) size_t const iterations = 10; for( size_t i = 0; i < iterations; ++i ) { - std::vector< camp::idx_t > xadj; - std::vector< camp::idx_t > adjncy; + stdVector< camp::idx_t > xadj; + stdVector< camp::idx_t > adjncy; if( rank == 0 ) { @@ -136,7 +136,7 @@ TEST_F( GraphColoringTest, RandomGraphs ) TEST_F( GraphColoringTest, CountPositiveDistinctColors ) { - std::vector< int > colors = {1, -1, 3, 2, 1, 4, 5, 3}; + stdVector< int > colors = {1, -1, 3, 2, 1, 4, 5, 3}; EXPECT_EQ( GraphColoringBase::getNumberOfColors( colors, MPI_COMM_GEOS ), 6 ); } diff --git a/src/coreComponents/schema/schema.xsd b/src/coreComponents/schema/schema.xsd index e29fdc5fd0b..8c982f16f26 100644 --- a/src/coreComponents/schema/schema.xsd +++ b/src/coreComponents/schema/schema.xsd @@ -463,6 +463,10 @@ + + + + @@ -491,6 +495,10 @@ + + + + @@ -569,6 +577,10 @@ + + + + @@ -581,6 +593,10 @@ + + + + @@ -2721,6 +2737,7 @@ Information output from lower logLevels is added with the desired log level + @@ -2728,6 +2745,7 @@ Information output from lower logLevels is added with the desired log level + @@ -5009,6 +5027,60 @@ Local- Add jump stabilization on interior of macro elements--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5349,6 +5421,60 @@ Local- Add jump stabilization on interior of macro elements--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5893,9 +6019,11 @@ When set to `all` output both convergence & iteration information to a csv.--> + + @@ -6089,6 +6217,19 @@ Information output from lower logLevels is added with the desired log level + + + + + + + + + + + + + + + + + + + + diff --git a/src/coreComponents/schema/schema.xsd.other b/src/coreComponents/schema/schema.xsd.other index 33a2ec00f2c..a75edea2ea6 100644 --- a/src/coreComponents/schema/schema.xsd.other +++ b/src/coreComponents/schema/schema.xsd.other @@ -585,6 +585,7 @@ + @@ -592,6 +593,7 @@ + @@ -1199,6 +1201,17 @@ + + + + + + + + + + + @@ -1274,6 +1287,17 @@ + + + + + + + + + + + @@ -1442,9 +1466,11 @@ + + @@ -1474,9 +1500,11 @@ + + @@ -3549,6 +3577,12 @@ + + + + + + @@ -3563,14 +3597,26 @@ + + + + + + + + + + + + From 5f6c1ad217bfe7cef8d748d63819e3320c7cf6ff Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 17:12:07 +0100 Subject: [PATCH 49/63] revert on stdContainerWrapper --- src/coreComponents/common/StdContainerWrappers.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/coreComponents/common/StdContainerWrappers.hpp b/src/coreComponents/common/StdContainerWrappers.hpp index a7e3b91d679..afb7506daab 100644 --- a/src/coreComponents/common/StdContainerWrappers.hpp +++ b/src/coreComponents/common/StdContainerWrappers.hpp @@ -46,7 +46,7 @@ namespace internal /** - * Default allocator type for stdVector. + * Default allocator type for std::vector. * This can be specialized if a different allocator is needed. * Required to avoid recursive evaluation in StdVectorWrapper. * @tparam T Type of elements in the vector. @@ -55,7 +55,7 @@ template< typename T > using DefaultAllocator = std::allocator< T >; /** - * Wrapper for stdVector that allows toggling between bounds-checked access + * Wrapper for std::vector that allows toggling between bounds-checked access * (using at()) and unchecked access (using operator[]). * @tparam T Type of elements in the vector. * @tparam Allocator Allocator type for the vector. @@ -65,11 +65,11 @@ using DefaultAllocator = std::allocator< T >; template< typename T, typename Allocator = DefaultAllocator< T >, bool USE_BOUNDS_CHECKING = false > -class StdVectorWrapper : public stdVector< T, Allocator > +class StdVectorWrapper : public std::vector< T, Allocator > { public: - /// Type alias for the base class (i.e., stdVector) - using Base = stdVector< T, Allocator >; + /// Type alias for the base class (i.e., std::vector) + using Base = std::vector< T, Allocator >; /// We have to declare explicitly all constructor because `using Base::Base` causes bugs during compilation /// @cond DO_NOT_DOCUMENT @@ -154,7 +154,7 @@ class StdVectorWrapper : public stdVector< T, Allocator > } /** - * type alias for stdVector + * type alias for std::vector * @tparam T Type of elements in the vector. * @tparam Allocator Allocator type for the vector. */ From 35a5aa4d34c2a48aeafbb5d4e503cde6dd78ae31 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 17:15:52 +0100 Subject: [PATCH 50/63] echo file --- scripts/check_code_rules.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 34b1cd2075b..d8533ce7d4f 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -68,6 +68,7 @@ for file in $FILES; do UMAP_VIOLATIONS_FOUND=1 fi if grep -q "std::vector\s*<" "$file" ; then + echo $file STR_VECTOR=" Found forbidden std::vector usage in: $file"$'\n' while IFS= read -r line; do STR_VECTOR+=" $line"$'\n' From 64479d047c9d0c2b7021d012d856370e8080baca Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 17:19:45 +0100 Subject: [PATCH 51/63] another echo --- scripts/check_code_rules.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index d8533ce7d4f..e4967347650 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -68,11 +68,11 @@ for file in $FILES; do UMAP_VIOLATIONS_FOUND=1 fi if grep -q "std::vector\s*<" "$file" ; then - echo $file STR_VECTOR=" Found forbidden std::vector usage in: $file"$'\n' while IFS= read -r line; do STR_VECTOR+=" $line"$'\n' done < <(grep -n "std::vector\s*<" "$file") + echo $STR_VECTOR ARRAY_VECTOR+=("$STR_VECTOR") VECTOR_VIOLATIONS_FOUND=1 fi From be824c62942d9e5b5a2dfe080fc2b303a5955c38 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 17:22:17 +0100 Subject: [PATCH 52/63] add id cond --- scripts/check_code_rules.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index e4967347650..ea9c5cc0eca 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -72,13 +72,12 @@ for file in $FILES; do while IFS= read -r line; do STR_VECTOR+=" $line"$'\n' done < <(grep -n "std::vector\s*<" "$file") - echo $STR_VECTOR ARRAY_VECTOR+=("$STR_VECTOR") VECTOR_VIOLATIONS_FOUND=1 fi done -if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )); then +if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )) || (($VECTOR_VIOLATIONS_FOUND == 1 )); then echo "----------------------------------------" echo "SUMMARY: Code rule violations found" echo "----------------------------------------" From 0845150b83bf5dc5b5c586386534f203723c7e6d Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 17:26:46 +0100 Subject: [PATCH 53/63] stdVector --- .../Outputs/unitTests/testMemoryStats.cpp | 4 +- .../unitTests/testMimeticInnerProducts.cpp | 8 ++-- .../testFieldSpecification.cpp | 6 +-- ...stCompositionalMultiPhaseMFDPolyhedral.cpp | 14 +++--- .../testSinglePhaseMFDPolyhedral.cpp | 10 ++-- .../solverStatisticsTests/testSolverStats.cpp | 10 ++-- .../wellsTests/testOpenClosePerf.cpp | 16 +++---- ...testReservoirThermalSinglePhaseMSWells.cpp | 4 +- ...rvoirThermalSinglePhaseMSWells_RateInj.cpp | 4 +- .../interfaces/hypre/HypreUtils.cpp | 2 +- .../multiscale/MultiscalePreconditioner.hpp | 2 +- .../multiscale/mesh/DofManager.hpp | 2 +- .../multiscale/mesh/MeshLevel.cpp | 20 ++++---- .../multiscale/mesh/MeshLevel.hpp | 12 ++--- .../multiscale/mesh/MeshUtils.hpp | 2 +- .../multiscale/mesh/coarsening/Coarsening.cpp | 4 +- .../multiscale/msrsb/MsrsbLevelBuilder.cpp | 2 +- .../msrsb/MsrsbLevelBuilderCoupled.hpp | 8 ++-- .../multiscale/msrsb/MsrsbUtils.cpp | 10 ++-- .../multiscale/msrsb/MsrsbUtils.hpp | 2 +- .../solvers/BlockPreconditioner.cpp | 2 +- .../solvers/BlockPreconditioner.hpp | 2 +- .../unitTests/testComponentMask.cpp | 16 +++---- src/coreComponents/mesh/DomainPartition.hpp | 4 +- .../mesh/ElementSubRegionBase.hpp | 2 +- .../mesh/WellElementSubRegion.cpp | 4 +- .../mesh/graphs/GraphColoringBase.cpp | 26 +++++----- .../mesh/graphs/GraphColoringBase.hpp | 12 ++--- src/coreComponents/mesh/graphs/GraphTools.cpp | 32 ++++++------- src/coreComponents/mesh/graphs/GraphTools.hpp | 12 ++--- .../mesh/graphs/GraphToolsMPI.cpp | 48 +++++++++---------- .../mesh/graphs/GraphToolsMPI.hpp | 16 +++---- .../mesh/graphs/RLFGraphColoring.cpp | 12 ++--- .../mesh/graphs/RLFGraphColoring.hpp | 10 ++-- 34 files changed, 170 insertions(+), 170 deletions(-) diff --git a/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp b/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp index b07a30431a2..9c7c111d62c 100644 --- a/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp +++ b/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp @@ -170,7 +170,7 @@ TEST( testXML, testMemoryCSVOutput ) memOutput.execute( 0.0, 0.0, dummyCycle, 0, 0.0, problem.getDomainPartition() ); // read the CSV output (parseFile() will throw if no CSV is generated) - std::vector< string > csvLines; + stdVector< string > csvLines; { std::ifstream is( memOutputFileName ); EXPECT_TRUE( is.good() ); @@ -184,7 +184,7 @@ TEST( testXML, testMemoryCSVOutput ) auto const findCSVMemoryEntry = [=]( string_view cycleStr, string_view memSpaceName ) -> bool { for( string const & csvLine : csvLines ) { - std::vector< string > const lineEntries = stringutilities::tokenize( csvLine, + stdVector< string > const lineEntries = stringutilities::tokenize( csvLine, TableCSVFormatter::m_separator, false ); EXPECT_GT( lineEntries.size(), 3 ); diff --git a/src/coreComponents/finiteVolume/mimeticInnerProducts/unitTests/testMimeticInnerProducts.cpp b/src/coreComponents/finiteVolume/mimeticInnerProducts/unitTests/testMimeticInnerProducts.cpp index 49c1df7a4c5..20da0e14b04 100644 --- a/src/coreComponents/finiteVolume/mimeticInnerProducts/unitTests/testMimeticInnerProducts.cpp +++ b/src/coreComponents/finiteVolume/mimeticInnerProducts/unitTests/testMimeticInnerProducts.cpp @@ -1381,7 +1381,7 @@ TEST( MimeticIP_Linear, UnitCube_LinearPressure_BdVLM ) TEST( MimeticIP_Linear, Distortion_Planar_LinearPressure ) { int neps = 3; - std::vector< double > eps_values( 3 ); + stdVector< double > eps_values( 3 ); eps_values[0] = 0.0; // no distortion eps_values[1] = 0.2; // moderate distortion eps_values[2] = 0.9; // severe distortion @@ -1422,7 +1422,7 @@ TEST( MimeticIP_Linear, Distortion_Planar_LinearPressure ) TEST( MimeticIP_Linear, Distortion_NonPlanar_LinearPressure ) { int neps = 2; - std::vector< double > eps_values( 2 ); + stdVector< double > eps_values( 2 ); eps_values[0] = 0.2; // moderate distortion eps_values[1] = 0.9; // severe distortion @@ -1727,7 +1727,7 @@ TEST( Hydrostatic, GravityConsistency_NoDistortion_BdVLM ) TEST( Hydrostatic, GravityConsistency_Distortion_Planar ) { int neps = 2; - std::vector< double > eps_values( 2 ); + stdVector< double > eps_values( 2 ); eps_values[0] = 0.2; // moderate distortion eps_values[1] = 0.9; // severe distortion @@ -1754,7 +1754,7 @@ TEST( Hydrostatic, GravityConsistency_Distortion_Planar ) TEST( Hydrostatic, GravityConsistency_Distortion_NonPlanar ) { int neps = 2; - std::vector< double > eps_values( 2 ); + stdVector< double > eps_values( 2 ); eps_values[0] = 0.2; // moderate distortion eps_values[1] = 0.9; // severe distortion diff --git a/src/coreComponents/integrationTests/fieldSpecificationTests/testFieldSpecification.cpp b/src/coreComponents/integrationTests/fieldSpecificationTests/testFieldSpecification.cpp index 2e576dc3283..6491ef4d0e4 100644 --- a/src/coreComponents/integrationTests/fieldSpecificationTests/testFieldSpecification.cpp +++ b/src/coreComponents/integrationTests/fieldSpecificationTests/testFieldSpecification.cpp @@ -199,10 +199,10 @@ void setupAndPlayWrongBC( string const & xml ) problem.applyInitialConditions(); } -std::vector< string > splitStringByDelimiter( string const & s, string const & delimiter ) +stdVector< string > splitStringByDelimiter( string const & s, string const & delimiter ) { string cpyTokens = s; - std::vector< string > tokens; + stdVector< string > tokens; size_t pos = 0; string token; while((pos = cpyTokens.find( delimiter )) != string::npos ) @@ -279,7 +279,7 @@ TEST( testIncorrectFieldSpecification, testRightFieldNames ) "ghostRank, localToGlobalMap, mass, pressure, rockPorosity_initialPorosity, rockPorosity_porosity, " "rockPorosity_referencePorosity, temperature, water_dDensity, water_dEnthalpy, water_dInternalEnergy, " "water_dViscosity, water_density, water_enthalpy, water_internalEnergy, water_viscosity"; - std::vector< string > const splitToken = splitStringByDelimiter( tokens, "," ); + stdVector< string > const splitToken = splitStringByDelimiter( tokens, "," ); for( auto const & token : splitToken ) { string const xmlTemplate = R"xml( diff --git a/src/coreComponents/integrationTests/fluidFlowTests/testCompositionalMultiPhaseMFDPolyhedral.cpp b/src/coreComponents/integrationTests/fluidFlowTests/testCompositionalMultiPhaseMFDPolyhedral.cpp index 8dfd432d91a..acf299b9871 100644 --- a/src/coreComponents/integrationTests/fluidFlowTests/testCompositionalMultiPhaseMFDPolyhedral.cpp +++ b/src/coreComponents/integrationTests/fluidFlowTests/testCompositionalMultiPhaseMFDPolyhedral.cpp @@ -327,21 +327,21 @@ static std::string generateXmlInputCompMFD( std::string const & innerProductType return oss.str(); } -// Helper: copy arrayView1d to std::vector -static inline std::vector< real64 > arrayViewToVector( arrayView1d< real64 const > & arr ) +// Helper: copy arrayView1d to stdVector +static inline stdVector< real64 > arrayViewToVector( arrayView1d< real64 const > & arr ) { arr.move( hostMemorySpace, false ); - return std::vector< real64 >( arr.data(), arr.data() + arr.size() ); + return stdVector< real64 >( arr.data(), arr.data() + arr.size() ); } // Helper: copy a 2D view to flat vector (row-major by phase index), accepts any 2D view type template< typename View2D > -static inline std::vector< real64 > arrayView2dToVector( View2D & arr ) +static inline stdVector< real64 > arrayView2dToVector( View2D & arr ) { arr.move( hostMemorySpace, false ); localIndex nCells = arr.size( 0 ); localIndex nCols = arr.size( 1 ); - std::vector< real64 > out; + stdVector< real64 > out; out.reserve( static_cast< size_t >( nCells ) * static_cast< size_t >( nCols ) ); for( localIndex i = 0; i < nCells; ++i ) { @@ -535,8 +535,8 @@ TEST_P( CompositionalTPFAvsMFDTPFA, PressureAndSaturationComparison ) std::string const testBinaryDir = TEST_BINARY_DIR; std::string const meshFile = testBinaryDir + std::string( "/" ) + GetParam(); - std::vector< real64 > p_tpfa, p_mfd; - std::vector< real64 > sat_tpfa, sat_mfd; // phase volume fractions flattened [cell,phase] + stdVector< real64 > p_tpfa, p_mfd; + stdVector< real64 > sat_tpfa, sat_mfd; // phase volume fractions flattened [cell,phase] localIndex n_cells_tpfa = 0, n_cells_mfd = 0; localIndex n_phases_tpfa = 2, n_phases_mfd = 2; // From XML phaseNames diff --git a/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseMFDPolyhedral.cpp b/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseMFDPolyhedral.cpp index 58c8c167f66..77915637bb8 100644 --- a/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseMFDPolyhedral.cpp +++ b/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseMFDPolyhedral.cpp @@ -433,11 +433,11 @@ class TPFAvsMFDTPFATest : public ::testing::TestWithParam< const char * > TPFAvsMFDTPFATest() = default; }; -// Helper function to copy arrayView1d to std::vector -static inline std::vector< real64 > arrayViewToVector( arrayView1d< real64 const > & arr, localIndex n ) +// Helper function to copy arrayView1d to stdVector +static inline stdVector< real64 > arrayViewToVector( arrayView1d< real64 const > & arr, localIndex n ) { arr.move( hostMemorySpace, false ); - return std::vector< real64 >( arr.data(), arr.data() + n ); + return stdVector< real64 >( arr.data(), arr.data() + n ); } @@ -458,8 +458,8 @@ TEST_P( TPFAvsMFDTPFATest, PressureFieldComparison ) // Use the CMAKE-defined TEST_BINARY_DIR variable std::string testBinaryDir = TEST_BINARY_DIR; - std::vector< real64 > p_tpfa; - std::vector< real64 > p_mfd; + stdVector< real64 > p_tpfa; + stdVector< real64 > p_mfd; localIndex n_data_tpfa = 0; localIndex n_data_mfd = 0; diff --git a/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp b/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp index 54415a077a5..f5373c21c07 100644 --- a/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp +++ b/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp @@ -54,8 +54,8 @@ class ConvergenceTest : public ConvergenceStatistics public: - void AssertConvergenceValuesEquals( std::vector< std::string > const & actualValues, - std::vector< std::string > const & expectedValues ) + void AssertConvergenceValuesEquals( stdVector< std::string > const & actualValues, + stdVector< std::string > const & expectedValues ) { EXPECT_EQ( actualValues[0], expectedValues[0] ); EXPECT_EQ( actualValues[1], expectedValues[1] ); @@ -238,7 +238,7 @@ TEST( testSolverStats, testOutputFiles ) ConvergenceTest & convergenceStat = static_cast< ConvergenceTest & >(solver.getConvergenceStats()); IterationTest & iterationStat = static_cast< IterationTest & >(solver.getIterationStats()); - auto loadCsvLines = []( string const & filename, std::vector< string > & lines ) { + auto loadCsvLines = []( string const & filename, stdVector< string > & lines ) { if( !std::filesystem::exists( filename )) { @@ -293,7 +293,7 @@ TEST( testSolverStats, testOutputFiles ) return true; }; - std::vector< string > csvLines; + stdVector< string > csvLines; loadCsvLines( iterationStat.getFilename(), csvLines ); EXPECT_EQ( csvLines[0], @@ -304,7 +304,7 @@ TEST( testSolverStats, testOutputFiles ) iterationStat.AssertIterationValuesEquals(); - std::vector< string > csvLines2; + stdVector< string > csvLines2; loadCsvLines( convergenceStat.getFilename(), csvLines2 ); EXPECT_EQ( csvLines2[0], "Cycle number,time_n (s),dt (s),iteration,R,Rflow" ); diff --git a/src/coreComponents/integrationTests/wellsTests/testOpenClosePerf.cpp b/src/coreComponents/integrationTests/wellsTests/testOpenClosePerf.cpp index c45c9a21e68..ea018e2284d 100644 --- a/src/coreComponents/integrationTests/wellsTests/testOpenClosePerf.cpp +++ b/src/coreComponents/integrationTests/wellsTests/testOpenClosePerf.cpp @@ -177,7 +177,7 @@ void testPlugTopDownPerfCheck( CompositionalMultiphaseReservoirAndWells<> & solv { CompositionalMultiphaseWell & wellSolver = *solver.wellSolver(); - typedef stdMap< real64, std::vector< int > > map_type; + typedef stdMap< real64, stdVector< int > > map_type; map_type refVal; refVal.insert( {29800.0, { 1, 1, 1, 1, 1}} ); refVal.insert( {32400.0, { 1, 1, 1, 1, 0}} ); @@ -189,7 +189,7 @@ void testPlugTopDownPerfCheck( CompositionalMultiphaseReservoirAndWells<> & solv { perfFunction( it->first ); - const std::vector< int > & refStatus = it->second; + const stdVector< int > & refStatus = it->second; wellSolver.forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) @@ -219,7 +219,7 @@ void testPlugBottomUpPerfCheck( CompositionalMultiphaseReservoirAndWells<> & sol { CompositionalMultiphaseWell & wellSolver = *solver.wellSolver(); - typedef stdMap< real64, std::vector< int > > map_type; + typedef stdMap< real64, stdVector< int > > map_type; map_type refVal; refVal.insert( {4800.0, { 1, 1, 1, 1, 1}} ); refVal.insert( {14800.0, { 1, 1, 1, 1, 0}} ); @@ -232,7 +232,7 @@ void testPlugBottomUpPerfCheck( CompositionalMultiphaseReservoirAndWells<> & sol { perfFunction( it->first ); - const std::vector< int > & refStatus = it->second; + const stdVector< int > & refStatus = it->second; wellSolver.forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) @@ -262,7 +262,7 @@ void testOpenTopDownPerfCheck( CompositionalMultiphaseReservoirAndWells<> & solv { CompositionalMultiphaseWell & wellSolver = *solver.wellSolver(); - typedef stdMap< real64, std::vector< int > > map_type; + typedef stdMap< real64, stdVector< int > > map_type; map_type refPerfTable; refPerfTable.insert( {4800.0, { 0, 0, 0, 0, 0}} ); refPerfTable.insert( {14800.0, { 1, 0, 0, 0, 0}} ); @@ -274,7 +274,7 @@ void testOpenTopDownPerfCheck( CompositionalMultiphaseReservoirAndWells<> & solv { perfFunction( it->first ); - const std::vector< int > & refStatus = it->second; + const stdVector< int > & refStatus = it->second; wellSolver.forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) @@ -304,7 +304,7 @@ void testOpenBottomUpPerfCheck( CompositionalMultiphaseReservoirAndWells<> & sol { CompositionalMultiphaseWell & wellSolver = *solver.wellSolver(); - typedef stdMap< real64, std::vector< int > > map_type; + typedef stdMap< real64, stdVector< int > > map_type; map_type refVal; refVal.insert( {4800.0, { 0, 0, 0, 0, 0}} ); refVal.insert( {33000.0, { 1, 1, 1, 1, 1}} ); @@ -314,7 +314,7 @@ void testOpenBottomUpPerfCheck( CompositionalMultiphaseReservoirAndWells<> & sol { perfFunction( it->first ); - const std::vector< int > & refStatus = it->second; + const stdVector< int > & refStatus = it->second; wellSolver.forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) diff --git a/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells.cpp b/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells.cpp index d10f1da56f6..049313c9c01 100644 --- a/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells.cpp +++ b/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells.cpp @@ -175,8 +175,8 @@ void printCompareLocalMatrices( CRSMatrixView< T const, COL_INDEX const > const std::ofstream omat1( testName+".csv" ); - std::vector< std::vector< double > > fmat1( matrix1.numRows(), std::vector< double >( matrix1.numRows(), 0.0 )); - std::vector< std::vector< double > > fmat2( matrix2.numRows(), std::vector< double >( matrix2.numRows(), 0.0 )); + stdVector< stdVector< double > > fmat1( matrix1.numRows(), stdVector< double >( matrix1.numRows(), 0.0 )); + stdVector< stdVector< double > > fmat2( matrix2.numRows(), stdVector< double >( matrix2.numRows(), 0.0 )); for( localIndex i = 0; i < matrix1.numRows(); ++i ) { diff --git a/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells_RateInj.cpp b/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells_RateInj.cpp index 255b0201692..5c34a364eba 100644 --- a/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells_RateInj.cpp +++ b/src/coreComponents/integrationTests/wellsTests/testReservoirThermalSinglePhaseMSWells_RateInj.cpp @@ -257,8 +257,8 @@ void printCompareLocalMatrices( CRSMatrixView< T const, COL_INDEX const > const std::ofstream omat1( testName+".csv" ); - std::vector< std::vector< double > > fmat1( matrix1.numRows(), std::vector< double >( matrix1.numRows(), 0.0 )); - std::vector< std::vector< double > > fmat2( matrix2.numRows(), std::vector< double >( matrix2.numRows(), 0.0 )); + stdVector< stdVector< double > > fmat1( matrix1.numRows(), stdVector< double >( matrix1.numRows(), 0.0 )); + stdVector< stdVector< double > > fmat2( matrix2.numRows(), stdVector< double >( matrix2.numRows(), 0.0 )); for( localIndex i = 0; i < matrix1.numRows(); ++i ) { diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/HypreUtils.cpp b/src/coreComponents/linearAlgebra/interfaces/hypre/HypreUtils.cpp index f2dba640c9c..5d4a64195b7 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/HypreUtils.cpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/HypreUtils.cpp @@ -82,7 +82,7 @@ HYPRE_Vector parVectorToVector( HYPRE_ParVector const vec, int const targetRank newVec = hypre_SeqVectorCreate( globalSize ); hypre_SeqVectorInitialize_v2( newVec, HYPRE_MEMORY_HOST ); - std::vector< MPI_Request > requests( numProcs, MPI_REQUEST_NULL ); + stdVector< MPI_Request > requests( numProcs, MPI_REQUEST_NULL ); for( int i = 0; i < numProcs; ++i ) { HYPRE_Real * const data = hypre_VectorData( newVec ) + offsets[i]; diff --git a/src/coreComponents/linearAlgebra/multiscale/MultiscalePreconditioner.hpp b/src/coreComponents/linearAlgebra/multiscale/MultiscalePreconditioner.hpp index c4758aeb7e2..f462331b6c3 100644 --- a/src/coreComponents/linearAlgebra/multiscale/MultiscalePreconditioner.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/MultiscalePreconditioner.hpp @@ -100,7 +100,7 @@ class MultiscalePreconditioner : public PreconditionerBase< LAI > DomainPartition & m_domain; - std::vector< LevelData > m_levels; + stdVector< LevelData > m_levels; std::unique_ptr< PreconditionerBase< LAI > > m_coarse_solver; diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/DofManager.hpp b/src/coreComponents/linearAlgebra/multiscale/mesh/DofManager.hpp index c27b6be3857..10f97b23fd1 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/DofManager.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/DofManager.hpp @@ -235,7 +235,7 @@ class DofManager DomainPartition * m_domain = nullptr; /// Array of field descriptions - std::vector< FieldDescription > m_fields; + stdVector< FieldDescription > m_fields; /// Flag indicating that DOFs have been reordered rank-wise. bool m_reordered = false; diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.cpp b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.cpp index 0d8bf0cdf29..b45e08c7e52 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.cpp @@ -123,7 +123,7 @@ void populateNodeManager( string const & localIndexKey, numLocalNodes ); // Setup neighbor data - std::vector< int > const neighborRanks = domain.getNeighborRanks(); + stdVector< int > const neighborRanks = domain.getNeighborRanks(); for( int const rank : neighborRanks ) { msNodeManager.addNeighbor( rank ); @@ -255,7 +255,7 @@ void populateCellManager( string const & localIndexKey, numLocalCells ); // Setup neighbor data - std::vector< int > const neighborRanks = domain.getNeighborRanks(); + stdVector< int > const neighborRanks = domain.getNeighborRanks(); for( int const rank : neighborRanks ) { msCellManager.addNeighbor( rank ); @@ -424,7 +424,7 @@ void MeshLevel::buildCoarseMesh( multiscale::MeshLevel & fineMesh, coarsening::buildCoarseMesh( fineMesh, *this, coarse_params, boundaryNodeSets ); } -void MeshLevel::writeCellData( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeCellData( stdVector< string > const & fieldNames, int depth ) const { if( m_fineMesh ) { @@ -436,7 +436,7 @@ void MeshLevel::writeCellData( std::vector< string > const & fieldNames, int dep } } -void MeshLevel::writeNodeData( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeNodeData( stdVector< string > const & fieldNames, int depth ) const { if( m_fineMesh ) { @@ -448,7 +448,7 @@ void MeshLevel::writeNodeData( std::vector< string > const & fieldNames, int dep } } -void MeshLevel::writeCellDataFine( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeCellDataFine( stdVector< string > const & fieldNames, int depth ) const { geos::MeshLevel & sourceMesh = m_domain->getMeshBody( m_support.meshBodyName ).getMeshLevel( m_support.meshLevelName ); arrayView1d< localIndex const > const origRegion = m_cellManager.getField< fields::multiscale::OrigElementRegion >(); @@ -492,13 +492,13 @@ void MeshLevel::writeCellDataFine( std::vector< string > const & fieldNames, int } } -void MeshLevel::writeCellDataCoarse( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeCellDataCoarse( stdVector< string > const & fieldNames, int depth ) const { GEOS_ASSERT( m_fineMesh != nullptr ); arrayView1d< localIndex const > const coarseCellIndex = m_fineMesh->cellManager().getField< fields::multiscale::CoarseCellLocalIndex >(); - std::vector< string > fineFieldNames; + stdVector< string > fineFieldNames; for( string const & fieldName : fieldNames ) { WrapperBase const & wrapper = m_cellManager.getWrapperBase( fieldName ); @@ -534,7 +534,7 @@ void MeshLevel::writeCellDataCoarse( std::vector< string > const & fieldNames, i m_fineMesh->writeCellData( fineFieldNames, depth + 1 ); } -void MeshLevel::writeNodeDataFine( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeNodeDataFine( stdVector< string > const & fieldNames, int depth ) const { geos::MeshLevel & sourceMesh = m_domain->getMeshBody( m_support.meshBodyName ).getMeshLevel( m_support.meshLevelName ); arrayView1d< localIndex const > const origNodeIndex = m_nodeManager.getField< fields::multiscale::OrigNodeIndex >(); @@ -570,12 +570,12 @@ void MeshLevel::writeNodeDataFine( std::vector< string > const & fieldNames, int } } -void MeshLevel::writeNodeDataCoarse( std::vector< string > const & fieldNames, int depth ) const +void MeshLevel::writeNodeDataCoarse( stdVector< string > const & fieldNames, int depth ) const { GEOS_ASSERT( m_fineMesh != nullptr ); arrayView1d< localIndex const > const fineNodeIndex = m_nodeManager.getField< fields::multiscale::FineNodeLocalIndex >(); - std::vector< string > fineFieldNames; + stdVector< string > fineFieldNames; for( string const & fieldName : fieldNames ) { WrapperBase const & wrapper = m_nodeManager.getWrapperBase( fieldName ); diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.hpp b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.hpp index 69843f3170e..db96de9ecd3 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshLevel.hpp @@ -96,14 +96,14 @@ class MeshLevel * @param fieldNames the list of field names to write * @param depth counter used to track recursion depth (leave default value of 0) */ - void writeCellData( std::vector< string > const & fieldNames, int depth = 0 ) const; + void writeCellData( stdVector< string > const & fieldNames, int depth = 0 ) const; /** * @brief Push node data to finer levels * @param fieldNames the list of field names to write * @param depth counter used to track recursion depth (leave default value of 0) */ - void writeNodeData( std::vector< string > const & fieldNames, int depth = 0 ) const; + void writeNodeData( stdVector< string > const & fieldNames, int depth = 0 ) const; /** * @brief @return the level name @@ -122,10 +122,10 @@ class MeshLevel private: - void writeCellDataFine( std::vector< string > const & fieldNames, int depth ) const; - void writeCellDataCoarse( std::vector< string > const & fieldNames, int depth ) const; - void writeNodeDataFine( std::vector< string > const & fieldNames, int depth ) const; - void writeNodeDataCoarse( std::vector< string > const & fieldNames, int depth ) const; + void writeCellDataFine( stdVector< string > const & fieldNames, int depth ) const; + void writeCellDataCoarse( stdVector< string > const & fieldNames, int depth ) const; + void writeNodeDataFine( stdVector< string > const & fieldNames, int depth ) const; + void writeNodeDataCoarse( stdVector< string > const & fieldNames, int depth ) const; string m_name; ///< Unique name prefix diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshUtils.hpp b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshUtils.hpp index 24a02ccffd7..38f820f756b 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/MeshUtils.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/MeshUtils.hpp @@ -247,7 +247,7 @@ void fillArrayBySrcIndex( arrayView1d< INDEX const > const & map, template< typename FUNC > void copyNeighborData( ObjectManagerBase const & srcManager, string const & mapKey, - std::vector< integer > const & ranks, + stdVector< integer > const & ranks, ObjectManagerBase & dstManager, FUNC && copyFunc ) { diff --git a/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/Coarsening.cpp b/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/Coarsening.cpp index 5571fd2b719..4a325636475 100644 --- a/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/Coarsening.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/mesh/coarsening/Coarsening.cpp @@ -234,7 +234,7 @@ void buildCoarseCells( multiscale::MeshLevel & fineMesh, fillBasicCellData( fineCellManager, coarseCellManager ); // Populate neighbor data and sets - std::vector< int > neighborRanks = fineMesh.domain()->getNeighborRanks(); + stdVector< int > neighborRanks = fineMesh.domain()->getNeighborRanks(); for( int const rank : neighborRanks ) { coarseCellManager.addNeighbor( rank ); @@ -375,7 +375,7 @@ void buildCoarseNodes( multiscale::MeshLevel & fineMesh, fillBasicNodeData( fineNodeManager, coarseNodeManager ); // Populate neighbor data and sets - std::vector< int > neighborRanks = fineMesh.domain()->getNeighborRanks(); + stdVector< int > neighborRanks = fineMesh.domain()->getNeighborRanks(); for( int const rank : neighborRanks ) { coarseNodeManager.addNeighbor( rank ); diff --git a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilder.cpp b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilder.cpp index a8b4ddd1d4e..97740161d51 100644 --- a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilder.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilder.cpp @@ -578,7 +578,7 @@ void MsrsbLevelBuilder< LAI >::writeProlongationForDebug() const MeshObjectManager & manager = m_location == FieldLocation::Node ? m_mesh.fineMesh()->nodeManager() : m_mesh.fineMesh()->cellManager(); - auto const writeFunc = [location = m_location]( multiscale::MeshLevel & mesh, std::vector< string > const & names ) + auto const writeFunc = [location = m_location]( multiscale::MeshLevel & mesh, stdVector< string > const & names ) { return location == FieldLocation::Node ? mesh.writeNodeData( names ) diff --git a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.hpp b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.hpp index 7f58df98b1c..e9d33362cd1 100644 --- a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbLevelBuilderCoupled.hpp @@ -98,16 +98,16 @@ class MsrsbLevelBuilderCoupled : public MsrsbLevelBuilderBase< LAI > void buildProlongationStructure( DofManager const & fineDofManager ); /// A field description for each sub-block - std::vector< string > m_fields; + stdVector< string > m_fields; /// Subproblem selector matrices at the current level - std::vector< Matrix > m_selectors; + stdVector< Matrix > m_selectors; /// Levels for each sub-problem - std::vector< std::unique_ptr< MsrsbLevelBuilder< LAI > > > m_builders; + stdVector< std::unique_ptr< MsrsbLevelBuilder< LAI > > > m_builders; /// Sub-problem prolongators in extracted (local) form - std::vector< CRSMatrix< real64, globalIndex > > m_prolongationBlocks; + stdVector< CRSMatrix< real64, globalIndex > > m_prolongationBlocks; /// Temporary storage for combined prolongation operator (stored to avoid recreating the structure) CRSMatrix< real64, globalIndex > m_localProlongation; diff --git a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.cpp b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.cpp index 24802af7456..c6da0affd6d 100644 --- a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.cpp +++ b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.cpp @@ -609,17 +609,17 @@ void writeProlongation( CRSMatrixView< real64 const, globalIndex const > const & string const & prefix, multiscale::MeshLevel & mesh, multiscale::MeshObjectManager & fineManager, - std::function< void ( multiscale::MeshLevel &, std::vector< string > const & ) > const & writeFunc ) + std::function< void ( multiscale::MeshLevel &, stdVector< string > const & ) > const & writeFunc ) { - std::vector< string > bNames{ "X ", "Y ", "Z " }; - std::vector< string > cNames{ " x", " y", " z" }; + stdVector< string > bNames{ "X ", "Y ", "Z " }; + stdVector< string > cNames{ " x", " y", " z" }; integer const numComp = dofManager.numComponents( fieldName ); globalIndex const numBfuncs = prolongation.numColumns() / numComp; int const labelWidth = static_cast< int >( std::log10( numBfuncs ) ) + 1; - std::vector< arrayView3d< real64 > > views; - std::vector< string > names; + stdVector< arrayView3d< real64 > > views; + stdVector< string > names; for( globalIndex bfIndex = 0; bfIndex < numBfuncs; ++bfIndex ) { diff --git a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.hpp b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.hpp index e4bcb7f8526..7dd1b7340fd 100644 --- a/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.hpp +++ b/src/coreComponents/linearAlgebra/multiscale/msrsb/MsrsbUtils.hpp @@ -254,7 +254,7 @@ void writeProlongation( CRSMatrixView< real64 const, globalIndex const > const & string const & prefix, multiscale::MeshLevel & mesh, multiscale::MeshObjectManager & fineManager, - std::function< void ( multiscale::MeshLevel &, std::vector< string > const & ) > const & writeFunc ); + std::function< void ( multiscale::MeshLevel &, stdVector< string > const & ) > const & writeFunc ); } // namespace msrsb } // namespace multiscale diff --git a/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.cpp b/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.cpp index 4d500926c0b..e0fd2af73ac 100644 --- a/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.cpp +++ b/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.cpp @@ -81,7 +81,7 @@ void BlockPreconditioner< LAI >::setupBlock( localIndex const blockIndex, template< typename LAI > void BlockPreconditioner< LAI >::setupBlock( localIndex const blockIndex, - std::vector< DofManager::SubComponent > blockDofs, + stdVector< DofManager::SubComponent > blockDofs, PreconditionerBase< LAI > * const solver, real64 const scaling ) { diff --git a/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp b/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp index 58622d2f933..951c1992fd1 100644 --- a/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp +++ b/src/coreComponents/linearAlgebra/solvers/BlockPreconditioner.hpp @@ -115,7 +115,7 @@ class BlockPreconditioner : public PreconditionerBase< LAI > * DoF components in the monolithic system. */ void setupBlock( localIndex const blockIndex, - std::vector< DofManager::SubComponent > blockDofs, + stdVector< DofManager::SubComponent > blockDofs, PreconditionerBase< LAI > * const solver, real64 const scaling = 1.0 ); diff --git a/src/coreComponents/linearAlgebra/unitTests/testComponentMask.cpp b/src/coreComponents/linearAlgebra/unitTests/testComponentMask.cpp index 23aef693db0..ad7e46fbcaa 100644 --- a/src/coreComponents/linearAlgebra/unitTests/testComponentMask.cpp +++ b/src/coreComponents/linearAlgebra/unitTests/testComponentMask.cpp @@ -27,21 +27,21 @@ using namespace geos; template< int N > -void compare( ComponentMask< N > const & mask, std::vector< int > const & expected ) +void compare( ComponentMask< N > const & mask, stdVector< int > const & expected ) { EXPECT_EQ( mask.empty(), expected.empty() ); EXPECT_EQ( mask.size(), expected.size() ); - EXPECT_EQ( std::vector< int >( mask.begin(), mask.end() ), expected ); + EXPECT_EQ( stdVector< int >( mask.begin(), mask.end() ), expected ); } -std::vector< int > make_range( int lo, int const hi, int const step = 1 ) +stdVector< int > make_range( int lo, int const hi, int const step = 1 ) { - std::vector< int > r( hi - lo ); + stdVector< int > r( hi - lo ); std::generate( r.begin(), r.end(), [&lo, step] { int const ret = lo; lo += step; return ret; } ); return r; } -std::vector< int > join_range( std::vector< int > lhs, std::vector< int > const & rhs ) +stdVector< int > join_range( stdVector< int > lhs, stdVector< int > const & rhs ) { lhs.insert( lhs.end(), rhs.begin(), rhs.end() ); return lhs; @@ -173,7 +173,7 @@ TYPED_TEST( ComponentMaskTest, Set_EveryOtherComp ) using Mask = typename TestFixture::CompMask; constexpr int N = TestFixture::MAX_COMP; Mask mask( N ); - std::vector< int > expected; + stdVector< int > expected; for( int i = 0; i < N; i += 2 ) { mask.set( i ); @@ -187,7 +187,7 @@ TYPED_TEST( ComponentMaskTest, Set_EveryComp ) using Mask = typename TestFixture::CompMask; constexpr int N = TestFixture::MAX_COMP; Mask mask( N ); - std::vector< int > expected; + stdVector< int > expected; for( int i = 0; i < N; i += 1 ) { mask.set( i ); @@ -213,7 +213,7 @@ TYPED_TEST( ComponentMaskTest, Unset_EveryOtherComp ) using Mask = typename TestFixture::CompMask; constexpr int N = TestFixture::MAX_COMP; Mask mask( N, true ); - std::vector< int > expected; + stdVector< int > expected; for( int i = 0; i < N; i += 2 ) { mask.unset( i ); diff --git a/src/coreComponents/mesh/DomainPartition.hpp b/src/coreComponents/mesh/DomainPartition.hpp index 6644915738c..870ad00bec2 100644 --- a/src/coreComponents/mesh/DomainPartition.hpp +++ b/src/coreComponents/mesh/DomainPartition.hpp @@ -278,9 +278,9 @@ class DomainPartition : public dataRepository::Group * @brief Get a list of neighbor ranks. * @return Container of neighbor ranks. */ - std::vector< int > getNeighborRanks() const + stdVector< int > getNeighborRanks() const { - std::vector< int > ranks; + stdVector< int > ranks; ranks.reserve( m_neighbors.size() ); for( NeighborCommunicator const & neighbor : m_neighbors ) { diff --git a/src/coreComponents/mesh/ElementSubRegionBase.hpp b/src/coreComponents/mesh/ElementSubRegionBase.hpp index 21810289001..3af0767c53b 100644 --- a/src/coreComponents/mesh/ElementSubRegionBase.hpp +++ b/src/coreComponents/mesh/ElementSubRegionBase.hpp @@ -281,7 +281,7 @@ class ElementSubRegionBase : public ObjectManagerBase { // collect node coordinates for element k localIndex const numNodes = this->numNodesPerElement( k ); - std::vector< std::array< real64, 3 > > nodes; + stdVector< std::array< real64, 3 > > nodes; nodes.reserve( numNodes ); for( localIndex a = 0; a < numNodes; ++a ) { diff --git a/src/coreComponents/mesh/WellElementSubRegion.cpp b/src/coreComponents/mesh/WellElementSubRegion.cpp index b58343bdd12..eb4d58acd6f 100644 --- a/src/coreComponents/mesh/WellElementSubRegion.cpp +++ b/src/coreComponents/mesh/WellElementSubRegion.cpp @@ -215,7 +215,7 @@ bool isPointInsideElement( SurfaceElementSubRegion const & subRegion, // collect element nodes integer const nV = subRegion.numNodesPerElement( eiLocal ); SurfaceElementSubRegion::NodeMapType const & nodeList = subRegion.nodeList(); - std::vector< Point3d > polygon( nV ); + stdVector< Point3d > polygon( nV ); for( integer i = 0; i < nV; ++i ) { for( integer j = 0; j < 3; ++j ) @@ -1087,7 +1087,7 @@ void WellElementSubRegion::setElementStatus( arrayView1d< integer > const & loca // Sort indices based on the global index - std::vector< size_t > indices( numElements ); + stdVector< size_t > indices( numElements ); for( size_t i = 0; i < indices.size(); ++i ) { indices[i] = i; // Initialize indices diff --git a/src/coreComponents/mesh/graphs/GraphColoringBase.cpp b/src/coreComponents/mesh/graphs/GraphColoringBase.cpp index 55f1208b480..849d360c25e 100644 --- a/src/coreComponents/mesh/graphs/GraphColoringBase.cpp +++ b/src/coreComponents/mesh/graphs/GraphColoringBase.cpp @@ -27,9 +27,9 @@ namespace geos namespace graph { -bool GraphColoringBase::isColoringValid( const std::vector< camp::idx_t > & xadj, - const std::vector< camp::idx_t > & adjncy, - const std::vector< int > & coloring ) +bool GraphColoringBase::isColoringValid( const stdVector< camp::idx_t > & xadj, + const stdVector< camp::idx_t > & adjncy, + const stdVector< int > & coloring ) { for( size_t node = 0; node < coloring.size(); ++node ) { @@ -48,7 +48,7 @@ bool GraphColoringBase::isColoringValid( const std::vector< camp::idx_t > & xadj } -size_t GraphColoringBase::getNumberOfColors( const std::vector< int > & colors ) +size_t GraphColoringBase::getNumberOfColors( const stdVector< int > & colors ) { std::unordered_set< int > uniqueColors; for( int color : colors ) @@ -63,13 +63,13 @@ size_t GraphColoringBase::getNumberOfColors( const std::vector< int > & colors ) // Assume only one node per rank. -bool GraphColoringBase::isColoringValid( const std::vector< camp::idx_t > & adjncy, +bool GraphColoringBase::isColoringValid( const stdVector< camp::idx_t > & adjncy, const int color, MPI_Comm comm ) { // Gather neighbor colors asynchronously - std::vector< int > neighborColors( adjncy.size()); - std::vector< MPI_Request > requests( adjncy.size() * 2, MPI_REQUEST_NULL ); // Two requests per neighbor (send and receive) + stdVector< int > neighborColors( adjncy.size()); + stdVector< MPI_Request > requests( adjncy.size() * 2, MPI_REQUEST_NULL ); // Two requests per neighbor (send and receive) for( size_t i = 0; i < adjncy.size(); ++i ) { int const neighborRank = adjncy[i]; @@ -101,27 +101,27 @@ bool GraphColoringBase::isColoringValid( const std::vector< camp::idx_t > & adjn size_t GraphColoringBase::getNumberOfColors( const int color, MPI_Comm comm ) { - std::vector< int > colors = {color}; + stdVector< int > colors = {color}; return getNumberOfColors( colors, comm ); } -size_t GraphColoringBase::getNumberOfColors( const std::vector< int > & colors, MPI_Comm comm ) +size_t GraphColoringBase::getNumberOfColors( const stdVector< int > & colors, MPI_Comm comm ) { int const rank = MpiWrapper::commRank( comm ); int const size = MpiWrapper::commSize( comm ); std::set< int > localDistinctColors = std::set< int >( colors.begin(), colors.end()); - std::vector< int > localDistinctColorsVector( localDistinctColors.begin(), localDistinctColors.end()); + stdVector< int > localDistinctColorsVector( localDistinctColors.begin(), localDistinctColors.end()); int const localSize = localDistinctColorsVector.size(); // Gather the sizes of the local color vectors from all ranks - std::vector< int > allSizes( size ); + stdVector< int > allSizes( size ); MpiWrapper::gather( &localSize, 1, allSizes.data(), 1, 0, comm ); // Calculate the total number of colors and the displacements for gathering int totalSize = 0; - std::vector< int > displacements( size, 0 ); + stdVector< int > displacements( size, 0 ); if( rank == 0 ) { for( int i = 0; i < size; ++i ) @@ -132,7 +132,7 @@ size_t GraphColoringBase::getNumberOfColors( const std::vector< int > & colors, } // Gather all colors from all ranks to rank 0 - std::vector< int > allColors( totalSize ); + stdVector< int > allColors( totalSize ); MpiWrapper::gatherv( localDistinctColorsVector.data(), localSize, allColors.data(), allSizes.data(), displacements.data(), 0, comm ); diff --git a/src/coreComponents/mesh/graphs/GraphColoringBase.hpp b/src/coreComponents/mesh/graphs/GraphColoringBase.hpp index 2b8242c70cf..3ca8fc45165 100644 --- a/src/coreComponents/mesh/graphs/GraphColoringBase.hpp +++ b/src/coreComponents/mesh/graphs/GraphColoringBase.hpp @@ -54,14 +54,14 @@ class GraphColoringBase * @param adjncy Adjacency list containing neighbors of each node. * @return A vector of colors assigned to each node. */ - virtual std::vector< int > colorGraph( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ) = 0; + virtual stdVector< int > colorGraph( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ) = 0; /** * @brief Pure virtual method to color a graph assuming one node per rank. * @param adjncy Adjacency list containing neighbors of each node. * @return Color of the node. */ - virtual int colorGraph( const std::vector< camp::idx_t > & adjncy ) = 0; + virtual int colorGraph( const stdVector< camp::idx_t > & adjncy ) = 0; /** @@ -81,7 +81,7 @@ class GraphColoringBase * @param coloring A vector where the index represents the node and the value represents the assigned color.* * @return True if the coloring is valid, false otherwise. */ - static bool isColoringValid( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy, const std::vector< int > & coloring ); + static bool isColoringValid( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy, const stdVector< int > & coloring ); /** * @brief Checks the validity of the graph coloring assuming one node per rank. @@ -92,7 +92,7 @@ class GraphColoringBase * * @return True if the coloring is valid, false otherwise. */ - static bool isColoringValid( const std::vector< camp::idx_t > & adjncy, const int color, MPI_Comm comm ); + static bool isColoringValid( const stdVector< camp::idx_t > & adjncy, const int color, MPI_Comm comm ); /** * @brief Counts the number of distinct colors. @@ -103,7 +103,7 @@ class GraphColoringBase * @param colors A vector of integers representing colors. * @return The number of distinct colors in the vector. */ - static size_t getNumberOfColors( const std::vector< int > & colors ); + static size_t getNumberOfColors( const stdVector< int > & colors ); /** * @brief Counts the number of distinct colors (parallel version). @@ -111,7 +111,7 @@ class GraphColoringBase * @param comm MPI communicator. * @return Number of distinct colors. */ - static size_t getNumberOfColors( const std::vector< int > & colors, MPI_Comm comm ); + static size_t getNumberOfColors( const stdVector< int > & colors, MPI_Comm comm ); /** * @brief Counts the number of distinct colors assuming one node per rank (parallel version). diff --git a/src/coreComponents/mesh/graphs/GraphTools.cpp b/src/coreComponents/mesh/graphs/GraphTools.cpp index 84b5f287591..3c112afacac 100644 --- a/src/coreComponents/mesh/graphs/GraphTools.cpp +++ b/src/coreComponents/mesh/graphs/GraphTools.cpp @@ -29,13 +29,13 @@ namespace geos namespace graph { -size_t getGraphNodeDegree( idx_t node, const std::vector< idx_t > & xadj ) +size_t getGraphNodeDegree( idx_t node, const stdVector< idx_t > & xadj ) { return xadj[node + 1] - xadj[node]; } -std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const std::vector< idx_t > & xadj, const std::vector< idx_t > & adjncy ) +std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const stdVector< idx_t > & xadj, const stdVector< idx_t > & adjncy ) { std::unordered_set< idx_t > neighbors; for( idx_t i = xadj[node]; i < xadj[node + 1]; ++i ) @@ -46,8 +46,8 @@ std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const std::vector } -bool isGraphValid( const std::vector< idx_t > & xadj, - const std::vector< idx_t > & adjncy ) +bool isGraphValid( const stdVector< idx_t > & xadj, + const stdVector< idx_t > & adjncy ) { idx_t num_nodes = xadj.size() - 1; @@ -95,9 +95,9 @@ bool isGraphValid( const std::vector< idx_t > & xadj, } -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphRandom( size_t numVertices, size_t numEdges ) +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphRandom( size_t numVertices, size_t numEdges ) { - std::vector< std::pair< size_t, size_t > > edges; + stdVector< std::pair< size_t, size_t > > edges; srand( static_cast< unsigned int >(time( 0 ))); // Generate random edges @@ -116,8 +116,8 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphRandom( si std::sort( edges.begin(), edges.end()); // Initialize xadj and adjncy - std::vector< idx_t > xadj( numVertices + 1, 0 ); - std::vector< idx_t > adjncy; + stdVector< idx_t > xadj( numVertices + 1, 0 ); + stdVector< idx_t > adjncy; adjncy.reserve( edges.size()); // Fill xadj and adjncy @@ -142,11 +142,11 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphRandom( si } -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartitionning3D( idx_t nx, idx_t ny, idx_t nz, const std::vector< std::array< int, 3 > > & neighbor_offsets ) +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphCartPartitionning3D( idx_t nx, idx_t ny, idx_t nz, const stdVector< std::array< int, 3 > > & neighbor_offsets ) { idx_t num_nodes = nx * ny * nz; - std::vector< idx_t > xadj( num_nodes + 1, 0 ); - std::vector< idx_t > adjncy; + stdVector< idx_t > xadj( num_nodes + 1, 0 ); + stdVector< idx_t > adjncy; auto getNodeIndex = [nx, ny] ( const idx_t x, const idx_t y, const idx_t z ) { @@ -160,7 +160,7 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartit { for( idx_t x = 0; x < nx; ++x ) { - std::vector< idx_t > neighbors; + stdVector< idx_t > neighbors; for( const auto & offset : neighbor_offsets ) { @@ -186,17 +186,17 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartit return {xadj, adjncy}; } -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartitionning3D6( idx_t nx, idx_t ny, idx_t nz ) +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphCartPartitionning3D6( idx_t nx, idx_t ny, idx_t nz ) { - std::vector< std::array< int, 3 > > neighbor_offsets = { + stdVector< std::array< int, 3 > > neighbor_offsets = { {-1, 0, 0}, {1, 0, 0}, {0, -1, 0}, {0, 1, 0}, {0, 0, -1}, {0, 0, 1} }; return generateGraphCartPartitionning3D( nx, ny, nz, neighbor_offsets ); } -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartitionning3D26( idx_t nx, idx_t ny, idx_t nz ) +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphCartPartitionning3D26( idx_t nx, idx_t ny, idx_t nz ) { - std::vector< std::array< int, 3 > > neighbor_offsets; + stdVector< std::array< int, 3 > > neighbor_offsets; for( int dz = -1; dz <= 1; ++dz ) { for( int dy = -1; dy <= 1; ++dy ) diff --git a/src/coreComponents/mesh/graphs/GraphTools.hpp b/src/coreComponents/mesh/graphs/GraphTools.hpp index 0aa09887889..c478863bbd8 100644 --- a/src/coreComponents/mesh/graphs/GraphTools.hpp +++ b/src/coreComponents/mesh/graphs/GraphTools.hpp @@ -45,7 +45,7 @@ using camp::idx_t; * @param adjncy The adjacency list containing the neighbors of each node. * @return True if the graph meets all criteria, false otherwise. */ -bool isGraphValid( const std::vector< idx_t > & xadj, const std::vector< idx_t > & adjncy ); +bool isGraphValid( const stdVector< idx_t > & xadj, const stdVector< idx_t > & adjncy ); /** * @brief Calculates the degree of a node in the graph. @@ -56,7 +56,7 @@ bool isGraphValid( const std::vector< idx_t > & xadj, const std::vector< idx_t > * @param xadj The adjacency list offsets for each node. * @return The degree of the node. */ -size_t getGraphNodeDegree( idx_t node, const std::vector< idx_t > & xadj ); +size_t getGraphNodeDegree( idx_t node, const stdVector< idx_t > & xadj ); /** * @brief Retrieves the neighbors of a node in the graph. @@ -68,7 +68,7 @@ size_t getGraphNodeDegree( idx_t node, const std::vector< idx_t > & xadj ); * @param adjncy The adjacency list containing the neighbors of each node. * @return A set of indices representing the neighbors of the node. */ -std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const std::vector< idx_t > & xadj, const std::vector< idx_t > & adjncy ); +std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const stdVector< idx_t > & xadj, const stdVector< idx_t > & adjncy ); @@ -81,7 +81,7 @@ std::unordered_set< idx_t > getGraphNodeNeighbors( idx_t node, const std::vector * @param num_edges Number of edges in the graph. * @return A tuple containing xadj and adjncy. */ -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphRandom( size_t num_nodes, size_t num_edges ); +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphRandom( size_t num_nodes, size_t num_edges ); /** * @brief Generates the adjacency list representation (xadj and adjncy) for a Cartesian domain decomposition in 3D. @@ -94,7 +94,7 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphRandom( si * @param nz Number of divisions along the z-axis. * @return A tuple containing xadj and adjncy. */ -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartitionning3D6( idx_t nx, idx_t ny, idx_t nz ); +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphCartPartitionning3D6( idx_t nx, idx_t ny, idx_t nz ); /** * @brief Generates the adjacency list representation (xadj and adjncy) for a Cartesian domain decomposition in 3D. @@ -107,7 +107,7 @@ std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartit * @param nz Number of divisions along the z-axis. * @return A tuple containing xadj and adjncy. */ -std::tuple< std::vector< idx_t >, std::vector< idx_t > > generateGraphCartPartitionning3D26( idx_t nx, idx_t ny, idx_t nz ); +std::tuple< stdVector< idx_t >, stdVector< idx_t > > generateGraphCartPartitionning3D26( idx_t nx, idx_t ny, idx_t nz ); } // namespace geos diff --git a/src/coreComponents/mesh/graphs/GraphToolsMPI.cpp b/src/coreComponents/mesh/graphs/GraphToolsMPI.cpp index c5206b26dd2..45651c21d3e 100644 --- a/src/coreComponents/mesh/graphs/GraphToolsMPI.cpp +++ b/src/coreComponents/mesh/graphs/GraphToolsMPI.cpp @@ -26,9 +26,9 @@ namespace geos namespace graph { -std::pair< std::vector< camp::idx_t >, std::vector< camp::idx_t > > -scatterGraphData( const std::vector< camp::idx_t > & xadj, - const std::vector< camp::idx_t > & adjncy, +std::pair< stdVector< camp::idx_t >, stdVector< camp::idx_t > > +scatterGraphData( const stdVector< camp::idx_t > & xadj, + const stdVector< camp::idx_t > & adjncy, MPI_Comm comm ) { int const rank = MpiWrapper::commRank( comm ); @@ -40,9 +40,9 @@ scatterGraphData( const std::vector< camp::idx_t > & xadj, GEOS_ASSERT_EQ_MSG( size, static_cast< int >(xadj.size()) - 1, "Number of ranks does not match the size of xadj-1" ); } - std::vector< int > sendCounts; - std::vector< int > displacements; - std::vector< camp::idx_t > xadjToScatter; + stdVector< int > sendCounts; + stdVector< int > displacements; + stdVector< camp::idx_t > xadjToScatter; if( rank == 0 ) { @@ -64,13 +64,13 @@ scatterGraphData( const std::vector< camp::idx_t > & xadj, } } - std::vector< camp::idx_t > localXadj( 2 ); // Each rank will have two elements in localXadj: xadj[i] and xadj[i+1] + stdVector< camp::idx_t > localXadj( 2 ); // Each rank will have two elements in localXadj: xadj[i] and xadj[i+1] MpiWrapper::scatter( xadjToScatter.data(), 2, localXadj.data(), 2, 0, comm ); int localSize; MpiWrapper::scatter( sendCounts.data(), 1, &localSize, 1, 0, comm ); - std::vector< camp::idx_t > localAdjncy( localSize ); + stdVector< camp::idx_t > localAdjncy( localSize ); MpiWrapper::scatterv( adjncy.data(), sendCounts.data(), displacements.data(), localAdjncy.data(), localSize, 0, comm ); @@ -78,9 +78,9 @@ scatterGraphData( const std::vector< camp::idx_t > & xadj, } -std::pair< std::vector< camp::idx_t >, std::vector< camp::idx_t > > -gatherGraphData( const std::vector< camp::idx_t > & localXadj, - const std::vector< camp::idx_t > & localAdjncy, +std::pair< stdVector< camp::idx_t >, stdVector< camp::idx_t > > +gatherGraphData( const stdVector< camp::idx_t > & localXadj, + const stdVector< camp::idx_t > & localAdjncy, MPI_Comm comm ) { int const rank = MpiWrapper::commRank( comm ); @@ -90,11 +90,11 @@ gatherGraphData( const std::vector< camp::idx_t > & localXadj, int nCounts = (rank < size - 1) ? static_cast< int >(localXadj.size() - 1) : static_cast< int >(localXadj.size()); // Gather the counts of elements from each rank - std::vector< int > recvCounts( size ); + stdVector< int > recvCounts( size ); MpiWrapper::gather( &nCounts, 1, recvCounts.data(), 1, 0, comm ); // Calculate displacements for the gathered data - std::vector< int > displacements( size ); + stdVector< int > displacements( size ); if( rank == 0 ) { displacements[0] = 0; @@ -105,7 +105,7 @@ gatherGraphData( const std::vector< camp::idx_t > & localXadj, } // Resize the xadj vector on rank 0 to hold the gathered data - std::vector< camp::idx_t > xadj; + stdVector< camp::idx_t > xadj; if( rank == 0 ) { int totalSize = std::accumulate( recvCounts.begin(), recvCounts.end(), 0 ); @@ -133,7 +133,7 @@ gatherGraphData( const std::vector< camp::idx_t > & localXadj, } // Resize the adjncy vector on rank 0 to hold the gathered data - std::vector< camp::idx_t > adjncy; + stdVector< camp::idx_t > adjncy; if( rank == 0 ) { int totalSize = std::accumulate( recvCounts.begin(), recvCounts.end(), 0 ); @@ -150,21 +150,21 @@ gatherGraphData( const std::vector< camp::idx_t > & localXadj, } -std::vector< camp::idx_t > createXadjFromAdjncy( const std::vector< camp::idx_t > & localAdjncy, MPI_Comm comm ) +stdVector< camp::idx_t > createXadjFromAdjncy( const stdVector< camp::idx_t > & localAdjncy, MPI_Comm comm ) { int const size = MpiWrapper::commSize( comm ); // Gather the counts of elements from each rank for localAdjncy int localAdjncySize = static_cast< int >(localAdjncy.size()); - std::vector< int > adjncyCounts( size ); + stdVector< int > adjncyCounts( size ); MpiWrapper::allgather( &localAdjncySize, 1, adjncyCounts.data(), 1, comm ); // Calculate xadj - std::vector< camp::idx_t > xadj( size + 1, 0 ); + stdVector< camp::idx_t > xadj( size + 1, 0 ); std::partial_sum( adjncyCounts.begin(), adjncyCounts.end(), xadj.begin() + 1 ); // Prepare data to scatter - std::vector< camp::idx_t > xadjToScatter( 2 * size ); + stdVector< camp::idx_t > xadjToScatter( 2 * size ); for( int i = 0; i < size; ++i ) { xadjToScatter[2 * i] = xadj[i]; @@ -172,29 +172,29 @@ std::vector< camp::idx_t > createXadjFromAdjncy( const std::vector< camp::idx_t } // Scatter the xadj data - std::vector< camp::idx_t > localXadj( 2 ); + stdVector< camp::idx_t > localXadj( 2 ); MpiWrapper::scatter( xadjToScatter.data(), 2, localXadj.data(), 2, 0, comm ); return localXadj; } -std::vector< int > createVertexGlobalID( const std::vector< camp::idx_t > & localXadj, MPI_Comm comm ) +stdVector< int > createVertexGlobalID( const stdVector< camp::idx_t > & localXadj, MPI_Comm comm ) { int const rank = MpiWrapper::commRank( comm ); int const size = MpiWrapper::commSize( comm ); int localNumVertices = static_cast< int >(localXadj.size()) - 1; - std::vector< int > allNumVertices( size ); + stdVector< int > allNumVertices( size ); MpiWrapper::allgather( &localNumVertices, 1, allNumVertices.data(), 1, comm ); // Compute displacement for the current rank - std::vector< int > displacements( size, 0 ); + stdVector< int > displacements( size, 0 ); std::partial_sum( allNumVertices.begin(), allNumVertices.end() - 1, displacements.begin() + 1 ); int displacement = displacements[rank]; - std::vector< int > globalID( localNumVertices ); + stdVector< int > globalID( localNumVertices ); std::iota( globalID.begin(), globalID.end(), displacement ); return globalID; diff --git a/src/coreComponents/mesh/graphs/GraphToolsMPI.hpp b/src/coreComponents/mesh/graphs/GraphToolsMPI.hpp index c0f09fe7086..c4b3cab082b 100644 --- a/src/coreComponents/mesh/graphs/GraphToolsMPI.hpp +++ b/src/coreComponents/mesh/graphs/GraphToolsMPI.hpp @@ -44,9 +44,9 @@ using camp::idx_t; * @param comm The MPI communicator (default is MPI_COMM_GEOS). * @return A pair of vectors containing the local adjacency list offsets and neighbors for each rank. */ -std::pair< std::vector< camp::idx_t >, std::vector< camp::idx_t > > -scatterGraphData( const std::vector< camp::idx_t > & xadj, - const std::vector< camp::idx_t > & adjncy, +std::pair< stdVector< camp::idx_t >, stdVector< camp::idx_t > > +scatterGraphData( const stdVector< camp::idx_t > & xadj, + const stdVector< camp::idx_t > & adjncy, MPI_Comm comm = MPI_COMM_GEOS ); @@ -62,9 +62,9 @@ scatterGraphData( const std::vector< camp::idx_t > & xadj, * @return A pair of vectors: global xadj and adjncy. */ -std::pair< std::vector< camp::idx_t >, std::vector< camp::idx_t > > -gatherGraphData( const std::vector< camp::idx_t > & localXadj, - const std::vector< camp::idx_t > & localAdjncy, +std::pair< stdVector< camp::idx_t >, stdVector< camp::idx_t > > +gatherGraphData( const stdVector< camp::idx_t > & localXadj, + const stdVector< camp::idx_t > & localAdjncy, MPI_Comm comm= MPI_COMM_GEOS ); @@ -78,7 +78,7 @@ gatherGraphData( const std::vector< camp::idx_t > & localXadj, * @param comm The MPI communicator. * @return The xadj array. */ -std::vector< camp::idx_t > createXadjFromAdjncy( const std::vector< camp::idx_t > & localAdjncy, MPI_Comm comm ); +stdVector< camp::idx_t > createXadjFromAdjncy( const stdVector< camp::idx_t > & localAdjncy, MPI_Comm comm ); /** @@ -90,7 +90,7 @@ std::vector< camp::idx_t > createXadjFromAdjncy( const std::vector< camp::idx_t * @param comm MPI communicator. * @return A vector of global vertex IDs. */ -std::vector< int > createVertexGlobalID( const std::vector< camp::idx_t > & localXadj, MPI_Comm comm ); +stdVector< int > createVertexGlobalID( const stdVector< camp::idx_t > & localXadj, MPI_Comm comm ); } // namespace geos } // namespace graph diff --git a/src/coreComponents/mesh/graphs/RLFGraphColoring.cpp b/src/coreComponents/mesh/graphs/RLFGraphColoring.cpp index 0abb5b5066f..6051ab888e7 100644 --- a/src/coreComponents/mesh/graphs/RLFGraphColoring.cpp +++ b/src/coreComponents/mesh/graphs/RLFGraphColoring.cpp @@ -34,20 +34,20 @@ RLFGraphColoring::~RLFGraphColoring() {} -int RLFGraphColoring::colorGraph( const std::vector< camp::idx_t > & GEOS_UNUSED_PARAM( adjncy )) +int RLFGraphColoring::colorGraph( const stdVector< camp::idx_t > & GEOS_UNUSED_PARAM( adjncy )) { return -1; } -std::vector< int > RLFGraphColoring::colorGraph( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ) +stdVector< int > RLFGraphColoring::colorGraph( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ) { return RecursiveLargestFirstColoring( xadj, adjncy ); } -std::vector< int > RLFGraphColoring::RecursiveLargestFirstColoring( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ) +stdVector< int > RLFGraphColoring::RecursiveLargestFirstColoring( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ) { - std::vector< int > color( xadj.size() - 1, -1 ); + stdVector< int > color( xadj.size() - 1, -1 ); std::unordered_set< camp::idx_t > uncoloredNodes; for( size_t i = 0; i < (xadj.size() - 1); ++i ) { @@ -120,12 +120,12 @@ std::vector< int > RLFGraphColoring::RecursiveLargestFirstColoring( const std::v return color; } -size_t RLFGraphColoring::getNumberOfColors( const std::vector< int > & colors ) const +size_t RLFGraphColoring::getNumberOfColors( const stdVector< int > & colors ) const { return GraphColoringBase::getNumberOfColors( colors ); } -bool RLFGraphColoring::isColoringValid( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy, const std::vector< int > & colors ) const +bool RLFGraphColoring::isColoringValid( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy, const stdVector< int > & colors ) const { return GraphColoringBase::isColoringValid( xadj, adjncy, colors ); } diff --git a/src/coreComponents/mesh/graphs/RLFGraphColoring.hpp b/src/coreComponents/mesh/graphs/RLFGraphColoring.hpp index af4c5338071..c59161f58e7 100644 --- a/src/coreComponents/mesh/graphs/RLFGraphColoring.hpp +++ b/src/coreComponents/mesh/graphs/RLFGraphColoring.hpp @@ -63,21 +63,21 @@ class RLFGraphColoring : public GraphColoringBase * @param adjncy Adjacency list. * @return A vector of assigned colors. */ - std::vector< int > colorGraph( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ) override; + stdVector< int > colorGraph( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ) override; /** * @brief Colors a graph assuming one node per rank. * @param localAdjncy Local adjacency list. * @return Color of the node. */ - int colorGraph( const std::vector< camp::idx_t > & localAdjncy ) override; + int colorGraph( const stdVector< camp::idx_t > & localAdjncy ) override; /** * @brief Returns the number of distinct colors used. * @param colors Vector of color assignments. * @return Number of unique colors. */ - size_t getNumberOfColors( const std::vector< int > & colors ) const; + size_t getNumberOfColors( const stdVector< int > & colors ) const; /** * @brief Validates the coloring of a graph. @@ -86,7 +86,7 @@ class RLFGraphColoring : public GraphColoringBase * @param colors Vector of assigned colors. * @return True if coloring is valid, false otherwise. */ - bool isColoringValid( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy, const std::vector< int > & colors ) const; + bool isColoringValid( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy, const stdVector< int > & colors ) const; private: @@ -96,7 +96,7 @@ class RLFGraphColoring : public GraphColoringBase * @param adjncy The adjacency list containing the neighbors of each node. * @return A vector where the index represents the node and the value represents the assigned color. */ - std::vector< int > RecursiveLargestFirstColoring( const std::vector< camp::idx_t > & xadj, const std::vector< camp::idx_t > & adjncy ); + stdVector< int > RecursiveLargestFirstColoring( const stdVector< camp::idx_t > & xadj, const stdVector< camp::idx_t > & adjncy ); }; } // namespace graph From 2a96409438a3a8f4400b8fd2538a9c374a388720 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 17:36:23 +0100 Subject: [PATCH 54/63] missing file --- .../dataRepository/unitTests/testErrorHandling.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/dataRepository/unitTests/testErrorHandling.cpp b/src/coreComponents/dataRepository/unitTests/testErrorHandling.cpp index 39103cc5580..f003bfae77c 100644 --- a/src/coreComponents/dataRepository/unitTests/testErrorHandling.cpp +++ b/src/coreComponents/dataRepository/unitTests/testErrorHandling.cpp @@ -62,7 +62,7 @@ void beginLocalLoggerTest( ErrorLogger & errorLogger, string_view filename ) * @param expectedFileBits reference file parts that must be in the logger file output */ void endLocalLoggerTest( ErrorLogger & errorLogger, - std::vector< string > expectedFileBits ) + stdVector< string > expectedFileBits ) { auto const readFile = [] ( string_view filename ) { if( !fs::exists( filename )) From 1d0f7f73ded01a2f4cd7a124b5232e6b70786c28 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 17:39:19 +0100 Subject: [PATCH 55/63] test for constituve --- scripts/check_code_rules.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index ea9c5cc0eca..0b9b1313b6c 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -5,6 +5,7 @@ FILE_PATTERNS=( "src/coreComponents/codingUtilities/*" "src/coreComponents/common/*" "src/coreComponents/dataRepository/*" + "src/coreComponents/constitutive/*" "src/coreComponents/denseLinearAlgebra/*" "src/coreComponents/discretizationMethods/*" "src/coreComponents/events/*" @@ -20,6 +21,7 @@ FILE_PATTERNS=( ) EXCLUDE_PATTERNS=( "src/coreComponents/common/Datatype.hpp" + "src/coreComponents/constitutive/PVTPackage/*" "src/coreComponents/common/StdContainerWrappers.hpp" "src/coreComponents/dataRepository/BufferOps_inline.hpp" "src/coreComponents/dataRepository/BufferOps.hpp" From a47e59677133fef903d4ad0716e746e5a32375b3 Mon Sep 17 00:00:00 2001 From: arng40 Date: Wed, 19 Nov 2025 18:06:40 +0100 Subject: [PATCH 56/63] try refacto with func --- scripts/check_code_rules.sh | 49 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 0b9b1313b6c..4bb9ca33ac9 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -1,5 +1,25 @@ #!/bin/bash +# while +# ... done < <(grep -n "std::map\s*<" "$file") +# Process the result of grep command as a file +# This allows everything to be handled in the same shell environment. +check_container_usage() { + local container="$1" + local -n array_name=$2 + local -n violation_found=$3 + local str=" Found forbidden ${container} usage in: $file"$'\n' + + if grep -q "${container}\s*<" "$file"; then + while IFS= read -r line; do + str+=" $line"$'\n' + done < <(grep -n "${container}\s*<" "$file") + + $array_name+=$str + $violation_found=1 + fi +} + echo "Test code rules" FILE_PATTERNS=( "src/coreComponents/codingUtilities/*" @@ -53,31 +73,10 @@ for file in $FILES; do continue fi - if grep -q "std::map\s*<" "$file" ; then - STR_MAP=" Found forbidden std::map usage in: $file"$'\n' - while IFS= read -r line; do - STR_MAP+=" $line"$'\n' - done < <(grep -n "std::map\s*<" "$file") - ARRAY_MAP+=("$STR_MAP") - MAP_VIOLATIONS_FOUND=1 - fi - if grep -q "std::unordered_map\s*<" "$file" ; then - STR_UMAP=" Found forbidden std::unordered_map usage in: $file"$'\n' - while IFS= read -r line; do - STR_UMAP+=" $line"$'\n' - done < <(grep -n "std::unordered_map\s*<" "$file") - ARRAY_UMAP+=("$STR_UMAP") - UMAP_VIOLATIONS_FOUND=1 - fi - if grep -q "std::vector\s*<" "$file" ; then - STR_VECTOR=" Found forbidden std::vector usage in: $file"$'\n' - while IFS= read -r line; do - STR_VECTOR+=" $line"$'\n' - done < <(grep -n "std::vector\s*<" "$file") - ARRAY_VECTOR+=("$STR_VECTOR") - VECTOR_VIOLATIONS_FOUND=1 - fi - done + check_container_usage "std::map" ARRAY_MAP MAP_VIOLATIONS_FOUND + check_container_usage "std::unordered_map" ARRAY_UMAP UMAP_VIOLATIONS_FOUND + check_container_usage "std::vector" ARRAY_VECTOR VECTOR_VIOLATIONS_FOUND +done if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )) || (($VECTOR_VIOLATIONS_FOUND == 1 )); then echo "----------------------------------------" From 411913ed3d068f825b4242b44df8b270e44dea75 Mon Sep 17 00:00:00 2001 From: arng40 Date: Thu, 20 Nov 2025 11:45:02 +0100 Subject: [PATCH 57/63] clean the code + test with file --- scripts/check_code_rules.sh | 126 +++++++++--------- .../mesh/generators/VTKUtilities.cpp | 6 +- 2 files changed, 65 insertions(+), 67 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 4bb9ca33ac9..a4ec0c28e63 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -2,12 +2,12 @@ # while # ... done < <(grep -n "std::map\s*<" "$file") -# Process the result of grep command as a file +# Process the result of grep command as a file. # This allows everything to be handled in the same shell environment. check_container_usage() { local container="$1" - local -n array_name=$2 - local -n violation_found=$3 + local -n array_name="$2" + local -n violation_found="$3" local str=" Found forbidden ${container} usage in: $file"$'\n' if grep -q "${container}\s*<" "$file"; then @@ -15,43 +15,56 @@ check_container_usage() { str+=" $line"$'\n' done < <(grep -n "${container}\s*<" "$file") - $array_name+=$str - $violation_found=1 + array_name+="$str" + violation_found=1 fi } -echo "Test code rules" +print_violation() +{ + local violation_found="$1" + local container="$2" + local targetStd="$3" + + if [ "$violation_found" -eq 1 ];then + echo "ERROR: Forbidden $targetStd usage detected" + echo "==========================================" + + for element in "${container[@]}" + do + echo "$element"; + done + fi +} + +# Variables initialization +FILE_PREFIX="src/coreComponents/" FILE_PATTERNS=( - "src/coreComponents/codingUtilities/*" - "src/coreComponents/common/*" - "src/coreComponents/dataRepository/*" - "src/coreComponents/constitutive/*" - "src/coreComponents/denseLinearAlgebra/*" - "src/coreComponents/discretizationMethods/*" - "src/coreComponents/events/*" - "src/coreComponents/fieldSpecification/*" - "src/coreComponents/fileIO/*" - "src/coreComponents/finiteElement/*" - "src/coreComponents/finiteVolume/*" - "src/coreComponents/functions/*" - "src/coreComponents/linearAlgebra/*" - "src/coreComponents/mainInterface/*" - "src/coreComponents/mesh/*" - "src/coreComponents/physicsSolvers/*" + "codingUtilities/*" + "common/*" + "dataRepository/*" + "constitutive/*" + "denseLinearAlgebra/*" + "discretizationMethods/*" + "events/*" + "fieldSpecification/*" + "fileIO/*" + "finiteElement/*" + "finiteVolume/*" + "functions/*" + "linearAlgebra/*" + "mainInterface/*" + "mesh/*" + "physicsSolvers/*" ) EXCLUDE_PATTERNS=( - "src/coreComponents/common/Datatype.hpp" - "src/coreComponents/constitutive/PVTPackage/*" - "src/coreComponents/common/StdContainerWrappers.hpp" - "src/coreComponents/dataRepository/BufferOps_inline.hpp" - "src/coreComponents/dataRepository/BufferOps.hpp" + "common/Datatype.hpp" + "constitutive/PVTPackage/*" + "common/StdContainerWrappers.hpp" + "dataRepository/BufferOps_inline.hpp" + "dataRepository/BufferOps.hpp" ) -FIND_CMD="find" -for pattern in "${FILE_PATTERNS[@]}"; do - FILE_PATH_PATERN+=${pattern}" " -done -FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' -FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); + MAP_VIOLATIONS_FOUND=0 UMAP_VIOLATIONS_FOUND=0 @@ -60,9 +73,19 @@ VECTOR_VIOLATIONS_FOUND=0 ARRAY_MAP=() ARRAY_UMAP=() ARRAY_VECTOR=() + +# Build the find command +FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}" +FULL_EXCLUDE_PATTERN="${FILE_PREFIX}${EXCLUDE_PATTERNS[*]}" + +FIND_CMD="find" +FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' +FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); + +# Main loop for file in $FILES; do SKIP=0 - for exclude in "${EXCLUDE_PATTERNS[@]}"; do + for exclude in "${FULL_EXCLUDE_PATTERN[@]}"; do if [[ "$file" == *"$exclude"* ]]; then SKIP=1 break @@ -78,40 +101,15 @@ for file in $FILES; do check_container_usage "std::vector" ARRAY_VECTOR VECTOR_VIOLATIONS_FOUND done -if (($MAP_VIOLATIONS_FOUND == 1)) || (($UMAP_VIOLATIONS_FOUND == 1 )) || (($VECTOR_VIOLATIONS_FOUND == 1 )); then +# Print section +if [ $MAP_VIOLATIONS_FOUND -eq 1 ] || [ $UMAP_VIOLATIONS_FOUND -eq 1 ] || [ $VECTOR_VIOLATIONS_FOUND -eq 1 ]; then echo "----------------------------------------" echo "SUMMARY: Code rule violations found" echo "----------------------------------------" - if((MAP_VIOLATIONS_FOUND == 1 ));then - echo $'ERROR: Forbidden std::map usage detected' - echo "==========================================" - fi - - for element in "${ARRAY_MAP[@]}" - do - echo "$element"; - done - - if((UMAP_VIOLATIONS_FOUND == 1 ));then - echo $'\nERROR: Forbidden std::unordered_map usage detected' - echo "======================================================" - fi - - for element in "${ARRAY_UMAP[@]}" - do - echo "$element"; - done - - if((VECTOR_VIOLATIONS_FOUND == 1 ));then - echo $'\nERROR: Forbidden std::vector usage detected' - echo "===============================================" - fi - - for element in "${ARRAY_VECTOR[@]}" - do - echo "$element"; - done + print_violation MAP_VIOLATIONS_FOUND ARRAY_MAP "std::map" + print_violation UMAP_VIOLATIONS_FOUND ARRAY_UMAP "std::unordered_map" + print_violation VECTOR_VIOLATIONS_FOUND ARRAY_VECTOR "std::vector" echo "" exit 1; diff --git a/src/coreComponents/mesh/generators/VTKUtilities.cpp b/src/coreComponents/mesh/generators/VTKUtilities.cpp index 93eaf103443..32e0c038d94 100644 --- a/src/coreComponents/mesh/generators/VTKUtilities.cpp +++ b/src/coreComponents/mesh/generators/VTKUtilities.cpp @@ -251,7 +251,7 @@ buildElemToNodesImpl( AllMeshes & meshes, localIndex const num3dCells = LvArray::integerConversion< localIndex >( meshes.getMainMesh()->GetNumberOfCells() ); localIndex num2dCells = 0; - stdMap< string, CollocatedNodes > collocatedNodesMap; + std::map< string, CollocatedNodes > collocatedNodesMap; for( auto & [fractureName, fractureMesh]: meshes.getFaceBlocks() ) { num2dCells += fractureMesh->GetNumberOfCells(); @@ -561,7 +561,7 @@ AllMeshes loadAllMeshes( Path const & filePath, { int const lastRank = MpiWrapper::commSize() - 1; vtkSmartPointer< vtkDataSet > main = loadMesh( filePath, mainBlockName ); - stdMap< string, vtkSmartPointer< vtkDataSet > > faces; + std::map< string, vtkSmartPointer< vtkDataSet > > faces; for( string const & faceBlockName: faceBlockNames ) { @@ -1008,7 +1008,7 @@ redistributeByKdTree( vtkDataSet & mesh ) return result; } -stdVector< int > +std::vector< int > findNeighborRanks( stdVector< vtkBoundingBox > boundingBoxes ) { int const numParts = LvArray::integerConversion< int >( boundingBoxes.size() ); From ae7e57c36b4bce041be8ef7ca4268e3ae3ffecc0 Mon Sep 17 00:00:00 2001 From: arng40 Date: Thu, 20 Nov 2025 11:57:51 +0100 Subject: [PATCH 58/63] fix declaration --- scripts/check_code_rules.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index a4ec0c28e63..d2ccf8c8b42 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -23,7 +23,7 @@ check_container_usage() { print_violation() { local violation_found="$1" - local container="$2" + local -n container="$2" local targetStd="$3" if [ "$violation_found" -eq 1 ];then @@ -107,9 +107,9 @@ if [ $MAP_VIOLATIONS_FOUND -eq 1 ] || [ $UMAP_VIOLATIONS_FOUND -eq 1 ] || [ $VEC echo "SUMMARY: Code rule violations found" echo "----------------------------------------" - print_violation MAP_VIOLATIONS_FOUND ARRAY_MAP "std::map" - print_violation UMAP_VIOLATIONS_FOUND ARRAY_UMAP "std::unordered_map" - print_violation VECTOR_VIOLATIONS_FOUND ARRAY_VECTOR "std::vector" + print_violation "$MAP_VIOLATIONS_FOUND" ARRAY_MAP "std::map" + print_violation "$UMAP_VIOLATIONS_FOUND" ARRAY_UMAP "std::unordered_map" + print_violation "$VECTOR_VIOLATIONS_FOUND" ARRAY_VECTOR "std::vector" echo "" exit 1; From 0dbd595e8978b0a802e26d1dca5580549ed7e1cb Mon Sep 17 00:00:00 2001 From: arng40 Date: Thu, 20 Nov 2025 12:02:37 +0100 Subject: [PATCH 59/63] log --- scripts/check_code_rules.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index d2ccf8c8b42..adbcaacf78b 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -86,6 +86,7 @@ FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); for file in $FILES; do SKIP=0 for exclude in "${FULL_EXCLUDE_PATTERN[@]}"; do + echo "file : ${file} vs exclude ${exclude}" if [[ "$file" == *"$exclude"* ]]; then SKIP=1 break From 7f5aa44797690beb5553006b4bda6e83e5c38ea6 Mon Sep 17 00:00:00 2001 From: arng40 Date: Thu, 20 Nov 2025 13:54:52 +0100 Subject: [PATCH 60/63] update echo --- scripts/check_code_rules.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index adbcaacf78b..6a9d56888d4 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -85,8 +85,9 @@ FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); # Main loop for file in $FILES; do SKIP=0 + echo "file : ${file}" for exclude in "${FULL_EXCLUDE_PATTERN[@]}"; do - echo "file : ${file} vs exclude ${exclude}" + echo " vs exclude ${exclude}" if [[ "$file" == *"$exclude"* ]]; then SKIP=1 break From 84d15e9016d07bb00fa0cd380d76419ccb49bf1e Mon Sep 17 00:00:00 2001 From: arng40 Date: Thu, 20 Nov 2025 14:07:52 +0100 Subject: [PATCH 61/63] refacto find cmd --- scripts/check_code_rules.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 6a9d56888d4..f8b7dca2a58 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -79,14 +79,17 @@ FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}" FULL_EXCLUDE_PATTERN="${FILE_PREFIX}${EXCLUDE_PATTERNS[*]}" FIND_CMD="find" -FIND_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' -FILES=$(eval "$FIND_CMD" 2>/dev/null || echo ""); +FIND_FILE_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' +FILES=$(eval "$FIND_FILE_CMD" 2>/dev/null); + +FIND_EXCLUDE_FILE_CMD="$FIND_CMD $FULL_EXCLUDE_PATTERN"' \( -name "*.hpp" -o -name "*.cpp" \)' +EXCLUDE_FILES=$(eval "$FIND_EXCLUDE_FILE_CMD" 2>/dev/null); # Main loop for file in $FILES; do SKIP=0 echo "file : ${file}" - for exclude in "${FULL_EXCLUDE_PATTERN[@]}"; do + for exclude in $EXCLUDE_FILES; do echo " vs exclude ${exclude}" if [[ "$file" == *"$exclude"* ]]; then SKIP=1 From bc8e010ecd35a313fab7789f8e68b31224b15081 Mon Sep 17 00:00:00 2001 From: arng40 Date: Thu, 20 Nov 2025 14:14:44 +0100 Subject: [PATCH 62/63] remove exclude find --- scripts/check_code_rules.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index f8b7dca2a58..4819c867e2b 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -59,7 +59,6 @@ FILE_PATTERNS=( ) EXCLUDE_PATTERNS=( "common/Datatype.hpp" - "constitutive/PVTPackage/*" "common/StdContainerWrappers.hpp" "dataRepository/BufferOps_inline.hpp" "dataRepository/BufferOps.hpp" @@ -74,22 +73,17 @@ ARRAY_MAP=() ARRAY_UMAP=() ARRAY_VECTOR=() -# Build the find command FULL_FILE_PATTERN="${FILE_PREFIX}${FILE_PATTERNS[*]}" -FULL_EXCLUDE_PATTERN="${FILE_PREFIX}${EXCLUDE_PATTERNS[*]}" - +# Build the find command FIND_CMD="find" FIND_FILE_CMD="$FIND_CMD $FILE_PATH_PATERN"' \( -name "*.hpp" -o -name "*.cpp" \)' FILES=$(eval "$FIND_FILE_CMD" 2>/dev/null); -FIND_EXCLUDE_FILE_CMD="$FIND_CMD $FULL_EXCLUDE_PATTERN"' \( -name "*.hpp" -o -name "*.cpp" \)' -EXCLUDE_FILES=$(eval "$FIND_EXCLUDE_FILE_CMD" 2>/dev/null); - # Main loop for file in $FILES; do SKIP=0 echo "file : ${file}" - for exclude in $EXCLUDE_FILES; do + for exclude in "${EXCLUDE_PATTERNS[@]}"; do echo " vs exclude ${exclude}" if [[ "$file" == *"$exclude"* ]]; then SKIP=1 From 74cad6757621739bb8325e86a8e23bc1e7527c06 Mon Sep 17 00:00:00 2001 From: arng40 Date: Thu, 20 Nov 2025 14:18:14 +0100 Subject: [PATCH 63/63] remove log + revert --- scripts/check_code_rules.sh | 2 -- src/coreComponents/mesh/generators/VTKUtilities.cpp | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/check_code_rules.sh b/scripts/check_code_rules.sh index 4819c867e2b..4ec0e54cd02 100755 --- a/scripts/check_code_rules.sh +++ b/scripts/check_code_rules.sh @@ -82,9 +82,7 @@ FILES=$(eval "$FIND_FILE_CMD" 2>/dev/null); # Main loop for file in $FILES; do SKIP=0 - echo "file : ${file}" for exclude in "${EXCLUDE_PATTERNS[@]}"; do - echo " vs exclude ${exclude}" if [[ "$file" == *"$exclude"* ]]; then SKIP=1 break diff --git a/src/coreComponents/mesh/generators/VTKUtilities.cpp b/src/coreComponents/mesh/generators/VTKUtilities.cpp index 32e0c038d94..93eaf103443 100644 --- a/src/coreComponents/mesh/generators/VTKUtilities.cpp +++ b/src/coreComponents/mesh/generators/VTKUtilities.cpp @@ -251,7 +251,7 @@ buildElemToNodesImpl( AllMeshes & meshes, localIndex const num3dCells = LvArray::integerConversion< localIndex >( meshes.getMainMesh()->GetNumberOfCells() ); localIndex num2dCells = 0; - std::map< string, CollocatedNodes > collocatedNodesMap; + stdMap< string, CollocatedNodes > collocatedNodesMap; for( auto & [fractureName, fractureMesh]: meshes.getFaceBlocks() ) { num2dCells += fractureMesh->GetNumberOfCells(); @@ -561,7 +561,7 @@ AllMeshes loadAllMeshes( Path const & filePath, { int const lastRank = MpiWrapper::commSize() - 1; vtkSmartPointer< vtkDataSet > main = loadMesh( filePath, mainBlockName ); - std::map< string, vtkSmartPointer< vtkDataSet > > faces; + stdMap< string, vtkSmartPointer< vtkDataSet > > faces; for( string const & faceBlockName: faceBlockNames ) { @@ -1008,7 +1008,7 @@ redistributeByKdTree( vtkDataSet & mesh ) return result; } -std::vector< int > +stdVector< int > findNeighborRanks( stdVector< vtkBoundingBox > boundingBoxes ) { int const numParts = LvArray::integerConversion< int >( boundingBoxes.size() );