From b2ef5b9474169ca9d11420a49ebf7f1b0944d48c Mon Sep 17 00:00:00 2001
From: "Dmitry Yu. Naumov" <github@naumov.de>
Date: Wed, 3 May 2017 22:15:46 +0200
Subject: [PATCH] Fix warnings (#1792)

* [NL] DOF: explicit cast of size for small vector.

* [NL] Use double pair of braces in initialization.

* [PL] SD: Remove unused function parameter.

* [MeL] Avoid implicit conversion from vtkIdType.

* [PL] LIE: Use int for variable and component ids.

* [T] GML: Avoid implicit integer conversion.
---
 MeshLib/Vtk/VtkMappedMeshSource.cpp                           | 2 +-
 NumLib/DOF/LocalToGlobalIndexMap.cpp                          | 2 +-
 NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp  | 2 +-
 .../LIE/HydroMechanics/LocalAssembler/LocalDataInitializer.h  | 4 ++--
 ProcessLib/SmallDeformation/SmallDeformationProcess.h         | 2 +-
 Tests/FileIO/TestGmlInterface.h                               | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/MeshLib/Vtk/VtkMappedMeshSource.cpp b/MeshLib/Vtk/VtkMappedMeshSource.cpp
index cb85f45ec12..8fd94ee2d46 100644
--- a/MeshLib/Vtk/VtkMappedMeshSource.cpp
+++ b/MeshLib/Vtk/VtkMappedMeshSource.cpp
@@ -98,7 +98,7 @@ int VtkMappedMeshSource::RequestData(vtkInformation*,
         {
             for (unsigned i = 0; i < 3; ++i)
             {
-                const unsigned prism_swap_id = ptIds->GetId(i);
+                const auto prism_swap_id = ptIds->GetId(i);
                 ptIds->SetId(i, ptIds->GetId(i + 3));
                 ptIds->SetId(i + 3, prism_swap_id);
             }
diff --git a/NumLib/DOF/LocalToGlobalIndexMap.cpp b/NumLib/DOF/LocalToGlobalIndexMap.cpp
index d3e0166654c..696f9267a51 100644
--- a/NumLib/DOF/LocalToGlobalIndexMap.cpp
+++ b/NumLib/DOF/LocalToGlobalIndexMap.cpp
@@ -209,7 +209,7 @@ LocalToGlobalIndexMap::LocalToGlobalIndexMap(
             "There are %d mesh subsets and %d components.",
             mesh_subsets.size(), global_component_ids.size());
 
-    for (int i = 0; i < global_component_ids.size(); ++i)
+    for (int i = 0; i < static_cast<int>(global_component_ids.size()); ++i)
     {
         auto const& mss = _mesh_subsets[i];
 
diff --git a/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp b/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp
index 5a53d633d54..9bc318cd9d8 100644
--- a/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp
+++ b/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp
@@ -96,7 +96,7 @@ void LocalLinearLeastSquaresExtrapolator::extrapolateElement(
            "integration points.");
 
     auto const pair_it_inserted = _qr_decomposition_cache.emplace(
-        std::make_pair(num_nodes, num_int_pts), CachedData{});
+        std::make_pair(num_nodes, num_int_pts), CachedData{{}});
 
     auto& cached_data = pair_it_inserted.first->second;
     if (pair_it_inserted.second)
diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/LocalDataInitializer.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/LocalDataInitializer.h
index b54aee76baf..cca32a96d4d 100644
--- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/LocalDataInitializer.h
+++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/LocalDataInitializer.h
@@ -195,7 +195,7 @@ public:
         auto const n_local_dof = _dof_table.getNumberOfElementDOF(id);
         const std::vector<std::size_t> varIDs(_dof_table.getElementVariableIDs(id));
         bool const isPressureDeactivated = (varIDs.front()!=0);
-        std::vector<std::size_t> involved_varIDs; // including deactived elements
+        std::vector<int> involved_varIDs;  // including deactived elements
         involved_varIDs.reserve(varIDs.size()+1);
         if (isPressureDeactivated)
             involved_varIDs.push_back(0); // always pressure come in
@@ -219,7 +219,7 @@ public:
             auto const var_id = involved_varIDs[i];
             auto const n_var_comp = _dof_table.getNumberOfVariableComponents(var_id);
             auto const n_var_element_nodes = vec_n_element_nodes[i];
-            for (unsigned var_comp_id = 0; var_comp_id < n_var_comp; var_comp_id++)
+            for (int var_comp_id = 0; var_comp_id < n_var_comp; var_comp_id++)
             {
                 auto& mss = _dof_table.getMeshSubsets(var_id, var_comp_id);
                 assert(mss.size() == 1);
diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.h b/ProcessLib/SmallDeformation/SmallDeformationProcess.h
index 1effe277d92..4930a9b8b69 100644
--- a/ProcessLib/SmallDeformation/SmallDeformationProcess.h
+++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.h
@@ -201,7 +201,7 @@ private:
             _local_assemblers, *_local_to_global_index_map, x, t, dt);
     }
 
-    void postTimestepConcreteProcess(GlobalVector const& x) override
+    void postTimestepConcreteProcess(GlobalVector const&) override
     {
         DBUG("PostTimestep SmallDeformationProcess.");
 
diff --git a/Tests/FileIO/TestGmlInterface.h b/Tests/FileIO/TestGmlInterface.h
index a312ff756d4..9bd77d4a388 100644
--- a/Tests/FileIO/TestGmlInterface.h
+++ b/Tests/FileIO/TestGmlInterface.h
@@ -99,7 +99,7 @@ public:
         {
             auto const & pnt_id_map(pnt_vec.getIDMap());
             lines[line_id] = new GeoLib::Polyline(*(pnt_vec.getVector()));
-            for (unsigned long pnt_id : pnt_ids)
+            for (auto pnt_id : pnt_ids)
             {
                 lines[line_id]->addPoint(pnt_id_map[pnt_id]);
             }
-- 
GitLab