Skip to content

Commit

Permalink
#1786 Actioned @TeranIvy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
oakleybrunt committed Jan 18, 2024
1 parent d9c2d93 commit 7307eb3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
30 changes: 16 additions & 14 deletions doc/user_guide/dynamo0p3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3271,19 +3271,13 @@ elements, e.g. in Fortran this would be: ``Y = INT(X, kind=i_<prec>)``.
Here ``Y`` is an ``integer``-valued field and ``X`` is the
``real``-valued field being converted::

ifield2(:) = INT(field1(:), kind=i_def)
ifield2(:) = INT(field1(:), kind=i_<prec>)

where **ifield2** is the only currently supported ``integer_field_type``
(``i_def`` precision) and a ``real``-valued field *field1* can be of
any :ref:`supported precisions <lfric-mixed-precision>` for ``GH_REAL``
fields (e.g. ``r_tran`` for ``r_tran_field_type``).

Built-ins which take a ``real`` field element for conversion to
a field of different datatype or precision prefixed with the keyword
**real** and are denoted by the datatype that the input ``real`` field will
be converted to. A Built-in that converts a ``real`` to an ``integer``
field is denoted by the keyword **int**. Likewise, a Built-in that
converts a ``real`` to a ``real`` field is denoted by the keyword **real**.
where **ifield2** is currently the only supported ``integer``-valued field
type in LFRic (``integer_field_type`` of ``i_def`` precision) and a ``real``
-valued field *field1* can be of any :ref:`supported precisions
<lfric-mixed-precision>` for ``GH_REAL`` fields (e.g. ``r_tran`` for
``r_tran_field_type``).

.. _real-to-real-built-in:

Expand All @@ -3298,12 +3292,19 @@ e.g. in Fortran this would be: ``Y = REAL(X, kind=r_<prec>)``. Here ``Y``
and ``X`` are both ``real``-valued fields, with ``X`` being converted
to the precision of ``Y``::

field2(:) = REAL(field1(:), kind=r_<prec>)
field2(:) = REAL(field1(:), kind=r_<prec>)

**field2** and *field1* are ``real``-valued fields of any :ref:`supported
precisions <lfric-mixed-precision>` for ``GH_REAL`` fields (e.g. ``r_tran``
for ``r_tran_field_type``).

Built-ins which take a ``real`` field for conversion to a field of
a different datatype or precision are denoted by the datatype that the
input ``real`` field will be converted to. A Built-in that converts a
``real`` to an ``integer`` field is denoted by the keyword **int**.
Likewise, a Built-in that converts a ``real`` to a ``real`` field is
denoted by the keyword **real**.

.. _lfric-built-ins-int:

Built-in operations on ``integer``-valued fields
Expand Down Expand Up @@ -3604,7 +3605,8 @@ Here ``Y`` is a ``real``-valued field and ``X`` is the

field2(:) = REAL(ifield1(:), kind=r_<prec>)

where *ifield1* is an ``integer_field_type`` of ``i_def`` precision.
where **ifield1** is currently the only supported ``integer``-valued
field type in LFRic (``integer_field_type`` of ``i_def`` precision).
The ``real``-valued **field1** can be of any :ref:`supported
precisions <lfric-mixed-precision>` for ``GH_REAL`` fields, hence
``r_<prec>`` is determined from the algorithm layer (e.g.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ def test_real_to_real_x(tmpdir, monkeypatch, annexed, dist_mem):
# Test code generation
code = str(psy.gen)

print(code)

# Check that the correct field types and constants are used
output = (
" USE constants_mod, ONLY: r_tran, r_solver, r_def, i_def\n"
Expand All @@ -116,7 +114,7 @@ def test_real_to_real_x(tmpdir, monkeypatch, annexed, dist_mem):
" END DO\n"
)
assert output in code

# Check built-in loop for 'r_solver'
output = (
" DO df=loop2_start,loop2_stop\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ program single_invoke
type(r_tran_field_type) :: f2
type(r_solver_field_type) :: f3

call invoke( real_to_real_X(f2, f1),&
real_to_real_X(f1, f3),&
call invoke( real_to_real_X(f2, f1), &
real_to_real_X(f1, f3), &
real_to_real_X(f3, f2) )

end program single_invoke

0 comments on commit 7307eb3

Please sign in to comment.