2021-11-11 14:09:39 +01:00
|
|
|
#include <fmt/format.h>
|
|
|
|
|
|
2021-12-14 08:06:42 +01:00
|
|
|
#include <opm/input/eclipse/Units/UnitSystem.hpp>
|
2019-10-11 16:29:09 +02:00
|
|
|
|
|
|
|
|
#include "export.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void python::common::export_UnitSystem(py::module& module)
|
|
|
|
|
{
|
|
|
|
|
py::class_<UnitSystem>(module, "UnitSystem")
|
2019-10-13 22:53:56 +02:00
|
|
|
.def_property_readonly( "name", &UnitSystem::getName );
|
2021-11-11 14:09:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
py::class_<Dimension>(module, "Dimension")
|
|
|
|
|
.def_property_readonly("scaling", &Dimension::getSIScaling)
|
|
|
|
|
.def_property_readonly("offset", &Dimension::getSIOffset)
|
|
|
|
|
.def("__repr__", [](const Dimension& dim) {
|
|
|
|
|
auto scaling = dim.getSIScaling();
|
|
|
|
|
auto offset = dim.getSIOffset();
|
|
|
|
|
if (dim.getSIOffset() != 0)
|
|
|
|
|
return fmt::format("Dimension(scaling={}, offset={})", scaling, offset);
|
|
|
|
|
else
|
|
|
|
|
return fmt::format("Dimension(scaling={})", scaling);
|
|
|
|
|
});
|
2019-10-11 16:29:09 +02:00
|
|
|
}
|