Skip to content

Commit

Permalink
small tweeks.. see if I can get github to use python
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarnier committed May 17, 2024
1 parent d1aa6c8 commit db0220a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ jobs:
with:
packages: zlib1g-dev libjpeg-dev libhdf5-dev
- name: Checkout on Ubuntu
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 1
- name : Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build on Ubuntu
uses: threeal/cmake-action@v1.2.0
with:
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ requires = [
"numpy",
"cibuildwheel",
"wheel",
"build"
"build",
"pydantic"
]
build-backend = "scikit_build_core.build"

Expand Down
18 changes: 9 additions & 9 deletions python/PyDipolEq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,24 +678,24 @@ PYBIND11_MODULE(_c, m) {
.def_readwrite("R2", &LIMITER::X2)
.def_readwrite("Z2", &LIMITER::Z2)
.def_readwrite("Enabled", &LIMITER::Enabled)
.def_readonly("Name", &LIMITER::Name)
.def("setName", [](LIMITER& self, std::string name)
{strncpy(self.Name, name.c_str(), sizeof(LIMITER::Name)-1);},
"Set the name of the limiter")
.def_readwrite("PsiMin", &LIMITER::PsiMin)
.def_readwrite("Rmin", &LIMITER::Xmin)
.def_readwrite("Zmin", &LIMITER::Zmin)
.def_property("Name", [](LIMITER& self) {return self.Name;},
[](LIMITER& self, std::string name){
strncpy(self.Name, name.c_str(), sizeof(LIMITER::Name)-1);
}, "Name of the limiter")
;

py::class_<SUBCOIL>(m, "SUBCOIL")
.def(py::init(&new_SubCoil), "Create SUBCOIL")
.def_readwrite("R", &SUBCOIL::X)
.def_readwrite("Z", &SUBCOIL::Z)
.def_readwrite("CurrentFraction", &SUBCOIL::CurrentFraction)
.def_readonly("Name", &SUBCOIL::Name)
.def("setName", [](SUBCOIL& self, std::string name)
{strncpy(self.Name, name.c_str(), sizeof(SUBCOIL::Name)-1);},
"Set the name of the subcoil")
.def_readwrite("Fraction", &SUBCOIL::CurrentFraction, "Fraction of current")
.def_property("Name", [](SUBCOIL& self) {return self.Name;},
[](SUBCOIL& self, std::string name){
strncpy(self.Name, name.c_str(), sizeof(COIL::Name)-1);
}, "Name of the subcoil")
;

py::class_<COIL>(m, "COIL")
Expand Down

0 comments on commit db0220a

Please sign in to comment.