Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HOHQMeshMain.f90 #121

Merged
merged 6 commits into from
Dec 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions Source/HOHQMeshMain.f90
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ END PROGRAM HOQMeshMain
SUBROUTINE ReadCommandLineArguments(version, test, generateTest, controlFileName, path)
USE CommandLineReader
USE ProgramGlobals
USE, INTRINSIC :: iso_fortran_env, only : stderr => ERROR_UNIT
IMPLICIT NONE
!
! ---------
Expand All @@ -162,13 +161,13 @@ SUBROUTINE ReadCommandLineArguments(version, test, generateTest, controlFileName


IF ( CommandLineArgumentIsPresent("-version") ) THEN
PRINT *, "HOMesh Version ", version
PRINT *, "HOHQMesh Version ", version
STOP
END IF

IF ( CommandLineArgumentIsPresent("-help") ) THEN
sloede marked this conversation as resolved.
Show resolved Hide resolved
WRITE(stderr,*) "No help available yet. Sorry!"
ERROR STOP "No help available"
CALL PrintHelpMessage()
STOP
END IF

test = .false.
Expand Down Expand Up @@ -201,3 +200,33 @@ SUBROUTINE ReadCommandLineArguments(version, test, generateTest, controlFileName
END IF

END SUBROUTINE ReadCommandLineArguments
!
!////////////////////////////////////////////////////////////////////////
!
SUBROUTINE PrintHelpMessage()
USE, INTRINSIC :: iso_fortran_env, only : OUTPUT_UNIT
IMPLICIT NONE
WRITE(OUTPUT_UNIT,*) "HOHQMesh Help..."
WRITE(OUTPUT_UNIT,*) "Invocation:"
WRITE(OUTPUT_UNIT,*) " ./HOHQMesh [options]"
WRITE(OUTPUT_UNIT,*) "Options:"
WRITE(OUTPUT_UNIT,*) "-help"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WRITE(OUTPUT_UNIT,*) "-help"
WRITE(OUTPUT_UNIT,*) "-help or --help"

For consistency if both commands are allowed.

Copy link

@fhindenlang fhindenlang Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

best is to also check if all command line arguments could be associated, and if not, print the help instead.
so if someone would now type -h, which is not part of the possible arguments, then the help would still appear.
From the argument syntax, I am more used to a minus with one letter, like -f followed by space and value, or an equivalent long argument like --file followed by = and value.
All this functionality would be provided by CLAF90, you should give it a try...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of issues with CLAF90, though. 1. No license. 2. We then depend on them maintaining it. I have been burned too many times over the years by libraries that stop being maintained and hence avoid them.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well the license says that you can copy it, so I just copied it into my code, its not something that need maintenance. But no worries, its your choice ;)

WRITE(OUTPUT_UNIT,*) " Prints this message. For the user manual, "
WRITE(OUTPUT_UNIT,*) " see https://trixi-framework.github.io/HOHQMesh/."
WRITE(OUTPUT_UNIT,*) "-version"
WRITE(OUTPUT_UNIT,*) " Prints the current version number of the software."
WRITE(OUTPUT_UNIT,*) "-f <ControlFileName>"
WRITE(OUTPUT_UNIT,*) " Generates a mesh using the control file <ControlFileName>."
WRITE(OUTPUT_UNIT,*) "-verbose"
WRITE(OUTPUT_UNIT,*) " Log the meshing progress to the screen."
WRITE(OUTPUT_UNIT,*) "-test"
WRITE(OUTPUT_UNIT,*) " Runs the test sequence"
WRITE(OUTPUT_UNIT,*) "-path <path>"
WRITE(OUTPUT_UNIT,*) " Use to specify location of the HOHQMesh directory for the test sequence."
WRITE(OUTPUT_UNIT,*) "-sLimit n"
WRITE(OUTPUT_UNIT,*) " Increase the number of subdivisions allowed to 2^n. Default is n = 8."
WRITE(OUTPUT_UNIT,*) "-generateTest"
WRITE(OUTPUT_UNIT,*) " Generates a test mesh using the control file. "
WRITE(OUTPUT_UNIT,*) " See https://trixi-framework.github.io/HOHQMesh/adding-a-new-test/"

END SUBROUTINE PrintHelpMessage
Loading