mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Return vectors by value
Return vectors by value instead of unique pointers to arrays.
This commit is contained in:
@@ -95,9 +95,8 @@ int PyBlackOilSimulator::currentStep()
|
||||
}
|
||||
|
||||
py::array_t<double> PyBlackOilSimulator::getCellVolumes() {
|
||||
std::size_t len;
|
||||
auto array = getMaterialState().getCellVolumes(&len);
|
||||
return py::array(len, array.get());
|
||||
auto vector = getMaterialState().getCellVolumes();
|
||||
return py::array(vector.size(), vector.data());
|
||||
}
|
||||
|
||||
double PyBlackOilSimulator::getDT() {
|
||||
@@ -106,36 +105,32 @@ double PyBlackOilSimulator::getDT() {
|
||||
|
||||
py::array_t<double> PyBlackOilSimulator::getPorosity()
|
||||
{
|
||||
std::size_t len;
|
||||
auto array = getMaterialState().getPorosity(&len);
|
||||
return py::array(len, array.get());
|
||||
auto vector = getMaterialState().getPorosity();
|
||||
return py::array(vector.size(), vector.data());
|
||||
}
|
||||
|
||||
py::array_t<double>
|
||||
PyBlackOilSimulator::
|
||||
getFluidStateVariable(const std::string &name) const
|
||||
{
|
||||
std::size_t len;
|
||||
auto array = getFluidState().getFluidStateVariable(name, &len);
|
||||
return py::array(len, array.get());
|
||||
auto vector = getFluidState().getFluidStateVariable(name);
|
||||
return py::array(vector.size(), vector.data());
|
||||
}
|
||||
|
||||
py::array_t<double>
|
||||
PyBlackOilSimulator::
|
||||
getPrimaryVariable(const std::string &variable) const
|
||||
{
|
||||
std::size_t len;
|
||||
auto array = getFluidState().getPrimaryVariable(variable, &len);
|
||||
return py::array(len, array.get());
|
||||
auto vector = getFluidState().getPrimaryVariable(variable);
|
||||
return py::array(vector.size(), vector.data());
|
||||
}
|
||||
|
||||
py::array_t<int>
|
||||
PyBlackOilSimulator::
|
||||
getPrimaryVarMeaning(const std::string &variable) const
|
||||
{
|
||||
std::size_t len;
|
||||
auto array = getFluidState().getPrimaryVarMeaning(variable, &len);
|
||||
return py::array(len, array.get());
|
||||
auto vector = getFluidState().getPrimaryVarMeaning(variable);
|
||||
return py::array(vector.size(), vector.data());
|
||||
}
|
||||
|
||||
std::map<std::string, int>
|
||||
|
||||
Reference in New Issue
Block a user