From 918589f3204abebd82e02a7747a335ec87ed8ce6 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 15 Apr 2026 08:26:43 +0900 Subject: [PATCH 1/3] remove various warnings from framework --- .../Helper/src/sofa/helper/system/FileMonitor_macosx.cpp | 2 +- .../src/sofa/linearalgebra/SparseMatrixProduct.inl | 4 ++-- .../Core/src/sofa/simulation/ParallelSparseMatrixProduct.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sofa/framework/Helper/src/sofa/helper/system/FileMonitor_macosx.cpp b/Sofa/framework/Helper/src/sofa/helper/system/FileMonitor_macosx.cpp index 41b884cc94e..ec2808be046 100644 --- a/Sofa/framework/Helper/src/sofa/helper/system/FileMonitor_macosx.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/system/FileMonitor_macosx.cpp @@ -95,7 +95,7 @@ These steps are explained in more detail in the sections that follow. 0.2, // CFTimeInterval latency kFSEventStreamCreateFlagFileEvents // FSEventStreamCreateFlags flags ); - FSEventStreamScheduleWithRunLoop(m_eventStream,CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + FSEventStreamSetDispatchQueue(m_eventStream, dispatch_get_main_queue()); FSEventStreamStart(m_eventStream); } diff --git a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/SparseMatrixProduct.inl b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/SparseMatrixProduct.inl index 668ab3c26e8..6d7fe261b57 100644 --- a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/SparseMatrixProduct.inl +++ b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/SparseMatrixProduct.inl @@ -291,8 +291,8 @@ void SparseMatrixProduct::computeProductFromIntersection() auto* rhs_ptr = m_rhs->valuePtr(); auto* product_ptr = m_productResult.valuePtr(); - [[maybe_unused]] const auto lhsNonZeros = m_lhs->nonZeros(); - [[maybe_unused]] const auto rhsNonZeros = m_rhs->nonZeros(); + [[maybe_unused]] const Eigen::Index lhsNonZeros = m_lhs->nonZeros(); + [[maybe_unused]] const Eigen::Index rhsNonZeros = m_rhs->nonZeros(); for (const auto& pairs : m_intersectionAB.intersection) { diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/ParallelSparseMatrixProduct.h b/Sofa/framework/Simulation/Core/src/sofa/simulation/ParallelSparseMatrixProduct.h index fcb9a7d4197..5ea7270ab7d 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/ParallelSparseMatrixProduct.h +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/ParallelSparseMatrixProduct.h @@ -38,7 +38,7 @@ class ParallelSparseMatrixProduct void computeProductFromIntersection() override { - assert(this->m_intersectionAB.intersection.size() == this->m_productResult.nonZeros()); + assert(static_cast(this->m_intersectionAB.intersection.size()) == this->m_productResult.nonZeros()); assert(taskScheduler); auto* lhs_ptr = this->m_lhs->valuePtr(); From 95f769ca8a9c94ff9a194bc470410417631a971a Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 15 Apr 2026 08:27:42 +0900 Subject: [PATCH 2/3] remove warning about copying diff vec (using copy ctor from a different typed mat) --- Sofa/framework/Type/src/sofa/type/Mat.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sofa/framework/Type/src/sofa/type/Mat.h b/Sofa/framework/Type/src/sofa/type/Mat.h index 00a78497693..2f223c92034 100644 --- a/Sofa/framework/Type/src/sofa/type/Mat.h +++ b/Sofa/framework/Type/src/sofa/type/Mat.h @@ -167,7 +167,9 @@ class Mat template constexpr Mat(const Mat& m) noexcept { - std::copy(m.begin(), m.begin()+L, this->begin()); + for( Size i=0; i(m(i,j)); } /// Constructor from another matrix with different size (with null default entries and ignoring outside entries) From 831f9798f1dad2afc0b9120524cb7d71e61e2b18 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 15 Apr 2026 11:18:29 +0900 Subject: [PATCH 3/3] fix implicit conversions --- .../core/objectmodel/BaseObjectDescription.cpp | 2 +- .../sofa/core/topology/TopologySubsetData.inl | 8 ++++---- .../src/sofa/defaulttype/TypeInfoRegistry.cpp | 2 +- .../Helper/src/sofa/helper/AdvancedTimer.cpp | 2 +- .../src/sofa/helper/MarchingCubeUtility.cpp | 16 ++++++++-------- .../Helper/src/sofa/helper/TriangleOctree.cpp | 2 +- Sofa/framework/Helper/src/sofa/helper/Utils.cpp | 2 +- .../Helper/src/sofa/helper/io/MeshGmsh.cpp | 2 +- .../src/sofa/helper/system/PipeProcess.cpp | 2 +- .../src/sofa/linearalgebra/BlockDiagonalMatrix.h | 4 ++-- .../CompressedRowSparseMatrixConstraint.h | 2 +- .../Core/src/sofa/simulation/Colors.cpp | 2 +- .../MechanicalAddMBKdxVisitor.cpp | 2 +- .../MechanicalComputeDfVisitor.cpp | 2 +- Sofa/framework/Type/src/sofa/type/DualQuat.inl | 2 +- Sofa/framework/Type/src/sofa/type/Vec.h | 2 +- 16 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Sofa/framework/Core/src/sofa/core/objectmodel/BaseObjectDescription.cpp b/Sofa/framework/Core/src/sofa/core/objectmodel/BaseObjectDescription.cpp index 17d93b42274..97bbbea54e5 100644 --- a/Sofa/framework/Core/src/sofa/core/objectmodel/BaseObjectDescription.cpp +++ b/Sofa/framework/Core/src/sofa/core/objectmodel/BaseObjectDescription.cpp @@ -141,7 +141,7 @@ int BaseObjectDescription::getAttributeAsInt(const std::string& attr, const int const char* attrstr=it->second.c_str(); char* end=nullptr; - const int retval = strtol(attrstr, &end, 10); + const int retval = static_cast(strtol(attrstr, &end, 10)); /// It is important to check that the attribute was totally parsed to report /// message to users because a silent error is the worse thing that can happen in UX. diff --git a/Sofa/framework/Core/src/sofa/core/topology/TopologySubsetData.inl b/Sofa/framework/Core/src/sofa/core/topology/TopologySubsetData.inl index a650d02dca5..9b99c23aebd 100644 --- a/Sofa/framework/Core/src/sofa/core/topology/TopologySubsetData.inl +++ b/Sofa/framework/Core/src/sofa/core/topology/TopologySubsetData.inl @@ -117,8 +117,8 @@ void TopologySubsetData ::add(sofa::Size nbElements, helper::WriteOnlyAccessor > data = this; // first resize the subsetData. value will be applied in the loop using callbacks - const Size size = data.size(); - data.resize(size + nbElements); + const Size size = static_cast(data.size()); + data.resize(size + static_cast(nbElements)); if (this->p_onCreationCallback) @@ -129,7 +129,7 @@ void TopologySubsetData ::add(sofa::Size nbElements, value_type& t = data[id]; // update map if needed - addPostProcess(LastDataId + i + 1); + addPostProcess(LastDataId + static_cast(i) + 1); this->p_onCreationCallback(id, t, elems[i], (ancestors.empty() || coefs.empty()) ? s_empty_ancestors : ancestors[i], @@ -154,7 +154,7 @@ void TopologySubsetData ::add(const sofa::type::vector { SOFA_UNUSED(ancestorElems); - const sofa::Size nbElements = index.size(); + const sofa::Size nbElements = static_cast(index.size()); this->add(nbElements, elems, ancestors, coefs); } diff --git a/Sofa/framework/DefaultType/src/sofa/defaulttype/TypeInfoRegistry.cpp b/Sofa/framework/DefaultType/src/sofa/defaulttype/TypeInfoRegistry.cpp index 0c47017cd26..3b9e92b6d04 100644 --- a/Sofa/framework/DefaultType/src/sofa/defaulttype/TypeInfoRegistry.cpp +++ b/Sofa/framework/DefaultType/src/sofa/defaulttype/TypeInfoRegistry.cpp @@ -90,7 +90,7 @@ int TypeInfoRegistry::AllocateNewTypeId(const std::type_info& nfo) const std::string name = sofa::helper::NameDecoder::decodeTypeName(nfo); const std::string typeName = sofa::helper::NameDecoder::decodeTypeName(nfo); typeinfos.push_back(new NameOnlyTypeInfo(name, typeName)); - return typeinfos.size()-1; + return static_cast(typeinfos.size()-1); } diff --git a/Sofa/framework/Helper/src/sofa/helper/AdvancedTimer.cpp b/Sofa/framework/Helper/src/sofa/helper/AdvancedTimer.cpp index 3bf86905226..81241ffa319 100644 --- a/Sofa/framework/Helper/src/sofa/helper/AdvancedTimer.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/AdvancedTimer.cpp @@ -1087,7 +1087,7 @@ std::string getTime(ctime_t t, int niter=1) double strToDouble(std::string const &stringToConvert, std::size_t const precision) { std::stringstream convertingStream; - convertingStream << std::setprecision(precision) << std::fixed << stringToConvert << std::endl; + convertingStream << std::setprecision(static_cast(precision)) << std::fixed << stringToConvert << std::endl; double answer; convertingStream >> answer; diff --git a/Sofa/framework/Helper/src/sofa/helper/MarchingCubeUtility.cpp b/Sofa/framework/Helper/src/sofa/helper/MarchingCubeUtility.cpp index 389a167f356..e207979b9af 100644 --- a/Sofa/framework/Helper/src/sofa/helper/MarchingCubeUtility.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/MarchingCubeUtility.cpp @@ -852,14 +852,14 @@ namespace sofa::helper void MarchingCubeUtility::updateTriangleInRegularGridVector ( type::vector< type::vector >& triangleIndexInRegularGrid, const type::Vec3i& coord, const GridCell& cell, unsigned int nbTriangles ) const { vector voxels; - if ( cell.val[0] ) voxels.push_back ( ( coord[0]+0 ) + ( coord[1]+0 ) *m_dataResolution[0] + ( coord[2]+0 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube - if ( cell.val[1] ) voxels.push_back ( ( coord[0]+1 ) + ( coord[1]+0 ) *m_dataResolution[0] + ( coord[2]+0 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube - if ( cell.val[3] ) voxels.push_back ( ( coord[0]+0 ) + ( coord[1]+1 ) *m_dataResolution[0] + ( coord[2]+0 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube - if ( cell.val[2] ) voxels.push_back ( ( coord[0]+1 ) + ( coord[1]+1 ) *m_dataResolution[0] + ( coord[2]+0 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube - if ( cell.val[4] ) voxels.push_back ( ( coord[0]+0 ) + ( coord[1]+0 ) *m_dataResolution[0] + ( coord[2]+1 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube - if ( cell.val[5] ) voxels.push_back ( ( coord[0]+1 ) + ( coord[1]+0 ) *m_dataResolution[0] + ( coord[2]+1 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube - if ( cell.val[7] ) voxels.push_back ( ( coord[0]+0 ) + ( coord[1]+1 ) *m_dataResolution[0] + ( coord[2]+1 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube - if ( cell.val[6] ) voxels.push_back ( ( coord[0]+1 ) + ( coord[1]+1 ) *m_dataResolution[0] + ( coord[2]+1 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube + if ( cell.val[0] != 0 ) voxels.push_back ( ( coord[0]+0 ) + ( coord[1]+0 ) *m_dataResolution[0] + ( coord[2]+0 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube + if ( cell.val[1] != 0 ) voxels.push_back ( ( coord[0]+1 ) + ( coord[1]+0 ) *m_dataResolution[0] + ( coord[2]+0 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube + if ( cell.val[3] != 0 ) voxels.push_back ( ( coord[0]+0 ) + ( coord[1]+1 ) *m_dataResolution[0] + ( coord[2]+0 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube + if ( cell.val[2] != 0 ) voxels.push_back ( ( coord[0]+1 ) + ( coord[1]+1 ) *m_dataResolution[0] + ( coord[2]+0 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube + if ( cell.val[4] != 0 ) voxels.push_back ( ( coord[0]+0 ) + ( coord[1]+0 ) *m_dataResolution[0] + ( coord[2]+1 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube + if ( cell.val[5] != 0 ) voxels.push_back ( ( coord[0]+1 ) + ( coord[1]+0 ) *m_dataResolution[0] + ( coord[2]+1 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube + if ( cell.val[7] != 0 ) voxels.push_back ( ( coord[0]+0 ) + ( coord[1]+1 ) *m_dataResolution[0] + ( coord[2]+1 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube + if ( cell.val[6] != 0 ) voxels.push_back ( ( coord[0]+1 ) + ( coord[1]+1 ) *m_dataResolution[0] + ( coord[2]+1 ) *m_dataResolution[0]*m_dataResolution[1] ); //les voxels occupes ds ce cube for ( size_t i = 0; i < nbTriangles; i++ ) { diff --git a/Sofa/framework/Helper/src/sofa/helper/TriangleOctree.cpp b/Sofa/framework/Helper/src/sofa/helper/TriangleOctree.cpp index b97a13c15c3..f709ef99c61 100644 --- a/Sofa/framework/Helper/src/sofa/helper/TriangleOctree.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/TriangleOctree.cpp @@ -840,7 +840,7 @@ void TriangleOctreeRoot::buildOctree() // for each triangle add it to the octree for (size_t i = 0; i < octreeTriangles->size(); i++) { - fillOctree (i); + fillOctree (static_cast(i)); } } diff --git a/Sofa/framework/Helper/src/sofa/helper/Utils.cpp b/Sofa/framework/Helper/src/sofa/helper/Utils.cpp index 80087c8bac0..74a0f265443 100644 --- a/Sofa/framework/Helper/src/sofa/helper/Utils.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/Utils.cpp @@ -109,7 +109,7 @@ static std::string computeExecutablePath() #elif defined(__APPLE__) std::vector buffer(PATH_MAX); std::vector real_path(PATH_MAX); - uint32_t size = buffer.size(); + uint32_t size = static_cast(buffer.size()); if (_NSGetExecutablePath(&buffer[0], &size) != 0) { msg_error("Utils::computeExecutablePath()") << "_NSGetExecutablePath() failed"; } diff --git a/Sofa/framework/Helper/src/sofa/helper/io/MeshGmsh.cpp b/Sofa/framework/Helper/src/sofa/helper/io/MeshGmsh.cpp index 9e14bcad143..97e3069bdb8 100644 --- a/Sofa/framework/Helper/src/sofa/helper/io/MeshGmsh.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/io/MeshGmsh.cpp @@ -63,7 +63,7 @@ void MeshGmsh::init (std::string filename) std::getline(file, version); // Getting the version line (e.g. 4.1 0 8) try { - gmshFormat = std::stoul(version.substr( 0, version.find(" ")) ); // Retrieving the mesh format, keeping only the integer part + gmshFormat = static_cast(std::stoul(version.substr( 0, version.find(" ")) )); // Retrieving the mesh format, keeping only the integer part } catch (const std::exception&) { diff --git a/Sofa/framework/Helper/src/sofa/helper/system/PipeProcess.cpp b/Sofa/framework/Helper/src/sofa/helper/system/PipeProcess.cpp index aecfe2cfaff..5ecfe606de6 100644 --- a/Sofa/framework/Helper/src/sofa/helper/system/PipeProcess.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/system/PipeProcess.cpp @@ -306,7 +306,7 @@ bool PipeProcess::executeProcess(const std::string &command, const std::vector< { int n = BUFSIZE-nfill[i]; if (n> STEPSIZE) n = STEPSIZE; - n = ::read(fds[i][0], buf[i]+nfill[i], n); + n = static_cast(::read(fds[i][0], buf[i]+nfill[i], n)); if (n == 0) { diff --git a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/BlockDiagonalMatrix.h b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/BlockDiagonalMatrix.h index beb752b4e2a..4dab9d3369e 100644 --- a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/BlockDiagonalMatrix.h +++ b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/BlockDiagonalMatrix.h @@ -78,12 +78,12 @@ class BlockDiagonalMatrix : public linearalgebra::BaseMatrix Index rowBSize(void) const { - return data.size(); + return static_cast(data.size()); } Index colBSize(void) const { - return data.size(); + return static_cast(data.size()); } const Block& bloc(Index i) const diff --git a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/CompressedRowSparseMatrixConstraint.h b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/CompressedRowSparseMatrixConstraint.h index 51f583d017f..2e8ae05181a 100644 --- a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/CompressedRowSparseMatrixConstraint.h +++ b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/CompressedRowSparseMatrixConstraint.h @@ -549,7 +549,7 @@ class CompressedRowSparseMatrixConstraint : public sofa::linearalgebra::Compress RowConstIterator readLine(Index lIndex) const { if constexpr (Policy::AutoCompress) const_cast(this)->compress(); /// \warning this violates the const-ness of the method ! - Index rowId = (this->nBlockRow == 0) ? 0 : lIndex * this->rowIndex.size() / this->nBlockRow; + Index rowId = (this->nBlockRow == 0) ? 0 : static_cast(lIndex * this->rowIndex.size() / this->nBlockRow); if (this->sortedFind(this->rowIndex, lIndex, rowId)) { return RowConstIterator(this, rowId); diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/Colors.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/Colors.cpp index bee044d6959..79013fe09d5 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/Colors.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/Colors.cpp @@ -104,7 +104,7 @@ const char* getColor(const sofa::Index id) sofa::Index registerColor(const std::string& hexColor) { DEFAULTCOLORS.emplace_back(hexColor); - return DEFAULTCOLORS.size()-1; + return static_cast(DEFAULTCOLORS.size()-1); } sofa::Index registerColor(const std::string& className, const std::string& hexColor) diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/mechanicalvisitor/MechanicalAddMBKdxVisitor.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/mechanicalvisitor/MechanicalAddMBKdxVisitor.cpp index ccf2a80e4d3..364d63e3b75 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/mechanicalvisitor/MechanicalAddMBKdxVisitor.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/mechanicalvisitor/MechanicalAddMBKdxVisitor.cpp @@ -49,7 +49,7 @@ void MechanicalAddMBKdxVisitor::bwdMechanicalMapping(simulation::Node* /*node*/, if (accumulate) { map->applyJT(mparams, res, res); - if( mparams->kFactor() ) map->applyDJT(mparams, res, res); + if( mparams->kFactor() != 0 ) map->applyDJT(mparams, res, res); } } diff --git a/Sofa/framework/Simulation/Core/src/sofa/simulation/mechanicalvisitor/MechanicalComputeDfVisitor.cpp b/Sofa/framework/Simulation/Core/src/sofa/simulation/mechanicalvisitor/MechanicalComputeDfVisitor.cpp index 7182b2a1237..2cb0b164ea5 100644 --- a/Sofa/framework/Simulation/Core/src/sofa/simulation/mechanicalvisitor/MechanicalComputeDfVisitor.cpp +++ b/Sofa/framework/Simulation/Core/src/sofa/simulation/mechanicalvisitor/MechanicalComputeDfVisitor.cpp @@ -49,7 +49,7 @@ void MechanicalComputeDfVisitor::bwdMechanicalMapping(simulation::Node* /*node*/ if (accumulate) { map->applyJT(mparams, res, res); // apply material stiffness: variation of force below the mapping - if( mparams->kFactor() ) map->applyDJT(mparams, res, res); // apply geometric stiffness: variation due to a change of mapping, with a constant force below the mapping + if(mparams->kFactor() != 0) map->applyDJT(mparams, res, res); // apply geometric stiffness: variation due to a change of mapping, with a constant force below the mapping } } diff --git a/Sofa/framework/Type/src/sofa/type/DualQuat.inl b/Sofa/framework/Type/src/sofa/type/DualQuat.inl index 9e81b3c6dd0..72d283d1d16 100644 --- a/Sofa/framework/Type/src/sofa/type/DualQuat.inl +++ b/Sofa/framework/Type/src/sofa/type/DualQuat.inl @@ -170,7 +170,7 @@ void DualQuatCoord3::normalize_getdJ( type::Mat<4,4,real>& dJ0, type::Mat real q0dqe = (real) ( qn.orientation[0]*dq.dual[0] + qn.orientation[1]*dq.dual[1] + qn.orientation[2]*dq.dual[2] + qn.orientation[3]*dq.dual[3]); - if(dq.orientation[0] || dq.orientation[1] || dq.orientation[2] || dq.orientation[3]) + if(dq.orientation[0] != 0 || dq.orientation[1] != 0 || dq.orientation[2] != 0 || dq.orientation[3] != 0) { real q0dq0 = (real) ( qn.orientation[0]*dq.orientation[0] + qn.orientation[1]*dq.orientation[1] + qn.orientation[2]*dq.orientation[2] + qn.orientation[3]*dq.orientation[3]); real qedq0 = (real) ( qn.dual[0]*dq.orientation[0] + qn.dual[1]*dq.orientation[1] + qn.dual[2]*dq.orientation[2] + qn.dual[3]*dq.orientation[3]); diff --git a/Sofa/framework/Type/src/sofa/type/Vec.h b/Sofa/framework/Type/src/sofa/type/Vec.h index 315c9d0ed90..c63bb2483b4 100644 --- a/Sofa/framework/Type/src/sofa/type/Vec.h +++ b/Sofa/framework/Type/src/sofa/type/Vec.h @@ -517,7 +517,7 @@ class Vec { ValueType n=0; for( Size i=0; ielems[i] ) n+=1; + if( this->elems[i] != static_cast(0) ) n+=1; return n; } else // generic implementation