From a741ff3f52f642084d0183823012d81576e8a094 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Fri, 5 Jun 2020 16:18:16 +0200
Subject: [PATCH] Constness.

---
 Applications/Utils/FileConverter/NetCdfConverter.cpp        | 2 +-
 ChemistryLib/PhreeqcKernelData/EquilibriumReactants.cpp     | 2 +-
 ChemistryLib/PhreeqcKernelData/EquilibriumReactants.h       | 2 +-
 MaterialLib/SolidModels/Lubby2.cpp                          | 4 ++--
 MaterialLib/SolidModels/Lubby2.h                            | 4 ++--
 MathLib/LinAlg/Eigen/EigenTools.h                           | 2 +-
 ParameterLib/TimeDependentHeterogeneousParameter.cpp        | 6 +++---
 .../TwoPhaseFlowWithPrhoMaterialProperties.cpp              | 6 +++---
 8 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/Applications/Utils/FileConverter/NetCdfConverter.cpp b/Applications/Utils/FileConverter/NetCdfConverter.cpp
index a1b305e78e1..6eeeadf2cbc 100644
--- a/Applications/Utils/FileConverter/NetCdfConverter.cpp
+++ b/Applications/Utils/FileConverter/NetCdfConverter.cpp
@@ -435,7 +435,7 @@ static std::vector<double> getData(NcFile const& dataset, NcVar const& var,
 
     std::replace_if(
         data_vec.begin(), data_vec.end(),
-        [](double& x) { return x == no_data_input; }, no_data_output);
+        [](double const& x) { return x == no_data_input; }, no_data_output);
 
     return data_vec;
 }
