Skip to content

Commit

Permalink
Merge pull request #157 from darianboggs/feature/impure_elemental_rel…
Browse files Browse the repository at this point in the history
…ations

Make numerous == and /= relational operators impure elemental.
Authored by Darian Boggs <william.d.boggs@nasa.gov>
  • Loading branch information
theurich authored Oct 6, 2023
2 parents f7c6356 + 5bee718 commit 3af84eb
Show file tree
Hide file tree
Showing 32 changed files with 143 additions and 142 deletions.
4 changes: 2 additions & 2 deletions src/Infrastructure/Array/interface/ESMF_ArrayCreate.cppF90
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ contains
! !IROUTINE: ESMF_ArrayEQ - Compare two Calendars for equality
!
! !INTERFACE:
function ESMF_ArrayEQ(array1, array2)
impure elemental function ESMF_ArrayEQ(array1, array2)
!
! !RETURN VALUE:
logical :: ESMF_ArrayEQ
Expand Down Expand Up @@ -346,7 +346,7 @@ contains
! !IROUTINE: ESMF_ArrayNE - Compare two Calendars for non-equality
!
! !INTERFACE:
function ESMF_ArrayNE(array1, array2)
impure elemental function ESMF_ArrayNE(array1, array2)
!
! !RETURN VALUE:
logical :: ESMF_ArrayNE
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/ArrayBundle/interface/ESMF_ArrayBundle.F90
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ subroutine c_ESMC_ArrayBundleSMMStore(srcArrayBundle, dstArrayBundle, &
! !IROUTINE: ESMF_ArrayBundleEQ - Compare two ArrayBundles for equality
!
! !INTERFACE:
function ESMF_ArrayBundleEQ(arraybundle1, arraybundle2)
impure elemental function ESMF_ArrayBundleEQ(arraybundle1, arraybundle2)
!
! !RETURN VALUE:
logical :: ESMF_ArrayBundleEQ
Expand Down Expand Up @@ -420,7 +420,7 @@ end function ESMF_ArrayBundleEQ
! !IROUTINE: ESMF_ArrayBundleNE - Compare two ArrayBundles for non-equality
!
! !INTERFACE:
function ESMF_ArrayBundleNE(arraybundle1, arraybundle2)
impure elemental function ESMF_ArrayBundleNE(arraybundle1, arraybundle2)
!
! !RETURN VALUE:
logical :: ESMF_ArrayBundleNE
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/ArraySpec/src/ESMF_ArraySpec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ module ESMF_ArraySpecMod
! !IROUTINE: ESMF_ArraySpecEQ - Test if ArraySpec 1 is equal to ArraySpec 2
!
! !INTERFACE:
function ESMF_ArraySpecEQ(arrayspec1, arrayspec2)
impure elemental function ESMF_ArraySpecEQ(arrayspec1, arrayspec2)
!
! !RETURN VALUE:
logical :: ESMF_ArraySpecEQ
Expand Down Expand Up @@ -281,7 +281,7 @@ end function ESMF_ArraySpecEQ
! !IROUTINE: ESMF_ArraySpecNE - Test if ArraySpec 1 is not equal to ArraySpec 2
!
! !INTERFACE:
function ESMF_ArraySpecNE(arrayspec1, arrayspec2)
impure elemental function ESMF_ArraySpecNE(arrayspec1, arrayspec2)
!
! !RETURN VALUE:
logical :: ESMF_ArraySpecNE
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/Base/interface/ESMF_Info.F90
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ module ESMF_InfoMod

#undef ESMF_METHOD
#define ESMF_METHOD "ESMF_InfoEqual()"
function ESMF_InfoEqual(lhs, rhs) result(is_equal)
impure elemental function ESMF_InfoEqual(lhs, rhs) result(is_equal)
type(ESMF_Info), intent(in) :: lhs
type(ESMF_Info), intent(in) :: rhs
logical :: is_equal
Expand All @@ -271,7 +271,7 @@ end function ESMF_InfoEqual

#undef ESMF_METHOD
#define ESMF_METHOD "ESMF_InfoNotEqual()"
function ESMF_InfoNotEqual(lhs, rhs) result(is_equal)
impure elemental function ESMF_InfoNotEqual(lhs, rhs) result(is_equal)
type(ESMF_Info), intent(in) :: lhs
type(ESMF_Info), intent(in) :: rhs
logical :: is_equal
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/Config/src/ESMF_Config.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3944,7 +3944,7 @@ end subroutine ESMF_ConfigValidate
! !IROUTINE: ESMF_ConfigEQ - Compare two Config objects for equality
!
! !INTERFACE:
function ESMF_ConfigEQ(Config1, Config2)
impure elemental function ESMF_ConfigEQ(Config1, Config2)
!
! !RETURN VALUE:
logical :: ESMF_ConfigEQ
Expand All @@ -3970,7 +3970,7 @@ end function ESMF_ConfigEQ
! !IROUTINE: ESMF_ConfigEQ - Compare two Config objects for inequality
!
! !INTERFACE:
function ESMF_ConfigNE(Config1, Config2)
impure elemental function ESMF_ConfigNE(Config1, Config2)
!
! !RETURN VALUE:
logical :: ESMF_ConfigNE
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/DELayout/interface/ESMF_DELayout.F90
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ module ESMF_DELayoutMod
! !IROUTINE: ESMF_DELayoutEQ - Compare two DELayouts for equality
!
! !INTERFACE:
function ESMF_DELayoutEQ(delayout1, delayout2)
impure elemental function ESMF_DELayoutEQ(delayout1, delayout2)
!
! !RETURN VALUE:
logical :: ESMF_DELayoutEQ
Expand Down Expand Up @@ -373,7 +373,7 @@ end function ESMF_DELayoutEQ
! !IROUTINE: ESMF_DELayoutNE - Compare two DELayouts for non-equality
!
! !INTERFACE:
function ESMF_DELayoutNE(delayout1, delayout2)
impure elemental function ESMF_DELayoutNE(delayout1, delayout2)
!
! !RETURN VALUE:
logical :: ESMF_DELayoutNE
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/DistGrid/interface/ESMF_DistGrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ module ESMF_DistGridMod
! !IROUTINE: ESMF_DistGridEQ - Compare two DistGrids for equality
!
! !INTERFACE:
function ESMF_DistGridEQ(distgrid1, distgrid2)
impure elemental function ESMF_DistGridEQ(distgrid1, distgrid2)
!
! !RETURN VALUE:
logical :: ESMF_DistGridEQ
Expand Down Expand Up @@ -491,7 +491,7 @@ end function ESMF_DistGridEQ
! !IROUTINE: ESMF_DistGridNE - Compare two DistGrids for non-equality
!
! !INTERFACE:
function ESMF_DistGridNE(distgrid1, distgrid2)
impure elemental function ESMF_DistGridNE(distgrid1, distgrid2)
!
! !RETURN VALUE:
logical :: ESMF_DistGridNE
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/Field/src/ESMF_Field.F90
Original file line number Diff line number Diff line change
Expand Up @@ -789,14 +789,14 @@ end subroutine ESMF_FieldInitialize
!------------------------------------------------------------------------------
! function to compare two ESMF_Status flags to see if they're the same or not

function ESMF_sfeq(sf1, sf2)
impure elemental function ESMF_sfeq(sf1, sf2)
logical ESMF_sfeq
type(ESMF_FieldStatus_Flag), intent(in) :: sf1, sf2

ESMF_sfeq = (sf1%status == sf2%status)
end function

function ESMF_sfne(sf1, sf2)
impure elemental function ESMF_sfne(sf1, sf2)
logical ESMF_sfne
type(ESMF_FieldStatus_Flag), intent(in) :: sf1, sf2

Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/Field/src/ESMF_FieldCreate.cppF90
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ contains
! !IROUTINE: ESMF_FieldEQ - Compare two Fields for equality
!
! !INTERFACE:
function ESMF_FieldEQ(field1, field2)
impure elemental function ESMF_FieldEQ(field1, field2)
!
! !RETURN VALUE:
logical :: ESMF_FieldEQ
Expand Down Expand Up @@ -330,7 +330,7 @@ contains
! !IROUTINE: ESMF_FieldNE - Compare two Fields for non-equality
!
! !INTERFACE:
function ESMF_FieldNE(field1, field2)
impure elemental function ESMF_FieldNE(field1, field2)
!
! !RETURN VALUE:
logical :: ESMF_FieldNE
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/FieldBundle/src/ESMF_FieldBundle.cppF90
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ contains
! !IROUTINE: ESMF_FieldBundleEQ - Compare two FieldBundles for equality
!
! !INTERFACE:
function ESMF_FieldBundleEQ(fieldbundle1, fieldbundle2)
impure elemental function ESMF_FieldBundleEQ(fieldbundle1, fieldbundle2)
!
! !RETURN VALUE:
logical :: ESMF_FieldBundleEQ
Expand Down Expand Up @@ -541,7 +541,7 @@ contains
! !IROUTINE: ESMF_FieldBundleNE - Compare two FieldBundles for non-equality
!
! !INTERFACE:
function ESMF_FieldBundleNE(fieldbundle1, fieldbundle2)
impure elemental function ESMF_FieldBundleNE(fieldbundle1, fieldbundle2)
!
! !RETURN VALUE:
logical :: ESMF_FieldBundleNE
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/Geom/src/ESMF_Geom.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ end function ESMF_GeomGetInit
! !IROUTINE: ESMF_GeomTypeEqual - Equality of GeomTypes
!
! !INTERFACE:
function ESMF_GeomTypeEqual(GeomType1, GeomType2)
impure elemental function ESMF_GeomTypeEqual(GeomType1, GeomType2)

! !RETURN VALUE:
logical :: ESMF_GeomTypeEqual
Expand Down Expand Up @@ -1787,7 +1787,7 @@ end function ESMF_GeomTypeEqual
! !IROUTINE: ESMF_GeomTypeNotEqual - Non-equality of GeomTypes
!
! !INTERFACE:
function ESMF_GeomTypeNotEqual(GeomType1, GeomType2)
impure elemental function ESMF_GeomTypeNotEqual(GeomType1, GeomType2)

! !RETURN VALUE:
logical :: ESMF_GeomTypeNotEqual
Expand Down
24 changes: 12 additions & 12 deletions src/Infrastructure/Grid/interface/ESMF_Grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ module ESMF_GridMod
! !IROUTINE: ESMF_GridEQ - Compare two Grids for equality
!
! !INTERFACE:
function ESMF_GridEQ(grid1, grid2)
impure elemental function ESMF_GridEQ(grid1, grid2)
!
! !RETURN VALUE:
logical :: ESMF_GridEQ
Expand Down Expand Up @@ -1244,7 +1244,7 @@ end function ESMF_GridEQ
! !IROUTINE: ESMF_GridNE - Compare two Grids for non-equality
!
! !INTERFACE:
function ESMF_GridNE(grid1, grid2)
impure elemental function ESMF_GridNE(grid1, grid2)
!
! !RETURN VALUE:
logical :: ESMF_GridNE
Expand Down Expand Up @@ -28021,7 +28021,7 @@ end function ESMF_GridGetInit
! !IROUTINE: ESMF_GridConnEqual - Equality of GridConns
!
! !INTERFACE:
function ESMF_GridConnEqual(GridConn1, GridConn2)
impure elemental function ESMF_GridConnEqual(GridConn1, GridConn2)

! !RETURN VALUE:
logical :: ESMF_GridConnEqual
Expand Down Expand Up @@ -28055,7 +28055,7 @@ end function ESMF_GridConnEqual
! !IROUTINE: ESMF_GridConnNotEqual - Non-equality of GridConns
!
! !INTERFACE:
function ESMF_GridConnNotEqual(GridConn1, GridConn2)
impure elemental function ESMF_GridConnNotEqual(GridConn1, GridConn2)

! !RETURN VALUE:
logical :: ESMF_GridConnNotEqual
Expand Down Expand Up @@ -28091,7 +28091,7 @@ end function ESMF_GridConnNotEqual
! !IROUTINE: ESMF_GridDecompEqual - Equality of GridDecomps
!
! !INTERFACE:
function ESMF_GridDecompEqual(GridDecomp1, GridDecomp2)
impure elemental function ESMF_GridDecompEqual(GridDecomp1, GridDecomp2)

! !RETURN VALUE:
logical :: ESMF_GridDecompEqual
Expand Down Expand Up @@ -28125,7 +28125,7 @@ end function ESMF_GridDecompEqual
! !IROUTINE: ESMF_GridDecompNotEqual - Non-equality of GridDecomps
!
! !INTERFACE:
function ESMF_GridDecompNotEqual(GridDecomp1, GridDecomp2)
impure elemental function ESMF_GridDecompNotEqual(GridDecomp1, GridDecomp2)

! !RETURN VALUE:
logical :: ESMF_GridDecompNotEqual
Expand Down Expand Up @@ -28644,7 +28644,7 @@ end subroutine ESMF_GridStatusAssignment
! !IROUTINE: ESMF_GridStatusEqual - Equality of GridStatus statuses
!
! !INTERFACE:
function ESMF_GridStatusEqual(GridStatus1, GridStatus2)
impure elemental function ESMF_GridStatusEqual(GridStatus1, GridStatus2)

! !RETURN VALUE:
logical :: ESMF_GridStatusEqual
Expand Down Expand Up @@ -28678,7 +28678,7 @@ end function ESMF_GridStatusEqual
! !IROUTINE: ESMF_GridStatusNotEqual - Non-equality of GridStatus statuses
!
! !INTERFACE:
function ESMF_GridStatusNotEqual(GridStatus1, GridStatus2)
impure elemental function ESMF_GridStatusNotEqual(GridStatus1, GridStatus2)

! !RETURN VALUE:
logical :: ESMF_GridStatusNotEqual
Expand Down Expand Up @@ -28855,7 +28855,7 @@ end function ESMF_GridStatusLessEqual
! !IROUTINE: ESMF_GridMatchEqual - Equality of GridMatch statuses
!
! !INTERFACE:
function ESMF_GridMatchEqual(GridMatch1, GridMatch2)
impure elemental function ESMF_GridMatchEqual(GridMatch1, GridMatch2)

! !RETURN VALUE:
logical :: ESMF_GridMatchEqual
Expand Down Expand Up @@ -28889,7 +28889,7 @@ end function ESMF_GridMatchEqual
! !IROUTINE: ESMF_GridMatchNotEqual - Non-equality of GridMatch statuses
!
! !INTERFACE:
function ESMF_GridMatchNotEqual(GridMatch1, GridMatch2)
impure elemental function ESMF_GridMatchNotEqual(GridMatch1, GridMatch2)

! !RETURN VALUE:
logical :: ESMF_GridMatchNotEqual
Expand Down Expand Up @@ -31220,7 +31220,7 @@ end subroutine SetupTileConn
! !IROUTINE: ESMF_PoleTypeEqual - Equality of PoleType statuses
!
! !INTERFACE:
function ESMF_PoleTypeEqual(PoleType1, PoleType2)
impure elemental function ESMF_PoleTypeEqual(PoleType1, PoleType2)

! !RETURN VALUE:
logical :: ESMF_PoleTypeEqual
Expand Down Expand Up @@ -31254,7 +31254,7 @@ end function ESMF_PoleTypeEqual
! !IROUTINE: ESMF_PoleTypeNotEqual - Non-equality of PoleType statuses
!
! !INTERFACE:
function ESMF_PoleTypeNotEqual(PoleType1, PoleType2)
impure elemental function ESMF_PoleTypeNotEqual(PoleType1, PoleType2)

! !RETURN VALUE:
logical :: ESMF_PoleTypeNotEqual
Expand Down
4 changes: 2 additions & 2 deletions src/Infrastructure/LocStream/src/ESMF_LocStream.F90
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ module ESMF_LocStreamMod
! !IROUTINE: ESMF_LocStreamEQ - Compare two LocStreams for equality
!
! !INTERFACE:
function ESMF_LocStreamEQ(locstream1, locstream2)
impure elemental function ESMF_LocStreamEQ(locstream1, locstream2)
!
! !RETURN VALUE:
logical :: ESMF_LocStreamEQ
Expand Down Expand Up @@ -418,7 +418,7 @@ end function ESMF_LocStreamEQ
! !IROUTINE: ESMF_LocStreamNE - Compare two LocStreams for non-equality
!
! !INTERFACE:
function ESMF_LocStreamNE(locstream1, locstream2)
impure elemental function ESMF_LocStreamNE(locstream1, locstream2)
!
! !RETURN VALUE:
logical :: ESMF_LocStreamNE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ contains
! !IROUTINE: ESMF_LocalArrayEQ - Compare two LocalArrays for equality
!
! !INTERFACE:
function ESMF_LocalArrayEQ(localarray1, localarray2)
impure elemental function ESMF_LocalArrayEQ(localarray1, localarray2)
!
! !RETURN VALUE:
logical :: ESMF_LocalArrayEQ
Expand Down Expand Up @@ -472,7 +472,7 @@ contains
! !IROUTINE: ESMF_LocalArrayNE - Compare two LocalArrays for non-equality
!
! !INTERFACE:
function ESMF_LocalArrayNE(localarray1, localarray2)
impure elemental function ESMF_LocalArrayNE(localarray1, localarray2)
!
! !RETURN VALUE:
logical :: ESMF_LocalArrayNE
Expand Down Expand Up @@ -504,14 +504,14 @@ contains

! functions to compare two ESMF_DataCopy_Flags to see if they are the same or not

function ESMF_cfeq(cf1, cf2)
impure elemental function ESMF_cfeq(cf1, cf2)
logical ESMF_cfeq
type(ESMF_DataCopy_Flag), intent(in) :: cf1, cf2

ESMF_cfeq = (cf1%datacopyflag .eq. cf2%datacopyflag)
end function

function ESMF_cfne(cf1, cf2)
impure elemental function ESMF_cfne(cf1, cf2)
logical ESMF_cfne
type(ESMF_DataCopy_Flag), intent(in) :: cf1, cf2

Expand Down
7 changes: 4 additions & 3 deletions src/Infrastructure/Mesh/interface/ESMF_Mesh.F90
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ module ESMF_MeshMod
!------------------------------------------------------------------------------



! -------------------------- ESMF-public method -------------------------------
!BOP
! !IROUTINE: ESMF_MeshOperator(/=) - Mesh not equal operator
Expand Down Expand Up @@ -477,7 +478,7 @@ subroutine ESMF_IntToMeshLoc(lhsMeshLoc, rhsInt)
! !IROUTINE: ESMF_MeshEQ - Compare two Meshes for equality
!
! !INTERFACE:
function ESMF_MeshEQ(mesh1, mesh2)
impure elemental function ESMF_MeshEQ(mesh1, mesh2)
!
! !RETURN VALUE:
logical :: ESMF_MeshEQ
Expand Down Expand Up @@ -528,7 +529,7 @@ end function ESMF_MeshEQ
! !IROUTINE: ESMF_MeshNE - Compare two Meshes for non-equality
!
! !INTERFACE:
function ESMF_MeshNE(mesh1, mesh2)
impure elemental function ESMF_MeshNE(mesh1, mesh2)
!
! !RETURN VALUE:
logical :: ESMF_MeshNE
Expand Down Expand Up @@ -6923,7 +6924,7 @@ end function ESMF_MeshStatusNotEqual
! !IROUTINE: ESMF_MeshLocEqual - Equality of MeshLocs
!
! !INTERFACE:
function ESMF_MeshLocEqual(MeshLoc1, MeshLoc2)
impure elemental function ESMF_MeshLocEqual(MeshLoc1, MeshLoc2)

! !RETURN VALUE:
logical :: ESMF_MeshLocEqual
Expand Down
Loading

0 comments on commit 3af84eb

Please sign in to comment.