From 9cab2539fb6c32ce9c6230a5aad09b1faf21ec23 Mon Sep 17 00:00:00 2001 From: Gregor Olenik Date: Fri, 11 Oct 2024 10:49:17 +0200 Subject: [PATCH] fix warnings, clean NeoFOAM:: in test --- include/NeoFOAM/dsl/equation.hpp | 2 +- include/NeoFOAM/dsl/operator.hpp | 2 +- include/NeoFOAM/fields/field.hpp | 2 +- test/dsl/coeff.cpp | 8 ++------ test/dsl/operator.cpp | 6 +++--- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/NeoFOAM/dsl/equation.hpp b/include/NeoFOAM/dsl/equation.hpp index 86ee0109d..f734e7cb4 100644 --- a/include/NeoFOAM/dsl/equation.hpp +++ b/include/NeoFOAM/dsl/equation.hpp @@ -112,7 +112,7 @@ class Equation const Executor& exec() const { return exec_; } - const std::size_t nCells() const { return nCells_; } + std::size_t nCells() const { return nCells_; } scalar getDt() const { return dt_; } diff --git a/include/NeoFOAM/dsl/operator.hpp b/include/NeoFOAM/dsl/operator.hpp index 8392a8591..3848e59c6 100644 --- a/include/NeoFOAM/dsl/operator.hpp +++ b/include/NeoFOAM/dsl/operator.hpp @@ -55,7 +55,7 @@ class OperatorMixin const Coeff& getCoefficient() const { return coeffs_; } /* @brief Given an input this function reads required coeffs */ - void build(const Input& input) {} + void build([[maybe_unused]] const Input& input) {} protected: diff --git a/include/NeoFOAM/fields/field.hpp b/include/NeoFOAM/fields/field.hpp index c5e02ab51..39e6baa85 100644 --- a/include/NeoFOAM/fields/field.hpp +++ b/include/NeoFOAM/fields/field.hpp @@ -79,7 +79,7 @@ class Field { void* ptr = nullptr; std::visit( - [this, &ptr, size](const auto& concreteExec) + [&ptr, size](const auto& concreteExec) { ptr = concreteExec.alloc(size * sizeof(ValueType)); }, exec_ ); diff --git a/test/dsl/coeff.cpp b/test/dsl/coeff.cpp index 583fcbd18..5a8ad335a 100644 --- a/test/dsl/coeff.cpp +++ b/test/dsl/coeff.cpp @@ -62,8 +62,8 @@ TEST_CASE("Coeff") { size_t size = 3; - NeoFOAM::Field fieldA(exec, size, 0.0); - NeoFOAM::Field fieldB(exec, size, 1.0); + Field fieldA(exec, size, 0.0); + Field fieldB(exec, size, 1.0); SECTION("span") { @@ -82,8 +82,6 @@ TEST_CASE("Coeff") SECTION("scalar") { - NeoFOAM::Field fieldA(exec, size, 0.0); - Coeff coeff = Coeff(2.0); { NeoFOAM::parallelFor( @@ -99,8 +97,6 @@ TEST_CASE("Coeff") SECTION("span and scalar") { - NeoFOAM::Field fieldA(exec, size, 0.0); - NeoFOAM::Field fieldB(exec, size, 1.0); Coeff coeff {-5.0, fieldB}; { NeoFOAM::parallelFor( diff --git a/test/dsl/operator.cpp b/test/dsl/operator.cpp index b48c4a1ee..e9b731240 100644 --- a/test/dsl/operator.cpp +++ b/test/dsl/operator.cpp @@ -42,9 +42,9 @@ TEST_CASE("Operator") auto d = fB * Dummy(exec, vf); auto e = Coeff(-3, fB) * Dummy(exec, vf); - auto coeffc = c.getCoefficient(); - auto coeffd = d.getCoefficient(); - auto coeffE = e.getCoefficient(); + [[maybe_unused]] auto coeffC = c.getCoefficient(); + [[maybe_unused]] auto coeffD = d.getCoefficient(); + [[maybe_unused]] auto coeffE = e.getCoefficient(); Field source(exec, 1, 2.0); c.explicitOperation(source);