diff --git a/applications/test/fieldMapping/Test-fieldMapping.C b/applications/test/fieldMapping/Test-fieldMapping.C index f65a2d3ae5..2c4b032e15 100644 --- a/applications/test/fieldMapping/Test-fieldMapping.C +++ b/applications/test/fieldMapping/Test-fieldMapping.C @@ -48,12 +48,6 @@ using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -bool notEqual(const scalar s1, const scalar s2, const scalar tol) -{ - return mag(s1-s2) > tol; -} - - // Main program: int main(int argc, char *argv[]) @@ -154,6 +148,8 @@ int main(int argc, char *argv[]) // Face removal engine. No checking for not merging boundary faces. removeFaces faceRemover(mesh, GREAT); + // Comparison for inequality + const auto isNotEqual = notEqualOp(1e-10); while (runTime.loop()) { @@ -254,7 +250,6 @@ int main(int argc, char *argv[]) } } - // Check constant profile { const scalar max = gMax(one); @@ -263,7 +258,7 @@ int main(int argc, char *argv[]) Info<< "Uniform one field min = " << min << " max = " << max << endl; - if (notEqual(max, 1.0, 1e-10) || notEqual(min, 1.0, 1e-10)) + if (isNotEqual(max, 1) || isNotEqual(min, 1)) { FatalErrorInFunction << "Uniform volVectorField not preserved." @@ -287,7 +282,7 @@ int main(int argc, char *argv[]) Info<< "Linear profile field min = " << min << " max = " << max << endl; - if (notEqual(max, 0.0, 1e-10) || notEqual(min, 0.0, 1e-10)) + if (isNotEqual(max, 0) || isNotEqual(min, 0)) { FatalErrorInFunction << "Linear profile not preserved." @@ -310,7 +305,7 @@ int main(int argc, char *argv[]) Info<< "Uniform surface field min = " << min << " max = " << max << endl; - if (notEqual(max, 1.0, 1e-10) || notEqual(min, 1.0, 1e-10)) + if (isNotEqual(max, 1) || isNotEqual(min, 1)) { FatalErrorInFunction << "Uniform surfaceScalarField not preserved." diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedLabel/dimensionedLabel.H b/src/OpenFOAM/dimensionedTypes/dimensionedLabel/dimensionedLabel.H new file mode 100644 index 0000000000..37e6fc4397 --- /dev/null +++ b/src/OpenFOAM/dimensionedTypes/dimensionedLabel/dimensionedLabel.H @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2023 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Typedef + Foam::dimensionedLabel + +Description + Dimensioned label obtained from generic dimensioned type. + +SourceFiles + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_dimensionedLabel_H +#define Foam_dimensionedLabel_H + +#include "dimensionedType.H" +#include "label.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +typedef dimensioned