Skip to content

Commit

Permalink
Support for Interaction class
Browse files Browse the repository at this point in the history
  • Loading branch information
austinschneider committed Dec 17, 2024
1 parent 6210de4 commit b3ef5ca
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion projects/interactions/private/pybindings/CrossSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <pybind11/operators.h>
#include <pybind11/stl.h>

#include "../../public/SIREN/interactions/Interaction.h"
#include "../../public/SIREN/interactions/CrossSection.h"
#include "../../public/SIREN/interactions/pyCrossSection.h"
#include "../../../dataclasses/public/SIREN/dataclasses/Particle.h"
Expand All @@ -18,7 +19,7 @@ void register_CrossSection(pybind11::module_ & m) {
using namespace pybind11;
using namespace siren::interactions;

class_<CrossSection, std::shared_ptr<CrossSection>, pyCrossSection>(m, "CrossSection")
class_<CrossSection, std::shared_ptr<CrossSection>, pyCrossSection, Interaction>(m, "CrossSection")
.def(init<>())
.def("__eq__", [](const CrossSection &self, const CrossSection &other){ return self == other; })
.def("equal", &CrossSection::equal)
Expand Down
3 changes: 2 additions & 1 deletion projects/interactions/private/pybindings/Decay.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <pybind11/operators.h>
#include <pybind11/stl.h>

#include "../../public/SIREN/interactions/Interaction.h"
#include "../../public/SIREN/interactions/CrossSection.h"
#include "../../public/SIREN/interactions/Decay.h"
#include "../../public/SIREN/interactions/pyDecay.h"
Expand All @@ -17,7 +18,7 @@ void register_Decay(pybind11::module_ & m) {
using namespace pybind11;
using namespace siren::interactions;

class_<Decay, std::shared_ptr<Decay>, pyDecay>(m, "Decay")
class_<Decay, std::shared_ptr<Decay>, pyDecay, Interaction>(m, "Decay")
.def("TotalDecayLength",&Decay::TotalDecayLength)
.def("TotalDecayLengthForFinalState",&Decay::TotalDecayLengthForFinalState);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <pybind11/operators.h>
#include <pybind11/stl.h>

#include "../../public/SIREN/interactions/Interaction.h"
#include "../../public/SIREN/interactions/CrossSection.h"
#include "../../public/SIREN/interactions/InteractionCollection.h"
#include "../../public/SIREN/interactions/Decay.h"
Expand All @@ -22,6 +23,7 @@ void register_InteractionCollection(pybind11::module_ & m) {
.def(init<siren::dataclasses::ParticleType, std::vector<std::shared_ptr<CrossSection>>>())
.def(init<siren::dataclasses::ParticleType, std::vector<std::shared_ptr<Decay>>>())
.def(init<siren::dataclasses::ParticleType, std::vector<std::shared_ptr<CrossSection>>, std::vector<std::shared_ptr<Decay>>>())
.def(init<siren::dataclasses::ParticleType, std::vector<std::shared_ptr<Interaction>>>())
.def(self == self)
.def("GetCrossSections",&InteractionCollection::GetCrossSections, return_value_policy::reference_internal)
.def("GetDecays",&InteractionCollection::GetDecays, return_value_policy::reference_internal)
Expand Down
3 changes: 3 additions & 0 deletions projects/interactions/private/pybindings/interactions.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#include <vector>

#include "../../public/SIREN/interactions/Interaction.h"
#include "../../public/SIREN/interactions/CrossSection.h"
#include "../../public/SIREN/interactions/NeutrissimoDecay.h"
#include "../../public/SIREN/interactions/InteractionCollection.h"
Expand All @@ -10,6 +11,7 @@
#include "../../public/SIREN/interactions/DarkNewsCrossSection.h"
#include "../../public/SIREN/interactions/DarkNewsDecay.h"

#include "./Interaction.h"
#include "./CrossSection.h"
#include "./DipoleFromTable.h"
#include "./DarkNewsCrossSection.h"
Expand All @@ -32,6 +34,7 @@ using namespace pybind11;
PYBIND11_MODULE(interactions,m) {
using namespace siren::interactions;

register_Interaction(m);
register_CrossSection(m);
register_Decay(m);
register_DipoleFromTable(m);
Expand Down

0 comments on commit b3ef5ca

Please sign in to comment.