Skip to content

Commit a2f2264

Browse files
__call__ operator fixed
1 parent 7e6c5b2 commit a2f2264

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

source/geometry/biasing/pyG4GeometryCellComp.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ void export_G4GeometryCellComp(py::module &m)
1616

1717
.def(py::init<>())
1818
.def("__copy__", [](const G4GeometryCellComp &self) { return G4GeometryCellComp(self); })
19-
.def("__deepcopy__", [](const G4GeometryCellComp &self, py::dict) { return G4GeometryCellComp(self); });
20-
21-
py::implicitly_convertible<G4GeometryCellComp, G4GeometryCell>();
19+
.def("__deepcopy__", [](const G4GeometryCellComp &self, py::dict) { return G4GeometryCellComp(self); })
20+
.def("__call__", &G4GeometryCellComp::operator(), py::arg("g1"), py::arg("g2"), py::is_operator());
2221
}

source/geometry/solids/specific/pyG4TessellatedSolid.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ void export_G4TessellatedSolid(py::module &m)
156156

157157
.def("__copy__", [](const G4VertexComparator &self) { return G4VertexComparator(self); })
158158
.def("__deepcopy__", [](const G4VertexComparator &self, py::dict) { return G4VertexComparator(self); })
159-
.def(py::init<>());
160-
161-
py::implicitly_convertible<G4VertexComparator, G4VertexInfo>();
159+
.def(py::init<>())
160+
.def("__call__", &G4VertexComparator::operator(), py::arg("l"), py::arg("r"), py::is_operator());
162161

163162
py::class_<G4TessellatedSolid, PyG4TessellatedSolid, G4VSolid, py::nodelete>(m, "G4TessellatedSolid")
164163

source/graphics_reps/pyG4AttDefStore.cc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ class ScopeG4AttDefStore {
1515
void export_G4AttDefStore(py::module &m)
1616
{
1717
py::class_<ScopeG4AttDefStore>(m, "G4AttDefStore")
18-
.def_static("GetInstance",
19-
[](const G4String &storeKey) {
20-
G4bool isNew;
21-
std::map<G4String, G4AttDef> *store = G4AttDefStore::GetInstance(storeKey, isNew);
22-
return py::make_tuple(store, isNew);
23-
})
18+
.def_static(
19+
"GetInstance",
20+
[](const G4String &storeKey) {
21+
G4bool isNew;
22+
std::map<G4String, G4AttDef> *store = G4AttDefStore::GetInstance(storeKey, isNew);
23+
return std::make_tuple(store, isNew);
24+
},
25+
py::return_value_policy::automatic_reference)
26+
2427
.def_static("GetStoreKey", [](const std::map<G4String, G4AttDef> *definitions) {
2528
G4String key;
2629
G4bool contains = G4AttDefStore::GetStoreKey(definitions, key);
27-
return py::make_tuple(contains, key);
30+
return std::make_tuple(contains, key);
2831
});
2932
}

0 commit comments

Comments
 (0)