Skip to content

Commit 2d604c9

Browse files
committed
Add doc/file_catalogue_DRAFT.md (will be moved into developer documentation later)
1 parent d568a44 commit 2d604c9

1 file changed

Lines changed: 149 additions & 0 deletions

File tree

doc/file_catalogue_DRAFT.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# capgen-ng repository — file catalogue (DRAFT)
2+
3+
> **Status: temporary draft for the code-walkthrough prep.** One row per file, except
4+
> the many test/example *input* fixtures, which are collapsed. Once reviewed, the
5+
> relevant sections will be folded into `README.md` / `doc/DevelopersGuide/`.
6+
> External checkouts under `EXT/` (UFS reference + capgen-ng integration trees) are
7+
> intentionally excluded — they are not part of this repository.
8+
9+
## Top level
10+
11+
| File | Description |
12+
|------|-------------|
13+
| `README.md` | Repository overview and entry point. |
14+
| `LICENSE` | License. |
15+
| `end-to-end-tests.sh` | Driver script that builds and runs all end-to-end tests. |
16+
| `ccpp_constituent_prop_mod.F90.patch` | Patch applied to the runtime constituent-properties module for host integrations. |
17+
| `CODEOWNERS`, `.codecov.yml`, `.codee-format`, `.gitignore` | Repo/CI configuration (code owners, coverage, formatter, ignore rules). |
18+
| `.github/` | GitHub Actions CI workflows (unit tests, end-to-end tests, doxygen). |
19+
20+
## `capgen-ng/` — command-line entry points
21+
22+
| File | Description |
23+
|------|-------------|
24+
| `__init__.py` | Package marker (“next-generation CCPP code generator”). |
25+
| `ccpp_capgen_ng.py` | **Main generator CLI.** Parses metadata + the SDF, resolves variables, and writes the caps, `ccpp_kinds.F90`, and `datatable.xml`. Hosts flags like `--kind-type`, `--trace`, `--no-host-introspection`, and the compat shims. |
26+
| `ccpp_datafile.py` | CLI to query the generated `datatable.xml` (generated files, scheme files, dependencies) for build systems / CMake. |
27+
| `ccpp_validator.py` | **Standalone validator** — checks scheme Fortran source against its `.meta` (intent/type/kind/rank/dimensions). Separate tool from the generator; owns the one Fortran parser. |
28+
29+
## `capgen-ng/generator/` — cap code generation
30+
31+
| File | Description |
32+
|------|-------------|
33+
| `__init__.py` | Package marker. |
34+
| `datatable.py` | Writes/reads `datatable.xml` mapping suites → generated files, scheme modules, and dependencies (the build-system interface). |
35+
| `suite_xml.py` | Parses the Suite Definition File (SDF) XML into the suite object model (groups, subcycles, subcolumns). |
36+
| `suite_types.py` | Object model for suites/groups/schemes, incl. intrinsic-vs-external scheme classification. |
37+
| `suite_resolver.py` | Resolves a suite end-to-end: matches variables across schemes + host, constituents, index symbols, unit normalization. |
38+
| `suite_cap.py` | Emits the **suite-level cap** (`ccpp_physics_run`/`_init`/… dispatching to groups; register-before-init contract). |
39+
| `group_cap.py` | Emits the **per-group caps** that call the schemes, with argument marshalling and inline transforms. |
40+
| `host_cap.py` | Emits the **host cap** (registration + runtime introspection API; introspection routines stubbed under `--no-host-introspection`). |
41+
| `host_constituents.py` | Host-side constituent handling (`type=host` constituent tables). |
42+
| `suite_data.py` | Emits the generated suite **data module** — pointer-wrapper DDTs plus transform local temporaries. |
43+
| `kinds_writer.py` | Writes `ccpp_kinds.F90` (kind definitions the caps `use`). |
44+
| `trace.py` | Shared helpers emitting the gated `if (trace) write(...) 'CCPP TRACE …'` lines in every cap (toggled by `--trace`). |
45+
46+
## `capgen-ng/metadata/` — metadata parsing & variable resolution
47+
48+
| File | Description |
49+
|------|-------------|
50+
| `__init__.py` | Package marker. |
51+
| `metadata_table.py` | Parser for `.meta` metadata-table files (`[ccpp-table-properties]` / `[ccpp-arg-table]`). |
52+
| `variable_resolver.py` | Core variable matching/transform engine — unit + kind conversions, vertical flip, DDT typing. |
53+
| `unit_conversion.py` | Unit-conversion formula table (`{var}` substitution) feeding the auto-inserted unit transforms. |
54+
| `registered_dimensions.py` | Registry of count-dim ↔ index-var pairings (`SCALAR_INDEX_DIMS`) and framework count dimensions. |
55+
| `legacy_compat.py` | **Transient shim** — rewrites legacy CCPP standard names (e.g. `horizontal_loop_extent`) at parse time. |
56+
| `dim_aliases.py` | **Transient shim** — collapses equivalent GFS-physics dimension names. |
57+
| `auto_clone_constituents.py` | **Transient shim** — reinstates original-capgen auto-cloning of static constituents. |
58+
59+
## `capgen-ng/metadata/parse_tools/` — shared parse utilities
60+
61+
| File | Description |
62+
|------|-------------|
63+
| `__init__.py` | Package marker. |
64+
| `parse_source.py` | Parsing primitives: parse context + exception types. |
65+
| `parse_checkers.py` | Metadata field validators (`check_units`, `check_dimensions`, `check_cf_standard_name`, …). |
66+
| `parse_log.py` | Shared logging utilities for parse processes. |
67+
| `io_helpers.py` | File-write helpers with write-if-changed (no-op-if-unchanged) semantics. |
68+
| `fortran_conditional.py` | Builds Fortran conditional expressions (in local names) for active/optional-argument handling. |
69+
| `xml_tools.py` | XML helpers — entity expansion and pretty-printed writing (SDF / datatable). |
70+
71+
## `capgen-ng/schema/` & `capgen-ng/src/` — schema + shipped runtime Fortran
72+
73+
| File | Description |
74+
|------|-------------|
75+
| `schema/suite_v1_0.xsd` | XML schema for SDF v1.0. |
76+
| `schema/suite_v2_0.xsd` | XML schema for SDF v2.0 (adds suite-level `<init>`/`<final>`). |
77+
| `src/ccpp_constituent_prop_mod.F90` (+ `.meta`) | Runtime constituent-properties DDT module shipped with the framework. |
78+
| `src/ccpp_hash_table.F90` | Runtime hash-table support. |
79+
| `src/ccpp_hashable.F90` | Hashable base type used by the hash table. |
80+
| `src/ccpp_scheme_utils.F90` | Runtime scheme utility routines. |
81+
82+
## `unit-tests/` — pytest suite (one row per driver; fixtures collapsed)
83+
84+
| File | Description |
85+
|------|-------------|
86+
| `run_tests.py`, `conftest.py`, `__init__.py` | Test runner, pytest fixtures, package marker. |
87+
| `test_metadata_table.py` | Tests for `metadata/metadata_table.py`. |
88+
| `test_variable_resolver.py` | Tests for `metadata/variable_resolver.py`. |
89+
| `test_registered_dimensions.py` | Tests for `metadata/registered_dimensions.py`. |
90+
| `test_dim_aliases.py` | Tests for `metadata/dim_aliases.py`. |
91+
| `test_legacy_compat.py` | Tests for `metadata/legacy_compat.py`. |
92+
| `test_auto_clone_constituents.py` | Tests for `metadata/auto_clone_constituents.py`. |
93+
| `test_io_helpers.py` | Tests for `parse_tools/io_helpers.py`. |
94+
| `test_suite_xml.py` | Tests for `generator/suite_xml.py`. |
95+
| `test_suite_types.py` | Tests for `generator/suite_types.py`. |
96+
| `test_suite_resolver.py` | Tests for `generator/suite_resolver.py`. |
97+
| `test_suite_cap.py` | Tests for `generator/suite_cap.py`. |
98+
| `test_suite_data.py` | Tests for `generator/suite_data.py`. |
99+
| `test_host_cap.py` | Tests for `generator/host_cap.py`. |
100+
| `test_host_constituents.py` | Tests for `generator/host_constituents.py`. |
101+
| `test_kinds_writer.py` | Tests for `generator/kinds_writer.py`. |
102+
| `test_datatable.py` | Tests for `generator/datatable.py`. |
103+
| `test_trace.py` | Tests for `generator/trace.py`. |
104+
| `test_ccpp_datafile.py` | Tests for `ccpp_datafile.py`. |
105+
| `test_validator.py` | Tests for `ccpp_validator.py` (incl. the Fortran parser). |
106+
| `test_control_validation.py` | Tests for control-variable validation rules. |
107+
| `test_integration.py` | End-to-end generator integration tests (full parse → resolve → emit). |
108+
| `sample_files/`, `sample_suite_files/` | **~100 metadata / SDF / Fortran fixtures** consumed by the tests above — not catalogued individually. |
109+
110+
## `end-to-end-tests/` — full build-and-run cases (one row per case; fixtures collapsed)
111+
112+
Each case directory bundles host + scheme Fortran, `.meta`, an SDF, a `*_test_reports.py`
113+
comparison driver, and CMake glue. The fixtures are collapsed; the row describes what the case exercises.
114+
115+
| Case | What it exercises |
116+
|------|-------------------|
117+
| `capgen_ng/` | **Overall generator capabilities** — multiple suites & groups, DDT usage (incl. an undocumented DDT member), `ccpp_constant_one:N` and bare-`N` dimensions, non-standard/integer dimensions, variables promoted to suite level, dimensions set in the register phase and used to allocate module-level interstitials, and threading. |
118+
| `advection/` | Constituent advection — cloud liquid/ice constituents with tendency application (`apply_constituent_tendencies` invoked twice); includes a deliberate error suite (`cld_suite_error.xml`) to exercise diagnostics. |
119+
| `advection_auto_clone/` | Same fixtures as `advection/`, run through the `--legacy-auto-clone-constituents` shim path. |
120+
| `ddthost/` | A host whose CCPP data is carried in a derived type (`host_ccpp_ddt`); runs the temp + DDT suites against it. |
121+
| `var_compat/` | The variable-compatibility object (`VarCompatObj`): unit conversions (forward & reverse), vertical flip (`top_at_one`), kind conversions, and combinations — plus subcycles (nested, dynamic vs fixed iteration length, shared length-defining standard names). |
122+
| `nested_suite/` | Nested suites (a suite that includes a sub-suite), expanded at and inside groups; SDF schema **2.0**; suite-level single `<init>`/`<final>` schemes. Inherited from `var_compat`. |
123+
| `constituents_dim/` | Variables dimensioned by the framework constituent count `number_of_ccpp_constituents` (host never declares it); covers host-owned, framework-allocated, and scheme-allocated count-dim cases, plus consuming constituents without re-flagging (rule b). |
124+
| `suite_allocate/` | A suite-owned, **scheme-allocated** (`allocatable`) variable promoted to `ccpp_<suite>_data`; its dimension is also suite-owned and set in the `timestep_init` phase (so it can't be allocated at init). |
125+
| `instances/` | **Multiple model instances**`instance`/`number_of_instances` paired control; the host loops `ccpp_physics_run` over instances with per-instance data (unit-conversion schemes are just the vehicle). |
126+
| `instances_advection/` | Multiple instances combined with constituent advection — scheme-registered constituents with a per-instance buffer (`ninstances` × cloud-liquid + tendency application). |
127+
| `opt_arg/` | Optional-argument handling — present/absent dummy arguments (pointer association vs runtime guard). |
128+
| `chunked_data/` | Chunked/blocked host data — `chunk_begin`/`chunk_end` bounds over `nchunks` chunks. |
129+
| `*_test_reports.py` (where present) | Per-case driver that builds, runs, and diffs expected vs actual output (older cases; newer cases run via `ctest`/CMake). |
130+
| `CMakeLists.txt`, `cmake/`, `utils/` | Shared CMake configuration and helpers for the e2e harness. |
131+
132+
## `doc/` — documentation
133+
134+
| File | Description |
135+
|------|-------------|
136+
| `README.md` | Documentation index. |
137+
| `redesign_prompt.md`, `redesign_analysis.md`, `redesign_analysis_original_*.md` | Original redesign brief and analysis that motivated capgen-ng. |
138+
| `briefing.md`, `briefing_pm.md` | Design briefings. |
139+
| `migration.md` | Guide for migrating a host from ccpp-prebuild/original-capgen to capgen-ng. |
140+
| `capgen_compat_layer.md` | Documents the transient compatibility shims (legacy names, dim aliases, auto-clone). |
141+
| `constituents.md` | Constituent-handling design. |
142+
| `constituents_overhaul.md` | Proposed constituent-model overhaul (proposals A/B/C). |
143+
| `auto_clone_constituents.md` | Design notes for the auto-clone-constituents shim. |
144+
| `cam4_fwaut_constituent_order.md` | Case study: CAM4 FWAUT constituent-ordering b4b investigation. |
145+
| `Doxyfile.in` | Doxygen configuration. |
146+
| `CMakeLists.txt` | Build glue for the docs. |
147+
| `DevelopersGuide/` | Developers Guide (`README.md`, generated PDFs, LaTeX style) — bundle, not catalogued per file. |
148+
| `HelloWorld/` | Worked “hello world” host + scheme + suite + build example — bundle, not catalogued per file. |
149+
| `img/` | Documentation images. |

0 commit comments

Comments
 (0)