From 0dadfbccbf5cd89f72c75c9f46be8bbd11ea9ea0 Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Sat, 24 May 2025 12:29:08 +0200 Subject: [PATCH 01/11] Enhance WebAssembly output configuration in compile_to_js.sh --- distributions/JavaScript/compile_to_js.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/distributions/JavaScript/compile_to_js.sh b/distributions/JavaScript/compile_to_js.sh index 7104f805..3782a326 100755 --- a/distributions/JavaScript/compile_to_js.sh +++ b/distributions/JavaScript/compile_to_js.sh @@ -108,4 +108,14 @@ funs='[' funs+=']' -emcc build/libat.a $GSL_LIBRARY $GSL_CBLAS_LIBRARY -o output/libat.html -sWASM=$WASM -sEXPORTED_FUNCTIONS="$funs" -sEXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' || exit 1 +emcc build/libat.a ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} \ + -o output/libat.js \ + -sWASM=${WASM} \ + -sEXPORTED_FUNCTIONS="${funs}" \ + -sEXPORTED_RUNTIME_METHODS='["ccall", "cwrap", "HEAPF64", "HEAPF32", "HEAPU8", "HEAPU16", "HEAPU32", "HEAPI8", "HEAPI16", "HEAPI32"]' \ + -sMODULARIZE=1 \ + -sEXPORT_NAME="createModule" \ + -sALLOW_MEMORY_GROWTH=1 \ + -sENVIRONMENT='web' \ + -O3 \ + || { echo "emcc failed"; exit 1; } \ No newline at end of file From 081a2fec1123cf8c9620a913835e6b8a3cab576c Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Sat, 24 May 2025 17:38:16 +0200 Subject: [PATCH 02/11] Add README files for Python and R wrappers of libamtrack --- distributions/Python/pyamtrack/README.md | 29 +++++++++++++++++++++++ distributions/Python/pyamtrack/README.txt | 3 --- distributions/R/README.md | 8 +++++++ 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 distributions/Python/pyamtrack/README.md delete mode 100644 distributions/Python/pyamtrack/README.txt create mode 100644 distributions/R/README.md diff --git a/distributions/Python/pyamtrack/README.md b/distributions/Python/pyamtrack/README.md new file mode 100644 index 00000000..1a30d50a --- /dev/null +++ b/distributions/Python/pyamtrack/README.md @@ -0,0 +1,29 @@ +# pyamtrack + +This directory contains a Python wrapper for the [libamtrack](https://github.com/libamtrack/libamtrack) library, supporting versions up to **0.14.0**. + +## Latest Stable Release + +- **Version:** 0.14.0 +- **Release Date:** 2022-10-03 + +## Limitations of Version 0.14.0 + +- Only available as a binary wheel package for **Linux** (no support for Windows or macOS). +- No official documentation describing the available functions or usage examples. + +## Current Development + +Active development of pyamtrack has moved to a new repository: + +- **GitHub:** [https://github.com/libamtrack/pyamtrack/](https://github.com/libamtrack/pyamtrack/) +- **Documentation:** [https://libamtrack.github.io/docs/python/](https://libamtrack.github.io/docs/python/) + +Please refer to the new repository and documentation for the latest features, installation instructions, and usage guides. + +## Getting Help + +For questions, issues, or contributions, please use the [new GitHub repository](https://github.com/libamtrack/pyamtrack/). + +--- +This file documents the legacy Python wrapper for libamtrack up to version 0.14.0. \ No newline at end of file diff --git a/distributions/Python/pyamtrack/README.txt b/distributions/Python/pyamtrack/README.txt deleted file mode 100644 index bee5b548..00000000 --- a/distributions/Python/pyamtrack/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -## Use cBinder - -https://github.com/Tetrite/cBinder \ No newline at end of file diff --git a/distributions/R/README.md b/distributions/R/README.md new file mode 100644 index 00000000..01254ccf --- /dev/null +++ b/distributions/R/README.md @@ -0,0 +1,8 @@ +# libamtrack R Plugin + +The **libamtrack R plugin** previously existed in the [CRAN repository](https://cran.r-project.org/web/packages/libamtrack/index.html), but was removed on 2019-09-03. + +This directory contains a **work in progress** on a new R package for libamtrack, aimed at physicists and researchers working with ion beam therapy and related applications. + +> **Note:** +> There is currently **no stable or working version** available. Contributions and feedback are welcome as development continues. From 40fdc5c2d26a10d5bf1ddce8429f85da80dfe303 Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Sat, 24 May 2025 23:11:38 +0200 Subject: [PATCH 03/11] Remove redundant exported runtime methods in WebAssembly output configuration --- distributions/JavaScript/compile_to_js.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distributions/JavaScript/compile_to_js.sh b/distributions/JavaScript/compile_to_js.sh index 3782a326..406aed4a 100755 --- a/distributions/JavaScript/compile_to_js.sh +++ b/distributions/JavaScript/compile_to_js.sh @@ -112,7 +112,7 @@ emcc build/libat.a ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} \ -o output/libat.js \ -sWASM=${WASM} \ -sEXPORTED_FUNCTIONS="${funs}" \ - -sEXPORTED_RUNTIME_METHODS='["ccall", "cwrap", "HEAPF64", "HEAPF32", "HEAPU8", "HEAPU16", "HEAPU32", "HEAPI8", "HEAPI16", "HEAPI32"]' \ + -sEXPORTED_RUNTIME_METHODS='["ccall", "cwrap", "HEAPF64", "HEAPF32", "HEAPU8", "HEAPU16", "HEAPU32"]' \ -sMODULARIZE=1 \ -sEXPORT_NAME="createModule" \ -sALLOW_MEMORY_GROWTH=1 \ From e6108cc39954500b4bc95183779b1611483ce2f2 Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Sun, 25 May 2025 11:02:11 +0200 Subject: [PATCH 04/11] Update distributions/JavaScript/compile_to_js.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- distributions/JavaScript/compile_to_js.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/distributions/JavaScript/compile_to_js.sh b/distributions/JavaScript/compile_to_js.sh index 406aed4a..5a06bb55 100755 --- a/distributions/JavaScript/compile_to_js.sh +++ b/distributions/JavaScript/compile_to_js.sh @@ -118,4 +118,8 @@ emcc build/libat.a ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} \ -sALLOW_MEMORY_GROWTH=1 \ -sENVIRONMENT='web' \ -O3 \ - || { echo "emcc failed"; exit 1; } \ No newline at end of file + || { echo "emcc failed with return code $?"; \ + echo "Diagnostic information:"; \ + echo " WASM: $WASM"; \ + echo " EXPORTED_FUNCTIONS: $funs"; \ + exit 1; } \ No newline at end of file From 637d699f299dadda8c43d4e438c6923404094b88 Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Sun, 25 May 2025 16:32:21 +0200 Subject: [PATCH 05/11] Add README files for Debian packaging and Matlab wrapper --- distributions/Linux/README.md | 6 ++++++ distributions/Matlab/README.md | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 distributions/Linux/README.md create mode 100644 distributions/Matlab/README.md diff --git a/distributions/Linux/README.md b/distributions/Linux/README.md new file mode 100644 index 00000000..460025c0 --- /dev/null +++ b/distributions/Linux/README.md @@ -0,0 +1,6 @@ +# libamtrack Debian Packaging + +This directory contains scripts and files for packaging **libamtrack** as `.deb` files for installation on Ubuntu systems. + +**Current status:** Unknown, likely not fully working. +**Contributions:** Contributions and improvements are very welcome! \ No newline at end of file diff --git a/distributions/Matlab/README.md b/distributions/Matlab/README.md new file mode 100644 index 00000000..fef3d37f --- /dev/null +++ b/distributions/Matlab/README.md @@ -0,0 +1,12 @@ +# Matlab Wrapper for Library Distributions + +This directory contains the Matlab wrapper for the library's distribution functionalities. + +**Current Status:** +The state of this wrapper is currently unknown. It may be incomplete or require updates. + +## Contributing + +We welcome contributions from anyone interested in fixing, updating, or improving this Matlab wrapper. If you have experience with Matlab or this library, your help would be greatly appreciated! + +Feel free to open issues or submit pull requests. From 5f88975badca330e84467dfe543ef989be49a4b3 Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Sun, 25 May 2025 16:38:43 +0200 Subject: [PATCH 06/11] Add Java and JavaScript distribution files, including README and removal of obsolete scripts --- distributions/Java/{README.txt => README.md} | 0 distributions/JavaScript/CMakeLists.txt | 14 -- distributions/JavaScript/JS_INSTALL | 49 ------- .../JavaScript/{output/.gitkeep => README.md} | 0 distributions/JavaScript/compile_to_js.sh | 125 ------------------ distributions/JavaScript/parse_headers.py | 66 --------- .../JavaScript/trigger_docker_rebuild.sh | 5 - 7 files changed, 259 deletions(-) rename distributions/Java/{README.txt => README.md} (100%) delete mode 100644 distributions/JavaScript/CMakeLists.txt delete mode 100644 distributions/JavaScript/JS_INSTALL rename distributions/JavaScript/{output/.gitkeep => README.md} (100%) delete mode 100755 distributions/JavaScript/compile_to_js.sh delete mode 100644 distributions/JavaScript/parse_headers.py delete mode 100755 distributions/JavaScript/trigger_docker_rebuild.sh diff --git a/distributions/Java/README.txt b/distributions/Java/README.md similarity index 100% rename from distributions/Java/README.txt rename to distributions/Java/README.md diff --git a/distributions/JavaScript/CMakeLists.txt b/distributions/JavaScript/CMakeLists.txt deleted file mode 100644 index b071785c..00000000 --- a/distributions/JavaScript/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 3.7.2) -project(library C) -set(CMAKE_C_STANDARD 99) - -# FIND_PACKAGE(GSL REQUIRED) - doesn't work with `emcmake cmake`, while working with pure `cmake` - -file(GLOB SOURCE_FILES "../../src/*.c") - -include_directories( ${GSL_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/../../include ) - -add_library(at STATIC ${SOURCE_FILES}) -install(TARGETS at DESTINATION ../../lib) - -target_link_libraries(at ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY}) \ No newline at end of file diff --git a/distributions/JavaScript/JS_INSTALL b/distributions/JavaScript/JS_INSTALL deleted file mode 100644 index ea40d11b..00000000 --- a/distributions/JavaScript/JS_INSTALL +++ /dev/null @@ -1,49 +0,0 @@ -1. Download Emscripten and install according to the steps from: - http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html - If your PATH do not contains commands "emcmake","emmake","emcc" (emcmake Commands not found) - In file distributions/JavaScript/compile_to_js.sh - uncomment lines and change path to directory where your emscripten is, i.e.: - - export PATH=$PATH:/home/osboxes/emsdk/emscripten/1.37.36 - -2. Download gsl sources - (you can change path GSL_PATH to f.e. `mktemp -d` - or where you GSL sources are but do not forget change it in CMakeList.txt) - - GSL_PATH=$PWD - echo $GSL_PATH && cd $GSL_PATH && wget "http://ftpmirror.gnu.org/gnu/gsl/gsl-latest.tar.gz" - mkdir $GSL_PATH/gsl-latest && tar -xzf gsl-latest.tar.gz -C $GSL_PATH/gsl-latest - mv $GSL_PATH/gsl-latest/** $GSL_PATH/gsl-latest/gsl - rm -r $GSL_PATH/gsl-latest.tar.gz - - 2.1 And compile to LLVM bytecode (optional, replace -j4 with settings specific to no of CPU cores) - - GSL_ROOT_DIR=$GSL_PATH/gsl-latest/gsl/usr - cd $GSL_PATH/gsl-latest/gsl && emconfigure ./configure --prefix=$PWD/usr && emmake make -j && emmake make install && cd ../../ - - Move generated files to distributions/JavaScript/ (exec from main library dir) - cp $GSL_ROOT_DIR/lib/libgsl.a . - cp $GSL_ROOT_DIR/lib/libgslcblas.a . - - 2.2 If you skipped 2.1 do - cd $GSL_PATH/gsl-latest/gsl/ - ./configure - make -j - -3. (Optional) If you want export some of functions not all first, - regenerate list of functions : - - python3 parse_headers.py. - - Cut everything from funs.txt and put to compile_to_js.sh before line - - emcc libat.a libgsl.a -o libat.html -s WASM=$WASM -s EXPORT_ALL=1 -s EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' - - and change this line to - emcc libat.a libgsl.a -o libat.html -s WASM=$WASM -s EXPORTED_FUNCTIONS="$funs" \ - -4. Run (exec from main_library_dir/distributions/JavaScript/) - export GSL_INCLUDE_DIRS=$GSL_ROOT_DIR/include - export GSL_LIBRARY=$GSL_ROOT_DIR/lib/libgsl.a - export GSL_CBLAS_LIBRARY=$GSL_ROOT_DIR/lib/libgslcblas.a - ./compile_to_js.sh diff --git a/distributions/JavaScript/output/.gitkeep b/distributions/JavaScript/README.md similarity index 100% rename from distributions/JavaScript/output/.gitkeep rename to distributions/JavaScript/README.md diff --git a/distributions/JavaScript/compile_to_js.sh b/distributions/JavaScript/compile_to_js.sh deleted file mode 100755 index 5a06bb55..00000000 --- a/distributions/JavaScript/compile_to_js.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash - -if [ "$1" != "" ]; then - echo "WASM parameter set to $1" - WASM=$1 -else - echo "WASM parameter EMPTY !!! Default set to 1" - WASM=1 -fi - -rm -rf build - -emcmake cmake -DGSL_INCLUDE_DIRS=$GSL_INCLUDE_DIRS -DGSL_LIBRARY=$GSL_LIBRARY -DGSL_CBLAS_LIBRARY=$GSL_CBLAS_LIBRARY -S . -B build || exit 1 -emmake cmake --build build || exit 1 - -funs='[' - - - #----AT_DataParticle.h - funs+='"_AT_atomic_weight_from_particle_no_single",' - - #----AT_DataMaterial.h - funs+='"_AT_density_g_cm3_from_material_no",' - - #----AT_EnergyLoss.h - funs+='"_AT_Vavilov_energy_loss_distribution",' - funs+='"_AT_Gauss_energy_loss_distribution",' - funs+='"_AT_Landau_energy_loss_distribution",' - funs+='"_AT_energy_loss_distribution",' - - #----AT_StoppingPower.h - funs+='"_AT_Mass_Stopping_Power",' - funs+='"_AT_Stopping_Power",' - funs+='"_AT_Mass_Stopping_Power_with_no",' - funs+='"_AT_Stopping_Power_with_no",' - funs+='"_AT_Energy_MeV_u_from_Stopping_Power_single",' - - #----AT_ProtonAnalyticalModels.h - funs+='"_AT_dose_Bortfeld_Gy_multi",' - funs+='"_AT_dose_Bortfeld_Gy_single",' - funs+='"_AT_LET_t_Wilkens_keV_um_multi",' - funs+='"_AT_LET_d_Wilkens_keV_um_multi",' - funs+='"_AT_proton_RBE_multi",' - - #----AT_ProtonAnalyticalBeamParameters.h - funs+='"_AT_range_Bortfeld_cm",' - funs+='"_AT_fwhm_Bortfeld_cm",' - funs+='"_AT_max_plateau_Bortfeld",' - funs+='"_AT_energy_Bortfeld_MeV",' - funs+='"_AT_fit_Bortfeld",' - - #----AT_KatzModel_Implementation.h - funs+='"_AT_KatzModel_KatzExtTarget_inactivation_cross_section_m2",' - funs+='"_AT_KatzModel_CucinottaExtTarget_inactivation_cross_section_m2",' - funs+='"_AT_KatzModel_inactivation_cross_section_m2",' - - #----AT_PhysicsRoutines.h - funs+='"_AT_E_MeV_u_from_E_MeV",' - funs+='"_AT_E_MeV_from_E_MeV_u",' - funs+='"_AT_beta_from_E_single",' - funs+='"_AT_beta_from_E",' - funs+='"_AT_E_from_beta_single",' - funs+='"_AT_E_from_beta",' - funs+='"_AT_E_from_gamma_single",' - funs+='"_AT_E_from_gamma",' - funs+='"_AT_E_MeV_u_from_momentum_single",' - funs+='"_AT_E_MeV_u_from_momentum_MeV_c_u",' - funs+='"_AT_gamma_from_E_single",' - funs+='"_AT_gamma_from_E",' - funs+='"_AT_effective_charge_from_beta_single",' - funs+='"_AT_effective_charge_from_beta",' - funs+='"_AT_energy_straggling_MeV2_cm2_g",' - funs+='"_AT_energy_straggling_after_slab_E_MeV_u",' - funs+='"_AT_effective_charge_from_E_MeV_u_single",' - funs+='"_AT_effective_charge_from_E_MeV_u",' - funs+='"_AT_momentum_from_E_MeV_c_u_single",' - funs+='"_AT_momentum_MeV_c_u_from_E_MeV_u",' - funs+='"_AT_dose_Gy_from_fluence_cm2_single",' - funs+='"_AT_dose_Gy_from_fluence_cm2",' - funs+='"_AT_fluence_cm2_from_dose_Gy_single",' - funs+='"_AT_fluence_cm2_from_dose_Gy",' - funs+='"_AT_Q_from_E_single",' - funs+='"_AT_Qeff_from_E_single",' - - #----AT_RDD_ExtendedTarget.h - funs+='"_AT_RDD_ExtendedTarget_KatzPoint_integrand_Gy",' - funs+='"_AT_RDD_ExtendedTarget_KatzPoint_Gy_by_integration",' - funs+='"_AT_RDD_ExtendedTarget_KatzPoint_Gy",' - funs+='"_AT_RDD_ExtendedTarget_CucinottaPoint_Gy_by_integration",' - funs+='"_AT_RDD_ExtendedTarget_CucinottaPoint_Gy",' - - #----AT_ElectronRange.h - funs+='"_AT_max_electron_ranges_m",' - funs+='"_AT_max_electron_range_m",' - - #----AT_DataRange.h - funs+='"_AT_CSDA_range_g_cm2_multi",' - funs+='"_AT_CSDA_range_g_cm2_single",' - funs+='"_AT_CSDA_energy_after_slab_E_MeV_u_single",' - funs+='"_AT_CSDA_energy_after_slab_E_MeV_u_multi",' - - #----AT_D_RDD_Gy.h - funs+='"_AT_D_RDD_Gy",' - - # malloc needed to allocate memory in Module JS object - - funs+='"_malloc"' - - funs+=']' - -emcc build/libat.a ${GSL_LIBRARY} ${GSL_CBLAS_LIBRARY} \ - -o output/libat.js \ - -sWASM=${WASM} \ - -sEXPORTED_FUNCTIONS="${funs}" \ - -sEXPORTED_RUNTIME_METHODS='["ccall", "cwrap", "HEAPF64", "HEAPF32", "HEAPU8", "HEAPU16", "HEAPU32"]' \ - -sMODULARIZE=1 \ - -sEXPORT_NAME="createModule" \ - -sALLOW_MEMORY_GROWTH=1 \ - -sENVIRONMENT='web' \ - -O3 \ - || { echo "emcc failed with return code $?"; \ - echo "Diagnostic information:"; \ - echo " WASM: $WASM"; \ - echo " EXPORTED_FUNCTIONS: $funs"; \ - exit 1; } \ No newline at end of file diff --git a/distributions/JavaScript/parse_headers.py b/distributions/JavaScript/parse_headers.py deleted file mode 100644 index fbeb6557..00000000 --- a/distributions/JavaScript/parse_headers.py +++ /dev/null @@ -1,66 +0,0 @@ -import os - -include_directory = os.fsencode("../../include") -function_types = ["int", "double", "long", "void"] -function_names = [] -inc_file_names = [] -function_counter = 0 - - -def browse_files(directory): - for file in os.listdir(directory): - filename = os.fsdecode(file) - inc_file_names.append(filename) - function_names.append(parse_file("../../include/" + filename)) - - -def parse_file(filename): - result = [] - - with open(filename, "r") as file: - lines = file.readlines() - - for line in lines: - split_line = line.split() - if len(split_line) >= 2 and split_line[0] in function_types: - if split_line[1][0] == "A": - result.append(split_line[1][:-1]) - - return result - - -def create_script(script_name): - i = 0 - - with open(script_name, "w") as file: - - file.write("\nfuns='['\n") - - for header in function_names: - file.write("\n#----" + inc_file_names[i] + "\n") - - for fun in header: - file.write("funs+='\"_" + fun + "\",' \n") - - i += 1 - - file.write("\nfuns+=']'\n") - - -def print_missing_files(directory): - print("Files not parsed: ") - - for file in os.listdir(directory): - filename = os.fsdecode(file) - - if filename not in inc_file_names: - print(filename) - - -def main(): - browse_files(include_directory) - create_script("funs.txt") - - -if __name__ == "__main__": - main() diff --git a/distributions/JavaScript/trigger_docker_rebuild.sh b/distributions/JavaScript/trigger_docker_rebuild.sh deleted file mode 100755 index b328c9d2..00000000 --- a/distributions/JavaScript/trigger_docker_rebuild.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "master" ]] -then - curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $TRAVIS_TOKEN" -d '{ "request": { "branch":"master", "message": "Build Travis after changes in libamtrack/library" }}' https://api.travis-ci.com/repo/libamtrack%2FDockerFiles/requests -fi From f7813f03e30b56fba64ba573380990597b47e767 Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Sun, 25 May 2025 16:40:02 +0200 Subject: [PATCH 07/11] Remove WebAssembly workflow and update Java README for clarity and maintenance status --- .github/workflows/main.yml | 10 +--- .github/workflows/webassembly-reusable.yml | 66 ---------------------- 2 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 .github/workflows/webassembly-reusable.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2bff31af..844e6bec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,12 +35,4 @@ jobs: if: ${{ needs.build_and_test_linux.result == 'success' }} uses: ./.github/workflows/windows-reusable.yml with: - linux_status: ${{ needs.build_and_test_linux.result }} - - javascript_package: - name: JavaScript Package (WebAssembly) - needs: build_and_test_linux - if: ${{ needs.build_and_test_linux.result == 'success' }} - uses: ./.github/workflows/webassembly-reusable.yml - with: - linux_status: ${{ needs.build_and_test_linux.result }} + linux_status: ${{ needs.build_and_test_linux.result }} \ No newline at end of file diff --git a/.github/workflows/webassembly-reusable.yml b/.github/workflows/webassembly-reusable.yml deleted file mode 100644 index 0b481fc8..00000000 --- a/.github/workflows/webassembly-reusable.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: JavaScript Package (WebAssembly) -permissions: - contents: read - pull-requests: write - -on: - workflow_call: - inputs: - linux_status: - description: 'Status of the Linux Build job' - required: true - type: string - -jobs: - javascript_package: - runs-on: ubuntu-latest - if: ${{ inputs.linux_status == 'success' }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Create local GSL directory - run: mkdir -p "${{ github.workspace }}/usr" - - - uses: mymindstorm/setup-emsdk@v14 - - - name: Cache compiled GSL - id: cache-gsl - uses: actions/cache@v4 - with: - path: ${{ github.workspace }}/usr - key: ${{ runner.os }}-gsl-${{ hashFiles('**/webassembly-reusable.yml') }} - restore-keys: | - ${{ runner.os }}-gsl- - ${{ runner.os }}- - - - name: Compile GSL for WebAssembly - if: steps.cache-gsl.outputs.cache-hit != 'true' - run: | - wget -q "http://ftpmirror.gnu.org/gnu/gsl/gsl-latest.tar.gz" - mkdir -p "${{ github.workspace }}/gsl-latest" - tar -xzf gsl-latest.tar.gz -C "${{ github.workspace }}/gsl-latest" - mv "${{ github.workspace }}/gsl-latest/"* "${{ github.workspace }}/gsl-latest/gsl" - mkdir -p "${{ github.workspace }}/usr" - cd "${{ github.workspace }}/gsl-latest/gsl" && emconfigure ./configure --prefix="${{ github.workspace }}/usr" --disable-shared && emmake make -j && emmake make install - ls -al "${{ github.workspace }}/usr/lib/" - ls -al "${{ github.workspace }}/usr/include/" - - - name: Build WebAssembly Package - working-directory: distributions/JavaScript - env: - GSL_INCLUDE_DIRS: "${{ github.workspace }}/usr/include" - GSL_LIBRARY: "${{ github.workspace }}/usr/lib/libgsl.a" - GSL_CBLAS_LIBRARY: "${{ github.workspace }}/usr/lib/libgslcblas.a" - run: ./compile_to_js.sh - - - name: Upload WebAssembly Artifact - uses: actions/upload-artifact@v4 - with: - name: libamtrack-wasm - path: | - distributions/JavaScript/output/libat.wasm - distributions/JavaScript/output/libat.js - if-no-files-found: error - retention-days: 5 From 5b6d1aa01c35a57eee330ab44c1e323fa5c6b3e6 Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Sun, 25 May 2025 16:43:36 +0200 Subject: [PATCH 08/11] Refactor Java README for clarity and structure; update prerequisites and compilation instructions --- distributions/Java/README.md | 178 ++++++++++++++++++----------------- 1 file changed, 92 insertions(+), 86 deletions(-) diff --git a/distributions/Java/README.md b/distributions/Java/README.md index 29858871..49c7d0a6 100644 --- a/distributions/Java/README.md +++ b/distributions/Java/README.md @@ -1,33 +1,34 @@ -================================================================================================================================== -= Prerequisites +# Java GUI for libamtrack (Unmaintained) -In order to compile Java GUI for libamtrack following things needs to be installed: +> **Note:** This code is not actively maintained. Contributors are welcome! -1. Web browser (preferably Firefox) with Java support installed (Java Java Runtime Environment, see http://java.sun.com/javase/downloads/index.jsp) +## Prerequisites -2. GCC compiler (preferably v.4.0+) . Linux user usually have it by default. Windows users can download - port of GCC for windows - MinGW compiler (Minimalist GNU for Windows), from the webpage http://www.mingw.org/. - -3. Java JDK, for example Sun Java SE v1.6 (visit http://java.sun.com/javase/downloads/widget/jdk6.jsp) +To compile the Java GUI for libamtrack, you need the following: + +1. **Web browser** (preferably Firefox) with Java support installed ([Java Runtime Environment](http://java.sun.com/javase/downloads/index.jsp)) -4. Swig interface compiler, preferably v1.3. On most linux platform it available in the repositories as swig package. -Windows users can download it from project webpage (visit http://www.swig.org/download.html). +2. **GCC compiler** (preferably v4.0+). Linux users usually have it by default. Windows users can download + port of GCC for windows - MinGW compiler (Minimalist GNU for Windows), from the [MinGW webpage](http://www.mingw.org/). + +3. **Java JDK**, for example Sun Java SE v1.6 ([download](http://java.sun.com/javase/downloads/widget/jdk6.jsp)) -5. GNU Scientific Library (http://www.gnu.org/software/gsl/). On most linux platforms it is avalaible in the repositories (please install -also -dev version of packages). Windows users can download it from here: http://gnuwin32.sourceforge.net/packages/gsl.htm +4. **Swig interface compiler**, preferably v1.3. On most Linux platforms it's available in the repositories as `swig` package. + Windows users can download it from the [SWIG project webpage](http://www.swig.org/download.html). +5. **GNU Scientific Library** ([GSL](http://www.gnu.org/software/gsl/)). On most Linux platforms, it's available in the repositories (please install + also `-dev` version of packages). Windows users can download it from [GnuWin32](http://gnuwin32.sourceforge.net/packages/gsl.htm) -================================================================================================================================== -= Compilation +## Compilation -========================================== -== Windows systems +### Windows systems -Locate file wrapper\Java\make_jar.bat and setup following variables: +Locate file `wrapper\Java\make_jar.bat` and setup following variables: +```bat set swigexe="Z:\swig\swig.exe" set jarsignerexe="C:\Program Files\Java\jdk1.6.0_18\bin\jarsigner.exe" set javacexe="C:\Program Files\Java\jdk1.6.0_18\bin\javac.exe" @@ -39,16 +40,16 @@ set gsllib="C:\Program Files\GnuWin32\lib" set gsldllA="C:\Program Files\GnuWin32\bin\libgsl.dll" set gsldllB="C:\Program Files\GnuWin32\bin\libgslcblas.dll" set gccexe="C:\Program Files\MinGW\bin\gcc.exe" +``` -Start windows command line (start -> Run -> cmd.exe), go to the directory -containing make_jar.bat file (using cd command) and run it (typing make_jar.bat). - +Start Windows command line (`Start → Run → cmd.exe`), go to the directory +containing `make_jar.bat` file (using `cd` command) and run it (typing `make_jar.bat`). -========================================== -== Linux systems +### Linux systems -Locate file distributions\Java\make_jar.sh and setup following variables: +Locate file `distributions\Java\make_jar.sh` and setup following variables: +```sh SWIGEXE=swig JARSIGNEREXE=jarsigner JAVACEXE=javac @@ -60,127 +61,132 @@ GSLLIB="/usr/lib" GSLDLLA="/usr/lib/libgsl.so" GSLDLLB="/usr/lib/libgslcblas.so" GCCEXE=gcc +``` Here if you have everything properly installed you will need only to adjust -java include path (you can locate them by trying to find jni.h file using -comand locate jni.h) and gsl libraries (locate libgsl.so). +Java include path (you can locate them by trying to find `jni.h` file using +command `locate jni.h`) and GSL libraries (locate `libgsl.so`). -Start your favorite console, go to the directory -containing make_jar.sh file (using cd command) and run it (typing ./make_jar.sh). +Start your favorite console, go to the directory +containing `make_jar.sh` file (using `cd` command) and run it (typing `./make_jar.sh`). -================================================================================================================================== -= Compilation details +## Compilation details +Both `make_jar` scripts do the same job, just with slightly different parameters of compiler. -Both make_jar scripts do the same job, just with slightly different parameters of compiler. +### Step 1. Generate interface elements using SWIG -========================================== -== Step 1. Generate interface elements using SWIG +First - please read [SWIG tutorial](http://www.swig.org/tutorial.html), then please +inspect file `example.i`. This file includes header files from libamtrack C library and contains list +of functions that we will use in GUI. - -First - please read SWIG tutorial : http://www.swig.org/tutorial.html then please -inspect file example.i -This file includes header files from libamtrack C library and contains list -of function that we will use in GUI. - -Command +Command: +```sh swig -java -o c-swig-src/$SWIGWRAPPER.c -outdir java-swig-src example.i +``` + will create interface files which consist of two sets: -A) C interface (*.c) which will be saved into c-swig-src directory and will be later compiled -together with the C libramtrack library -B) Java interface files (*.java) which will be saved into java-swig-src directory and will be -later compiled with Java libamtrack GUI +A) **C interface** (`*.c`) which will be saved into `c-swig-src` directory and will be later compiled +together with the C libamtrack library -Please do not commit generated files into repository. +B) **Java interface files** (`*.java`) which will be saved into `java-swig-src` directory and will be +later compiled with Java libamtrack GUI +> **Note:** Please do not commit generated files into the repository. -========================================== -== Step 2. Compile libamtrack C library + SWIG C wrapper +### Step 2. Compile libamtrack C library + SWIG C wrapper -In this step all the *.c files will be compiled to the *.o files (these -will go to obj directory). SWIG C wrappers needs to be compiled -with Java JDK include directory as they contains JNI stubs. +In this step all the `*.c` files will be compiled to the `*.o` files (these +will go to `obj` directory). SWIG C wrappers need to be compiled +with Java JDK include directory as they contain JNI stubs. -Finally all *.o files and necessary libraries (GSL) will be linked together -to create C library file (example.dll or libamtrack.so respectively). +Finally all `*.o` files and necessary libraries (GSL) will be linked together +to create C library file (`example.dll` or `libamtrack.so` respectively). Please note that there is difference in compilation flags: -Windows: -fno-strict-aliasing -Linux: -fPIC -and in linking flags: -Windows: -mno-cygwin -Wl,--add-stdcall-alias -Linux: +- Windows: `-fno-strict-aliasing` +- Linux: `-fPIC` +and in linking flags: +- Windows: `-mno-cygwin -Wl,--add-stdcall-alias` +- Linux: *(none specified)* -========================================== -== Step 3. Compile Java GUI +### Step 3. Compile Java GUI -All java source files (*.java) will be compiled in this -step to the java bytecode (*.class): +All Java source files (`*.java`) will be compiled in this +step to the Java bytecode (`*.class`): +```sh $JAVACEXE java-swig-src/*.java src/*.java -d bin/ +``` Compilation is done on SWIG generated stubs and on JAVA GUI source files. -Generated *.class files will be save in bin directory. - +Generated `*.class` files will be saved in the `bin` directory. -========================================== -== Step 3. Create JAR file +### Step 4. Create JAR file -Java bytecode files (*.class), manifest file together with libamtrack C library -and with GSL libraries will packed into JAR file. +Java bytecode files (`*.class`), manifest file together with libamtrack C library +and with GSL libraries will be packed into a JAR file: +```sh $JAREXE cvfm example.jar MANIFEST.MF *.class libexample.so libgsl.so libgslcblas.so +``` + or + +```bat %jarexe% cvfm example.jar MANIFEST.MF *.class example.dll libgsl.dll libgslcblas.dll +``` -Previously generated *.class files are deleted in this step. +Previously generated `*.class` files are deleted in this step. -Generated example.jar file can be now used as local GUI. +Generated `example.jar` file can be now used as local GUI. Can be started by typing command: +```sh java -jar example.jar +``` -========================================== -== Step 4. Sign JAR file +### Step 5. Sign JAR file - -All JAR files that needs to be used in Java Web Start technology -needs to be signed. I've prepared self-signed certificate, stored -in myk file. During signing process it will ask for password, which +All JAR files that need to be used in Java Web Start technology +need to be signed. I've prepared self-signed certificate, stored +in `myk` file. During signing process it will ask for password, which is "libamtrack". If you want to generate your own certificate, please use command: +```sh keytool -genkey -keystore myk -alias jdc +``` -Signed JAR file will be save as webstart/examplesigned-Linux.jar or -webstart/examplesigned-Windows.jar - +Signed JAR file will be saved as `webstart/examplesigned-Linux.jar` or +`webstart/examplesigned-Windows.jar`. -========================================== -== Step 5. Deploying web start application +### Step 6. Deploying Web Start Application In order to run generated JAR archive from within web browser -you will need to adjust *.jnpl file. Please inspect -webstart/libamtrack-linux.jnlp or webstart/libamtrack-windows.jnlp +you will need to adjust `*.jnlp` file. Please inspect +`webstart/libamtrack-linux.jnlp` or `webstart/libamtrack-windows.jnlp` respectively. In the second line of that file you will find: +```xml +``` -Instead of XX you need to put URL. If you test how the applet works +Instead of XXX you need to put URL. If you test how the applet works locally, please put there local URL, like: -file:///home/libamtrack/workspace/AmTrack_reorgan/wrapper/Java/webstart -if you test it on the webserver, put there usuall URL: -http://libamtrack.dkfz.org/libamtrack +`file:///home/libamtrack/workspace/AmTrack_reorgan/wrapper/Java/webstart` +if you test it on the webserver, put there usual URL: +`http://libamtrack.dkfz.org/libamtrack` This URL should point to location where JAR file is stored. -There is also webstart/HelloWorld.html file with links to jnlp files. +There is also `webstart/HelloWorld.html` file with links to jnlp files. From 0da3fed2b4a81c267a27c264477a904f9bdcae5b Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Sun, 25 May 2025 16:51:01 +0200 Subject: [PATCH 09/11] Add comprehensive README for libamtrack distributions, detailing status, features, and requirements for each language-specific package --- distributions/README.md | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 distributions/README.md diff --git a/distributions/README.md b/distributions/README.md new file mode 100644 index 00000000..7c2033b2 --- /dev/null +++ b/distributions/README.md @@ -0,0 +1,63 @@ +# libamtrack Distributions + +This directory contains language-specific and platform-specific distributions of the libamtrack library. The libamtrack library provides computational routines for the prediction of detector response and radiobiological efficiency in heavy charged particle beams. + +## Directory Structure + +### Java + +- **Status:** Unmaintained +- **Description:** Contains Java GUI for libamtrack with compilation scripts for both Windows and Linux +- **Features:** + - Web-based interface with Java support + - Compilation scripts (make_jar.bat for Windows, make_jar.sh for Linux) + - SWIG interface for C/Java integration +- **Requirements:** Java JDK, SWIG, GSL, GCC compiler +- **Note:** Not actively maintained, contributors welcome + +### JavaScript + +- **Status:** Empty/Placeholder +- **Description:** Contains only an empty README.md file +- **Note:** No active development visible + +### Linux + +- **Status:** Unknown, likely not fully working +- **Description:** Contains scripts and files for Debian packaging of libamtrack +- **Features:** Creates .deb files for installation on Ubuntu systems +- **Note:** Contributions and improvements welcome + +### Matlab + +- **Status:** Unknown, potentially incomplete +- **Description:** Contains Matlab wrapper for library's distribution functionalities +- **Features:** + - Wrapper generation scripts + - NAMESPACE definitions +- **Note:** May require updates, contributions welcome + +### Python (pyamtrack) + +- **Status:** Legacy version 0.14.0 (2022-10-03), active development moved to separate repository +- **Description:** Python wrapper for libamtrack library +- **Features:** + - Binary wheel package for Linux only + - Scripts for wheel package generation and testing +- **Limitations:** + - No Windows or macOS support + - Limited documentation +- **Note:** Active development moved to https://github.com/libamtrack/pyamtrack/ + +### R + +- **Status:** Work in progress, no stable version available +- **Description:** R package for libamtrack aimed at physicists and researchers +- **History:** Previously existed in CRAN repository, removed in 2019 +- **Note:** Contributions and feedback welcome + +## Overall Status + +The libamtrack distributions are in varying states of maintenance. The Python distribution has been actively moved to a separate repository, while others (Java, Matlab, R) are either unmaintained or work in progress. Contributions to any of these distributions are welcome. + +For the latest information on libamtrack, refer to the main project repository and documentation. From 5da6b64ec35525da76fed1a535033ed395a5b7ea Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Sun, 25 May 2025 16:52:31 +0200 Subject: [PATCH 10/11] Update JavaScript section in README to reflect active development status and repository link --- distributions/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/distributions/README.md b/distributions/README.md index 7c2033b2..a5b15098 100644 --- a/distributions/README.md +++ b/distributions/README.md @@ -17,9 +17,9 @@ This directory contains language-specific and platform-specific distributions of ### JavaScript -- **Status:** Empty/Placeholder -- **Description:** Contains only an empty README.md file -- **Note:** No active development visible +- **Status:** active development moved to separate repository +- **Description:** Contains only an README.md file +- **Note:** Active development moved to https://github.com/libamtrack/web/ ### Linux From 4c7de8a787c9dc91a34a03b7ed02193630030fd8 Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Sun, 25 May 2025 16:54:12 +0200 Subject: [PATCH 11/11] Add initial JavaScript README with project overview and setup instructions --- distributions/JavaScript/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/distributions/JavaScript/README.md b/distributions/JavaScript/README.md index e69de29b..5bfd4c02 100644 --- a/distributions/JavaScript/README.md +++ b/distributions/JavaScript/README.md @@ -0,0 +1,21 @@ +# JavaScript Bindings for Library Distributions + +This repository provides JavaScript bindings for the core library distributions. + +> **Note:** WebAssembly bindings have been moved to a new repository: +> [https://github.com/libamtrack/web](https://github.com/libamtrack/web) + +Please visit the new repository for the latest WebAssembly support and updates. + +## Overview + +- JavaScript interface for library distributions +- Easy integration with web and Node.js projects + +## Getting Started + +Clone this repository and follow the instructions in the documentation to build and use the JavaScript bindings. + +## License + +Distributed under the terms of the project license. \ No newline at end of file