diff --git a/MaterialLib/MPL/CheckMaterialSpatialDistributionMap.h b/MaterialLib/MPL/CheckMaterialSpatialDistributionMap.h
index f3d78a977fc72a5de49725f901adf722a99b08bc..7d4ec3b2a94f442a45b5f29b7fa8b7a33a31b0b6 100644
--- a/MaterialLib/MPL/CheckMaterialSpatialDistributionMap.h
+++ b/MaterialLib/MPL/CheckMaterialSpatialDistributionMap.h
@@ -28,10 +28,8 @@ void checkMaterialSpatialDistributionMap(
     ContainerLiquid const& required_properties_liquid_phase,
     ContainerGas const& required_properties_gas_phase)
 {
-    for (auto const& element : mesh.getElements())
+    for (auto const element_id : mesh.getElements() | MeshLib::views::ids)
     {
-        auto const element_id = element->getID();
-
         auto const& medium = *media_map.getMedium(element_id);
         if (!required_properties_medium.empty())
         {
diff --git a/ProcessLib/BoundaryConditionAndSourceTerm/ConstraintDirichletBoundaryCondition.cpp b/ProcessLib/BoundaryConditionAndSourceTerm/ConstraintDirichletBoundaryCondition.cpp
index b9593bd78b88336d270f5f1c02374c08ae0ba7b7..acf8af3f23b4cf8249db30e3e13a0a545bc091f7 100644
--- a/ProcessLib/BoundaryConditionAndSourceTerm/ConstraintDirichletBoundaryCondition.cpp
+++ b/ProcessLib/BoundaryConditionAndSourceTerm/ConstraintDirichletBoundaryCondition.cpp
@@ -114,15 +114,13 @@ void ConstraintDirichletBoundaryCondition::preTimestep(
     DBUG(
         "ConstraintDirichletBoundaryCondition::preTimestep: computing flux "
         "constraints");
-    for (auto const* boundary_element : _bc_mesh.getElements())
+    for (auto const id : _bc_mesh.getElements() | MeshLib::views::ids)
     {
-        _flux_values[boundary_element->getID()] =
-            _local_assemblers[boundary_element->getID()]->integrate(
-                x, t,
-                [this](std::size_t const element_id,
-                       MathLib::Point3d const& pnt, double const t,
-                       std::vector<GlobalVector*> const& x)
-                { return _getFlux(element_id, pnt, t, x); });
+        _flux_values[id] = _local_assemblers[id]->integrate(
+            x, t,
+            [this](std::size_t const element_id, MathLib::Point3d const& pnt,
+                   double const t, std::vector<GlobalVector*> const& x)
+            { return _getFlux(element_id, pnt, t, x); });
     }
 }
 
diff --git a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp
index 5446d3f91123308a77ca436625e24cfec2fe5c68..022adcac2c3e6f5ed5ab9685ca281b4f09237b2c 100644
--- a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp
+++ b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp
@@ -47,10 +47,8 @@ void checkMPLProperties(
         MaterialPropertyLib::PropertyType::decay_rate,
         MaterialPropertyLib::PropertyType::pore_diffusion};
 
-    for (auto const& element : mesh.getElements())
+    for (auto const& element_id : mesh.getElements() | MeshLib::views::ids)
     {
-        auto const element_id = element->getID();
-
         auto const& medium = *media_map.getMedium(element_id);
         checkRequiredProperties(medium, required_properties_medium);
 
diff --git a/ProcessLib/HydroMechanics/CreateHydroMechanicsProcess.cpp b/ProcessLib/HydroMechanics/CreateHydroMechanicsProcess.cpp
index d69ac4a5f40fa697a5374cf719d000835f55628b..a40c37308aed02ffaa990b4d076f392e21185ef8 100644
--- a/ProcessLib/HydroMechanics/CreateHydroMechanicsProcess.cpp
+++ b/ProcessLib/HydroMechanics/CreateHydroMechanicsProcess.cpp
@@ -214,9 +214,8 @@ std::unique_ptr<Process> createHydroMechanicsProcess(
                                                 MaterialPropertyLib::density};
     std::array const requiredSolidProperties = {MaterialPropertyLib::density};
 
-    for (auto const& element : mesh.getElements())
+    for (auto const& element_id : mesh.getElements() | MeshLib::views::ids)
     {
-        auto const element_id = element->getID();
         media_map->checkElementHasMedium(element_id);
         auto const& medium = *media_map->getMedium(element_id);
         checkRequiredProperties(medium, requiredMediumProperties);
diff --git a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp
index e605bd9279050ded4bb92f75f2dfa81173c84f03..b2f079c5fbe9f11019e8cd88ed6c34be8e35eb1a 100644
--- a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp
+++ b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp
@@ -144,10 +144,10 @@ SmallDeformationProcess<DisplacementDim>::SmallDeformationProcess(
     for (unsigned i = 0; i < vec_junction_nodeID_matIDs.size(); i++)
     {
         auto node = mesh.getNode(vec_junction_nodeID_matIDs[i].first);
-        for (auto e : mesh.getElementsConnectedToNode(*node))
+        for (auto id :
+             mesh.getElementsConnectedToNode(*node) | MeshLib::views::ids)
         {
-            _process_data._vec_ele_connected_junctionIDs[e->getID()].push_back(
-                i);
+            _process_data._vec_ele_connected_junctionIDs[id].push_back(i);
         }
     }
 
diff --git a/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp b/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp
index 71ab59ce43901e5db1e03b3b5b12c7aefb7e4b2a..a94e9842b0cbb3015bec52a397fd25cfd88114ee 100644
--- a/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp
+++ b/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp
@@ -46,10 +46,8 @@ void checkMPLProperties(
         MaterialPropertyLib::PropertyType::decay_rate,
         MaterialPropertyLib::PropertyType::pore_diffusion};
 
-    for (auto const& element : mesh.getElements())
+    for (auto const element_id : mesh.getElements() | MeshLib::views::ids)
     {
-        auto const element_id = element->getID();
-
         auto const& medium = *media_map.getMedium(element_id);
         checkRequiredProperties(medium, required_properties_medium);
 
diff --git a/ProcessLib/StokesFlow/CreateStokesFlowProcess.cpp b/ProcessLib/StokesFlow/CreateStokesFlowProcess.cpp
index 91cea3678a8d74028dc1dc1b0e4eea5261ff3850..955011e536ee1ad909d4e99bf9d4c60195223c5c 100644
--- a/ProcessLib/StokesFlow/CreateStokesFlowProcess.cpp
+++ b/ProcessLib/StokesFlow/CreateStokesFlowProcess.cpp
@@ -33,9 +33,8 @@ void checkMPLProperties(
     std::array const required_properties_medium = {
         MaterialPropertyLib::PropertyType::permeability};
 
-    for (auto const& element : mesh.getElements())
+    for (auto const element_id : mesh.getElements() | MeshLib::views::ids)
     {
-        auto const element_id = element->getID();
         auto const& medium = *media_map.getMedium(element_id);
 
         if (use_stokes_brinkman_form)