1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-26 12:08:52 -05:00

storage info bug

This commit is contained in:
hrocho 2019-05-15 16:32:45 +02:00
parent eb1b40a9cf
commit 519081ca43

View File

@ -7,6 +7,7 @@
#include "catima/srim.h" #include "catima/srim.h"
#include "catima/nucdata.h" #include "catima/nucdata.h"
#include <iostream> #include <iostream>
#include <string>
namespace py = pybind11; namespace py = pybind11;
using namespace catima; using namespace catima;
@ -128,7 +129,17 @@ PYBIND11_MODULE(pycatima,m){
.def("thickness",py::overload_cast<double>(&Material::thickness), "set thickness") .def("thickness",py::overload_cast<double>(&Material::thickness), "set thickness")
.def("thickness_cm",&Material::thickness_cm,"set thickness in cm unit") .def("thickness_cm",&Material::thickness_cm,"set thickness in cm unit")
.def("I",py::overload_cast<>(&Material::I, py::const_), "get I") .def("I",py::overload_cast<>(&Material::I, py::const_), "get I")
.def("I",py::overload_cast<double>(&Material::I), "set I"); .def("I",py::overload_cast<double>(&Material::I), "set I")
.def("__str__",[](const Material &r){
std::string s;
auto n = r.ncomponents();
for(int i = 0; i < n; i++){
auto el = r.get_element(i);
s += "#"+std::to_string(i);
s += ": A = "+std::to_string(el.A) + ", Z = "+std::to_string(el.A)+ ", stn = "+std::to_string(el.stn)+"\n";
}
return s;
});
py::class_<Layers>(m,"Layers") py::class_<Layers>(m,"Layers")
.def(py::init<>(),"constructor") .def(py::init<>(),"constructor")
@ -265,6 +276,13 @@ PYBIND11_MODULE(pycatima,m){
d["calculation"] = r.calculation; d["calculation"] = r.calculation;
d["skip"] = r.skip; d["skip"] = r.skip;
return d; return d;
})
.def("__str__",[](const Config &r){
std::string s;
s = "z_effective = "+std::to_string(r.z_effective);
s += ", corrections = "+std::to_string(r.corrections);
s += ", calculation = "+std::to_string(r.calculation);
return s;
}); });
m.def("srim_dedx_e",&srim_dedx_e); m.def("srim_dedx_e",&srim_dedx_e);