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

wrapper for concatenate function in amrex #145

Merged
Merged
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions src/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ foreach(D IN LISTS AMReX_SPACEDIM)
ParmParse.cpp
Periodicity.cpp
PODVector.cpp
Utility.cpp
Vector.cpp
)
endforeach()
19 changes: 19 additions & 0 deletions src/Base/Utility.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* Copyright 2021-2022 The AMReX Community
*
* License: BSD-3-Clause-LBNL
ax3l marked this conversation as resolved.
Show resolved Hide resolved
*/
#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",
&amrex::Concatenate,
"Builds plotfile name",
py::arg("root"), py::arg("num"), py::arg("mindigits")=5
);
}
5 changes: 5 additions & 0 deletions src/pyAMReX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void init_ParticleTile(py::module &);
void init_ParticleContainer(py::module &);
void init_Periodicity(py::module &);
void init_PODVector(py::module &);
void init_Utility(py::module &);
void init_Vector(py::module &);

ax3l marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -82,6 +83,7 @@ PYBIND11_MODULE(amrex_3d_pybind, m) {
Periodicity
PODVector
StructOfArrays
Utility
Vector
)pbdoc";

Expand Down Expand Up @@ -114,6 +116,9 @@ PYBIND11_MODULE(amrex_3d_pybind, m) {
init_ParticleContainer(m);
init_AmrMesh(m);

// Wrappers around standalone functions
init_Utility(m);

// API runtime version
// note PEP-440 syntax: x.y.zaN but x.y.z.devN
#ifdef PYAMReX_VERSION_INFO
Expand Down
11 changes: 11 additions & 0 deletions tests/test_utility.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-


ax3l marked this conversation as resolved.
Show resolved Hide resolved
import amrex.space3d as amr


def test_concatenate():
pltname = amr.concatenate("plt", 1000, 5)
print("--test concatenate --")
print("plotfile name", pltname)
ax3l marked this conversation as resolved.
Show resolved Hide resolved
assert pltname == "plt01000"
Loading