Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codee-format
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ SpacesAroundOperators:
Relational: Both
RelationalLegacy: Both
LogicalBinary: Both
LogicalNot: NoTrailing
LogicalNot: Trailing
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peverwhee Take note please

UnaryPlusMinus: NoTrailing
Comma: OnlyTrailing
Concat: Both
Expand Down
30 changes: 27 additions & 3 deletions .github/workflows/fortran-formatting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
types: [opened, synchronize, labeled, unlabeled]

env:
CODEE_VERSION: 2025.4.8
CODEE_VERSION: 2026.1.2

# Only needed when fixing formatting automatically, but this only
# works for pull requests from the same repo, not from a fork
Expand Down Expand Up @@ -36,8 +36,32 @@ jobs:

# Filter list of modified files to exclude certain files
EXCLUDED_FILES=(
# file1
# file2
# Exclude all .F90 files in test/unit_tests/**
test/unit_tests/sample_files/test_fortran_to_metadata.F90
test/unit_tests/sample_files/fortran_files/array_parsing_test.F90
test/unit_tests/sample_files/fortran_files/linebreak_test.F90
test/unit_tests/sample_files/fortran_files/long_string_test.F90
test/unit_tests/sample_files/fortran_files/comments_test.F90
test/unit_tests/sample_host_files/ddt1_plus.F90
test/unit_tests/sample_host_files/mismatch_hdim_mod.F90
test/unit_tests/sample_host_files/ddt1.F90
test/unit_tests/sample_host_files/ddt2_extra_var.F90
test/unit_tests/sample_host_files/ddt2.F90
test/unit_tests/sample_host_files/ddt_data1_mod.F90
test/unit_tests/sample_host_files/data1_mod.F90
test/unit_tests/sample_scheme_files/CCPPnotset_var_missing_in_meta.F90
test/unit_tests/sample_scheme_files/CCPPeq1_var_missing_in_meta.F90
test/unit_tests/sample_scheme_files/missing_fort_header.F90
test/unit_tests/sample_scheme_files/mismatch_intent.F90
test/unit_tests/sample_scheme_files/CCPPgt1_var_in_fort_meta.F90
test/unit_tests/sample_scheme_files/mismatch_hdim.F90
test/unit_tests/sample_scheme_files/CCPPeq1_var_missing_in_fort.F90
test/unit_tests/sample_scheme_files/temp_adjust.F90
test/unit_tests/sample_scheme_files/CCPPeq1_var_in_fort_meta.F90
test/unit_tests/sample_scheme_files/reorder.F90
test/unit_tests/sample_scheme_files/invalid_dummy_arg.F90
test/unit_tests/sample_scheme_files/invalid_subr_stmnt.F90
test/unit_tests/sample_scheme_files/missing_arg_table.F90
)
FILTERED_FILES=()
while IFS= read -r file; do
Expand Down
22 changes: 12 additions & 10 deletions src/ccpp_constituent_prop_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ module ccpp_constituent_prop_mod
! ccpp_contituent_prop_mod contains types and procedures for storing
! and retrieving constituent properties

use ccpp_hashable, only: ccpp_hashable_t, ccpp_hashable_char_t
use ccpp_hash_table, only: ccpp_hash_table_t, ccpp_hash_iterator_t
use ccpp_hashable, only: ccpp_hashable_t, &
ccpp_hashable_char_t
use ccpp_hash_table, only: ccpp_hash_table_t, &
ccpp_hash_iterator_t
use ccpp_kinds, only: kind_phys

implicit none
Expand Down Expand Up @@ -368,7 +370,7 @@ logical function ccp_is_instantiated(this, errcode, errmsg)

