Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dsarrut committed Jul 28, 2023
1 parent e3ddf3a commit 1531ba0
Show file tree
Hide file tree
Showing 207 changed files with 6,445 additions and 410 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ __pycache__

/opengate.egg-info/

opengate_temporaire

/opengate/tests/src/preload.sh
/opengate/tests/log/*log
/opengate/tests/log/*tmp
Expand Down Expand Up @@ -74,12 +76,14 @@ __pycache__
/opengate/tests/output_save
/opengate/tests/src/garf
/opengate/tests/src/temp_output
/opengate/tests/src/temp
/opengate/tests/src/test_visu
/opengate/tests/src/intevo
/opengate/tests/src/*.vrml
/opengate/tests/src/*.wrl
/opengate/tests/src/temp
/opengate/tests/src/pb212
/opengate/tests/src/*.gdml

/cmake-build-debug
/cmake-build-release
Expand Down
18 changes: 18 additions & 0 deletions core/opengate_core/g4_bindings/pyG4DataVector.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/stl_bind.h>

namespace py = pybind11;

#include "G4DataVector.hh"

void init_G4DataVector(py::module &m) {
py::class_<G4DataVector>(m, "G4DataVector").def(py::init<>());
}
19 changes: 19 additions & 0 deletions core/opengate_core/g4_bindings/pyG4DecayTable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4DecayTable.hh"

void init_G4DecayTable(py::module &m) {
py::class_<G4DecayTable>(m, "G4DecayTable")
.def("entries", &G4DecayTable::entries)
.def("GetDecayChannel", &G4DecayTable::GetDecayChannel,
py::return_value_policy::reference);
}
16 changes: 16 additions & 0 deletions core/opengate_core/g4_bindings/pyG4IInterpolator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4IInterpolator.hh"

void init_G4IInterpolator(py::module &m) {
py::class_<G4IInterpolator>(m, "G4IInterpolator");
}
50 changes: 50 additions & 0 deletions core/opengate_core/g4_bindings/pyG4IonTable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4IonTable.hh"
#include "G4ParticleDefinition.hh"

void init_G4IonTable(py::module &m) {

py::class_<G4IonTable, std::unique_ptr<G4IonTable, py::nodelete>>(
m, "G4IonTable")
.def("GetIonTable", &G4IonTable::GetIonTable,
py::return_value_policy::reference)

.def("GetNumberOfElements", &G4IonTable::GetNumberOfElements)
.def("Entries", &G4IonTable::Entries)
.def("size", &G4IonTable::size)
.def("CreateAllIon", &G4IonTable::CreateAllIon)
.def("CreateAllIsomer", &G4IonTable::CreateAllIsomer)

.def("GetIon",
(G4ParticleDefinition *
(G4IonTable::*)(G4int Z, G4int A, G4int lvl)) &
G4IonTable::GetIon,
py::return_value_policy::reference)

.def("GetIon",
(G4ParticleDefinition *
(G4IonTable::*)(G4int Z, G4int A, G4double E, G4int J)) &
G4IonTable::GetIon,
py::return_value_policy::reference)

.def("GetIon",
(G4ParticleDefinition * (G4IonTable::*)(G4int encoding)) &
G4IonTable::GetIon,
py::return_value_policy::reference)

.def("GetIonName", (const G4String &(G4IonTable::*)(G4int Z, G4int A,
G4int lvl) const) &
G4IonTable::GetIonName)

.def("DumpTable", &G4IonTable::DumpTable);
}
21 changes: 21 additions & 0 deletions core/opengate_core/g4_bindings/pyG4Ions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4Ions.hh"
#include "G4ParticleDefinition.hh"

void init_G4Ions(py::module &m) {
py::class_<G4Ions, G4ParticleDefinition>(m, "G4Ions")
.def("GetExcitationEnergy", &G4Ions::GetExcitationEnergy)
.def("GetIsomerLevel", &G4Ions::GetIsomerLevel)
.def("GetFloatLevelBase", &G4Ions::GetFloatLevelBase)
.def("GetFloatLevelBaseIndex", &G4Ions::GetFloatLevelBaseIndex);
}
17 changes: 17 additions & 0 deletions core/opengate_core/g4_bindings/pyG4LinInterpolator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4LinInterpolator.hh"

void init_G4LinInterpolator(py::module &m) {
py::class_<G4LinInterpolator, G4IInterpolator>(m, "G4LinInterpolator")
.def(py::init<>());
}
3 changes: 1 addition & 2 deletions core/opengate_core/g4_bindings/pyG4ParticleDefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ void init_G4ParticleDefinition(py::module &m) {
.def("SetPDGStable", &G4ParticleDefinition::SetPDGStable)
.def("GetPDGLifeTime", &G4ParticleDefinition::GetPDGLifeTime)
.def("SetPDGLifeTime", &G4ParticleDefinition::SetPDGLifeTime)
.def("GetIonLifeTime", &G4ParticleDefinition::GetIonLifeTime)
.def("GetDecayTable", &G4ParticleDefinition::GetDecayTable,
py::return_value_policy::reference_internal)
.def("SetDecayTable", &G4ParticleDefinition::SetDecayTable)
.def("GetProcessManager", &G4ParticleDefinition::GetProcessManager,
py::return_value_policy::reference_internal)
.def("SetProcessManager", &G4ParticleDefinition::SetProcessManager)

// cludge!! (G4ParticleTable object is sigleton!!)
.def("GetParticleTable", &G4ParticleDefinition::GetParticleTable,
py::return_value_policy::reference)
.def("DumpTable", &G4ParticleDefinition::DumpTable)
Expand Down
19 changes: 19 additions & 0 deletions core/opengate_core/g4_bindings/pyG4PixeCrossSectionHandler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4PixeCrossSectionHandler.hh"

void init_G4PixeCrossSectionHandler(py::module &m) {
py::class_<G4PixeCrossSectionHandler>(m, "G4PixeCrossSectionHandler")

.def(py::init<>())
.def("PrintData", &G4PixeCrossSectionHandler::PrintData);
}
36 changes: 36 additions & 0 deletions core/opengate_core/g4_bindings/pyG4PixeShellDataSet.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

namespace py = pybind11;

#include "G4IInterpolator.hh"
#include "G4PixeShellDataSet.hh"

void init_G4PixeShellDataSet(py::module &m) {
py::class_<G4PixeShellDataSet,
std::unique_ptr<G4PixeShellDataSet, py::nodelete>>(
m, "G4PixeShellDataSet")
.def(py::init<G4int, G4IInterpolator *, const G4String &,
const G4String &, const G4String &, G4double, G4double>())
.def("LoadData", &G4PixeShellDataSet::LoadData)
.def("NumberOfComponents", &G4PixeShellDataSet::NumberOfComponents)
.def("GetEnergies",
[](G4PixeShellDataSet &d, G4int componentId) {
std::vector<double> e = d.GetEnergies(componentId);
return e;
})
.def("GetData",
[](G4PixeShellDataSet &d, G4int componentId) {
std::vector<double> e = d.GetData(componentId);
return e;
})
.def("GetData", &G4PixeShellDataSet::GetData)
.def("PrintData", &G4PixeShellDataSet::PrintData);
}
36 changes: 36 additions & 0 deletions core/opengate_core/g4_bindings/pyG4ProcessTable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4ProcessTable.hh"
#include "G4ProcessVector.hh"
#include "G4RadioactiveDecay.hh"

void init_G4ProcessTable(py::module &m) {

py::class_<G4ProcessTable, std::unique_ptr<G4ProcessTable, py::nodelete>>(
m, "G4ProcessTable")
.def("GetProcessTable", &G4ProcessTable::GetProcessTable,
py::return_value_policy::reference)
.def("Length", &G4ProcessTable::Length)
.def(
"FindProcesses",
(G4ProcessVector * (G4ProcessTable::*)(const G4String &processName)) &
G4ProcessTable::FindProcesses,
py::return_value_policy::reference)
.def(
"FindRadioactiveDecay",
[](G4ProcessTable &t) -> G4RadioactiveDecay * {
auto *pv = t.FindProcesses("RadioactiveDecay");
auto *p = (*pv)[0];
return (G4RadioactiveDecay *)(p);
},
py::return_value_policy::reference);
}
21 changes: 21 additions & 0 deletions core/opengate_core/g4_bindings/pyG4ProcessVector.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4ProcessVector.hh"
#include "G4VProcess.hh"

void init_G4ProcessVector(py::module &m) {

py::class_<G4ProcessVector>(m, "G4ProcessVector")
.def("size", &G4ProcessVector::size)
// Bracket operator
.def("__getitem__", [](const G4ProcessVector &s, int i) { return s[i]; });
}
21 changes: 21 additions & 0 deletions core/opengate_core/g4_bindings/pyG4RadioactiveDecay.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4DecayTable.hh"
#include "G4RadioactiveDecay.hh"
#include "G4VRestDiscreteProcess.hh"

void init_G4RadioactiveDecay(py::module &m) {
py::class_<G4RadioactiveDecay, G4VRestDiscreteProcess>(m,
"G4RadioactiveDecay")
.def("LoadDecayTable", &G4RadioactiveDecay::LoadDecayTable)
.def("GetDecayTable", &G4RadioactiveDecay::GetDecayTable);
}
27 changes: 27 additions & 0 deletions core/opengate_core/g4_bindings/pyG4VDecayChannel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4ParticleDefinition.hh"
#include "G4VDecayChannel.hh"

void init_G4VDecayChannel(py::module &m) {
py::class_<G4VDecayChannel>(m, "G4VDecayChannel")
.def("GetKinematicsName", &G4VDecayChannel::GetKinematicsName)
.def("GetBR", &G4VDecayChannel::GetBR)
.def("GetNumberOfDaughters", &G4VDecayChannel::GetNumberOfDaughters)
.def("GetParent", &G4VDecayChannel::GetParent,
py::return_value_policy::reference)
.def("GetDaughter", &G4VDecayChannel::GetDaughter,
py::return_value_policy::reference)
.def("GetDaughterName", &G4VDecayChannel::GetDaughterName)
.def("GetParentMass", &G4VDecayChannel::GetParentMass)
.def("GetDaughterMass", &G4VDecayChannel::GetDaughterMass);
}
10 changes: 5 additions & 5 deletions core/opengate_core/g4_bindings/pyG4VProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4VProcess.hh"

// Declaration of this class is needed because other classes such as
// StepLimiter inherit from it and pybind needs to know about it.

void init_G4VProcess(py::module &m) {

py::class_<G4VProcess, std::unique_ptr<G4VProcess, py::nodelete>>(
m, "G4VProcess");
m, "G4VProcess")
.def("GetProcessName", &G4VProcess::GetProcessName)
.def("GetProcessTypeName", &G4VProcess::GetProcessTypeName)
.def("ProcessDescription", &G4VProcess::ProcessDescription);
}
16 changes: 16 additions & 0 deletions core/opengate_core/g4_bindings/pyG4VRestDiscreteProcess.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* --------------------------------------------------
Copyright (C): OpenGATE Collaboration
This software is distributed under the terms
of the GNU Lesser General Public Licence (LGPL)
See LICENSE.md for further details
-------------------------------------------------- */

#include <pybind11/pybind11.h>

namespace py = pybind11;

#include "G4VRestDiscreteProcess.hh"

void init_G4VRestDiscreteProcess(py::module &m) {
py::class_<G4VRestDiscreteProcess, G4VProcess>(m, "G4VRestDiscreteProcess");
}
Loading

0 comments on commit 1531ba0

Please sign in to comment.