From d4ac96cdf311385b873a3e8fc4ed93b40d71ca24 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Mon, 29 Mar 2021 13:27:39 +0200
Subject: [PATCH] ENH: support use of 'vector' in `#calc` directive (fixes
 #2039)

---
 applications/test/dictionary/blockMeshDict1.calc   | 2 +-
 applications/test/dictionary/blockMeshDict1.eval   | 2 +-
 etc/codeTemplates/dynamicCode/codeStreamTemplate.C | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/applications/test/dictionary/blockMeshDict1.calc b/applications/test/dictionary/blockMeshDict1.calc
index 91dbbd10a62..1045cedb484 100644
--- a/applications/test/dictionary/blockMeshDict1.calc
+++ b/applications/test/dictionary/blockMeshDict1.calc
@@ -32,7 +32,7 @@ vertices
 (
     (0.0    0.0 0)      //0
     (10     0.0 0)
-    (10     0.0 0)      //2
+    #calc #{ vector(10, 0, 0) #} //2
     (0.0    0.0 0)
 
     (0.0    $minY $z)   //4
diff --git a/applications/test/dictionary/blockMeshDict1.eval b/applications/test/dictionary/blockMeshDict1.eval
index 6dd94e3cd96..048389c2c32 100644
--- a/applications/test/dictionary/blockMeshDict1.eval
+++ b/applications/test/dictionary/blockMeshDict1.eval
@@ -32,7 +32,7 @@ vertices
 (
     (0.0    0.0 0)      //0
     (10     0.0 0)
-    (10     0.0 0)      //2
+    #eval{ vector(10, 0, 0) } //2
     (0.0    0.0 0)
 
     (0.0    $minY $z)   //4
diff --git a/etc/codeTemplates/dynamicCode/codeStreamTemplate.C b/etc/codeTemplates/dynamicCode/codeStreamTemplate.C
index bedf07b8a6d..f88eda7a15e 100644
--- a/etc/codeTemplates/dynamicCode/codeStreamTemplate.C
+++ b/etc/codeTemplates/dynamicCode/codeStreamTemplate.C
@@ -31,6 +31,8 @@ Description
 #include "dictionary.H"
 #include "Ostream.H"
 #include "Pstream.H"
+#include "pointField.H"
+#include "tensor.H"
 #include "unitConversion.H"
 
 //{{{ begin codeInclude
@@ -51,7 +53,7 @@ ${localCode}
 
 // * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
 
-extern "C" void ${typeName}(Ostream& os, const dictionary& dict)
+extern "C" void ${typeName}(Foam::Ostream& os, const Foam::dictionary& dict)
 {
 //{{{ begin code
     ${code}
-- 
GitLab