diff --git a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaMeshMatrixMass.inl b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaMeshMatrixMass.inl index 51784080531..068dc97d8b4 100644 --- a/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaMeshMatrixMass.inl +++ b/applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaMeshMatrixMass.inl @@ -64,13 +64,13 @@ using namespace sofa::gpu::cuda; template<> void MeshMatrixMass::copyVertexMass() { - helper::vector& vertexInf = *(d_vertexMassInfo.beginEdit()); + helper::vector& vertexInf = *(d_vertexMass.beginEdit()); data.vMass.resize(m_topology->getNbPoints()); for (int i=0; im_topology->getNbPoints(); ++i) data.vMass[i] = (float) vertexInf[i]; - d_vertexMassInfo.endEdit(); + d_vertexMass.endEdit(); } template<> @@ -113,13 +113,13 @@ void MeshMatrixMass::accFromF(const core::MechanicalParam template<> void MeshMatrixMass::copyVertexMass() { - helper::vector& vertexInf = *(d_vertexMassInfo.beginEdit()); + helper::vector& vertexInf = *(d_vertexMass.beginEdit()); data.vMass.resize(m_topology->getNbPoints()); for (int i=0; im_topology->getNbPoints(); ++i) data.vMass[i] = (float) vertexInf[i]; - d_vertexMassInfo.endEdit(); + d_vertexMass.endEdit(); } template<> @@ -162,13 +162,13 @@ void MeshMatrixMass::accFromF(const core::MechanicalParam template<> void MeshMatrixMass::copyVertexMass() { - helper::vector& vertexInf = *(d_vertexMassInfo.beginEdit()); + helper::vector& vertexInf = *(d_vertexMass.beginEdit()); data.vMass.resize(m_topology->getNbPoints()); for (int i=0; im_topology->getNbPoints(); ++i) data.vMass[i] = (float) vertexInf[i]; - d_vertexMassInfo.endEdit(); + d_vertexMass.endEdit(); } template<> diff --git a/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.cpp b/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.cpp index 477a543b4ad..54da1e92e4c 100644 --- a/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.cpp +++ b/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.cpp @@ -32,8 +32,8 @@ using namespace sofa::defaulttype; template <> Vector6 MeshMatrixMass::getMomentum ( const core::MechanicalParams*, const DataVecCoord& vx, const DataVecDeriv& vv ) const { - const MassVector &vertexMass= d_vertexMassInfo.getValue(); - const MassVector &edgeMass= d_edgeMassInfo.getValue(); + const MassVector &vertexMass= d_vertexMass.getValue(); + const MassVector &edgeMass= d_edgeMass.getValue(); helper::ReadAccessor< DataVecCoord > x = vx; helper::ReadAccessor< DataVecDeriv > v = vv; diff --git a/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.h b/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.h index 361ec6f4ea5..3a4c8b988f8 100644 --- a/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.h +++ b/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.h @@ -86,8 +86,6 @@ class MeshMatrixMass : public core::behavior::Mass /// @name Data of mass information /// @{ - /// Mass stored on vertices - Data< sofa::helper::vector< Real > > d_vertexMass; /// Mass density of the object Data< sofa::helper::vector< Real > > d_massDensity; /// Total mass of the object @@ -96,12 +94,9 @@ class MeshMatrixMass : public core::behavior::Mass /// Values of the particles masses stored on vertices - topology::PointData > d_vertexMassInfo; + topology::PointData > d_vertexMass; /// Values of the particles masses stored on edges - topology::EdgeData > d_edgeMassInfo; - - /// to display the center of gravity of the system - Data< sofa::helper::vector< Real > > d_edgeMass; + topology::EdgeData > d_edgeMass; /// if true, the mass of every element is computed based on the rest position rather than the position Data< bool > d_computeMassOnRest; @@ -162,7 +157,7 @@ class MeshMatrixMass : public core::behavior::Mass } int getMassCount() { - return d_vertexMassInfo.getValue().size(); + return d_vertexMass.getValue().size(); } /// Print key mass informations (totalMass, vertexMass and massDensity) diff --git a/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.inl b/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.inl index a0ee1a94daa..45c3a57de7a 100644 --- a/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.inl +++ b/modules/SofaMiscForceField/src/SofaMiscForceField/MeshMatrixMass.inl @@ -45,15 +45,12 @@ using namespace sofa::core::topology; template MeshMatrixMass::MeshMatrixMass() - : d_vertexMass( initData(&d_vertexMass, "vertexMass", "Specify a vector giving the mass of each vertex. \n" - "If unspecified or wrongly set, another mass information is used.") ) - , d_massDensity( initData(&d_massDensity, "massDensity", "Specify real and strictly positive value(s) for the mass density. \n" + : d_massDensity( initData(&d_massDensity, "massDensity", "Specify real and strictly positive value(s) for the mass density. \n" "If unspecified or wrongly set, the totalMass information is used.") ) , d_totalMass( initData(&d_totalMass, Real(1.0), "totalMass", "Specify the total mass resulting from all particles. \n" "If unspecified or wrongly set, the default value is used: totalMass = 1.0") ) - , d_vertexMassInfo( initData(&d_vertexMassInfo, "vertexMassInfo", "internal values of the particles masses on vertices, supporting topological changes") ) - , d_edgeMassInfo( initData(&d_edgeMassInfo, "edgeMassInfo", "internal values of the particles masses on edges, supporting topological changes") ) - , d_edgeMass( initData(&d_edgeMass, "edgeMass", "values of the particles masses on edges") ) + , d_vertexMass( initData(&d_vertexMass, "vertexMass", "internal values of the particles masses on vertices, supporting topological changes") ) + , d_edgeMass( initData(&d_edgeMass, "edgeMass", "internal values of the particles masses on edges, supporting topological changes") ) , d_computeMassOnRest(initData(&d_computeMassOnRest, false, "computeMassOnRest", "If true, the mass of every element is computed based on the rest position rather than the position")) , d_showCenterOfGravity( initData(&d_showCenterOfGravity, false, "showGravityCenter", "display the center of gravity of the system" ) ) , d_showAxisSize( initData(&d_showAxisSize, Real(1.0), "showAxisSizeFactor", "factor length of the axis displayed (only used for rigids)" ) ) @@ -69,8 +66,6 @@ MeshMatrixMass::MeshMatrixMass() f_graph.setWidget("graph"); /// Internal data, not supposed to be accessed by the user - d_vertexMassInfo.setDisplayed(false); - d_edgeMassInfo.setDisplayed(false); } template @@ -114,7 +109,7 @@ void MeshMatrixMass::VertexMassHandler::applyTriangleCreati if (MMM && MMM->getMassTopologyType() == TopologyElementType::TRIANGLE) { - helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMassInfo ); + helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -155,7 +150,7 @@ void MeshMatrixMass::EdgeMassHandler::applyTriangleCreation if (MMM && MMM->getMassTopologyType() == TopologyElementType::TRIANGLE) { - helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMassInfo ); + helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -192,7 +187,7 @@ void MeshMatrixMass::VertexMassHandler::applyTriangleDestru MeshMatrixMass *MMM = this->m; if (MMM && MMM->getMassTopologyType() == TopologyElementType::TRIANGLE) { - helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMassInfo ); + helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -229,7 +224,7 @@ void MeshMatrixMass::EdgeMassHandler::applyTriangleDestruct MeshMatrixMass *MMM = this->m; if (MMM && MMM->getMassTopologyType() == TopologyElementType::TRIANGLE) { - helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMassInfo ); + helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -315,7 +310,7 @@ void MeshMatrixMass::VertexMassHandler::applyQuadCreation(c if (MMM && MMM->getMassTopologyType() == TopologyElementType::QUAD) { - helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMassInfo ); + helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -356,7 +351,7 @@ void MeshMatrixMass::EdgeMassHandler::applyQuadCreation(con if (MMM && MMM->getMassTopologyType() == TopologyElementType::QUAD) { - helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMassInfo ); + helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -393,7 +388,7 @@ void MeshMatrixMass::VertexMassHandler::applyQuadDestructio MeshMatrixMass *MMM = this->m; if (MMM && MMM->getMassTopologyType() == TopologyElementType::QUAD) { - helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMassInfo ); + helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -430,7 +425,7 @@ void MeshMatrixMass::EdgeMassHandler::applyQuadDestruction( MeshMatrixMass *MMM = this->m; if (MMM && MMM->getMassTopologyType() == TopologyElementType::QUAD) { - helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMassInfo ); + helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -518,7 +513,7 @@ void MeshMatrixMass::VertexMassHandler::applyTetrahedronCre if (MMM && MMM->getMassTopologyType() == TopologyElementType::TETRAHEDRON) { - helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMassInfo ); + helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -559,7 +554,7 @@ void MeshMatrixMass::EdgeMassHandler::applyTetrahedronCreat if (MMM && MMM->getMassTopologyType() == TopologyElementType::TETRAHEDRON) { - helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMassInfo ); + helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -596,7 +591,7 @@ void MeshMatrixMass::VertexMassHandler::applyTetrahedronDes MeshMatrixMass *MMM = this->m; if (MMM && MMM->getMassTopologyType() == TopologyElementType::TETRAHEDRON) { - helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMassInfo ); + helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -633,7 +628,7 @@ void MeshMatrixMass::EdgeMassHandler::applyTetrahedronDestr MeshMatrixMass *MMM = this->m; if (MMM && MMM->getMassTopologyType() == TopologyElementType::TETRAHEDRON) { - helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMassInfo ); + helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -720,7 +715,7 @@ void MeshMatrixMass::VertexMassHandler::applyHexahedronCrea if (MMM && MMM->getMassTopologyType() == TopologyElementType::HEXAHEDRON) { - helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMassInfo ); + helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -761,7 +756,7 @@ void MeshMatrixMass::EdgeMassHandler::applyHexahedronCreati if (MMM && MMM->getMassTopologyType() == TopologyElementType::HEXAHEDRON) { - helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMassInfo ); + helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -798,7 +793,7 @@ void MeshMatrixMass::VertexMassHandler::applyHexahedronDest MeshMatrixMass *MMM = this->m; if (MMM && MMM->getMassTopologyType() == TopologyElementType::HEXAHEDRON) { - helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMassInfo ); + helper::WriteAccessor< Data< helper::vector > > VertexMasses ( MMM->d_vertexMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -835,7 +830,7 @@ void MeshMatrixMass::EdgeMassHandler::applyHexahedronDestru MeshMatrixMass *MMM = this->m; if (MMM && MMM->getMassTopologyType() == TopologyElementType::HEXAHEDRON) { - helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMassInfo ); + helper::WriteAccessor< Data< helper::vector > > EdgeMasses ( MMM->d_edgeMass ); // Initialisation const helper::vector densityM = MMM->getMassDensity(); typename DataTypes::Real mass = typename DataTypes::Real(0); @@ -1040,12 +1035,12 @@ template void MeshMatrixMass::initTopologyHandlers(sofa::core::topology::TopologyElementType topologyType) { // add the functions to handle topology changes for Vertex informations - m_vertexMassHandler = new VertexMassHandler(this, &d_vertexMassInfo); - d_vertexMassInfo.createTopologyHandler(m_topology, m_vertexMassHandler); + m_vertexMassHandler = new VertexMassHandler(this, &d_vertexMass); + d_vertexMass.createTopologyHandler(m_topology, m_vertexMassHandler); // add the functions to handle topology changes for Edge informations - m_edgeMassHandler = new EdgeMassHandler(this, &d_edgeMassInfo); - d_edgeMassInfo.createTopologyHandler(m_topology, m_edgeMassHandler); + m_edgeMassHandler = new EdgeMassHandler(this, &d_edgeMass); + d_edgeMass.createTopologyHandler(m_topology, m_edgeMassHandler); // register engines to the corresponding toplogy containers depending on current topology type @@ -1053,36 +1048,36 @@ void MeshMatrixMass::initTopologyHandlers(sofa::core::topol bool hasQuads = false; if (topologyType == TopologyElementType::HEXAHEDRON) { - d_vertexMassInfo.linkToHexahedronDataArray(); - d_edgeMassInfo.linkToHexahedronDataArray(); + d_vertexMass.linkToHexahedronDataArray(); + d_edgeMass.linkToHexahedronDataArray(); hasQuads = true; // hexahedron imply quads } else if (topologyType == TopologyElementType::TETRAHEDRON) { - d_vertexMassInfo.linkToTetrahedronDataArray(); - d_edgeMassInfo.linkToTetrahedronDataArray(); + d_vertexMass.linkToTetrahedronDataArray(); + d_edgeMass.linkToTetrahedronDataArray(); hasTriangles = true; // Tetrahedron imply triangles } if (topologyType == TopologyElementType::QUAD || hasQuads) { - d_vertexMassInfo.linkToQuadDataArray(); - d_edgeMassInfo.linkToQuadDataArray(); + d_vertexMass.linkToQuadDataArray(); + d_edgeMass.linkToQuadDataArray(); } if (topologyType == TopologyElementType::TRIANGLE || hasTriangles) { - d_vertexMassInfo.linkToTriangleDataArray(); - d_edgeMassInfo.linkToTriangleDataArray(); + d_vertexMass.linkToTriangleDataArray(); + d_edgeMass.linkToTriangleDataArray(); } - // PointData need to be linked to Edge container in any topology. d_edgeMassInfo as EdgeData is automatically register to Edge container - d_vertexMassInfo.linkToEdgeDataArray(); + // PointData need to be linked to Edge container in any topology. d_edgeMass as EdgeData is automatically register to Edge container + d_vertexMass.linkToEdgeDataArray(); // Register topological Data - d_vertexMassInfo.registerTopologicalData(); - d_edgeMassInfo.registerTopologicalData(); + d_vertexMass.registerTopologicalData(); + d_edgeMass.registerTopologicalData(); } @@ -1165,8 +1160,6 @@ void MeshMatrixMass::massInitialization() initFromTotalMass(); } - d_vertexMass.setValue(d_vertexMassInfo.getValue()); - d_edgeMass.setValue(d_edgeMassInfo.getValue()); //Info post-init printMass(); @@ -1230,8 +1223,8 @@ void MeshMatrixMass::computeMass() clear(); // prepare to store info in the vertex array - helper::vector& my_vertexMassInfo = *d_vertexMassInfo.beginEdit(); - helper::vector& my_edgeMassInfo = *d_edgeMassInfo.beginEdit(); + helper::vector& my_vertexMassInfo = *d_vertexMass.beginEdit(); + helper::vector& my_edgeMassInfo = *d_edgeMass.beginEdit(); unsigned int ndof = this->mstate->getSize(); unsigned int nbEdges=m_topology->getNbEdges(); @@ -1310,11 +1303,11 @@ void MeshMatrixMass::computeMass() m_massLumpingCoeff = 2.0; } - d_vertexMassInfo.registerTopologicalData(); - d_edgeMassInfo.registerTopologicalData(); + d_vertexMass.registerTopologicalData(); + d_edgeMass.registerTopologicalData(); - d_vertexMassInfo.endEdit(); - d_edgeMassInfo.endEdit(); + d_vertexMass.endEdit(); + d_edgeMass.endEdit(); } @@ -1355,6 +1348,7 @@ void MeshMatrixMass::doUpdateInternal() this->d_componentState.setValue(sofa::core::objectmodel::ComponentState::Invalid); } } + else if(this->hasDataChanged(d_vertexMass)) { if(this->hasDataChanged(d_edgeMass)) @@ -1390,8 +1384,6 @@ void MeshMatrixMass::doUpdateInternal() } } - d_vertexMass.setValue(d_vertexMassInfo.getValue()); - d_edgeMass.setValue(d_edgeMassInfo.getValue()); //Info post-init msg_info() << "mass information updated"; @@ -1470,7 +1462,7 @@ void MeshMatrixMass::initFromVertexMass() computeMass(); - helper::WriteAccessor > vertexMassInfo = d_vertexMassInfo; + helper::WriteAccessor > vertexMassInfo = d_vertexMass; //Compute volume = mass since massDensity = 1.0 Real volume = 0.0; for(size_t i=0; i::initFromVertexAndEdgeMass() computeMass(); - helper::WriteAccessor > vertexMassInfo = d_vertexMassInfo; - helper::WriteAccessor > edgeMassInfo = d_edgeMassInfo; + helper::WriteAccessor > vertexMassInfo = d_vertexMass; + helper::WriteAccessor > edgeMassInfo = d_edgeMass; //Compute volume = mass since massDensity = 1.0 Real volume = 0.0; for(size_t i=0; i::initFromMassDensity() computeMass(); - const MassVector &vertexMassInfo = d_vertexMassInfo.getValue(); + const MassVector &vertexMassInfo = d_vertexMass.getValue(); Real sumMass = 0.0; for (size_t i=0; igetNbPoints()); i++) { @@ -1670,7 +1662,7 @@ void MeshMatrixMass::initFromTotalMass() computeMass(); - const MassVector &vertexMassInfo = d_vertexMassInfo.getValue(); + const MassVector &vertexMassInfo = d_vertexMass.getValue(); for (size_t i=0; igetNbPoints()); i++) { sumMass += vertexMassInfo[i]*m_massLumpingCoeff; @@ -1695,7 +1687,7 @@ void MeshMatrixMass::setVertexMass(sofa::helper::vector< Re } else { - d_vertexMassInfo.setValue(vertexMass); + d_vertexMass.setValue(vertexMass); } } @@ -1775,12 +1767,12 @@ void MeshMatrixMass::copyVertexMass(){} template void MeshMatrixMass::clear() { - MassVector& vertexMass = *d_vertexMassInfo.beginEdit(); - MassVector& edgeMass = *d_edgeMassInfo.beginEdit(); + MassVector& vertexMass = *d_vertexMass.beginEdit(); + MassVector& edgeMass = *d_edgeMass.beginEdit(); vertexMass.clear(); edgeMass.clear(); - d_vertexMassInfo.endEdit(); - d_edgeMassInfo.endEdit(); + d_vertexMass.endEdit(); + d_edgeMass.endEdit(); } @@ -1788,8 +1780,8 @@ void MeshMatrixMass::clear() template void MeshMatrixMass::addMDx(const core::MechanicalParams*, DataVecDeriv& vres, const DataVecDeriv& vdx, SReal factor) { - const MassVector &vertexMass= d_vertexMassInfo.getValue(); - const MassVector &edgeMass= d_edgeMassInfo.getValue(); + const MassVector &vertexMass= d_vertexMass.getValue(); + const MassVector &edgeMass= d_edgeMass.getValue(); helper::WriteAccessor< DataVecDeriv > res = vres; helper::ReadAccessor< DataVecDeriv > dx = vdx; @@ -1863,7 +1855,7 @@ void MeshMatrixMass::accFromF(const core::MechanicalParams* helper::WriteAccessor< DataVecDeriv > _a = a; const VecDeriv& _f = f.getValue(); - const MassVector &vertexMass= d_vertexMassInfo.getValue(); + const MassVector &vertexMass= d_vertexMass.getValue(); for (unsigned int i=0; i::addForce(const core::MechanicalParams* helper::WriteAccessor< DataVecDeriv > f = vf; - const MassVector &vertexMass= d_vertexMassInfo.getValue(); + const MassVector &vertexMass= d_vertexMass.getValue(); // gravity defaulttype::Vec3d g ( this->getContext()->getGravity() ); @@ -1898,8 +1890,8 @@ void MeshMatrixMass::addForce(const core::MechanicalParams* template SReal MeshMatrixMass::getKineticEnergy( const core::MechanicalParams*, const DataVecDeriv& vv ) const { - const MassVector &vertexMass= d_vertexMassInfo.getValue(); - const MassVector &edgeMass= d_edgeMassInfo.getValue(); + const MassVector &vertexMass= d_vertexMass.getValue(); + const MassVector &edgeMass= d_edgeMass.getValue(); helper::ReadAccessor< DataVecDeriv > v = vv; @@ -1929,7 +1921,7 @@ SReal MeshMatrixMass::getKineticEnergy( const core::Mechani template SReal MeshMatrixMass::getPotentialEnergy( const core::MechanicalParams*, const DataVecCoord& vx) const { - const MassVector &vertexMass= d_vertexMassInfo.getValue(); + const MassVector &vertexMass= d_vertexMass.getValue(); helper::ReadAccessor< DataVecCoord > x = vx; @@ -1981,8 +1973,8 @@ void MeshMatrixMass::addGravityToV(const core::MechanicalPa template void MeshMatrixMass::addMToMatrix(const core::MechanicalParams *mparams, const sofa::core::behavior::MultiMatrixAccessor* matrix) { - const MassVector &vertexMass= d_vertexMassInfo.getValue(); - const MassVector &edgeMass= d_edgeMassInfo.getValue(); + const MassVector &vertexMass= d_vertexMass.getValue(); + const MassVector &edgeMass= d_edgeMass.getValue(); size_t nbEdges=m_topology->getNbEdges(); size_t v0,v1; @@ -2065,7 +2057,7 @@ void MeshMatrixMass::addMToMatrix(const core::MechanicalPar template SReal MeshMatrixMass::getElementMass(Index index) const { - const MassVector &vertexMass= d_vertexMassInfo.getValue(); + const MassVector &vertexMass= d_vertexMass.getValue(); SReal mass = vertexMass[index] * m_massLumpingCoeff; return mass; @@ -2080,7 +2072,7 @@ void MeshMatrixMass::getElementMass(Index index, defaulttyp if (m->rowSize() != dimension || m->colSize() != dimension) m->resize(dimension,dimension); m->clear(); - AddMToMatrixFunctor()(m, d_vertexMassInfo.getValue()[index] * m_massLumpingCoeff, 0, 1); + AddMToMatrixFunctor()(m, d_vertexMass.getValue()[index] * m_massLumpingCoeff, 0, 1); } @@ -2097,7 +2089,7 @@ void MeshMatrixMass::draw(const core::visual::VisualParams* if (!vparams->displayFlags().getShowBehaviorModels()) return; - const MassVector &vertexMass= d_vertexMassInfo.getValue(); + const MassVector &vertexMass= d_vertexMass.getValue(); const VecCoord& x = this->mstate->read(core::ConstVecCoordId::position())->getValue(); Coord gravityCenter;