From de7ccd8e5b2482aec031af358d8d24e70b116f59 Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Wed, 1 Feb 2012 12:30:16 +0000
Subject: [PATCH] tensor2D: Added specialisation for the outerProduct of
 Vector2D to enable outer product operation

---
 applications/test/tensor2D/Make/files        |  3 +++
 applications/test/tensor2D/Make/options      |  0
 applications/test/tensor2D/Test-tensor2D.C   | 14 ++++++++++++++
 src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H | 10 +++++++++-
 4 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 applications/test/tensor2D/Make/files
 create mode 100644 applications/test/tensor2D/Make/options
 create mode 100644 applications/test/tensor2D/Test-tensor2D.C

diff --git a/applications/test/tensor2D/Make/files b/applications/test/tensor2D/Make/files
new file mode 100644
index 00000000000..29b058c0ff2
--- /dev/null
+++ b/applications/test/tensor2D/Make/files
@@ -0,0 +1,3 @@
+Test-tensor2D.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-tensor2D
diff --git a/applications/test/tensor2D/Make/options b/applications/test/tensor2D/Make/options
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/applications/test/tensor2D/Test-tensor2D.C b/applications/test/tensor2D/Test-tensor2D.C
new file mode 100644
index 00000000000..367c9244706
--- /dev/null
+++ b/applications/test/tensor2D/Test-tensor2D.C
@@ -0,0 +1,14 @@
+#include "tensor2D.H"
+#include "IOstreams.H"
+
+using namespace Foam;
+
+int main()
+{
+    vector2D v1(1, 2), v2(3, 4);
+    tensor2D t = v1*v2;
+
+    Info<< "v1(1, 2)*v2(3, 4) = " << t << endl;
+
+    return 0;
+}
diff --git a/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H b/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H
index 1760cc1f5fc..7fe348c9d34 100644
--- a/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H
+++ b/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -513,6 +513,14 @@ public:
 };
 
 
+template<class Cmpt>
+class outerProduct<Vector2D<Cmpt>, Vector2D<Cmpt> >
+{
+public:
+
+    typedef Tensor2D<Cmpt> type;
+};
+
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-- 
GitLab