Skip to content

Commit 43818e4

Browse files
sbryngelsonclaude
andcommitted
Rewrite module briefs, add description tables to landing pages, and lint for missing briefs
- Rewrite ~51 module-level !> @brief descriptions to be concise and descriptive (one sentence, no boilerplate) - Update gen_api_landing.py to extract briefs from source files and render module tables with descriptions on API landing pages - Add check_module_briefs() linter to lint_docs.py ensuring every m_*.fpp/.f90 has a module-level !> @brief before the module declaration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 29ee512 commit 43818e4

57 files changed

Lines changed: 272 additions & 318 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/gen_api_landing.py

Lines changed: 63 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010

1111
from __future__ import annotations
1212

13+
import re
1314
import sys
1415
from pathlib import Path
1516

1617
src_dir = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(".")
1718

19+
_BRIEF_RE = re.compile(r"^!>\s*@brief\s+(.+)", re.IGNORECASE)
20+
1821
TARGETS = {
1922
"pre_process": {
2023
"title": "MFC Pre-Process",
@@ -47,13 +50,60 @@
4750
}
4851

4952

50-
def get_modules(directory: Path) -> list[str]:
51-
"""Return sorted list of module names (m_*) from .fpp and .f90 files."""
52-
modules: set[str] = set()
53+
def _extract_brief(path: Path) -> str:
54+
"""Extract the module-level @brief from a Fortran source file.
55+
56+
Reads the first !> @brief line (outside the @file block) and any
57+
!! continuation lines, joins them, and returns the first sentence.
58+
"""
59+
lines = path.read_text(encoding="utf-8").splitlines()
60+
parts: list[str] = []
61+
in_file_block = False
62+
collecting = False
63+
for line in lines[:40]:
64+
stripped = line.strip()
65+
# Track whether we are inside the @file doc-comment block
66+
if stripped.startswith("!>") and not stripped.startswith("!> @brief"):
67+
in_file_block = True
68+
continue
69+
if in_file_block and stripped.startswith("!!"):
70+
continue
71+
if in_file_block:
72+
in_file_block = False
73+
# Match module-level @brief (outside @file block)
74+
m = _BRIEF_RE.match(stripped)
75+
if m and not collecting:
76+
brief_text = m.group(1).strip()
77+
# Skip file-level "Contains module/program X" briefs
78+
if re.match(r"Contains\s+(module|program)\s+\w+", brief_text):
79+
continue
80+
parts.append(brief_text)
81+
collecting = True
82+
continue
83+
if collecting:
84+
if stripped.startswith("!!"):
85+
parts.append(stripped.lstrip("! ").strip())
86+
else:
87+
break
88+
if not parts:
89+
return ""
90+
text = " ".join(parts)
91+
# Take first sentence only
92+
dot = text.find(". ")
93+
if dot != -1:
94+
text = text[:dot]
95+
return text.rstrip(". ").strip()
96+
97+
98+
def get_modules(directory: Path) -> list[tuple[str, str]]:
99+
"""Return sorted list of (module_name, brief) from .fpp and .f90 files."""
100+
modules: dict[str, str] = {}
53101
for pattern in ("m_*.fpp", "m_*.f90"):
54102
for f in directory.glob(pattern):
55-
modules.add(f.stem)
56-
return sorted(modules)
103+
if f.stem in modules:
104+
continue
105+
modules[f.stem] = _extract_brief(f)
106+
return sorted(modules.items())
57107

58108

59109
for target, info in TARGETS.items():
@@ -74,15 +124,19 @@ def get_modules(directory: Path) -> list[str]:
74124
if target_modules:
75125
lines.append(f"### {info['title'].split()[-1]}")
76126
lines.append("")
77-
for m in target_modules:
78-
lines.append(f"- @ref {m.lower()} \"{m}\"")
127+
lines.append("| Module | Description |")
128+
lines.append("|--------|-------------|")
129+
for name, brief in target_modules:
130+
lines.append(f"| @ref {name.lower()} \"{name}\" | {brief} |")
79131
lines.append("")
80132

81133
if common_modules:
82134
lines.append("### Common (shared)")
83135
lines.append("")
84-
for m in common_modules:
85-
lines.append(f"- @ref {m.lower()} \"{m}\"")
136+
lines.append("| Module | Description |")
137+
lines.append("|--------|-------------|")
138+
for name, brief in common_modules:
139+
lines.append(f"| @ref {name.lower()} \"{name}\" | {brief} |")
86140
lines.append("")
87141

88142
lines.append("## See Also")

docs/post_process/readme.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,36 @@ The post-process component reads raw simulation output and computes derived quan
66

77
### Post-Process
88

9-
- @ref m_checker "m_checker"
10-
- @ref m_data_input "m_data_input"
11-
- @ref m_data_output "m_data_output"
12-
- @ref m_derived_variables "m_derived_variables"
13-
- @ref m_global_parameters "m_global_parameters"
14-
- @ref m_mpi_proxy "m_mpi_proxy"
15-
- @ref m_start_up "m_start_up"
9+
| Module | Description |
10+
|--------|-------------|
11+
| @ref m_checker "m_checker" | Validates post-process input parameters and output format consistency |
12+
| @ref m_data_input "m_data_input" | Reads raw simulation grid and conservative-variable data for a given time-step and fills buffer regions |
13+
| @ref m_data_output "m_data_output" | Writes post-processed grid and flow-variable data to Silo-HDF5 or binary database files |
14+
| @ref m_derived_variables "m_derived_variables" | Computes derived flow quantities (sound speed, vorticity, Schlieren, etc.) from conservative and primitive variables |
15+
| @ref m_global_parameters "m_global_parameters" | Global parameters for the post-process: domain geometry, equation of state, and output database settings |
16+
| @ref m_mpi_proxy "m_mpi_proxy" | MPI gather and scatter operations for distributing post-process grid and flow-variable data |
17+
| @ref m_start_up "m_start_up" | Reads and validates user inputs, allocates variables, and configures MPI decomposition and I/O for post-processing |
1618

1719
### Common (shared)
1820

19-
- @ref m_boundary_common "m_boundary_common"
20-
- @ref m_checker_common "m_checker_common"
21-
- @ref m_chemistry "m_chemistry"
22-
- @ref m_compile_specific "m_compile_specific"
23-
- @ref m_constants "m_constants"
24-
- @ref m_delay_file_access "m_delay_file_access"
25-
- @ref m_derived_types "m_derived_types"
26-
- @ref m_finite_differences "m_finite_differences"
27-
- @ref m_helper "m_helper"
28-
- @ref m_helper_basic "m_helper_basic"
29-
- @ref m_model "m_model"
30-
- @ref m_mpi_common "m_mpi_common"
31-
- @ref m_nvtx "m_nvtx"
32-
- @ref m_phase_change "m_phase_change"
33-
- @ref m_precision_select "m_precision_select"
34-
- @ref m_variables_conversion "m_variables_conversion"
21+
| Module | Description |
22+
|--------|-------------|
23+
| @ref m_boundary_common "m_boundary_common" | Noncharacteristic and processor boundary condition application for ghost cells and buffer regions |
24+
| @ref m_checker_common "m_checker_common" | Shared input validation checks for grid dimensions and AMD GPU compiler limits |
25+
| @ref m_chemistry "m_chemistry" | Multi-species chemistry interface for thermodynamic properties, reaction rates, and transport coefficients |
26+
| @ref m_compile_specific "m_compile_specific" | Platform-specific file and directory operations: create, delete, inquire, getcwd, and basename |
27+
| @ref m_constants "m_constants" | Compile-time constant parameters: default values, tolerances, and physical constants |
28+
| @ref m_delay_file_access "m_delay_file_access" | Rank-staggered file access delays to prevent I/O contention on parallel file systems |
29+
| @ref m_derived_types "m_derived_types" | Shared derived types for field data, patch geometry, bubble dynamics, and MPI I/O structures |
30+
| @ref m_finite_differences "m_finite_differences" | Finite difference operators for computing divergence of velocity fields |
31+
| @ref m_helper "m_helper" | Utility routines for bubble model setup, coordinate transforms, array sampling, and special functions |
32+
| @ref m_helper_basic "m_helper_basic" | Basic floating-point utilities: approximate equality, default detection, and coordinate bounds |
33+
| @ref m_model "m_model" | Binary STL file reader and processor for immersed boundary geometry |
34+
| @ref m_mpi_common "m_mpi_common" | MPI communication layer: domain decomposition, halo exchange, reductions, and parallel I/O setup |
35+
| @ref m_nvtx "m_nvtx" | NVIDIA NVTX profiling API bindings for GPU performance instrumentation |
36+
| @ref m_phase_change "m_phase_change" | Phase transition relaxation solvers for liquid-vapor flows with cavitation and boiling |
37+
| @ref m_precision_select "m_precision_select" | Working-precision kind selection (half/single/double) and corresponding MPI datatype parameters |
38+
| @ref m_variables_conversion "m_variables_conversion" | Conservative-to-primitive variable conversion, mixture property evaluation, and pressure computation |
3539

3640
## See Also
3741

docs/pre_process/readme.md

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,43 @@ The pre-process component generates initial conditions and computational meshes
66

77
### Pre-Process
88

9-
- @ref m_assign_variables "m_assign_variables"
10-
- @ref m_boundary_conditions "m_boundary_conditions"
11-
- @ref m_check_ib_patches "m_check_ib_patches"
12-
- @ref m_check_patches "m_check_patches"
13-
- @ref m_checker "m_checker"
14-
- @ref m_data_output "m_data_output"
15-
- @ref m_global_parameters "m_global_parameters"
16-
- @ref m_grid "m_grid"
17-
- @ref m_icpp_patches "m_icpp_patches"
18-
- @ref m_initial_condition "m_initial_condition"
19-
- @ref m_mpi_proxy "m_mpi_proxy"
20-
- @ref m_perturbation "m_perturbation"
21-
- @ref m_simplex_noise "m_simplex_noise"
22-
- @ref m_start_up "m_start_up"
9+
| Module | Description |
10+
|--------|-------------|
11+
| @ref m_assign_variables "m_assign_variables" | Assigns initial primitive variables to computational cells based on patch geometry |
12+
| @ref m_boundary_conditions "m_boundary_conditions" | Applies spatially varying boundary condition patches along domain edges and faces |
13+
| @ref m_check_ib_patches "m_check_ib_patches" | Validates geometry parameters and constraints for immersed boundary patches |
14+
| @ref m_check_patches "m_check_patches" | Validates geometry parameters and constraints for initial condition patches |
15+
| @ref m_checker "m_checker" | Checks pre-process input file parameters for compatibility and correctness |
16+
| @ref m_data_output "m_data_output" | Writes grid and initial condition data to serial or parallel output files |
17+
| @ref m_global_parameters "m_global_parameters" | Defines global parameters for the computational domain, simulation algorithm, and initial conditions |
18+
| @ref m_grid "m_grid" | Generates uniform or stretched rectilinear grids with hyperbolic-tangent spacing |
19+
| @ref m_icpp_patches "m_icpp_patches" | Constructs initial condition patch geometries (lines, circles, rectangles, spheres, etc.) on the grid |
20+
| @ref m_initial_condition "m_initial_condition" | Assembles initial conditions by layering prioritized patches via constructive solid geometry |
21+
| @ref m_mpi_proxy "m_mpi_proxy" | Broadcasts user inputs and decomposes the domain across MPI ranks for pre-processing |
22+
| @ref m_perturbation "m_perturbation" | Perturbs initial mean flow fields with random noise, mixing-layer instabilities, or simplex noise |
23+
| @ref m_simplex_noise "m_simplex_noise" | 2D and 3D simplex noise generation for procedural initial condition perturbations |
24+
| @ref m_start_up "m_start_up" | Reads and validates user inputs, loads existing grid/IC data, and initializes pre-process modules |
2325

2426
### Common (shared)
2527

26-
- @ref m_boundary_common "m_boundary_common"
27-
- @ref m_checker_common "m_checker_common"
28-
- @ref m_chemistry "m_chemistry"
29-
- @ref m_compile_specific "m_compile_specific"
30-
- @ref m_constants "m_constants"
31-
- @ref m_delay_file_access "m_delay_file_access"
32-
- @ref m_derived_types "m_derived_types"
33-
- @ref m_finite_differences "m_finite_differences"
34-
- @ref m_helper "m_helper"
35-
- @ref m_helper_basic "m_helper_basic"
36-
- @ref m_model "m_model"
37-
- @ref m_mpi_common "m_mpi_common"
38-
- @ref m_nvtx "m_nvtx"
39-
- @ref m_phase_change "m_phase_change"
40-
- @ref m_precision_select "m_precision_select"
41-
- @ref m_variables_conversion "m_variables_conversion"
28+
| Module | Description |
29+
|--------|-------------|
30+
| @ref m_boundary_common "m_boundary_common" | Noncharacteristic and processor boundary condition application for ghost cells and buffer regions |
31+
| @ref m_checker_common "m_checker_common" | Shared input validation checks for grid dimensions and AMD GPU compiler limits |
32+
| @ref m_chemistry "m_chemistry" | Multi-species chemistry interface for thermodynamic properties, reaction rates, and transport coefficients |
33+
| @ref m_compile_specific "m_compile_specific" | Platform-specific file and directory operations: create, delete, inquire, getcwd, and basename |
34+
| @ref m_constants "m_constants" | Compile-time constant parameters: default values, tolerances, and physical constants |
35+
| @ref m_delay_file_access "m_delay_file_access" | Rank-staggered file access delays to prevent I/O contention on parallel file systems |
36+
| @ref m_derived_types "m_derived_types" | Shared derived types for field data, patch geometry, bubble dynamics, and MPI I/O structures |
37+
| @ref m_finite_differences "m_finite_differences" | Finite difference operators for computing divergence of velocity fields |
38+
| @ref m_helper "m_helper" | Utility routines for bubble model setup, coordinate transforms, array sampling, and special functions |
39+
| @ref m_helper_basic "m_helper_basic" | Basic floating-point utilities: approximate equality, default detection, and coordinate bounds |
40+
| @ref m_model "m_model" | Binary STL file reader and processor for immersed boundary geometry |
41+
| @ref m_mpi_common "m_mpi_common" | MPI communication layer: domain decomposition, halo exchange, reductions, and parallel I/O setup |
42+
| @ref m_nvtx "m_nvtx" | NVIDIA NVTX profiling API bindings for GPU performance instrumentation |
43+
| @ref m_phase_change "m_phase_change" | Phase transition relaxation solvers for liquid-vapor flows with cavitation and boiling |
44+
| @ref m_precision_select "m_precision_select" | Working-precision kind selection (half/single/double) and corresponding MPI datatype parameters |
45+
| @ref m_variables_conversion "m_variables_conversion" | Conservative-to-primitive variable conversion, mixture property evaluation, and pressure computation |
4246

4347
## See Also
4448

0 commit comments

Comments
 (0)