Skip to content

Commit

Permalink
Merge pull request #20 from ORNL-Fusion/command-line
Browse files Browse the repository at this point in the history
Command line
  • Loading branch information
cianciosa authored Nov 21, 2024
2 parents f0b7beb + 7f9cddd commit 1e328e8
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 4 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci_doxygen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build Documentation
on:
workflow_dispatch:
push:
branches:
- 'master'
jobs:
ci_doxygen:
if: ${{github.ref_name}} == 'master'
runs-on: ubuntu-latest
steps:
- name: Clone Repo
shell: bash
working-directory: ${{runner.workspace}}
run: |
git clone https://github.com/ORNL-Fusion/Stellarator-Tools.git ${{runner.workspace}}/Stellarator-Tools
git clone https://token:${{secrets.AUTH_TOKEN}}@github.com/ORNL-Fusion/Stellarator-Tools-Docs.git
- name: Create build directory.
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools
run: cmake -E make_directory build
- name: Install Libraries Linux
shell: bash
run: |
sudo apt update
sudo apt-get install libnetcdf-dev
sudo apt-get install libnetcdff-dev
sudo apt-get install libopenmpi-dev
sudo apt-get install libscalapack-openmpi-dev
sudo apt-get install doxygen
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
run: cmake -DBUILD_BOOZ_XFORM=ON -DBUILD_V3FIT=ON -DBUILD_V3RFUN=ON -DBUILD_SIESTA=ON -DBUILD_LGRID=ON -DBUILD_SURFACE=ON -DBUILD_BMW=ON -DBUILD_PARVMEC=ON -DBUILD_DESCUR=ON -DDOXYGEN_OUTPUT_DIRECTORY=${{runner.workspace}}/Stellarator-Tools-Docs -DDOXYGEN_HTML_OUTPUT=docs ../
- name: Build
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
run: make doc
- name: Push changes.
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools-Docs/docs
env:
GITHUB_TOKEN: ${{secrets.AUTH_TOKEN}}
run: |
git config user.name ${{secrets.AUTH_USER}}
git config user.email ${{secrets.AUTH_EMAIL}}
git add *
git commit . -m "Update Doxygen docs."
git push origin main
82 changes: 78 additions & 4 deletions Sources/bmw_commandline_parser.f
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ MODULE bmw_commandline_parser
& is_flag_set => bmw_commandline_parser_is_flag_set
PROCEDURE, PASS :: flag_requires_value => &
& bmw_commandline_parser_flag_requires_value
PROCEDURE, PASS :: &
& check_arg => bmw_commandline_parser_check_arg
FINAL :: bmw_commandline_parser_destruct
END TYPE

Expand Down Expand Up @@ -197,23 +199,28 @@ FUNCTION bmw_commandline_parser_construct(parallel)
CALL bmw_commandline_parser_print_help
END IF

bmw_commandline_parser_construct%arg(i) = TRIM(temp)
bmw_commandline_parser_construct%arg(i) = &
& TRIM(bmw_commandline_parser_construct%check_arg(temp))
bmw_commandline_parser_construct%value(i) = ''
ELSE
bmw_commandline_parser_construct%arg(i) = &
& temp(1:value_index - 1)
& TRIM(bmw_commandline_parser_construct%check_arg( &
& temp(1:value_index - 1)))
bmw_commandline_parser_construct%value(i) = &
& temp(value_index + 1:LEN_TRIM(temp))
END IF
END IF
ELSE
WRITE (*,1000) temp
END IF

CALL bmw_commandline_parser_flag_requires_value( &
CALL bmw_commandline_parser_flag_requires_value( &
& bmw_commandline_parser_construct, i)
END DO

CALL profiler_set_stop_time('bmw_commandline_parser_construct', &
& start_time)

1000 FORMAT('Invalid commandline argument: ',a)
END FUNCTION

!*******************************************************************************
Expand Down Expand Up @@ -511,6 +518,73 @@ SUBROUTINE bmw_commandline_parser_flag_requires_value(this, index)

END SUBROUTINE

!-------------------------------------------------------------------------------
!> @brief Check if a command line argument is valid.
!>
!> Valid commands are
!>
!> * -h
!> * -mgridf
!> * -woutf
!> * -wvacf
!> * -siestaf
!> * -outf
!> * -logf
!> * -jv
!> * -ju
!> * -p_start
!> * -p_end
!> * -para
!> * -force
!> * -num_r
!> * -num_p
!> * -num_z
!> * -rmax
!> * -rmin
!> * -zmax
!> * -zmin
!>
!> @param[in] this A @ref bmw_commandline_parser_class instance.
!> @param[in] arg A command line argument to check.
!> @returns The argument if it's valid.
!-------------------------------------------------------------------------------
FUNCTION bmw_commandline_parser_check_arg(this, arg)
IMPLICIT NONE
! Declare Arguments
CHARACTER (len=path_length) :: bmw_commandline_parser_check_arg
CLASS (bmw_commandline_parser_class), INTENT(in) :: this
CHARACTER (len=*), INTENT(in) :: arg
! Local arguments
INTEGER :: i
REAL (rprec) :: start_time
! Start of executable code
start_time = profiler_get_start_time()
SELECT CASE (TRIM(arg))
CASE ('-h','-mgridf','-woutf','-wvacf','-siestaf','-outf', &
& '-logf','-jv','-ju','-p_start','-p_end','-para', &
& '-force','-num_r','-num_p','-num_z','-rmax','-rmin', &
& '-zmax','-zmin')
bmw_commandline_parser_check_arg = arg
CASE DEFAULT
WRITE (*,1000) TRIM(arg)
CALL bmw_commandline_parser_print_help
END SELECT
CALL profiler_set_stop_time('bmw_commandline_parser_check_arg', &
& start_time)
1000 FORMAT('Invalid commandline argument: ',a)
END FUNCTION
!-------------------------------------------------------------------------------
!> @brief Print out help text.
!>
Expand Down

0 comments on commit 1e328e8

Please sign in to comment.