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
31 changes: 31 additions & 0 deletions src/Base/Algorithm.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* Copyright 2021-2025 The AMReX Community
*
* Authors: Axel Huebl
* License: BSD-3-Clause-LBNL
*/
#include "pyAMReX.H"

#include <AMReX_Algorithm.H>

#include <type_traits>


void init_Algorithm (py::module& m)
{
using namespace amrex;

m.def(
"almost_equal",
&almostEqual<Real>,
py::arg("x"), py::arg("y"), py::arg("ulp")=2
);

if constexpr (!std::is_same_v<Real, ParticleReal>)
{
m.def(
"almost_equal",
&almostEqual<ParticleReal>,
py::arg("x"), py::arg("y"), py::arg("ulp")=2
);
}
}
1 change: 1 addition & 0 deletions src/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
foreach(D IN LISTS AMReX_SPACEDIM)
target_sources(pyAMReX_${D}d
PRIVATE
Algorithm.cpp
AMReX.cpp
Arena.cpp
Array4.cpp
Expand Down
2 changes: 2 additions & 0 deletions src/pyAMReX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


// forward declarations of exposed classes
void init_Algorithm(py::module&);
void init_AMReX(py::module&);
void init_Arena(py::module&);
void init_Array4(py::module&);
Expand Down Expand Up @@ -90,6 +91,7 @@ PYBIND11_MODULE(amrex_3d_pybind, m) {
init_AMReX(m);
init_Arena(m);
init_Dim3(m);
init_Algorithm(m);
init_IntVect(m);
init_IndexType(m);
init_RealVect(m);
Expand Down
Loading