Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Plugin/src/SofaPython3/DataHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ void checkAmbiguousCreation(BaseNode* self, const std::string& name, const std::

}

void checkAmbiguousCreation(BaseObject* self, const std::string& name, const std::string& type)
void checkAmbiguousCreation(BaseComponent* self, const std::string& name, const std::string& type)
{
if (!self) return;

Expand All @@ -543,14 +543,14 @@ void checkAmbiguousCreation(BaseObject* self, const std::string& name, const std
void checkAmbiguousCreation(Base* self, const std::string& name, const std::string& type)
{
checkAmbiguousCreation(dynamic_cast<BaseNode*>(self), name, type);
checkAmbiguousCreation(dynamic_cast<BaseObject*>(self), name, type);
checkAmbiguousCreation(dynamic_cast<BaseComponent*>(self), name, type);
}

void checkAmbiguousCreation(py::object& py_self, const std::string& name, const std::string& type)
{
Base* self = py::cast<Base*>(py_self);
checkAmbiguousCreation(dynamic_cast<BaseNode*>(self), name, type);
checkAmbiguousCreation(dynamic_cast<BaseObject*>(self), name, type);
checkAmbiguousCreation(dynamic_cast<BaseComponent*>(self), name, type);

if (py_self.attr("__dict__").contains(name))
msg_warning(self) << "Ambiguous creation of " << type << " named '" << name << "' in " << self->getName() << ": Component alread has a python attribute with such name in __dict__";
Expand Down Expand Up @@ -581,7 +581,7 @@ BaseData* addData(py::object py_self, const std::string& name, py::object value,
data = deriveTypeFromParent(dynamic_cast<BaseNode*>(self)->getContext(),
py::cast<py::str>(value));
else
data = deriveTypeFromParent(dynamic_cast<BaseObject*>(self)->getContext(),
data = deriveTypeFromParent(dynamic_cast<BaseComponent*>(self)->getContext(),
py::cast<py::str>(value));
if (!data)
throw py::type_error("Cannot deduce type from value");
Expand Down
8 changes: 4 additions & 4 deletions Plugin/src/SofaPython3/DataHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <sofa/helper/Factory.h>
#include <sofa/core/objectmodel/Data.h>
#include <sofa/core/objectmodel/Base.h>
#include <sofa/core/objectmodel/BaseObject.h>
#include <sofa/core/objectmodel/BaseComponent.h>
#include <sofa/core/objectmodel/BaseNode.h>
#include <SofaPython3/config.h>

Expand Down Expand Up @@ -62,7 +62,7 @@ namespace sofa {
if (l.getTargetBase())
{
auto bn = l.getTargetBase()->toBaseNode();
auto bo = l.getTargetBase()->toBaseObject();
auto bo = l.getTargetBase()->toBaseComponent();
out << "@" + (bn ? bn->getPathName() : bo->getPathName());
}
out << l.getTargetPath();
Expand Down Expand Up @@ -148,7 +148,7 @@ namespace sofa {
if (ptr.getTargetBase())
{
auto bn = ptr.getTargetBase()->toBaseNode();
auto bo = ptr.getTargetBase()->toBaseObject();
auto bo = ptr.getTargetBase()->toBaseComponent();
return "@" + (bn ? bn->getPathName() : bo->getPathName());
}
return ptr.getTargetPath();
Expand Down Expand Up @@ -181,7 +181,7 @@ using sofa::core::objectmodel::Base;
using sofa::core::objectmodel::BaseData;
using sofa::core::objectmodel::BaseLink;
using sofa::core::objectmodel::BaseNode;
using sofa::core::objectmodel::BaseObject;
using sofa::core::objectmodel::BaseComponent;
using sofa::defaulttype::AbstractTypeInfo;

SOFAPYTHON3_API void setItem2D(pybind11::array a, pybind11::slice slice, pybind11::object o);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <SofaPython3/PythonFactory.h>

using sofa::component::topology::container::grid::RegularGridTopology;
using sofa::core::objectmodel::BaseObject;
using sofa::core::objectmodel::BaseComponent;

PYBIND11_DECLARE_HOLDER_TYPE(Base, sofa::core::sptr<Base>, true)

Expand All @@ -35,7 +35,7 @@ namespace sofapython3 {
namespace py { using namespace pybind11; }

void moduleAddRegularGridTopology(pybind11::module& m) {
py::class_<RegularGridTopology, sofa::core::objectmodel::BaseObject,sofa::core::sptr<RegularGridTopology>>
py::class_<RegularGridTopology, sofa::core::objectmodel::BaseComponent,sofa::core::sptr<RegularGridTopology>>
c (m, "RegularGridTopology", doc::SofaBaseTopology::regularGridTopologyClass);

c.def("getPoint", &RegularGridTopology::getPoint, doc::SofaBaseTopology::getPoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <SofaPython3/PythonFactory.h>

using sofa::component::topology::container::grid::SparseGridTopology;
using sofa::core::objectmodel::BaseObject;
using sofa::core::objectmodel::BaseComponent;

PYBIND11_DECLARE_HOLDER_TYPE(Base, sofa::core::sptr<Base>, true)

Expand All @@ -36,7 +36,7 @@ namespace sofapython3 {
namespace py { using namespace pybind11; }

void moduleAddSparseGridTopology(pybind11::module& m) {
py::class_<SparseGridTopology, sofa::core::objectmodel::BaseObject,sofa::core::sptr<SparseGridTopology>>
py::class_<SparseGridTopology, sofa::core::objectmodel::BaseComponent,sofa::core::sptr<SparseGridTopology>>
c(m, "SparseGridTopology", doc::SofaBaseTopology::sparseGridTopologyClass);

// getRegularGrid ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void moduleAddConstraintSolver(py::module &m)
{
const auto typeName = ConstraintSolverImpl::GetClass()->className;
py::class_<ConstraintSolverImpl,
sofa::core::objectmodel::BaseObject,
sofa::core::objectmodel::BaseComponent,
sofapython3::py_shared_ptr<ConstraintSolverImpl> > c(m, typeName.c_str(), sofapython3::doc::constraintsolver::constraintSolverClass);

c.def("W", [](ConstraintSolverImpl& self) -> EigenMatrixMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void bindSpringForcefield(py::module& m) {
DataType::Name();

py::class_<SpringForceField,
sofa::core::objectmodel::BaseObject,
sofa::core::objectmodel::BaseComponent,
py_shared_ptr<SpringForceField>> s (m, type_name.c_str(), sofapython3::doc::SofaDeformable::SpringForceFieldClass);

// remove all springs and optionally reserve memory for #reserve springs in the vector of springs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void bindLinearSolvers(py::module &m)
const std::string typeName = CRSLinearSolver::GetClass()->className + CRSLinearSolver::GetCustomTemplateName();

py::class_<CRSLinearSolver,
sofa::core::objectmodel::BaseObject,
sofa::core::objectmodel::BaseComponent,
sofapython3::py_shared_ptr<CRSLinearSolver> > c(m, typeName.c_str(), sofapython3::doc::linearsolver::linearSolverClass);

c.def("A", [](CRSLinearSolver& self) -> EigenSparseMatrix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Vector<typename TVector::Real> getSolutionVector(sofa::component::linearsystem::
template<class TMatrix, class TVector>
using LinearSystemClass =
py::class_<sofa::component::linearsystem::TypedMatrixLinearSystem<TMatrix, TVector>,
sofa::core::objectmodel::BaseObject,
sofa::core::objectmodel::BaseComponent,
sofapython3::py_shared_ptr<sofa::component::linearsystem::TypedMatrixLinearSystem<TMatrix, TVector>> >;

template<class TMatrix, class TVector>
Expand Down
2 changes: 1 addition & 1 deletion bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ py::object BindingBase::getData(Base& self, const std::string& s)

std::string BindingBase::getPathName(Base& self)
{
return self.toBaseNode() ? self.toBaseNode()->getPathName() : self.toBaseObject()->getPathName();
return self.toBaseNode() ? self.toBaseNode()->getPathName() : self.toBaseComponent()->getPathName();
}

std::string BindingBase::getLinkPath(Base& self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <SofaPython3/PythonFactory.h>

namespace py { using namespace pybind11; }
using sofa::core::objectmodel::BaseObject;
using sofa::core::objectmodel::BaseComponent;
using sofa::component::visual::BaseCamera;

namespace sofapython3 {
Expand Down Expand Up @@ -74,7 +74,7 @@ void moduleAddBaseCamera(py::module &m)
{
/// register the BaseCamera binding in the pybind11 typeing sytem
py::class_<BaseCamera,
sofa::core::objectmodel::BaseObject,
sofa::core::objectmodel::BaseComponent,
py_shared_ptr<BaseCamera>> c(m, "Camera", sofapython3::doc::baseCamera::baseCameraClass);

/// register the BaseCamera binding in the downcasting subsystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <SofaPython3/Sofa/Core/Binding_BaseContext.h>
#include <SofaPython3/PythonFactory.h>
#include <sofa/core/BaseState.h>
#include <sofa/core/objectmodel/BaseObject.h>
#include <sofa/core/objectmodel/BaseComponent.h>
#include <sofa/core/behavior/BaseMechanicalState.h>
#include <sofa/core/topology/Topology.h>
#include <sofa/core/topology/BaseMeshTopology.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <sofa/defaulttype/DataTypeInfo.h>

#include <sofa/core/objectmodel/BaseData.h>
#include <sofa/core/objectmodel/BaseObject.h>
#include <sofa/core/objectmodel/BaseComponent.h>

#include <SofaPython3/Sofa/Core/Binding_Base.h>
#include <SofaPython3/Sofa/Core/Binding_BaseData.h>
Expand Down
6 changes: 3 additions & 3 deletions bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseLink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <sofa/core/objectmodel/BaseLink.h>
using sofa::core::objectmodel::BaseLink;

#include <sofa/core/objectmodel/BaseObject.h>
using sofa::core::objectmodel::BaseObject;
#include <sofa/core/objectmodel/BaseComponent.h>
using sofa::core::objectmodel::BaseComponent;

#include <sofa/core/objectmodel/BaseNode.h>

Expand Down Expand Up @@ -64,7 +64,7 @@ py::object getOwnerBase(BaseLink& self)
std::string getPathName(BaseLink& self)
{
auto n = self.getOwnerBase()->toBaseNode();
auto o = self.getOwnerBase()->toBaseObject();
auto o = self.getOwnerBase()->toBaseComponent();
return (n ? n->getPathName() : o->getPathName()) + "." + self.getName();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <SofaPython3/Sofa/Core/Binding_BaseMeshTopology.h>
#include <SofaPython3/PythonFactory.h>
#include <sofa/core/BaseState.h>
#include <sofa/core/objectmodel/BaseObject.h>
#include <sofa/core/objectmodel/BaseComponent.h>
#include <sofa/core/behavior/BaseMechanicalState.h>
#include <sofa/core/topology/Topology.h>
#include <sofa/core/topology/BaseMeshTopology.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <SofaPython3/PythonFactory.h>

namespace py { using namespace pybind11; }
using sofa::core::objectmodel::BaseObject;
using sofa::core::objectmodel::BaseComponent;
using sofa::component::collision::response::contact::ContactListener;

namespace sofapython3
Expand Down Expand Up @@ -92,7 +92,7 @@ void moduleAddContactListener(pybind11::module &m)
{
/// register the ContactListener binding in the pybind11 typing sytem
pybind11::class_<ContactListener,
sofa::core::objectmodel::BaseObject,
sofa::core::objectmodel::BaseComponent,
py_shared_ptr<ContactListener>> c(m, "ContactListener", sofapython3::doc::contactListener::contactListenerClass);

c.def("getNumberOfContacts", &ContactListener::getNumberOfContacts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace py { using namespace pybind11; }
namespace sofapython3
{
using sofa::core::objectmodel::Event;
using sofa::core::objectmodel::BaseObject;
using sofa::core::objectmodel::BaseComponent;

Controller_Trampoline::Controller_Trampoline() = default;

Expand Down Expand Up @@ -207,7 +207,7 @@ void Controller_Trampoline::handleEvent(Event* event)
void moduleAddController(py::module &m) {
py::class_<Controller,
Controller_Trampoline,
BaseObject,
BaseComponent,
py_shared_ptr<Controller>> f(m, "Controller",
py::dynamic_attr(),
sofapython3::doc::controller::controllerClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace sofapython3
using sofa::core::objectmodel::Event;
using sofa::core::DataEngine;
using sofa::core::objectmodel::BaseData;
using sofa::core::objectmodel::BaseObject;
using sofa::core::objectmodel::BaseComponent;
using sofa::core::objectmodel::DDGNode;

std::string DataEngine_Trampoline::getClassName() const
Expand Down Expand Up @@ -73,7 +73,7 @@ void moduleAddDataEngine(pybind11::module &m)
{
py::class_<DataEngine,
DataEngine_Trampoline,
BaseObject,
BaseComponent,
py_shared_ptr<DataEngine>> f(m, "DataEngine",
py::dynamic_attr(),
sofapython3::doc::dataengine::DataEngine);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
namespace py { using namespace pybind11; }
using sofa::core::objectmodel::BaseData;
using sofa::core::objectmodel::Data;
using sofa::core::objectmodel::BaseObject;
using sofa::core::objectmodel::BaseComponent;
using sofa::core::visual::VisualParams;
using sofa::core::visual::DrawTool;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ using namespace pybind11::literals;

namespace sofapython3
{
using sofa::core::objectmodel::BaseObject;
using sofa::core::objectmodel::BaseComponent;
using sofa::core::objectmodel::ComponentState;
using sofa::core::behavior::MechanicalState;
using sofa::core::MechanicalParams;
Expand Down Expand Up @@ -186,7 +186,7 @@ namespace sofapython3
template<class TDOFType>
void declare_forcefield(py::module &m) {
const std::string pyclass_name = std::string("ForceField") + TDOFType::Name();
py::class_<ForceField<TDOFType>, BaseObject, ForceField_Trampoline<TDOFType>, py_shared_ptr<ForceField<TDOFType>>> f(m, pyclass_name.c_str(), py::dynamic_attr(), py::multiple_inheritance(), sofapython3::doc::forceField::forceFieldClass);
py::class_<ForceField<TDOFType>, BaseComponent, ForceField_Trampoline<TDOFType>, py_shared_ptr<ForceField<TDOFType>>> f(m, pyclass_name.c_str(), py::dynamic_attr(), py::multiple_inheritance(), sofapython3::doc::forceField::forceFieldClass);

f.def(py::init([](py::args &args, py::kwargs &kwargs) {
auto ff = sofa::core::sptr<ForceField_Trampoline<TDOFType>> (new ForceField_Trampoline<TDOFType>());
Expand Down
4 changes: 2 additions & 2 deletions bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_LinkPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <sofa/core/objectmodel/BaseLink.h>
using sofa::core::objectmodel::BaseLink;

#include <sofa/core/objectmodel/BaseObject.h>
using sofa::core::objectmodel::BaseObject;
#include <sofa/core/objectmodel/BaseComponent.h>
using sofa::core::objectmodel::BaseComponent;

#include <SofaPython3/PythonFactory.h>

Expand Down
4 changes: 2 additions & 2 deletions bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Mapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ using namespace pybind11::literals;
namespace sofapython3
{
using sofa::core::Mapping;
using sofa::core::objectmodel::BaseObject;
using sofa::core::objectmodel::BaseComponent;
using sofa::core::objectmodel::ComponentState;
using sofa::core::behavior::MechanicalState;
using sofa::core::MechanicalParams;
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace sofapython3
void declareMapping(py::module &m) {
const std::string pyclass_name = std::string("Mapping_") + In::Name()+ "_" + Out::Name();

py::class_<Mapping<In, Out>, BaseObject, Mapping_Trampoline<In, Out>,
py::class_<Mapping<In, Out>, BaseComponent, Mapping_Trampoline<In, Out>,
py_shared_ptr<Mapping<In, Out>>> f(m, pyclass_name.c_str(), py::dynamic_attr(), py::multiple_inheritance(),
sofapython3::doc::mapping::mappingClass);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/// Makes an alias for the pybind11 namespace to increase readability.
namespace py { using namespace pybind11; }

using sofa::core::objectmodel::BaseObject;
using sofa::core::objectmodel::BaseComponent;

namespace sofapython3 {

Expand Down
2 changes: 1 addition & 1 deletion bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Node_doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static auto removeObject =
R"(
Remove an object
:param object: the object to be removed
:type object: BaseObject
:type object: BaseComponent
)";

static auto getRootPath =
Expand Down
4 changes: 2 additions & 2 deletions bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Topology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <SofaPython3/Sofa/Core/Binding_BaseContext.h>
#include <SofaPython3/PythonFactory.h>
#include <sofa/core/BaseState.h>
#include <sofa/core/objectmodel/BaseObject.h>
#include <sofa/core/objectmodel/BaseComponent.h>
#include <sofa/core/behavior/BaseMechanicalState.h>
#include <sofa/core/topology/Topology.h>
#include <sofa/core/topology/BaseMeshTopology.h>
Expand All @@ -36,7 +36,7 @@ using namespace sofa::core::topology;
namespace sofapython3 {

auto getTopologyClass(py::module& m){
static py::class_<Topology, BaseObject, py_shared_ptr<Topology>> c (m, "Topology", "Compatibility topology class (against BaseMeshTopology)");
static py::class_<Topology, BaseComponent, py_shared_ptr<Topology>> c (m, "Topology", "Compatibility topology class (against BaseMeshTopology)");
return c;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ using sofa::defaulttype::AbstractTypeInfo;
#include <sofa/core/objectmodel/BaseData.h>
using sofa::core::objectmodel::BaseData;

#include <sofa/core/objectmodel/BaseObject.h>
using sofa::core::objectmodel::BaseObject;
#include <sofa/core/objectmodel/BaseComponent.h>
using sofa::core::objectmodel::BaseComponent;

#include <sofa/core/objectmodel/BaseNode.h>
using sofa::core::objectmodel::BaseNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ using sofa::defaulttype::AbstractTypeInfo;
#include <sofa/core/objectmodel/BaseData.h>
using sofa::core::objectmodel::BaseData;

#include <sofa/core/objectmodel/BaseObject.h>
using sofa::core::objectmodel::BaseObject;
#include <sofa/core/objectmodel/BaseComponent.h>
using sofa::core::objectmodel::BaseComponent;

#include <sofa/core/objectmodel/BaseNode.h>
using sofa::core::objectmodel::BaseNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ using sofa::defaulttype::AbstractTypeInfo;
#include <sofa/core/objectmodel/BaseData.h>
using sofa::core::objectmodel::BaseData;

#include <sofa/core/objectmodel/BaseObject.h>
using sofa::core::objectmodel::BaseObject;
#include <sofa/core/objectmodel/BaseComponent.h>
using sofa::core::objectmodel::BaseComponent;

#include <sofa/core/objectmodel/BaseNode.h>
using sofa::core::objectmodel::BaseNode;
Expand Down
Loading