|
| 1 | +/****************************************************************************** |
| 2 | +* SofaPython3 plugin * |
| 3 | +* (c) 2021 CNRS, University of Lille, INRIA * |
| 4 | +* * |
| 5 | +* This program is free software; you can redistribute it and/or modify it * |
| 6 | +* under the terms of the GNU Lesser General Public License as published by * |
| 7 | +* the Free Software Foundation; either version 2.1 of the License, or (at * |
| 8 | +* your option) any later version. * |
| 9 | +* * |
| 10 | +* This program is distributed in the hope that it will be useful, but WITHOUT * |
| 11 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * |
| 12 | +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * |
| 13 | +* for more details. * |
| 14 | +* * |
| 15 | +* You should have received a copy of the GNU Lesser General Public License * |
| 16 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. * |
| 17 | +******************************************************************************* |
| 18 | +* Contact information: [email protected] * |
| 19 | +******************************************************************************/ |
| 20 | + |
| 21 | +#include <SofaPython3/Sofa/Core/Binding_MechanicalParams.h> |
| 22 | +#include <SofaPython3/Sofa/Core/Binding_MechanicalParams_doc.h> |
| 23 | +#include <sofa/core/MechanicalParams.h> |
| 24 | + |
| 25 | +namespace py { using namespace pybind11; } |
| 26 | + |
| 27 | +namespace sofapython3 { |
| 28 | + |
| 29 | +void moduleAddMechanicalParams(py::module& m) { |
| 30 | + using namespace sofa::core; |
| 31 | + py::class_<MechanicalParams> c (m, "MechanicalParams", doc::mechanicalparams::MechanicalParamsClass); |
| 32 | + c.def(py::init()); |
| 33 | + |
| 34 | + // Dt |
| 35 | + c.def_property("dt", &MechanicalParams::dt, &MechanicalParams::setDt); |
| 36 | + c.def("setDt", &MechanicalParams::setDt, py::arg("dt")); |
| 37 | + |
| 38 | + // Implicit |
| 39 | + c.def_property("implicit", &MechanicalParams::implicit, &MechanicalParams::setImplicit, "Specify if the time integration scheme is implicit."); |
| 40 | + c.def("setImplicit", &MechanicalParams::setImplicit, py::arg("v"), "Specify if the time integration scheme is implicit."); |
| 41 | + |
| 42 | + // Mass factor |
| 43 | + c.def_property("mFactor", &MechanicalParams::mFactor, &MechanicalParams::setMFactor, "Set Mass matrix contributions factor (for implicit schemes)."); |
| 44 | + c.def("setMFactor", &MechanicalParams::setMFactor, py::arg("m"), "Set Mass matrix contributions factor (for implicit schemes)."); |
| 45 | + |
| 46 | + // Damping factor |
| 47 | + c.def_property("bFactor", &MechanicalParams::bFactor, &MechanicalParams::setBFactor, "Set Damping matrix contributions factor (for implicit schemes)."); |
| 48 | + c.def("setBFactor", &MechanicalParams::setBFactor, py::arg("b"), "Set Damping matrix contributions factor (for implicit schemes)."); |
| 49 | + |
| 50 | + // Stiffness factor |
| 51 | + c.def_property("kFactor", &MechanicalParams::kFactor, &MechanicalParams::setKFactor, "Set Stiffness matrix contributions factor (for implicit schemes)."); |
| 52 | + c.def("setKFactor", &MechanicalParams::setKFactor, py::arg("k"), "Set Stiffness matrix contributions factor (for implicit schemes)."); |
| 53 | + |
| 54 | + // Symmetric |
| 55 | + c.def_property("symmetricMatrix", &MechanicalParams::symmetricMatrix, &MechanicalParams::setSymmetricMatrix, "Set the symmetric matrix flag (for implicit schemes), for solvers specialized on symmetric matrices"); |
| 56 | + c.def("setSymmetricMatrix", &MechanicalParams::setSymmetricMatrix, "Set the symmetric matrix flag (for implicit schemes), for solvers specialized on symmetric matrices"); |
| 57 | + |
| 58 | + // Energy |
| 59 | + c.def_property("energy", &MechanicalParams::energy, &MechanicalParams::setEnergy, "Specify if the potential and kinematic energies should be computed."); |
| 60 | + c.def("setEnergy", &MechanicalParams::setEnergy, "Specify if the potential and kinematic energies should be computed."); |
| 61 | +} |
| 62 | + |
| 63 | +} // namespace sofapython3 |
0 commit comments