From cefecfb2ae49f87f21f12488f6db186f56592ddd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <foss@grueninger.de>
Date: Sun, 29 Mar 2020 15:06:26 +0200
Subject: [PATCH] Use C++14's std::optional instead of Dune helper

---
 .../navierstokes/staggered/fluxvariables.hh   | 14 +++++++-------
 .../staggered/staggeredupwindfluxvariables.hh | 19 ++++++++++---------
 .../staggered/velocitygradients.hh            | 18 +++++++++---------
 3 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh
index 8500c684ea..bbd5e19812 100644
--- a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh
+++ b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh
@@ -25,7 +25,7 @@
 #define DUMUX_NAVIERSTOKES_STAGGERED_FLUXVARIABLES_HH
 
 #include <array>
-#include <dune/common/std/optional.hh>
+#include <optional>
 
 #include <dumux/common/math.hh>
 #include <dumux/common/exceptions.hh>
@@ -278,7 +278,7 @@ public:
 
         // If the current scvf is on a boundary, check if there is a Neumann BC for the stress in tangential direction.
         // Create a boundaryTypes object (will be empty if not at a boundary).
-        Dune::Std::optional<BoundaryTypes> currentScvfBoundaryTypes;
+        std::optional<BoundaryTypes> currentScvfBoundaryTypes;
         if (scvf.boundary())
             currentScvfBoundaryTypes.emplace(problem.boundaryTypes(element, scvf));
 
@@ -290,7 +290,7 @@ public:
             const auto& lateralScvf = fvGeometry.scvf(eIdx, scvf.pairData(localSubFaceIdx).localLateralFaceIdx);
 
             // Create a boundaryTypes object (will be empty if not at a boundary).
-            Dune::Std::optional<BoundaryTypes> lateralFaceBoundaryTypes;
+            std::optional<BoundaryTypes> lateralFaceBoundaryTypes;
 
             // Check if there is face/element parallel to our face of interest where the dof lives on. If there is no parallel neighbor,
             // we are on a boundary where we have to check for boundary conditions.
@@ -477,8 +477,8 @@ private:
                                                                     const ElementVolumeVariables& elemVolVars,
                                                                     const FaceVariables& faceVars,
                                                                     const GridFluxVariablesCache& gridFluxVarsCache,
