Skip to content

Commit

Permalink
Missing commit of this source file, ooops.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin D. Weinberg committed Dec 25, 2024
1 parent 4fb9894 commit 4ec255e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions exputil/DiskDensityFunc.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <DiskDensityFunc.H>

namespace py = pybind11; // Convenience


DiskDensityFunc::DiskDensityFunc(const std::string& modulename)
{
py::initialize_interpreter();

disk_density =
py::reinterpret_borrow<py::function>
( py::module::import(modulename.c_str()).attr("disk_density") );
}

DiskDensityFunc::~DiskDensityFunc()
{
py::finalize_interpreter();
}

double DiskDensityFunc::operator() (double R, double z, double phi)
{
return disk_density(R, z, phi).cast<double>();
}

0 comments on commit 4ec255e

Please sign in to comment.