![]() |
Shamrock 2025.10.0
Astrophysical Code
|
#include "shambase/aliases_float.hpp"#include "shambackends/typeAliasVec.hpp"#include "shambindings/pybindaliases.hpp"#include "shambindings/pytypealias.hpp"#include "shammath/crystalLattice.hpp"#include "shammath/derivatives.hpp"#include "shammath/integrator.hpp"#include "shammath/matrix.hpp"#include "shammath/matrix_op.hpp"#include "shammath/paving_function.hpp"#include "shammath/solve.hpp"#include "shammath/symtensor_collections.hpp"#include "shammath/symtensors.hpp"#include "shampylib/math/pyAABB.hpp"#include "shampylib/math/pyRay.hpp"#include "shampylib/math/pySPHKernels.hpp"#include "shampylib/math/pySfc.hpp"#include <fmt/core.h>#include <pybind11/cast.h>#include <pybind11/functional.h>#include <pybind11/numpy.h>#include <functional>Go to the source code of this file.
Functions | |
| math_module | def ("derivative_upwind", [](f64 x, f64 dx, std::function< f64(f64)> fct) { return shammath::derivative_upwind< f64 >(x, dx, [&](f64 x) { return fct(x);});}) |
| math_module | def ("derivative_centered", [](f64 x, f64 dx, std::function< f64(f64)> fct) { return shammath::derivative_centered< f64 >(x, dx, [&](f64 x) { return fct(x);});}) |
| math_module | def ("derivative_3point_forward", [](f64 x, f64 dx, std::function< f64(f64)> fct) { return shammath::derivative_3point_forward< f64 >(x, dx, [&](f64 x) { return fct(x);});}) |
| math_module | def ("derivative_3point_backward", [](f64 x, f64 dx, std::function< f64(f64)> fct) { return shammath::derivative_3point_backward< f64 >(x, dx, [&](f64 x) { return fct(x);});}) |
| math_module | def ("derivative_5point_midpoint", [](f64 x, f64 dx, std::function< f64(f64)> fct) { return shammath::derivative_5point_midpoint< f64 >(x, dx, [&](f64 x) { return fct(x);});}) |
| math_module | def ("estim_deriv_step", [](u32 order) { return shammath::estim_deriv_step< f64 >(order);}, R"pbdoc( Estim the correct step to use for a given order when using derivatives )pbdoc") |
| py::class_< shammath::paving_function_periodic_3d< f64_3 > >(math_module, "paving_function_periodic_3d") .def(py py::class_< shammath::paving_function_general_3d< f64_3 > >(math_module, "paving_function_general_3d") .def(py py::class_< shammath::paving_function_general_3d_shear_x< f64_3 > >(math_module, "paving_function_general_3d_shear_x") .def(py py::class_< f64_4x4 >(math_module, "f64_4x4") .def(py math_module | def ("get_identity_f64_4x4", []() -> f64_4x4 { return shammath::mat_identity< f64, 4 >();}) |
| math_module | def ("mat_mul", [](const f64_4x4 &a, const f64_4x4 &b) -> f64_4x4 { f64_4x4 ret;shammath::mat_prod(a.get_mdspan(), b.get_mdspan(), ret.get_mdspan());return ret;}) |
| math_module | def ("mat_set_identity", [](f64_4x4 &a) { shammath::mat_set_identity(a.get_mdspan());}) |
| py::class_< shammath::SymTensor3d_1< f64 > >(math_module, "SymTensor3d_1_f64") .def(py py::class_< shammath::SymTensor3d_2< f64 > >(math_module, "SymTensor3d_2_f64") .def(py py::class_< shammath::SymTensor3d_3< f64 > >(math_module, "SymTensor3d_3_f64") .def(py py::class_< shammath::SymTensor3d_4< f64 > >(math_module, "SymTensor3d_4_f64") .def(py py::class_< shammath::SymTensor3d_5< f64 > >(math_module, "SymTensor3d_5_f64") .def(py py::class_< shammath::SymTensorCollection< f64, 0, 5 > >(math_module, "SymTensorCollection_f64_0_5") .def(py py::class_< shammath::SymTensorCollection< f64, 0, 4 > >(math_module, "SymTensorCollection_f64_0_4") .def(py py::class_< shammath::SymTensorCollection< f64, 0, 3 > >(math_module, "SymTensorCollection_f64_0_3") .def(py py::class_< shammath::SymTensorCollection< f64, 0, 2 > >(math_module, "SymTensorCollection_f64_0_2") .def(py py::class_< shammath::SymTensorCollection< f64, 0, 1 > >(math_module, "SymTensorCollection_f64_0_1") .def(py py::class_< shammath::SymTensorCollection< f64, 0, 0 > >(math_module, "SymTensorCollection_f64_0_0") .def(py py::class_< shammath::SymTensorCollection< f64, 1, 5 > >(math_module, "SymTensorCollection_f64_1_5") .def(py py::class_< shammath::SymTensorCollection< f64, 1, 4 > >(math_module, "SymTensorCollection_f64_1_4") .def(py py::class_< shammath::SymTensorCollection< f64, 1, 3 > >(math_module, "SymTensorCollection_f64_1_3") .def(py py::class_< shammath::SymTensorCollection< f64, 1, 2 > >(math_module, "SymTensorCollection_f64_1_2") .def(py py::class_< shammath::SymTensorCollection< f64, 1, 1 > >(math_module, "SymTensorCollection_f64_1_1") .def(py math_module | def ("euler_ode", [](f64 start, f64 end, f64 step, std::function< f64(f64, f64)> &&ode, f64 x0, f64 u0) { return shammath::euler_ode< f64 >(start, end, step, ode, x0, u0);}, py::kw_only(), py::arg("start"), py::arg("end"), py::arg("step"), py::arg("ode"), py::arg("x0"), py::arg("u0"), R"pbdoc( Solve ODE with Euler method start : Lower bound of integration end : Higher bound of integration step : Step of integration ode : Ode function x0 : Initial coordinate u0 : Initial value )pbdoc") |
| math_module | def ("least_squares", [](const std::function< f64(const std::vector< f64 > &, f64)> &func, const std::vector< f64 > &x_data, const std::vector< f64 > &y_data, const std::vector< f64 > &p0) { return shammath::least_squares(func, x_data, y_data, p0);}, py::kw_only(), py::arg("func"), py::arg("x_data"), py::arg("y_data"), py::arg("p0"), R"pbdoc( Fit data with a given function by least squares method f: Function (1d values) X: $x$ Data to fit Y: $y$ Data to fit p0: Initial parameters estimated )pbdoc") |
| math_module | def ("get_ideal_hcp_box", [](f64 dr, f64_3 box_min, f64_3 box_max) { return shammath::LatticeHCP< f64_3 >::get_ideal_hcp_box(dr, {box_min, box_max});}) |
| math_module | def ("get_periodic_hcp_box", [](f64 dr, std::array< i32, 3 > box_min, std::array< i32, 3 > box_max) { auto ret=shammath::LatticeHCP< f64_3 >::get_periodic_box(dr, box_min, box_max);return std::tuple< f64_3, f64_3 >{ret.lower, ret.upper};}, py::arg("dr"), py::arg("box_min"), py::arg("box_max"), R"pbdoc( Get the periodic box corresponding to integer lattice coordinates this function will throw if the coordinates asked cannot make a periodic lattice Args: dr: the particle spacing in the lattice box_min: integer triplet for the minimal coordinates on the lattice box_max: integer triplet for the maximal coordinates on the lattice )pbdoc") |
Variables | |
| ON_PYTHON_INIT | |
Definition in file pyshammath.cpp.
| ON_PYTHON_INIT |
Definition at line 41 of file pyshammath.cpp.