From e1efe792dd8b9db117eb8cb2e01b676dcef82f21 Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Tue, 2 Aug 2016 11:45:16 +0200
Subject: [PATCH] [C++] Remove reference to Model in Data

---
 src/multibody/model.hpp |  3 ---
 src/multibody/model.hxx | 13 ++++++-------
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/multibody/model.hpp b/src/multibody/model.hpp
index a2377d27f..8157d6ee7 100644
--- a/src/multibody/model.hpp
+++ b/src/multibody/model.hpp
@@ -362,9 +362,6 @@ namespace se3
     typedef SE3::Vector3 Vector3;
     
   public:
-    /// \brief A const reference to the reference model.
-    const Model & model;
-    
     /// \brief Vector of se3::JointData associated to the se3::JointModel stored in model, encapsulated in JointDataAccessor.
     JointDataVector joints;
     
diff --git a/src/multibody/model.hxx b/src/multibody/model.hxx
index 8f95be229..eb4efeaf9 100644
--- a/src/multibody/model.hxx
+++ b/src/multibody/model.hxx
@@ -238,8 +238,7 @@ namespace se3
 
 
   inline Data::Data (const Model & ref)
-    :model(ref)
-    ,joints(0)
+    :joints(0)
     ,a((std::size_t)ref.njoint)
     ,a_gf((std::size_t)ref.njoint)
     ,v((std::size_t)ref.njoint)
@@ -275,16 +274,16 @@ namespace se3
     ,lambda_c()
     ,sDUiJt(ref.nv,ref.nv)
     ,torque_residual(ref.nv)
-    ,dq_after(model.nv)
+    ,dq_after(ref.nv)
     ,impulse_c()
   {
     /* Create data strcture associated to the joints */
-    for(Model::Index i=0;i<(Model::JointIndex)(model.njoint);++i) 
-      joints.push_back(CreateJointData::run(model.joints[i]));
+    for(Model::Index i=0;i<(Model::JointIndex)(ref.njoint);++i) 
+      joints.push_back(CreateJointData::run(ref.joints[i]));
 
     /* Init for CRBA */
     M.fill(0);
-    for(Model::Index i=0;i<(Model::Index)(ref.njoint);++i ) { Fcrb[i].resize(6,model.nv); }
+    for(Model::Index i=0;i<(Model::Index)(ref.njoint);++i ) { Fcrb[i].resize(6,ref.nv); }
     computeLastChild(ref);
 
     /* Init for Cholesky */
@@ -299,7 +298,7 @@ namespace se3
     
     a[0].setZero();
     v[0].setZero();
-    a_gf[0] = -model.gravity;
+    a_gf[0] = -ref.gravity;
     f[0].setZero();
     oMi[0].setIdentity();
     liMi[0].setIdentity();
-- 
GitLab