diff --git a/inversion.cpp b/inversion.cpp
index facc1258355420b6e434c3dd031c57c0e28e71a1..a15842a100b2babfa5125556e3fcf081482baae0 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)
         {