Skip to content

Commit 565178a

Browse files
Add mfc commands to argparser (#948)
1 parent df321c8 commit 565178a

File tree

5 files changed

+70
-39
lines changed

5 files changed

+70
-39
lines changed

src/pre_process/m_check_ib_patches.fpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ contains
4141
if (i <= num_ibs) then
4242
! call s_check_patch_geometry(i)
4343
call s_int_to_str(i, iStr)
44+
@:PROHIBIT(patch_ib(i)%geometry == dflt_int, "IB patch undefined. &
45+
patch_ib("//trim(iStr)//")%geometry must be set.")
4446

4547
! Constraints on the geometric initial condition patch parameters
4648
if (patch_ib(i)%geometry == 2) then
@@ -60,22 +62,15 @@ contains
6062
else if (patch_ib(i)%geometry == 5 .or. &
6163
patch_ib(i)%geometry == 12) then
6264
call s_check_model_ib_patch_geometry(i)
63-
else if (patch_ib(i)%geometry == dflt_int) then
64-
call s_prohibit_abort("IB patch undefined", &
65-
"patch_ib("//trim(iStr)//")%geometry must be set.")
6665
else
6766
call s_prohibit_abort("Invalid IB patch", &
6867
"patch_ib("//trim(iStr)//")%geometry must be "// &
6968
"2-4, 8-10, 11 or 12.")
7069
end if
7170
else
72-
if (patch_ib(i)%geometry == dflt_int) then
73-
call s_check_inactive_ib_patch_geometry(i)
74-
else
75-
call s_prohibit_abort("Inactive IB patch defined", &
76-
"patch_ib("//trim(iStr)//")%geometry "// &
77-
"must not be set for inactive patches.")
78-
end if
71+
@:PROHIBIT(patch_ib(i)%geometry /= dflt_int, "Inactive IB patch defined. "// &
72+
"patch_ib("//trim(iStr)//")%geometry must not be set for inactive patches.")
73+
call s_check_inactive_ib_patch_geometry(i)
7974
end if
8075
end do
8176

src/pre_process/m_check_patches.fpp

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ contains
4646
if (i <= num_patches) then
4747
! call s_check_patch_geometry(i)
4848
call s_int_to_str(i, iStr)
49+
@:PROHIBIT(patch_icpp(i)%geometry == 6, "Invalid patch geometry number. "// &
50+
"patch_icpp("//trim(iStr)//")%geometry is deprecated.")
51+
@:PROHIBIT(patch_icpp(i)%geometry == 7, "Invalid patch geometry number. "// &
52+
"patch_icpp("//trim(iStr)//")%geometry is deprecated.")
53+
@:PROHIBIT(patch_icpp(i)%geometry == 13, "Invalid patch geometry number. "// &
54+
"patch_icpp("//trim(iStr)//")%geometry is deprecated.")
55+
@:PROHIBIT(patch_icpp(i)%geometry == 15, "Invalid patch geometry number. "// &
56+
"patch_icpp("//trim(iStr)//")%geometry is deprecated.")
57+
@:PROHIBIT(patch_icpp(i)%geometry == dflt_int, "Invalid patch geometry number. "// &
58+
"patch_icpp("//trim(iStr)//")%geometry must be set.")
59+
4960
! Constraints on the geometric initial condition patch parameters
5061
if (patch_icpp(i)%geometry == 1) then
5162
call s_check_line_segment_patch_geometry(i)
@@ -57,12 +68,6 @@ contains
5768
call s_check_line_sweep_patch_geometry(i)
5869
elseif (patch_icpp(i)%geometry == 5) then
5970
call s_check_ellipse_patch_geometry(i)
60-
elseif (patch_icpp(i)%geometry == 6) then
61-
call s_prohibit_abort("Invalid patch geometry number", "patch_icpp("//trim(iStr)//")%geometry "// &
62-
"is deprecated")
63-
elseif (patch_icpp(i)%geometry == 7) then
64-
call s_prohibit_abort("Invalid patch geometry number", "patch_icpp("//trim(iStr)//")%geometry "// &
65-
"is deprecated")
6671
elseif (patch_icpp(i)%geometry == 8) then
6772
call s_check_sphere_patch_geometry(i)
6873
elseif (patch_icpp(i)%geometry == 9) then
@@ -73,31 +78,21 @@ contains
7378
call s_check_plane_sweep_patch_geometry(i)
7479
elseif (patch_icpp(i)%geometry == 12) then
7580
call s_check_ellipsoid_patch_geometry(i)
76-
elseif (patch_icpp(i)%geometry == 13) then
77-
call s_prohibit_abort("Invalid patch geometry number", "patch_icpp("//trim(iStr)//")%geometry "// &
78-
"is deprecated")
7981
elseif (patch_icpp(i)%geometry == 14) then
8082
call s_check_spherical_harmonic_patch_geometry(i)
81-
elseif (patch_icpp(i)%geometry == 15) then
82-
call s_prohibit_abort("Invalid patch geometry number", "patch_icpp("//trim(iStr)//")%geometry "// &
83-
"is deprecated")
8483
elseif (patch_icpp(i)%geometry == 20) then
8584
call s_check_2D_TaylorGreen_vortex_patch_geometry(i)
8685
elseif (patch_icpp(i)%geometry == 21) then
8786
call s_check_model_geometry(i)
88-
elseif (patch_icpp(i)%geometry == dflt_int) then
89-
call s_prohibit_abort("Active patch undefined", "patch_icpp("//trim(iStr)//")%geometry must be set")
9087
else
9188
call s_prohibit_abort("Invalid patch geometry number", "patch_icpp("//trim(iStr)//")%geometry "// &
9289
"must be between 1 and 21")
9390
end if
9491
else
95-
if (patch_icpp(i)%geometry == dflt_int) then
96-
call s_check_inactive_patch_geometry(i)
97-
else
98-
call s_prohibit_abort("Inactive patch defined", "patch_icpp("//trim(iStr)//")%geometry must not be set. "// &
99-
"Patch "//trim(iStr)//" is inactive as the number of patches is "//trim(num_patches_str))
100-
end if
92+
@:PROHIBIT(patch_icpp(i)%geometry /= dflt_int, "Inactive patch defined. "// &
93+
"patch_icpp("//trim(iStr)//")%geometry not be set for inactive patches. "// &
94+
"Patch "//trim(iStr)//" is inactive as the number of patches is "//trim(num_patches_str))
95+
call s_check_inactive_patch_geometry(i)
10196
end if
10297
end do
10398

toolchain/bootstrap/format.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
#!/bin/bash
22

3+
# Function to display help message
4+
show_help() {
5+
echo "Usage: $(basename "$0") [OPTIONS]"
6+
echo "This function formats all code in and below the current execution directory."
7+
echo ""
8+
echo "Options:"
9+
echo " -h, --help Display this help message and exit."
10+
echo " -j, --jobs JOBS Runs JOBS number of jobs."
11+
echo ""
12+
exit 0
13+
}
14+
315
while [[ $# -gt 0 ]]; do
416
case "$1" in
517
-j|--jobs)
618
JOBS="$2"
719
shift
820
;;
21+
-h | --help)
22+
show_help
23+
;;
924
*)
1025
echo "Format, unknown argument: $1."
1126
exit 1

toolchain/bootstrap/modules.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
#!/bin/bash
22

3+
# Function to display help message
4+
show_help() {
5+
echo "Usage: $(basename "$0") [OPTIONS]"
6+
echo "This function loads in modules for a specific computer and mode"
7+
echo ""
8+
echo "Options:"
9+
echo " -h, --help Display this help message and exit."
10+
echo " -c, --computer COMPUTER Configures for COMPUTER environment."
11+
echo " Options: Ascent (a) | Frontier (f) | Summit (s) | Wombat (w)"
12+
echo " Bridges2 (b) | Expanse (e) | Delta (d) | DeltaAI (dai)"
13+
echo " Phoenix (p) | Richardson (r) | Oscar (o)"
14+
echo " Carpenter Cray (cc) | Carpenter GNU (c) | Nautilus (n)"
15+
echo " -m, --mode MODE Configures into MODE."
16+
echo " Options: gpu (g) | cpu (c)"
17+
echo ""
18+
exit 0
19+
}
20+
321
unset u_c
422
unset u_cg
523

@@ -12,6 +30,7 @@ while [[ $# -gt 0 ]]; do
1230
case $1 in
1331
-c|--computer) u_c="$2"; shift; shift; ;;
1432
-m|--mode) u_cg="$2"; shift; shift; ;;
33+
-h|--help) show_help; shift; shift; ;;
1534
-*|--*) echo "Unknown option $1"; return; ;;
1635
esac
1736
done

toolchain/mfc/args.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,23 @@ def parse(config):
1717
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
1818
)
1919

20+
# Here are all of the parser arguments that call functions in other python files
2021
parsers = parser.add_subparsers(dest="command")
21-
run = parsers.add_parser(name="run", help="Run a case with MFC.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
22-
test = parsers.add_parser(name="test", help="Run MFC's test suite.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
23-
build = parsers.add_parser(name="build", help="Build MFC and its dependencies.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
24-
clean = parsers.add_parser(name="clean", help="Clean build artifacts.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
25-
bench = parsers.add_parser(name="bench", help="Benchmark MFC (for CI).", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
26-
bench_diff = parsers.add_parser(name="bench_diff", help="Compare MFC Benchmarks (for CI).", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
27-
count = parsers.add_parser(name="count", help="Count LOC in MFC.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
28-
count_diff = parsers.add_parser(name="count_diff", help="Count LOC in MFC.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
29-
packer = parsers.add_parser(name="packer", help="Packer utility (pack/unpack/compare)", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
22+
run = parsers.add_parser(name="run", help="Run a case with MFC.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
23+
test = parsers.add_parser(name="test", help="Run MFC's test suite.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
24+
build = parsers.add_parser(name="build", help="Build MFC and its dependencies.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
25+
clean = parsers.add_parser(name="clean", help="Clean build artifacts.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
26+
bench = parsers.add_parser(name="bench", help="Benchmark MFC (for CI).", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
27+
bench_diff = parsers.add_parser(name="bench_diff", help="Compare MFC Benchmarks (for CI).", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
28+
count = parsers.add_parser(name="count", help="Count LOC in MFC.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
29+
count_diff = parsers.add_parser(name="count_diff", help="Count LOC in MFC.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
30+
packer = parsers.add_parser(name="packer", help="Packer utility (pack/unpack/compare).", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
31+
32+
# These parser arguments all call BASH scripts, and they only exist so that they show up in the help message
33+
parsers.add_parser(name="load", help="Loads the MFC environment with source.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
34+
parsers.add_parser(name="lint", help="Lints all code after editing.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
35+
parsers.add_parser(name="format", help="Formats all code after editing.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
36+
parsers.add_parser(name="spelling", help="Runs the spell checker after editing.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
3037

3138
packers = packer.add_subparsers(dest="packer")
3239
pack = packers.add_parser(name="pack", help="Pack a case into a single file.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)

0 commit comments

Comments
 (0)