diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..d60f070 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "monthly" diff --git a/.github/workflows/SpellCheck.yml b/.github/workflows/SpellCheck.yml new file mode 100644 index 0000000..a780e97 --- /dev/null +++ b/.github/workflows/SpellCheck.yml @@ -0,0 +1,13 @@ +name: Spell Check + +on: [pull_request, workflow_dispatch] + +jobs: + typos-check: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Check spelling + uses: crate-ci/typos@v1.16.26 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..03e0248 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +on: + push: + branches: + - main + paths-ignore: + - 'AUTHORS.md' + - 'LICENSE.md' + - 'README.md' + pull_request: + paths-ignore: + - 'AUTHORS.md' + - 'LICENSE.md' + - 'README.md' + workflow_dispatch: + inputs: + debug_enabled: + description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' + required: false + default: false + +jobs: + test: + if: "!contains(github.event.head_commit.message, 'skip ci')" + name: ${{ matrix.os }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Configure + run: | + mkdir build && cd build + cmake .. -DCMAKE_INSTALL_PREFIX=../install + - name: Build + run: | + cd build + make -j 2 + - name: Install + run: | + cd build + make install + - name: Run test + run: | + install/bin/test_smesh + # Enable tmate debugging of manually-triggered workflows if the input option was provided + - name: Setup tmate session for debugging + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled && always() }} + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 15 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dc28c5a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/ +install/ diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..fc6c32b --- /dev/null +++ b/.typos.toml @@ -0,0 +1,4 @@ +[default.extend-words] +inout = "inout" +INOUT = "INOUT" +alle = "alle" diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8e18656 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required (VERSION 3.5.1) + +# Get project version from `VERSION` file +file(READ "${CMAKE_SOURCE_DIR}/VERSION" version_file) +# Parse string +if (${version_file} MATCHES "(([0-9]+)\\.([0-9]+)\\.([0-9]+)([+-]([A-Za-z0-9_-]+))?)") + set(SMESH_VERSION ${CMAKE_MATCH_1}) + set(SMESH_VERSION_MAJOR ${CMAKE_MATCH_2}) + set(SMESH_VERSION_MINOR ${CMAKE_MATCH_3}) + set(SMESH_VERSION_PATCH ${CMAKE_MATCH_4}) + set(SMESH_VERSION_PRERELEASE ${CMAKE_MATCH_6}) +else() + message(FATAL_ERROR "Unable to parse version from `VERSION` file") +endif() + +project(smesh + VERSION ${SMESH_VERSION_MAJOR}.${SMESH_VERSION_MINOR}.${SMESH_VERSION_PATCH} + LANGUAGES Fortran) + +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + +add_library(smesh SHARED + ${CMAKE_SOURCE_DIR}/src/smesh.f90 +) + +add_library(input_output SHARED + ${CMAKE_SOURCE_DIR}/src/input_output.f90 +) + +add_executable(test_smesh + ${CMAKE_SOURCE_DIR}/src/test_smesh.f90 +) +target_link_libraries(test_smesh PRIVATE smesh input_output) + +install(TARGETS smesh input_output test_smesh) diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..0d4d124 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0-dev diff --git a/output_data/.gitignore b/output_data/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/output_data/.gitignore @@ -0,0 +1 @@ +* diff --git a/output_data/empty.txt b/output_data/empty.txt deleted file mode 100644 index 7b4d68d..0000000 --- a/output_data/empty.txt +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/input_output.f90 b/src/input_output.f90 similarity index 100% rename from input_output.f90 rename to src/input_output.f90 diff --git a/smesh.f90 b/src/smesh.f90 similarity index 99% rename from smesh.f90 rename to src/smesh.f90 index ec40e62..3dc2873 100644 --- a/smesh.f90 +++ b/src/smesh.f90 @@ -131,7 +131,7 @@ SUBROUTINE build_delaunay_triangulation(ve_out, data_points, shuffle, verbose) ! some degree of spatial organization, apparently not shuffling them leads to ! very short search times when starting the search at the last inserted triangle, ! while shuffling renders very few edge flips necessary in orger to - ! mantain the delaunay property. + ! maintain the delaunay property. IF (present(shuffle)) THEN IF (shuffle) THEN @@ -268,7 +268,7 @@ SUBROUTINE build_delaunay_triangulation(ve_out, data_points, shuffle, verbose) pt(:,ve(2,j)), pt(:,ve(3,j)), triangle_inside) IF (triangle_inside) THEN ! The point has been located inside the triangle j - ! Save the informations about the old triangle j and build k1 and k2 + ! Save the information about the old triangle j and build k1 and k2 k1 = k + 1 k2 = k + 2 ! WRITE(*,"(A, I6, A, I6, A, I6, A, I6, A, I6)") "Point ", i, & @@ -322,7 +322,7 @@ SUBROUTINE build_delaunay_triangulation(ve_out, data_points, shuffle, verbose) bc(:, j) = sum(pt(:,ve(:, j)),2)*oot bc(:,k1) = sum(pt(:,ve(:,k1)),2)*oot bc(:,k2) = sum(pt(:,ve(:,k2)),2)*oot - k = k2 ! 3 triangles added - 1 deletd + k = k2 ! 3 triangles added - 1 deleted END IF END IF IF (triangle_inside .or. triangle_edge) THEN @@ -794,7 +794,7 @@ END SUBROUTINE fuzzy_test_segment PURE SUBROUTINE onedge(p, v1, v2, v3, edge, ii) ! Tests if p lies on an edge of triangle (v1, v2, v3). - ! Returns the index of the edge yelding maximum collinearity + ! Returns the index of the edge yielding maximum collinearity REAL(8), DIMENSION(2), INTENT(IN) :: p, v1, v2, v3 LOGICAL, INTENT(OUT) :: edge INTEGER, INTENT(OUT) :: ii @@ -995,7 +995,7 @@ PURE FUNCTION obtuse(po, pe1, pe2) obtuse = sum((pe1 - po)*(pe2 - po)) .lt. 0.0d0 ! in doubt we might say that pi/2 and slightly less is still ! obtuse and generate one more node, for robustness - ! but maybe we introduce instability on boundig box borders? + ! but maybe we introduce instability on bounding box borders? END FUNCTION obtuse PURE FUNCTION acute(po, pe1, pe2) @@ -1004,7 +1004,7 @@ PURE FUNCTION acute(po, pe1, pe2) acute = sum((pe1 - po)*(pe2 - po)) .gt. 0.0d0 ! in doubt we might say that pi/2 and slightly less is still ! obtuse and generate one more node, for robustness - ! but maybe we introduce instability on boundig box borders? + ! but maybe we introduce instability on bounding box borders? END FUNCTION acute PURE FUNCTION near_obtuse(po, pe1, pe2, cosmin) diff --git a/test_smesh.f90 b/src/test_smesh.f90 similarity index 100% rename from test_smesh.f90 rename to src/test_smesh.f90