-                                                                    const Dune::Std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
-                                                                    const Dune::Std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
+                                                                    const std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
+                                                                    const std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
                                                                     const int localSubFaceIdx)
     {
         const auto eIdx = scvf.insideScvIdx();
@@ -545,8 +545,8 @@ private:
                                                                     const SubControlVolumeFace& scvf,
                                                                     const ElementVolumeVariables& elemVolVars,
                                                                     const FaceVariables& faceVars,
-                                                                    const Dune::Std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
-                                                                    const Dune::Std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
+                                                                    const std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
+                                                                    const std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
                                                                     const int localSubFaceIdx)
     {
         const auto eIdx = scvf.insideScvIdx();
diff --git a/dumux/freeflow/navierstokes/staggered/staggeredupwindfluxvariables.hh b/dumux/freeflow/navierstokes/staggered/staggeredupwindfluxvariables.hh
index fbdb57c2da..bcae100b68 100644
--- a/dumux/freeflow/navierstokes/staggered/staggeredupwindfluxvariables.hh
+++ b/dumux/freeflow/navierstokes/staggered/staggeredupwindfluxvariables.hh
@@ -25,6 +25,7 @@
 #define DUMUX_NAVIERSTOKES_STAGGERED_UPWINDVARIABLES_HH
 
 #include <array>
+#include <optional>
 
 #include <dumux/common/math.hh>
 #include <dumux/common/exceptions.hh>
@@ -123,8 +124,8 @@ public:
                                                                const FaceVariables& faceVars,
                                                                const GridFluxVariablesCache& gridFluxVarsCache,
                                                                const int localSubFaceIdx,
-                                                               const Dune::Std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
-                                                               const Dune::Std::optional<BoundaryTypes>& lateralFaceBoundaryTypes)
+                                                               const std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
+                                                               const std::optional<BoundaryTypes>& lateralFaceBoundaryTypes)
     {
         const auto eIdx = scvf.insideScvIdx();
         const auto& lateralFace = fvGeometry.scvf(eIdx, scvf.pairData(localSubFaceIdx).localLateralFaceIdx);
@@ -368,8 +369,8 @@ private:
                                                              const FaceVariables& faceVars,
                                                              const Scalar transportingVelocity,
                                                              const int localSubFaceIdx,
-                                                             const Dune::Std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
-                                                             const Dune::Std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
+                                                             const std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
+                                                             const std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
                                                              std::true_type)
     {
         const SubControlVolumeFace& lateralFace = fvGeometry.scvf(ownScvf.insideScvIdx(), ownScvf.pairData(localSubFaceIdx).localLateralFaceIdx);
@@ -451,8 +452,8 @@ private:
                                                              const FaceVariables& faceVars,
                                                              const Scalar transportingVelocity,
                                                              const int localSubFaceIdx,
-                                                             const Dune::Std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
-                                                             const Dune::Std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
+                                                             const std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
+                                                             const std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
                                                              std::false_type)
     {
          // Check whether the own or the neighboring element is upstream.
@@ -575,8 +576,8 @@ private:
                                                    const FVElementGeometry& fvGeometry,
                                                    const SubControlVolumeFace& scvf,
                                                    const FaceVariables& faceVars,
-                                                   const Dune::Std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
-                                                   const Dune::Std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
+                                                   const std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
+                                                   const std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
                                                    const int localSubFaceIdx)
     {
         // Find out what boundary type is set on the lateral face
@@ -630,7 +631,7 @@ private:
                                                            const FVElementGeometry& fvGeometry,
                                                            const SubControlVolumeFace& scvf,
                                                            const FaceVariables& faceVars,
-                                                           const Dune::Std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
+                                                           const std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
                                                            const int localOppositeSubFaceIdx)
     {
         // A ghost subface at the boundary is created, featuring the location of the sub face's center
diff --git a/dumux/freeflow/navierstokes/staggered/velocitygradients.hh b/dumux/freeflow/navierstokes/staggered/velocitygradients.hh
index 014a98b7e7..a9c3c452b3 100644
--- a/dumux/freeflow/navierstokes/staggered/velocitygradients.hh
+++ b/dumux/freeflow/navierstokes/staggered/velocitygradients.hh
@@ -24,7 +24,7 @@
 #ifndef DUMUX_NAVIERSTOKES_STAGGERED_VELOCITYGRADIENTS_HH
 #define DUMUX_NAVIERSTOKES_STAGGERED_VELOCITYGRADIENTS_HH
 
-#include <dune/common/std/optional.hh>
+#include <optional>
 #include <dumux/common/exceptions.hh>
 #include <dumux/common/parameters.hh>
 
@@ -100,8 +100,8 @@ public:
                                  const FVElementGeometry& fvGeometry,
                                  const SubControlVolumeFace& scvf,
                                  const FaceVariables& faceVars,
-                                 const Dune::Std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
-                                 const Dune::Std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
+                                 const std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
+                                 const std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
                                  const std::size_t localSubFaceIdx)
     {
         const auto eIdx = scvf.insideScvIdx();
@@ -174,8 +174,8 @@ public:
                                  const FVElementGeometry& fvGeometry,
                                  const SubControlVolumeFace& scvf,
                                  const FaceVariables& faceVars,
-                                 const Dune::Std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
-                                 const Dune::Std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
+                                 const std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
+                                 const std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
                                  const std::size_t localSubFaceIdx)
     {
         const auto eIdx = scvf.insideScvIdx();
@@ -243,8 +243,8 @@ public:
                                                      const FVElementGeometry& fvGeometry,
                                                      const SubControlVolumeFace& scvf,
                                                      const FaceVariables& faceVars,
-                                                     const Dune::Std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
-                                                     const Dune::Std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
+                                                     const std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
+                                                     const std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
                                                      const std::size_t localSubFaceIdx)
     {
         const auto eIdx = scvf.insideScvIdx();
@@ -303,8 +303,8 @@ public:
                                                      const FVElementGeometry& fvGeometry,
                                                      const SubControlVolumeFace& scvf,
                                                      const FaceVariables& faceVars,
-                                                     const Dune::Std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
-                                                     const Dune::Std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
+                                                     const std::optional<BoundaryTypes>& currentScvfBoundaryTypes,
+                                                     const std::optional<BoundaryTypes>& lateralFaceBoundaryTypes,
                                                      const std::size_t localSubFaceIdx)
     {
         const auto eIdx = scvf.insideScvIdx();
-- 
GitLab