diff --git a/src/stencil/D2CornerStencil.h b/src/stencil/D2CornerStencil.h
index 9d1716100079943e2229f7418c0c47c0ad2ebc3d..5888bad3047a336dd2aafba3ca2cf93e607b956d 100644
--- a/src/stencil/D2CornerStencil.h
+++ b/src/stencil/D2CornerStencil.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/D2Q4.h b/src/stencil/D2Q4.h
index 9c1f9b7b7f6da572bdb1f7d88963ec0ee94d19da..294f3551220fe8ddd3e21b72e276e46254cffa10 100644
--- a/src/stencil/D2Q4.h
+++ b/src/stencil/D2Q4.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/D2Q5.h b/src/stencil/D2Q5.h
index 98cfbb0099d1cfdbee82a3ff74c5b5b6d50de15c..a09f40cdc1dcdb25be2cc79fde4484fa2cb6c1df 100644
--- a/src/stencil/D2Q5.h
+++ b/src/stencil/D2Q5.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/D2Q9.h b/src/stencil/D2Q9.h
index 4c3dc0cd9948536a4d13473b57a04dd63f928365..5d55c7fe89b21b6f571faa1920ea476d16ba70c8 100644
--- a/src/stencil/D2Q9.h
+++ b/src/stencil/D2Q9.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/D3CornerStencil.h b/src/stencil/D3CornerStencil.h
index b234a89d09776919e0c008391cd699ef72a2b9ef..5df290d22b164f08858ed455ed0678f0654e4b17 100644
--- a/src/stencil/D3CornerStencil.h
+++ b/src/stencil/D3CornerStencil.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/D3EdgeCornerStencil.h b/src/stencil/D3EdgeCornerStencil.h
index e3e6a2832a025c39d9427cd14234ba3910fd5df5..318752ead018b307f59f2fc01f3a6827b6e99284 100644
--- a/src/stencil/D3EdgeCornerStencil.h
+++ b/src/stencil/D3EdgeCornerStencil.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/D3Q15.h b/src/stencil/D3Q15.h
index 896c8c49b912752204af227920e53e56ba42a798..32dab37b9eba8182d69d8d5873f5c4ecfd1d46e3 100644
--- a/src/stencil/D3Q15.h
+++ b/src/stencil/D3Q15.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/D3Q19.h b/src/stencil/D3Q19.h
index a7a520f69b4cd2d59e6b03f9ceffa186e5c5bb5a..6077893823241858a2bb90bec3743825869e6f05 100644
--- a/src/stencil/D3Q19.h
+++ b/src/stencil/D3Q19.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/D3Q27.h b/src/stencil/D3Q27.h
index 6ba403bd579e77ecc6b324538eeaa44e83ad64ad..74b986f4a2ea9fcefdda55a87cf014aef0e9cd4e 100644
--- a/src/stencil/D3Q27.h
+++ b/src/stencil/D3Q27.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/D3Q6.h b/src/stencil/D3Q6.h
index 8b9f81d3ad1cea8de9ca2991a1de327514d90699..249b4dc5427d9232a9673928be5c1f8c6ea1efc6 100644
--- a/src/stencil/D3Q6.h
+++ b/src/stencil/D3Q6.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/D3Q7.h b/src/stencil/D3Q7.h
index 8e14c9b001d47f384c466c5bd7e0c9a60775581e..33ecb5b14eb63661ec7bded54da25779ed9a60f6 100644
--- a/src/stencil/D3Q7.h
+++ b/src/stencil/D3Q7.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/EdgeStencil.h b/src/stencil/EdgeStencil.h
index 1c4982c995ffa520a81cdf22ff0442dc30ff1bd6..e045795309850e97671edbe79a5b0ae3ebc899b9 100644
--- a/src/stencil/EdgeStencil.h
+++ b/src/stencil/EdgeStencil.h
@@ -1,10 +1,10 @@
+#pragma once
+
 //====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================
 #ifndef DOXY_SKIP_INTERNAL
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
diff --git a/src/stencil/Stencil.in.h b/src/stencil/Stencil.in.h
index 893ad59ab36fd860e0dc25f1d0a9feb2e97368ac..4443d823585c4b2413dff0d233a040f1b36aa1a7 100644
--- a/src/stencil/Stencil.in.h
+++ b/src/stencil/Stencil.in.h
@@ -1,5 +1,3 @@
-#pragma once
-
 #include "Directions.h"
 #include "Iterator.h"
 
@@ -83,7 +81,7 @@ namespace stencil {
          /*! \name Iteration*/
          //@{
 
-         typedef stencil::Iterator<$name> iterator;
+         using iterator = stencil::Iterator<$name>;
 
          static iterator begin()           { return iterator(0); }
          static iterator beginNoCenter()   { return iterator(noCenterFirstIdx); }
@@ -182,7 +180,7 @@ namespace stencil {
 
    } // namespace internal
 
-   typedef internal::$name<> $name;
+   using $name = internal::$name<>;
 
 } // namespace stencil
 } // namespace walberla
diff --git a/src/stencil/generate.py b/src/stencil/generate.py
index 47291f67de8d838651e1ae7df724c7189aa1ec67..263d7077d2fb56022a20811ae277a025fcbe2abd 100755
--- a/src/stencil/generate.py
+++ b/src/stencil/generate.py
@@ -80,7 +80,9 @@ def coordinateToDirection(coord):
     return directionStr
 
 
-header = """//====================================================================================================================
+header = """#pragma once
+
+//====================================================================================================================
 //  Caution: This file has been generated automatically. All manual changes are lost when file is regenerated!
 //           Changes should be done in Stencil.in.h,and then all stencils classes can be generated again.
 //====================================================================================================================