Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[All] Fix minor compilation warnings #2233

Merged
8 changes: 4 additions & 4 deletions SofaKernel/modules/Sofa.Type/src/sofa/type/Mat_solve_LCP.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ bool solveLCP(const Vec<dim,real> &q, const Mat<dim,dim,real> &M, Vec<dim * 2, r
const Size dim_mult2 = 2 * dim;
const Size dim_mult2_plus1 = dim_mult2 + 1;

int ii, jj;
Index ii, jj;
int ligPiv; // ligne du pivot
int colPiv; // colonne du pivot
double pivot; // pivot
double min; // recherche du minimum pour le pivot
double coeff; // valeur du coefficient de la combinaison lineaire
int boucles; // ii du nombre de passages dans la boucle
Index boucles; // ii du nombre de passages dans la boucle
double mat[dim][dim_mult2_plus1];
int base[dim]; // base des variables non nulles
Index base[dim]; // base des variables non nulles

// matrix initialization
for (ii = 0; ii < dim; ii++)
Expand Down Expand Up @@ -130,7 +130,7 @@ bool solveLCP(const Vec<dim,real> &q, const Mat<dim,dim,real> &M, Vec<dim * 2, r
// combinaisons lineaires mettant la colonne du pivot a 0
for (ii = 0; ii < dim; ii++)
{
if (ii != ligPiv)
if (int(ii) != ligPiv)
{
coeff = mat[ii][colPiv];
for (jj = 0; jj < dim_mult2_plus1; jj++)
Expand Down
8 changes: 0 additions & 8 deletions SofaKernel/modules/SofaHelper/src/sofa/helper/proximity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ void DistanceTriTri::
NewComputation(const Vector3& P1, const Vector3& P2, const Vector3& P3, const Vector3& Q1, const Vector3& Q2, const Vector3& Q3, Vector3 &Presult, Vector3 &Qresult)
{
double alphaP, betaP, alphaQ, betaQ;
int i;
Vector3 P1P2, P1P3, Q1Q2, Q1Q3, P1Q1, PQ;
type::Mat<6, 6, SReal> A;
type::Vec<6, SReal> b;
Expand Down Expand Up @@ -146,9 +145,6 @@ void DistanceSegTri::
NewComputation(const Vector3 &P1, const Vector3 &P2, const Vector3 &P3, const Vector3 &Q1, const Vector3 &Q2, Vector3 &Presult, Vector3 &Qresult)
{
double alpha, beta, gamma;
int i;


Vector3 P1P2, P1P3, Q1Q2, P1Q1, PQ;
type::Mat<5, 5, SReal> A;
type::Vec<5, SReal> b;
Expand Down Expand Up @@ -215,10 +211,6 @@ void DistancePointTri::
NewComputation(const Vector3 &P1, const Vector3 &P2, const Vector3 &P3, const Vector3 &Q, Vector3 &Presult)
{
double alpha, beta;
int i;

//Vector3 P1, P2, P3;

Vector3 P1P2, P1P3, P1Q;
type::Mat<3, 3, SReal> A;
type::Vec<3, SReal> b;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class TetrahedronFEMForceField : public core::behavior::ForceField<DataTypes>, p
void handleTopologyChange() override { needUpdateTopology = true; }

void computeVonMisesStress();
const bool isComputeVonMisesStressMethodSet();
bool isComputeVonMisesStressMethodSet();
void handleEvent(core::objectmodel::Event *event) override;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2617,7 +2617,7 @@ void TetrahedronFEMForceField<DataTypes>::computeVonMisesStress()
}

template<class DataTypes>
const bool TetrahedronFEMForceField<DataTypes>::isComputeVonMisesStressMethodSet()
bool TetrahedronFEMForceField<DataTypes>::isComputeVonMisesStressMethodSet()
{
return ( _computeVonMisesStress.getValue() == 1 || _computeVonMisesStress.getValue() == 2 );
}
Expand Down
4 changes: 2 additions & 2 deletions applications/plugins/SofaTest/Sofa_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ using sofa::helper::Utils;

namespace sofa {
namespace {
static struct raii {
struct raii {
raii() {
PluginManager::getInstance().loadPlugin("SceneCreator") ;
PluginManager::getInstance().loadPlugin("SofaComponentAll") ;
Expand All @@ -65,6 +65,6 @@ void BaseSofa_test::clearSceneGraph()



template struct SOFA_SOFATEST_API Sofa_test<double>;
template class SOFA_SOFATEST_API Sofa_test<double>;

}
6 changes: 5 additions & 1 deletion modules/SofaGuiQt/src/sofa/gui/qt/viewer/qt/QtViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,12 +1043,16 @@ void QtViewer::paintGL()
drawScene();

if(!captureTimer.isActive())
{
SofaViewer::captureEvent();
}

if (_waitForRender)
{
_waitForRender = false;
}

emit( redrawn());
emit redrawn();
}

void QtViewer::paintEvent(QPaintEvent* qpe)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ class MeshMatrixMass_test : public BaseTest
if(mass!=nullptr){

static const MassType volume = 8.0;
static const MassType volumeElem = volume / 8.0; // 8 hexa in the grid
static const MassType expectedTotalMass = 27.0;
static const MassType expectedDensity = expectedTotalMass / volume;

Expand Down Expand Up @@ -1669,17 +1668,9 @@ class MeshMatrixMass_test : public BaseTest
EdgeSetTopologyModifier* modifier = root->getTreeObject<EdgeSetTopologyModifier>();
ASSERT_NE(modifier, nullptr);

damienmarchal marked this conversation as resolved.
Show resolved Hide resolved
static const MassType volume = 2.0;
static const MassType volumeElem = volume / 3.0; // 3 edges in the grid
static const MassType expectedDensity = 1.0;
static const MassType expectedTotalMass = expectedDensity * volume;
static const MassType massElem = expectedDensity * volumeElem;

const VecMass& vMasses = mass->d_vertexMass.getValue();
const VecMass& eMasses = mass->d_edgeMass.getValue();
static const MassType refValueV = (MassType)(expectedDensity * volumeElem * 1 / 6);
static const MassType refValueE = (MassType)(expectedDensity * volumeElem * 1 / 12);
static const MassType wrongValue = 0; // TODO epernod 2021-06-29: MeshMatrixMass based on edge topology doesn't support topological changes
static const MassType wrongValue = 0; // TODO epernod 2021-06-29: MeshMatrixMass based on edge topology doesn't support topological changes
damienmarchal marked this conversation as resolved.
Show resolved Hide resolved

// check value at init
EXPECT_EQ(vMasses.size(), 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ void MeshMatrixMass<DataTypes, MassType>::EdgeMassHandler::applyCreateFunction(I
template< class DataTypes, class MassType>
void MeshMatrixMass<DataTypes, MassType>::VertexMassHandler::applyDestroyFunction(Index id, MassType& VertexMass)
{
SOFA_UNUSED(id);
helper::WriteAccessor<Data<Real> > totalMass(this->m->d_totalMass);
totalMass -= VertexMass;
}
Expand All @@ -105,6 +106,7 @@ void MeshMatrixMass<DataTypes, MassType>::VertexMassHandler::applyDestroyFunctio
template< class DataTypes, class MassType>
void MeshMatrixMass<DataTypes, MassType>::EdgeMassHandler::applyDestroyFunction(Index id, MassType& EdgeMass)
{
SOFA_UNUSED(id);
helper::WriteAccessor<Data<Real> > totalMass(this->m->d_totalMass);
totalMass -= EdgeMass;
}
Expand Down