Skip to content

Commit 86151b1

Browse files
ENH: started to update the pyflowy bindings
Previously the flowy revision was pinned to edb24844c42a4921f596b06129540b7aa80deb28. This is an effort to update the flowy dependency to the newest version. Co-authored-by: Amrita Goswami <amrita16thaug646@gmail.com>
1 parent c3e1994 commit 86151b1

2 files changed

Lines changed: 19 additions & 15 deletions

File tree

python_bindings/bindings.cpp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
#include "flowy/include/config_parser.hpp"
44
#include "flowy/include/definitions.hpp"
55
#include "flowy/include/lobe.hpp"
6+
#include "flowy/include/models/mr_lava_loba.hpp"
67
#include "flowy/include/simulation.hpp"
78
#include "flowy/include/topography.hpp"
89
#include "flowy/include/topography_file.hpp"
10+
#include "pybind11/detail/common.h"
911
#include "pybind11/pytypes.h"
1012

1113
#ifdef WITH_NETCDF
@@ -45,13 +47,13 @@ PYBIND11_MODULE( flowycpp, m )
4547
.def_readwrite( "y_min", &Flowy::TopographyCrop::y_min )
4648
.def_readwrite( "y_max", &Flowy::TopographyCrop::y_max );
4749

48-
py::enum_<Flowy::OutputQuantitiy>( m, "OutputQuantitiy" )
49-
.value( "Hazard", Flowy::OutputQuantitiy::Hazard )
50-
.value( "Height", Flowy::OutputQuantitiy::Height );
50+
py::enum_<Flowy::OutputQuantity>( m, "OutputQuantity" )
51+
.value( "Hazard", Flowy::OutputQuantity::Hazard )
52+
.value( "Height", Flowy::OutputQuantity::Height );
5153

5254
py::class_<Flowy::AscFile>( m, "AscFile" )
5355
.def( py::init<>() )
54-
.def( py::init<Flowy::Topography, Flowy::OutputQuantitiy>() )
56+
.def( py::init<Flowy::Topography, Flowy::OutputQuantity>() )
5557
.def( py::init<std::filesystem::path>(), "file_path"_a )
5658
.def( py::init<std::filesystem::path, Flowy::TopographyCrop>() )
5759
.def( "save", &Flowy::AscFile::save )
@@ -101,7 +103,8 @@ PYBIND11_MODULE( flowycpp, m )
101103
.def( "extent_xy", &Flowy::Lobe::extent_xy )
102104
.def( "line_segment_intersects", &Flowy::Lobe::line_segment_intersects )
103105
.def( "is_point_in_lobe", &Flowy::Lobe::is_point_in_lobe )
104-
.def( "point_at_angle", &Flowy::Lobe::point_at_angle )
106+
// .def( "point_at_angle", py::overload_cast<const double>(&Flowy::Lobe::point_at_angle) )
107+
// .def( "point_at_angle", py::overload_cast<const double, const double>(&Flowy::Lobe::point_at_angle) )
105108
.def( "rasterize_perimeter", &Flowy::Lobe::rasterize_perimeter );
106109

107110
py::class_<Flowy::LobeCells>( m, "LobeCells" )
@@ -183,28 +186,29 @@ PYBIND11_MODULE( flowycpp, m )
183186

184187
py::class_<Flowy::CommonLobeDimensions>( m, "CommonLobeDimensions" )
185188
.def( py::init<>() )
186-
.def( py::init<Flowy::Config::InputParams, Flowy::Topography>() )
189+
.def( py::init<Flowy::Config::InputParams>() )
187190
.def_readwrite( "avg_lobe_thickness", &Flowy::CommonLobeDimensions::avg_lobe_thickness )
188191
.def_readwrite( "lobe_area", &Flowy::CommonLobeDimensions::lobe_area )
189192
.def_readwrite( "max_semiaxis", &Flowy::CommonLobeDimensions::max_semiaxis )
190-
.def_readwrite( "max_cells", &Flowy::CommonLobeDimensions::max_cells )
191193
.def_readwrite( "thickness_min", &Flowy::CommonLobeDimensions::thickness_min );
192194

193195
py::class_<Flowy::Simulation>( m, "Simulation" )
194196
.def( py::init<Flowy::Config::InputParams, std::optional<int>>() )
195197
.def_readwrite( "input", &Flowy::Simulation::input )
196198
.def_readwrite( "topography", &Flowy::Simulation::topography )
197199
.def_readwrite( "lobes", &Flowy::Simulation::lobes )
198-
.def_readwrite( "lobe_dimensions", &Flowy::Simulation::lobe_dimensions )
199-
.def( "compute_initial_lobe_position", &Flowy::Simulation::compute_initial_lobe_position )
200-
.def( "compute_lobe_axes", &Flowy::Simulation::compute_lobe_axes )
201-
.def( "compute_descendent_lobe_position", &Flowy::Simulation::compute_descendent_lobe_position )
202-
.def( "perturb_lobe_angle", &Flowy::Simulation::perturb_lobe_angle )
203-
.def( "select_parent_lobe", &Flowy::Simulation::select_parent_lobe )
204-
.def( "add_inertial_contribution", &Flowy::Simulation::add_inertial_contribution )
205200
.def( "stop_condition", &Flowy::Simulation::stop_condition )
206201
.def( "run", &Flowy::Simulation::run );
207202

203+
py::class_<Flowy::MrLavaLoba>( m, "MrLavaLoba" )
204+
.def_readwrite( "lobe_dimensions", &Flowy::MrLavaLoba::lobe_dimensions )
205+
.def( "compute_initial_lobe_position", &Flowy::MrLavaLoba::compute_initial_lobe_position )
206+
.def( "compute_lobe_axes", &Flowy::MrLavaLoba::compute_lobe_axes )
207+
.def( "compute_descendent_lobe_position", &Flowy::MrLavaLoba::compute_descendent_lobe_position )
208+
.def( "perturb_lobe_angle", &Flowy::MrLavaLoba::perturb_lobe_angle )
209+
.def( "select_parent_lobe", &Flowy::MrLavaLoba::select_parent_lobe )
210+
.def( "add_inertial_contribution", &Flowy::MrLavaLoba::add_inertial_contribution );
211+
208212
m.def(
209213
"parse_config", &Flowy::Config::parse_config, "A function to parse input settings from a TOML file.",
210214
"config_path"_a );

subprojects/flowy.wrap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[wrap-git]
22
directory=flowy
33
url=https://github.com/flowy-code/flowy.git
4-
revision=e4bd3e2f5e220f7588a155643d604ffe204c8802
4+
revision=edb24844c42a4921f596b06129540b7aa80deb28
55
depth=1

0 commit comments

Comments
 (0)