Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 16 additions & 0 deletions docs/source/usage/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,19 @@ This is for the legacy, AoS + SoA particle containers only:
.. autoclass:: amrex.space3d.Particle_2_1
:members:
:undoc-members:

.. _usage-api-eb:

Embedded Boundaries
-------------------

Embedded boundary (EB) support is still experimental. To build pyAMReX with
EB support, you need to add ``-DAMReX_EB=ON`` to CMake build options.

.. autofunction:: amrex.space3d.EB2_Build

.. autoclass:: amrex.space3d.EBFArrayBoxFactory
:members:
:undoc-members:

.. autofunction:: amrex.space3d.makeEBFabFactory
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
add_subdirectory(AmrCore)
add_subdirectory(Base)
#add_subdirectory(Boundary)
#add_subdirectory(EB)
if (AMReX_EB)
add_subdirectory(EB)
endif()
#add_subdirectory(Extern)
#add_subdirectory(LinearSolvers)
add_subdirectory(Particle)
Expand Down
11 changes: 11 additions & 0 deletions src/EB/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
foreach(D IN LISTS AMReX_SPACEDIM)
if (D EQUAL 1)
return()
endif()

target_sources(pyAMReX_${D}d
PRIVATE
EB.cpp
EBFabFactory.cpp
)
endforeach()
28 changes: 28 additions & 0 deletions src/EB/EB.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "pyAMReX.H"

#include <AMReX_EB2.H>

void init_EBFabFactory (py::module& m);

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

m.def(
"EB2_Build",
[] (Geometry const& geom, int required_coarsening_level, int max_coarsening_level,
int ngrow, bool build_coarse_level_by_coarsening, bool extend_domain_face,
int num_coarsen_opt)
{
EB2::Build(geom, required_coarsening_level, max_coarsening_level, ngrow,
build_coarse_level_by_coarsening, extend_domain_face, num_coarsen_opt);
},
py::arg("geom"), py::arg("required_coarsening_level"), py::arg("max_coarsening_level"),
py::arg("ngrow") = 4, py::arg("build_coarse_level_by_coarsening") = true,
py::arg("extend_domain_face") = EB2::ExtendDomainFace(),
py::arg("num_coarsen_opt") = EB2::NumCoarsenOpt(),
"EB generation"
);

init_EBFabFactory(m);
}
32 changes: 32 additions & 0 deletions src/EB/EBFabFactory.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

#include "pyAMReX.H"

#include <AMReX_EBFabFactory.H>
#include <AMReX_MultiFab.H>

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

py::class_<EBFArrayBoxFactory, FabFactory<FArrayBox>>(m, "EBFArrayBoxFactory")
.def("getVolFrac", &EBFArrayBoxFactory::getVolFrac,
py::return_value_policy::reference_internal,
"Return volume faction MultiFab");

py::enum_<EBSupport>(m, "EBSupport")
.value("basic", EBSupport::basic)
.value("volume", EBSupport::volume)
.value("full", EBSupport::full);

m.def(
"makeEBFabFactory",
[] (Geometry const& geom, BoxArray const& ba, DistributionMapping const& dm,
Vector<int> const& ngrow, EBSupport support)
{
return makeEBFabFactory(geom, ba, dm, ngrow, support);
},
py::arg("geom"), py::arg("ba"), py::arg("dm"), py::arg("ngrow"),
py::arg("support").
"Make EBFArrayBoxFactory for given Geometry, BoxArray and DistributionMapping"
);
}
7 changes: 7 additions & 0 deletions src/pyAMReX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ void init_Utility(py::module &);
void init_Vector(py::module &);
void init_Version(py::module &);
void init_VisMF(py::module &);
#ifdef AMREX_USE_EB
void init_EB(py::module &);
#endif

#if AMREX_SPACEDIM == 1
PYBIND11_MODULE(amrex_1d_pybind, m) {
Expand Down Expand Up @@ -139,6 +142,10 @@ PYBIND11_MODULE(amrex_3d_pybind, m) {
init_Version(m);
init_VisMF(m);

#ifdef AMREX_USE_EB
init_EB(m);
#endif

// authors
m.attr("__author__") =
"Axel Huebl, Ryan T. Sandberg, Shreyas Ananthan, David P. Grote, "
Expand Down
Loading