From b0892b2067b137ddb7338d30350d2e3bdd7f78ac Mon Sep 17 00:00:00 2001 From: Gregor Olenik Date: Sat, 8 Feb 2025 22:14:45 +0100 Subject: [PATCH] template interpolation test --- .../interpolation/surfaceInterpolation.hpp | 6 ++++++ .../cellCentred/interpolation/linear.cpp | 13 ++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/NeoFOAM/finiteVolume/cellCentred/interpolation/surfaceInterpolation.hpp b/include/NeoFOAM/finiteVolume/cellCentred/interpolation/surfaceInterpolation.hpp index 2efaa33d1..682e053a0 100644 --- a/include/NeoFOAM/finiteVolume/cellCentred/interpolation/surfaceInterpolation.hpp +++ b/include/NeoFOAM/finiteVolume/cellCentred/interpolation/surfaceInterpolation.hpp @@ -108,6 +108,12 @@ class SurfaceInterpolation interpolationKernel_->interpolate(volField, surfaceField); } + void interpolate(const VolumeField& volField, SurfaceField& surfaceField) const + { + interpolationKernel_->interpolate(volField, surfaceField); + } + + ScalarSurfaceField interpolate(const VolumeField& volField) const { std::string nameInterpolated = "interpolated_" + volField.name; diff --git a/test/finiteVolume/cellCentred/interpolation/linear.cpp b/test/finiteVolume/cellCentred/interpolation/linear.cpp index 8f8c1bcbf..44fd3e82e 100644 --- a/test/finiteVolume/cellCentred/interpolation/linear.cpp +++ b/test/finiteVolume/cellCentred/interpolation/linear.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "NeoFOAM/NeoFOAM.hpp" @@ -13,7 +14,7 @@ using NeoFOAM::finiteVolume::cellCentred::SurfaceInterpolation; using NeoFOAM::finiteVolume::cellCentred::VolumeField; using NeoFOAM::finiteVolume::cellCentred::SurfaceField; -TEST_CASE("linear") +TEMPLATE_TEST_CASE("linear", "", NeoFOAM::scalar, NeoFOAM::Vector) { NeoFOAM::Executor exec = GENERATE( NeoFOAM::Executor(NeoFOAM::SerialExecutor {}), @@ -26,8 +27,14 @@ TEST_CASE("linear") NeoFOAM::Input input = NeoFOAM::TokenList({std::string("linear")}); auto linear = SurfaceInterpolation(exec, mesh, input); - auto in = VolumeField(exec, "in", mesh, {}); - auto out = SurfaceField(exec, "out", mesh, {}); + auto in = VolumeField(exec, "in", mesh, {}); + auto out = SurfaceField(exec, "out", mesh, {}); + + // FIXME add fill + // fill(in.internalField(), 1); linear.interpolate(in, out); + + // FIXME add fill + // REQUIRE(out.internalField()[0] == one::value); }