Skip to content

Commit 5b94f06

Browse files
committed
templates wip
1 parent 2f3879c commit 5b94f06

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

flopy4/mf6/templates/blocks.jinja

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% for block in blocks %}
2+
begin {{ block.name }} {{ block.index }}
3+
{% for var in block %}
4+
{% if var.kind in ['keyword', 'integer', 'double precision'] %}
5+
{{ macros.scalar(var) }}
6+
{% elif var.kind == 'keystring' %}
7+
{{ macros.union(var) }}
8+
{% elif var.kind == 'record' %}
9+
{{ macros.record(var) }}
10+
{% elif var.kind == 'array' %}
11+
{{ macros.array(var) }}
12+
{% elif var.kind == 'list' %}
13+
{{ macros.list(var) }}
14+
{% endif %}
15+
{% endfor %}
16+
end {{ block.name }}
17+
{% endfor %}

flopy4/mf6/templates/macros.jinja

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{% macro scalar(var) %}
2+
{{ var.name }} {% endif %}{{ var.value }}
3+
{% endmacro %}
4+
5+
{% macro union(var) %}
6+
{% endmacro %}
7+
8+
{% macro record(var) %}
9+
{% if var.tagged %}{{ var.name }} {% endif %}{{ var.value|join(' ') }}
10+
{% endmacro %}
11+
12+
{% macro array(var) %}
13+
{% if constant %}{% if layered %}
14+
{# layered constant #}
15+
{{ var.name }} LAYERED
16+
{% for val in var.value %}
17+
CONSTANT
18+
{% endfor %}
19+
{% else %}
20+
{# constant #}
21+
{{ var.name }} CONSTANT {{ var.value }}
22+
{% endif %}
23+
{% else %}
24+
{# layered #}
25+
{% if layered %}
26+
{{ var.name }}
27+
{% for val in var.value %}{{ val }}{% endfor %}
28+
{% else %}
29+
{# grid-shaped #}
30+
{{ var.name }} {{ var.value }}
31+
{% endif %}
32+
{% endif %}
33+
{% endmacro %}
34+
35+
{% macro list(var) %}
36+
{% endmacro %}

0 commit comments

Comments
 (0)