ccp_is_instantiated = allocated(this%var_std_name)
call initialize_errvars(errcode, errmsg)
if (.not.ccp_is_instantiated) then
if (.not. ccp_is_instantiated) then
call append_errvars(1, "ccpp_constituent_properties_t object is not initialized", &
subname, errcode=errcode, errmsg=errmsg)
end if
Expand Down Expand Up @@ -1093,7 +1095,7 @@ logical function ccp_model_const_locked(this, errcode, errmsg, warn_func)
! Use an initialized hash table as double check
if (this%hash_table%is_initialized()) then
ccp_model_const_locked = this%table_locked .and. this%data_locked
if ((.not.(this%table_locked .and. this%data_locked)) .and. &
if ((.not. (this%table_locked .and. this%data_locked)) .and. &
present(errmsg) .and. present(warn_func)) then
! Write a warning as a courtesy to calling function but do not set
! errcode (let caller decide).
Expand Down Expand Up @@ -1125,7 +1127,7 @@ logical function ccp_model_const_props_locked(this, errcode, errmsg, warn_func)
! Use an initialized hash table as double check
if (this%hash_table%is_initialized()) then
ccp_model_const_props_locked = this%table_locked
if (.not.this%table_locked .and. &
if (.not. this%table_locked .and. &
present(errmsg) .and. present(warn_func)) then
! Write a warning as a courtesy to calling function but do not set
! errcode (let caller decide).
Expand Down Expand Up @@ -1158,7 +1160,7 @@ logical function ccp_model_const_data_locked(this, errcode, errmsg, warn_func)
! Use an initialized hash table as double check
if (this%hash_table%is_initialized()) then
ccp_model_const_data_locked = this%data_locked
if (.not.this%data_locked .and. &
if (.not. this%data_locked .and. &
present(errmsg) .and. present(warn_func)) then
! Write a warning as a courtesy to calling function but do not set
! errcode (let caller decide).
Expand Down Expand Up @@ -1191,10 +1193,10 @@ logical function ccp_model_const_okay_to_add(this, errcode, errmsg, &

ccp_model_const_okay_to_add = this%hash_table%is_initialized()
if (ccp_model_const_okay_to_add) then
ccp_model_const_okay_to_add = .not.(this%const_props_locked(errcode=errcode, &
ccp_model_const_okay_to_add = .not. (this%const_props_locked(errcode=errcode, &
errmsg=errmsg, warn_func=subname) .or. this%const_data_locked(errcode=errcode, &
errmsg=errmsg, warn_func=subname))
if (.not.ccp_model_const_okay_to_add) then
if (.not. ccp_model_const_okay_to_add) then
call append_errvars(1, &
"WARNING: Model constituents are locked", &
subname, errcode=errcode, errmsg=errmsg, caller=warn_func)
Expand Down Expand Up @@ -1440,7 +1442,7 @@ subroutine ccp_model_const_table_lock(this, errcode, errmsg)
call this%const_metadata(index_const)%set(cprop)
end if
! Make sure this is a layer variable
if (.not.cprop%is_layer_var()) then
if (.not. cprop%is_layer_var()) then
call cprop%vertical_dimension(dimname, &
errcode=errcode, errmsg=errmsg)
call append_errvars(1, "ERROR: Bad vertical dimension, '" // &
Expand Down Expand Up @@ -1510,7 +1512,7 @@ subroutine ccp_model_const_data_lock(this, ncols, num_layers, errcode, errmsg)
"WARNING: Model constituent data already locked, ignoring", &
subname, errcode=errcode, errmsg=errmsg)
errcode_local = errcode_local + 1
else if (.not.this%const_props_locked(errcode=errcode, errmsg=errmsg, &
else if (.not. this%const_props_locked(errcode=errcode, errmsg=errmsg, &
warn_func=subname)) then
call append_errvars(1, &
"WARNING: Model constituent properties not yet locked, ignoring", &
Expand Down
6 changes: 3 additions & 3 deletions src/ccpp_hash_table.F90
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ function hash_table_table_value(this, key, errmsg) result(tbl_val)
end if
end if

if ((.not.associated(tbl_val)) .and. present(errmsg)) then
if (.not.have_error(errmsg)) then ! Still need to test for empty
if ((.not. associated(tbl_val)) .and. present(errmsg)) then
if (.not. have_error(errmsg)) then ! Still need to test for empty
write(errmsg, *) subname, ": No entry for '", trim(key), "'"
end if
end if
Expand Down Expand Up @@ -453,7 +453,7 @@ subroutine hash_iterator_next_entry(this)
end if
if (has_table_next) then
this%table_entry => this%table_entry%next
else if ((.not.has_table_entry) .and. &
else if ((.not. has_table_entry) .and. &
associated(this%hash_table%table(this%index)%next)) then
this%table_entry => this%hash_table%table(this%index)%next
else
Expand Down
5 changes: 3 additions & 2 deletions src/ccpp_scheme_utils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module ccpp_scheme_utils

! Module of utilities available to CCPP schemes

use ccpp_constituent_prop_mod, only: ccpp_model_constituents_t, int_unassigned
use ccpp_constituent_prop_mod, only: ccpp_model_constituents_t, &
int_unassigned

implicit none
private
Expand Down Expand Up @@ -62,7 +63,7 @@ subroutine ccpp_initialize_constituent_ptr(const_obj)
! Dummy arguments
type(ccpp_model_constituents_t), pointer, intent(in) :: const_obj

if (.not.initialized) then
if (.not. initialized) then
constituent_obj => const_obj
initialized = .true.
end if
Expand Down
50 changes: 25 additions & 25 deletions test/advection_test/apply_constituent_tendencies.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@ module apply_constituent_tendencies

public :: apply_constituent_tendencies_run

CONTAINS

!> \section arg_table_apply_constituent_tendencies_run Argument Table
!!! \htmlinclude apply_constituent_tendencies_run.html
subroutine apply_constituent_tendencies_run(const_tend, const, errcode, errmsg)
! Dummy arguments
real(kind_phys), intent(inout) :: const_tend(:,:,:) ! constituent tendency array
real(kind_phys), intent(inout) :: const(:,:,:) ! constituent state array
integer, intent(out) :: errcode
character(len=512), intent(out) :: errmsg

! Local variables
integer :: klev, jcnst, icol

errcode = 0
errmsg = ''

do icol = 1, size(const_tend, 1)
do klev = 1, size(const_tend, 2)
do jcnst = 1, size(const_tend, 3)
const(icol, klev, jcnst) = const(icol, klev, jcnst) + const_tend(icol, klev, jcnst)
end do
end do
contains

!> \section arg_table_apply_constituent_tendencies_run Argument Table
!!! \htmlinclude apply_constituent_tendencies_run.html
subroutine apply_constituent_tendencies_run(const_tend, const, errcode, errmsg)
! Dummy arguments
real(kind=kind_phys), intent(inout) :: const_tend(:, :, :) ! constituent tendency array
real(kind=kind_phys), intent(inout) :: const(:, :, :) ! constituent state array
integer, intent(out) :: errcode
character(len=512), intent(out) :: errmsg

! Local variables
integer :: klev, jcnst, icol

errcode = 0
errmsg = ''

do icol = 1, size(const_tend, 1)
do klev = 1, size(const_tend, 2)
do jcnst = 1, size(const_tend, 3)
const(icol, klev, jcnst) = const(icol, klev, jcnst) + const_tend(icol, klev, jcnst)
end do
end do
end do

const_tend = 0._kind_phys
const_tend = 0._kind_phys

end subroutine apply_constituent_tendencies_run
end subroutine apply_constituent_tendencies_run

end module apply_constituent_tendencies
Loading
Loading