Skip to content

Commit

Permalink
wrapper for concatenate function in amrex
Browse files Browse the repository at this point in the history
  • Loading branch information
RevathiJambunathan committed Jul 12, 2023
1 parent 0354504 commit 393c84e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ foreach(D IN LISTS AMReX_SPACEDIM)
Periodicity.cpp
PODVector.cpp
Vector.cpp
Utility.cpp
)
endforeach()
21 changes: 21 additions & 0 deletions src/Base/Utility.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright 2021-2022 The AMReX Community
*
* License: BSD-3-Clause-LBNL
*/
#include <AMReX_Utility.H>
#include <pybind11/pybind11.h>
#include <sstream>

namespace py = pybind11;
using namespace amrex;

void init_Utility(py::module& m)
{
m.def("concatenate",
[] (const std::string& root,
int num,
int mindigits) {
return amrex::Concatenate(root, num, mindigits);
}, py::return_value_policy::move,
"Builds plotfile name");
}
6 changes: 5 additions & 1 deletion src/pyAMReX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void init_ParticleContainer(py::module &);
void init_Periodicity(py::module &);
void init_PODVector(py::module &);
void init_Vector(py::module &);

void init_Utility(py::module &);

#if AMREX_SPACEDIM == 1
PYBIND11_MODULE(amrex_1d_pybind, m) {
Expand Down Expand Up @@ -83,6 +83,7 @@ PYBIND11_MODULE(amrex_3d_pybind, m) {
PODVector
StructOfArrays
Vector
Utility
)pbdoc";

// note: order from parent to child classes
Expand Down Expand Up @@ -114,6 +115,9 @@ PYBIND11_MODULE(amrex_3d_pybind, m) {
init_ParticleContainer(m);
init_AmrMesh(m);

// Wrappers around functions, independent of parent to child order
init_Utility(m);

// API runtime version
// note PEP-440 syntax: x.y.zaN but x.y.z.devN
#ifdef PYAMReX_VERSION_INFO
Expand Down

0 comments on commit 393c84e

Please sign in to comment.