From 1d2fee323c2af22b89cb33aaa96b812be487b748 Mon Sep 17 00:00:00 2001
From: Boris Martin <boris.martin.be@gmail.com>
Date: Fri, 24 Mar 2023 17:01:43 +0100
Subject: [PATCH] minor refactoring

---
 inversion.cpp | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/inversion.cpp b/inversion.cpp
index facc125..a15842a 100644
--- a/inversion.cpp
+++ b/inversion.cpp
@@ -55,6 +55,18 @@ static unsigned int getNumberOfGroups(const GmshFem &gmshFem)
     return n_group;
 }
 
+static std::string getIntegrationType(const GmshFem &gmshFem, std::string suffix_g)
+{
+    std::string integrationType;
+    if (!(
+            gmshFem.userDefinedParameter(integrationType, "integration_type") ||
+            gmshFem.userDefinedParameter(integrationType, "integration_type" + suffix_g)))
+    {
+        throw Exception("Integration type could not be found.");
+    }
+    return integrationType;
+}
+
 template <Physic T_Physic>
 int inversion(const GmshFem& gmshFem)
 {
@@ -131,15 +143,7 @@ int inversion(const GmshFem& gmshFem)
             }
         }
 
-        std::string integrationType;
-        if(!(
-        gmshFem.userDefinedParameter(integrationType, "integration_type")
-        ||
-        gmshFem.userDefinedParameter(integrationType, "integration_type"+suffix_g)
-        ))
-        {
-            throw Exception("Integration type could not be found.");
-        }
+        std::string integrationType = getIntegrationType(gmshFem, suffix_g);
         model::Discretization m_discret(gmshFem,suffix_g);
         if(g==0)
         {
-- 
GitLab