Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comparison operator for boxarray and distromap. Add hdf5 to dep.py #4173

Merged
merged 4 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions Src/F_Interfaces/Base/AMReX_boxarray_fi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,9 @@ extern "C" {
Box bx(IntVect(lo), IntVect(hi), ba->ixType());
return ba->intersects(bx);
}

int amrex_fi_boxarray_issame (const BoxArray* baa, const BoxArray* bab)
{
return baa == bab;
WeiqunZhang marked this conversation as resolved.
Show resolved Hide resolved
}
}
19 changes: 18 additions & 1 deletion Src/F_Interfaces/Base/AMReX_boxarray_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module amrex_boxarray_module

private

public :: amrex_boxarray_build, amrex_boxarray_destroy, amrex_print
public :: amrex_boxarray_build, amrex_boxarray_destroy, amrex_print, &
operator(==)

type, public :: amrex_boxarray
logical :: owner = .false.
Expand All @@ -36,6 +37,10 @@ module amrex_boxarray_module
#endif
end type amrex_boxarray

interface operator(==)
module procedure amrex_boxarray_issame
end interface operator(==)

interface amrex_boxarray_build
module procedure amrex_boxarray_build_bx
module procedure amrex_boxarray_build_bxs
Expand Down Expand Up @@ -128,6 +133,12 @@ pure integer function amrex_fi_boxarray_intersects_box (ba, lo, hi) bind(c)
type(c_ptr), value, intent(in) :: ba
integer, intent(in) :: lo(*), hi(*)
end function amrex_fi_boxarray_intersects_box

pure integer function amrex_fi_boxarray_issame (baa, bab) bind(c)
import
implicit none
type(c_ptr), value, intent(in) :: baa, bab
end function amrex_fi_boxarray_issame
end interface

contains
Expand Down Expand Up @@ -258,4 +269,10 @@ pure function amrex_boxarray_intersects_box (this, bx) result(r)
r = ir .ne. 0
end function amrex_boxarray_intersects_box

pure logical function amrex_boxarray_issame(baa, bab) result(r)
type(amrex_boxarray), intent(in) :: baa
type(amrex_boxarray), intent(in) :: bab
r = amrex_fi_boxarray_issame(baa%p, bab%p)
end function amrex_boxarray_issame

end module amrex_boxarray_module
5 changes: 5 additions & 0 deletions Src/F_Interfaces/Base/AMReX_distromap_fi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@ extern "C" {
{
AllPrint() << *dm;
}

int amrex_fi_distromap_issame (const DistributionMapping* dma, const DistributionMapping* dmb)
{
return dma == dmb;
}
}
18 changes: 17 additions & 1 deletion Src/F_Interfaces/Base/AMReX_distromap_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module amrex_distromap_module

private

public :: amrex_distromap_build, amrex_distromap_destroy, amrex_print
public :: amrex_distromap_build, amrex_distromap_destroy, amrex_print, &
operator(==)

type, public :: amrex_distromap
logical :: owner = .false.
Expand All @@ -25,6 +26,10 @@ module amrex_distromap_module
#endif
end type amrex_distromap

interface operator(==)
module procedure amrex_distromap_issame
end interface operator(==)

interface amrex_distromap_build
module procedure amrex_distromap_build_ba
module procedure amrex_distromap_build_pmap
Expand Down Expand Up @@ -89,6 +94,12 @@ subroutine amrex_fi_print_distromap (dm) bind(c)
implicit none
type(c_ptr), value :: dm
end subroutine amrex_fi_print_distromap

pure integer function amrex_fi_distromap_issame (dma, dmb) bind(c)
import
implicit none
type(c_ptr), value, intent(in) :: dma, dmb
end function amrex_fi_distromap_issame
end interface

contains
Expand Down Expand Up @@ -158,4 +169,9 @@ subroutine amrex_distromap_print (dm)
call amrex_fi_print_distromap(dm%p)
end subroutine amrex_distromap_print

pure logical function amrex_distromap_issame (dma, dmb) result(r)
type(amrex_distromap), intent(in) :: dma, dmb
r = amrex_fi_distromap_issame(dma%p, dmb%p)
end function amrex_distromap_issame

end module amrex_distromap_module
2 changes: 1 addition & 1 deletion Tools/F_scripts/dep.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import preprocess

# modules to ignore in the dependencies
IGNORES = ["iso_c_binding", "iso_fortran_env", "omp_lib", "mpi", "cudafor", "openacc", "hdf"]
IGNORES = ["iso_c_binding", "iso_fortran_env", "omp_lib", "mpi", "cudafor", "openacc", "hdf", "hdf5"]

# regular expression for "{}module{}name", where {} can be any number
# of spaces. We use 4 groups here, denoted by (), so the name of the
Expand Down