66%ignore WS
77%ignore SH_COMMENT
88
9+ // Top-level structure
910start: block*
10- block: {% for block_name in blocks .keys () %} {{ block_name }}_block{% if not loop .last %} | {% endif %}{% endfor %}
11+ block: {% for block_name in blocks .keys () %}
12+ {{- block_name }}_block
13+ {% - if not loop .last %} | {% endif %}
14+ {% - endfor %}
1115
12- {% for block_name , block_ in blocks .items () %}
16+ // Block definitions
17+ {% for block_name , block_fields in blocks .items () %}
1318{% if block_name == 'period' %}
1419{{ block_name }}_block: "begin"i "{{ block_name }}"i block_index {{ block_name }}_fields "end"i "{{ block_name }}"i block_index
1520{% else %}
@@ -19,19 +24,32 @@ block: {% for block_name in blocks.keys() %}{{ block_name }}_block{% if not loop
1924{% if 'period' in blocks %}
2025block_index: integer
2126{% endif %}
22- {% for block_name , block_ in blocks .items () %}
23- {% set period_groups = block_ |group_period_fields %}
27+ // Block field lists
28+ {% for block_name , block_fields in blocks .items () %}
29+ {% set period_groups = block_fields |group_period_fields %}
2430{% if period_groups %}
31+ {# This block has period data (e.g., stress_period_data), split fields accordingly #}
2532{% set recarray_name = block_name |get_recarray_name %}
2633{% set grouped_field_names = period_groups .values ()|first %}
2734{% set non_grouped_fields = [] %}
28- {% for field_name in block_ .keys () %}{% if field_name not in grouped_field_names %}{% set _ = non_grouped_fields .append (field_name ) %}{% endif %}{% endfor %}
29- {{ block_name }}_fields: ({% for field_name in non_grouped_fields %} {{ field_name }} | {% endfor %} {{ recarray_name }})*
35+ {% for field_name in block_fields .keys () %}
36+ {% - if field_name not in grouped_field_names %}
37+ {% - set _ = non_grouped_fields .append (field_name ) %}
38+ {% - endif %}
39+ {% - endfor %}
40+ {{ block_name }}_fields: (
41+ {% - for field_name in non_grouped_fields %} {{ field_name }} | {% endfor -%}
42+ {{ recarray_name }})*
3043{% else %}
31- {{ block_name }}_fields: ({% for field_name , field in block_ .items () %} {{ field_name }}{% if not loop .last %} | {% endif
32- %}{% endfor %} )*
44+ {# Regular block - just list all fields #}
45+ {{ block_name }}_fields: (
46+ {% - for field_name in block_fields .keys () %}
47+ {{- field_name }}{% if not loop .last %} | {% endif %}
48+ {% - endfor -%}
49+ )*
3350{% endif %}
3451{% endfor %}
52+ // Individual field rules
3553{% set grouped_fields = blocks |get_all_grouped_field_names %}
3654{% for field_name , field in fields .items () %}
3755{% if field_name not in grouped_fields %}
@@ -76,13 +94,13 @@ opt.type }}{% endif %}
7694{% endfor %}
7795{% endif %}
7896{% endfor %}
79- {# Generate recarray rules for grouped period fields #}
80- {% for block_name , block_ in blocks .items () %}
81- {% set period_groups = block_ |group_period_fields %}
97+ // Recarray rules for period data (stress_period_data, etc.)
98+ {% for block_name , block_fields in blocks .items () %}
99+ {% set period_groups = block_fields |group_period_fields %}
82100{% if period_groups %}
83101{% set recarray_name = block_name |get_recarray_name %}
84102{% set field_names = period_groups .values ()|first %}
85- {% set columns = field_names |get_recarray_columns (block_ ) %}
103+ {% set columns = field_names |get_recarray_columns (block_fields ) %}
86104{{ recarray_name}}: (number | simple_string)+ NEWLINE
87105{% endif %}
88106{% endfor %}
0 commit comments