From 7a6a5154142c06e43c1291b0804cc2989b823f2b Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Tue, 17 Oct 2017 19:00:08 +0200
Subject: [PATCH] [NL] DOF: getNumberOfVariables() returns an int.

and not size_t avoiding some warinings in usage of getElementVariableIDs().
---
 NumLib/DOF/LocalToGlobalIndexMap.cpp                      | 8 ++++----
 NumLib/DOF/LocalToGlobalIndexMap.h                        | 8 ++++++--
 .../HydroMechanics/LocalAssembler/LocalDataInitializer.h  | 4 ++--
 .../LocalAssembler/LocalDataInitializer.h                 | 3 +--
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/NumLib/DOF/LocalToGlobalIndexMap.cpp b/NumLib/DOF/LocalToGlobalIndexMap.cpp
index 92456d96a6a..5c892d56c4b 100644
--- a/NumLib/DOF/LocalToGlobalIndexMap.cpp
+++ b/NumLib/DOF/LocalToGlobalIndexMap.cpp
@@ -304,11 +304,11 @@ LocalToGlobalIndexMap::getNumberOfElementComponents(std::size_t const mesh_item_
     return n;
 }
 
-std::vector<std::size_t>
-LocalToGlobalIndexMap::getElementVariableIDs(std::size_t const mesh_item_id) const
+std::vector<int> LocalToGlobalIndexMap::getElementVariableIDs(
+    std::size_t const mesh_item_id) const
 {
-    std::vector<std::size_t> vec;
-    for (unsigned i=0; i<getNumberOfVariables(); i++)
+    std::vector<int> vec;
+    for (int i = 0; i < getNumberOfVariables(); i++)
     {
         for (int j=0; j<getNumberOfVariableComponents(i); j++)
         {
diff --git a/NumLib/DOF/LocalToGlobalIndexMap.h b/NumLib/DOF/LocalToGlobalIndexMap.h
index 0784de22416..c40a4d08dd3 100644
--- a/NumLib/DOF/LocalToGlobalIndexMap.h
+++ b/NumLib/DOF/LocalToGlobalIndexMap.h
@@ -103,7 +103,10 @@ public:
 
     std::size_t size() const;
 
-    std::size_t getNumberOfVariables() const { return (_variable_component_offsets.size() - 1); }
+    int getNumberOfVariables() const
+    {
+        return static_cast<int>(_variable_component_offsets.size()) - 1;
+    }
 
     int getNumberOfVariableComponents(int variable_id) const
     {
@@ -119,7 +122,8 @@ public:
 
     std::size_t getNumberOfElementComponents(std::size_t const mesh_item_id) const;
 
-    std::vector<std::size_t> getElementVariableIDs(std::size_t const mesh_item_id) const;
+    std::vector<int> getElementVariableIDs(
+        std::size_t const mesh_item_id) const;
 
     GlobalIndexType getGlobalIndex(MeshLib::Location const& l,
                                    int const variable_id,
diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/LocalDataInitializer.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/LocalDataInitializer.h
index 0b68a86c9c5..0082088412c 100644
--- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/LocalDataInitializer.h
+++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/LocalDataInitializer.h
@@ -199,7 +199,7 @@ public:
                 type_idx.name());
 
         auto const n_local_dof = _dof_table.getNumberOfElementDOF(id);
-        const std::vector<std::size_t> varIDs(_dof_table.getElementVariableIDs(id));
+        auto const varIDs = _dof_table.getElementVariableIDs(id);
         bool const isPressureDeactivated = (varIDs.front()!=0);
         std::vector<int> involved_varIDs;  // including deactived elements
         involved_varIDs.reserve(varIDs.size()+1);
@@ -215,7 +215,7 @@ public:
         //TODO how to get the shape function order for each variable?
         vec_n_element_nodes.push_back(mesh_item.getNumberOfBaseNodes()); // pressure
         auto const max_varID = *std::max_element(varIDs.begin(), varIDs.end());
-        for (unsigned i=1; i<max_varID+1; i++)
+        for (int i = 1; i < max_varID + 1; i++)
             vec_n_element_nodes.push_back(mesh_item.getNumberOfNodes()); // displacements
 
         unsigned local_id = 0;
diff --git a/ProcessLib/LIE/SmallDeformation/LocalAssembler/LocalDataInitializer.h b/ProcessLib/LIE/SmallDeformation/LocalAssembler/LocalDataInitializer.h
index 2f0ad662cf7..55bd3fc0875 100644
--- a/ProcessLib/LIE/SmallDeformation/LocalAssembler/LocalDataInitializer.h
+++ b/ProcessLib/LIE/SmallDeformation/LocalAssembler/LocalDataInitializer.h
@@ -249,8 +249,7 @@ public:
             auto const n_local_dof = _dof_table.getNumberOfElementDOF(id);
             auto const n_global_components =
                 _dof_table.getNumberOfElementComponents(id);
-            const std::vector<std::size_t> varIDs(
-                _dof_table.getElementVariableIDs(id));
+            const std::vector<int> varIDs(_dof_table.getElementVariableIDs(id));
 
             std::vector<unsigned> dofIndex_to_localIndex;
             if (mesh_item.getDimension() < GlobalDim ||
-- 
GitLab