diff --git a/ChemistryLib/PhreeqcKernelData/EquilibriumReactants.cpp b/ChemistryLib/PhreeqcKernelData/EquilibriumReactants.cpp
index 3bdfc32ccd4..dae97d52e35 100644
--- a/ChemistryLib/PhreeqcKernelData/EquilibriumReactants.cpp
+++ b/ChemistryLib/PhreeqcKernelData/EquilibriumReactants.cpp
@@ -25,7 +25,7 @@ PhaseComponent::PhaseComponent(std::string&& name_,
 }
 
 EquilibriumReactants::EquilibriumReactants(
-    std::vector<PhaseComponent>& phase_components)
+    std::vector<PhaseComponent> const& phase_components)
 {
     for (auto& phase_component : phase_components)
     {
diff --git a/ChemistryLib/PhreeqcKernelData/EquilibriumReactants.h b/ChemistryLib/PhreeqcKernelData/EquilibriumReactants.h
index e9116510cea..abaffd2ddfe 100644
--- a/ChemistryLib/PhreeqcKernelData/EquilibriumReactants.h
+++ b/ChemistryLib/PhreeqcKernelData/EquilibriumReactants.h
@@ -38,7 +38,7 @@ class EquilibriumReactants final : private cxxPPassemblage
 {
 public:
     explicit EquilibriumReactants(
-        std::vector<PhaseComponent>& phase_components);
+        std::vector<PhaseComponent> const& phase_components);
 
     void setChemicalSystemID(std::size_t const chemical_system_id)
     {
diff --git a/MaterialLib/SolidModels/Lubby2.cpp b/MaterialLib/SolidModels/Lubby2.cpp
index 6b20e0c1c49..437bb8ce611 100644
--- a/MaterialLib/SolidModels/Lubby2.cpp
+++ b/MaterialLib/SolidModels/Lubby2.cpp
@@ -208,9 +208,9 @@ void Lubby2<DisplacementDim>::calculateResidualBurgers(
     const KelvinVector& strain_t,
     const KelvinVector& stress_curr,
     const KelvinVector& stress_t,
-    KelvinVector& strain_Kel_curr,
+    const KelvinVector& strain_Kel_curr,
     const KelvinVector& strain_Kel_t,
-    KelvinVector& strain_Max_curr,
+    const KelvinVector& strain_Max_curr,
     const KelvinVector& strain_Max_t,
     ResidualVector& res,
     detail::LocalLubby2Properties<DisplacementDim> const& properties) const
diff --git a/MaterialLib/SolidModels/Lubby2.h b/MaterialLib/SolidModels/Lubby2.h
index 369939a6774..ecdb11296c1 100644
--- a/MaterialLib/SolidModels/Lubby2.h
+++ b/MaterialLib/SolidModels/Lubby2.h
@@ -250,9 +250,9 @@ private:
         const KelvinVector& strain_t,
         const KelvinVector& stress_curr,
         const KelvinVector& stress_t,
-        KelvinVector& strain_Kel_curr,
+        const KelvinVector& strain_Kel_curr,
         const KelvinVector& strain_Kel_t,
-        KelvinVector& strain_Max_curr,
+        const KelvinVector& strain_Max_curr,
         const KelvinVector& strain_Max_t,
         ResidualVector& res,
         detail::LocalLubby2Properties<DisplacementDim> const& properties) const;
diff --git a/MathLib/LinAlg/Eigen/EigenTools.h b/MathLib/LinAlg/Eigen/EigenTools.h
index c947efb4ae3..7bc520c589f 100644
--- a/MathLib/LinAlg/Eigen/EigenTools.h
+++ b/MathLib/LinAlg/Eigen/EigenTools.h
@@ -34,7 +34,7 @@ void applyKnownSolution(EigenMatrix &A, EigenVector &b, EigenVector &/*x*/,
         const std::vector<double> &_vec_knownX_x, double penalty_scaling = 1e+10);
 
 inline
-void applyKnownSolution(Eigen::MatrixXd &A, Eigen::VectorXd &b, Eigen::VectorXd &/*x*/,
+void applyKnownSolution(Eigen::MatrixXd const &A, Eigen::VectorXd &b, Eigen::VectorXd &/*x*/,
         const std::vector<Eigen::MatrixXd::Index> &_vec_knownX_id,
         const std::vector<double> &_vec_knownX_x, double penalty_scaling = 1e+10)
 {
diff --git a/ParameterLib/TimeDependentHeterogeneousParameter.cpp b/ParameterLib/TimeDependentHeterogeneousParameter.cpp
index 6e262147964..7c3e3be59d9 100644
--- a/ParameterLib/TimeDependentHeterogeneousParameter.cpp
+++ b/ParameterLib/TimeDependentHeterogeneousParameter.cpp
@@ -66,12 +66,12 @@ std::vector<double> TimeDependentHeterogeneousParameter::operator()(
 
     auto r0 = _time_parameter_mapping[k - 1].second->operator()(t, pos);
     std::transform(r0.begin(), r0.end(), r0.begin(),
-                   [alpha](auto& v) { return (1 - alpha) * v; });
+                   [alpha](auto const& v) { return (1 - alpha) * v; });
     auto r1 = _time_parameter_mapping[k].second->operator()(t, pos);
     std::transform(r1.begin(), r1.end(), r1.begin(),
-                   [alpha](auto& v) { return alpha * v; });
+                   [alpha](auto const& v) { return alpha * v; });
     std::transform(r0.begin(), r0.end(), r1.begin(), r0.begin(),
-                   [](auto& v0, auto const& v1) { return v0 + v1; });
+                   [](auto const& v0, auto const& v1) { return v0 + v1; });
     return r0;
 }
 
diff --git a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp
index 98ef4430bdd..1314db363c7 100644
--- a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp
+++ b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp
@@ -229,7 +229,7 @@ bool TwoPhaseFlowWithPrhoMaterialProperties::computeConstitutiveRelation(
 }
 void TwoPhaseFlowWithPrhoMaterialProperties::calculateResidual(
     const int material_id, double const pl, double const X, double const T,
-    double Sw, double rho_h2_wet, ResidualVector& res)
+    double const Sw, double const rho_h2_wet, ResidualVector& res)
 {
     const double pg =
         pl + _capillary_pressure_models[material_id]->getCapillaryPressure(Sw);
@@ -243,8 +243,8 @@ void TwoPhaseFlowWithPrhoMaterialProperties::calculateResidual(
 void TwoPhaseFlowWithPrhoMaterialProperties::calculateJacobian(
     const int material_id, double const /*t*/,
     ParameterLib::SpatialPosition const& /*x*/, double const pl,
-    double const /*X*/, double const T, JacobianMatrix& Jac, double Sw,
-    double rho_h2_wet)
+    double const /*X*/, double const T, JacobianMatrix& Jac, double const Sw,
+    double const rho_h2_wet)
 {
     const double pg =
         pl + _capillary_pressure_models[material_id]->getCapillaryPressure(Sw);
-- 
GitLab