From c3aecfab819d7068cc3303fe987f3e08a4c33201 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Mon, 23 Jan 2023 15:04:03 +0100
Subject: [PATCH] WIP: fv fields

---
 .../test/pointField/Test-PointField.C         | 36 +++++++++++-
 .../test/primitives/Test-primitives.C         | 56 +------------------
 src/finiteVolume/fields/volFields/volFields.C |  2 +
 3 files changed, 38 insertions(+), 56 deletions(-)

diff --git a/applications/test/pointField/Test-PointField.C b/applications/test/pointField/Test-PointField.C
index 2665d4b5158..e98511cb006 100644
--- a/applications/test/pointField/Test-PointField.C
+++ b/applications/test/pointField/Test-PointField.C
@@ -39,7 +39,6 @@ Description
 
 int main(int argc, char *argv[])
 {
-
     #include "setRootCase.H"
 
     #include "createTime.H"
@@ -47,11 +46,42 @@ int main(int argc, char *argv[])
 
     const pointMesh& pMesh = pointMesh::New(mesh);
 
+    #if 1
+    pointLabelField state
+    (
+        IOobject
+        (
+            "test-state",
+            runTime.timeName(),
+            mesh,
+            IOobject::MUST_READ,
+            IOobject::AUTO_WRITE
+        ),
+        pMesh
+    );
+    #else
+    pointLabelField state
+    (
+        IOobject
+        (
+            "test-state",
+            runTime.timeName(),
+            mesh,
+            IOobject::NO_READ,
+            IOobject::AUTO_WRITE
+        ),
+        pMesh,
+        dimensioned<label>(dimLength, 1),
+        pointPatchLabelField::calculatedType()
+    );
+    state.write();
+    #endif
+
     pointVectorField U
     (
         IOobject
         (
-            "U",
+            "test-U",
             runTime.timeName(),
             mesh,
             IOobject::NO_READ,
@@ -62,6 +92,8 @@ int main(int argc, char *argv[])
         pointPatchVectorField::calculatedType()
     );
 
+    U.write();
+
     pointVectorField V(U + 2*U);
 
     Info<< "End\n" << endl;
diff --git a/applications/test/primitives/Test-primitives.C b/applications/test/primitives/Test-primitives.C
index df381e3399f..4c0c0fa1c7a 100644
--- a/applications/test/primitives/Test-primitives.C
+++ b/applications/test/primitives/Test-primitives.C
@@ -224,73 +224,21 @@ int main(int argc, char *argv[])
             << lerp(vector::uniform(0), vector::uniform(100), 0.5) << nl;
     }
 
-    {
-        const lerpOp1<vector> half(0.5);
-
-        const vector a(vector::uniform(20));
-        const vector b(vector::uniform(100));
-
-        Info<< "lerp half: "
-            << a << " : " << b << " => " << half(a, b) << nl;
-    }
-
     {
         const labelVector a(labelVector::uniform(10000));
         const labelVector b(labelVector::uniform(1));
 
-        Info<< "lerp (labelVector) = "
+        Info<<"lerp (labelVector) = "
             << lerp(a, b, 0.1) << nl;
     }
 
-    {
-        const scalar a(0);
-        const scalar b(100);
-
-        Info<< "lerp of " << a << " : " << b << nl;
-
-        for (const double t : { 0.0, 0.5, 1.0, -0.5, 1.5 })
-        {
-            Info<< "    " << t << " = " << lerp(a, b, t) << nl;
-        }
-    }
-
-
-    // No yet
-    #if 0
-    {
-        const label a(10000);
-        const label b(1);
-
-        Info<<"lerp (label) = "
-            << label(lerp(a, b, 0.1)) << nl;
-    }
-
-    {
-        const bool a(true);
-        const bool b(false);
-
-        Info<<"lerp (bool) = "
-            << (lerp(a, b, 0.5)) << nl;
-    }
-    #endif
-
     {
         const sphericalTensor a(10), b(20);
 
         Info<<"lerp exact: "
             << (a == lerp(a, b, 0.0f)) << " "
             << (b == lerp(a, b, 1.0f)) << nl;
-//        Info<< "lerp: "
-//            << lerp(vector::uniform(0), vector::uniform(100), 0.5) << nl;
-    }
-
-    {
-        const tensor a(tensor::uniform(1e24));
-        const tensor b(tensor::uniform(0));
-
-        Info<<"lerp exact: "
-            << (a == lerp(a, b, 0.0f)) << " "
-            << (b == lerp(a, b, 1.0f)) << nl;
+//
 //        Info<< "lerp: "
 //            << lerp(vector::uniform(0), vector::uniform(100), 0.5) << nl;
     }
diff --git a/src/finiteVolume/fields/volFields/volFields.C b/src/finiteVolume/fields/volFields/volFields.C
index 5d943e68de5..861af733779 100644
--- a/src/finiteVolume/fields/volFields/volFields.C
+++ b/src/finiteVolume/fields/volFields/volFields.C
@@ -87,6 +87,7 @@ void GeometricField<scalar, fvPatchField, volMesh>::replace
 
 const Foam::wordList Foam::fieldTypes::internal
 ({
+    "volLabelField::Internal",
     "volScalarField::Internal",
     "volVectorField::Internal",
     "volSphericalTensorField::Internal",
@@ -97,6 +98,7 @@ const Foam::wordList Foam::fieldTypes::internal
 
 const Foam::wordList Foam::fieldTypes::volume
 ({
+    "volLabelField",
     "volScalarField",
     "volVectorField",
     "volSphericalTensorField",
-- 
GitLab