From 1888bc62ab998ad71e624f2c4781c3d38b601701 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Fri, 9 Dec 2022 17:17:26 +0100 Subject: [PATCH] ENH: x/y, y/x comparison operators for Vector2D STYLE: init label variants with std::sqrt + double (compile-time invariant) --- src/OpenFOAM/Make/files | 4 +- .../labelSphericalTensor.C | 4 +- .../labelSymmTensor/labelSymmTensor.C | 4 +- .../primitives/Tensor/ints/labelTensor.C | 4 +- src/OpenFOAM/primitives/Vector/Vector.H | 2 +- src/OpenFOAM/primitives/Vector/VectorI.H | 2 +- .../primitives/Vector/ints/labelVector.C | 91 ++++++++------- .../primitives/Vector/ints/labelVector.H | 4 +- src/OpenFOAM/primitives/Vector2D/Vector2D.H | 17 +++ src/OpenFOAM/primitives/Vector2D/Vector2DI.H | 30 ++++- .../primitives/Vector2D/floats/vector2D.C | 105 ++++++++++++++++++ .../Vector2D/{vector2D => floats}/vector2D.H | 13 ++- .../primitives/Vector2D/ints/labelVector2D.C | 88 +++++++++++++++ .../{labelVector2D => ints}/labelVector2D.H | 4 +- .../Vector2D/labelVector2D/labelVector2D.C | 75 ------------- .../primitives/Vector2D/vector2D/vector2D.C | 78 ------------- 16 files changed, 312 insertions(+), 213 deletions(-) create mode 100644 src/OpenFOAM/primitives/Vector2D/floats/vector2D.C rename src/OpenFOAM/primitives/Vector2D/{vector2D => floats}/vector2D.H (84%) create mode 100644 src/OpenFOAM/primitives/Vector2D/ints/labelVector2D.C rename src/OpenFOAM/primitives/Vector2D/{labelVector2D => ints}/labelVector2D.H (97%) delete mode 100644 src/OpenFOAM/primitives/Vector2D/labelVector2D/labelVector2D.C delete mode 100644 src/OpenFOAM/primitives/Vector2D/vector2D/vector2D.C diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index d0e703cfd18..881ca47c7a6 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -90,8 +90,8 @@ primitives/Vector/lists/vectorListIOList.C primitives/Tensor2D/tensor2D/tensor2D.C primitives/SphericalTensor2D/sphericalTensor2D/sphericalTensor2D.C primitives/SymmTensor2D/symmTensor2D/symmTensor2D.C -primitives/Vector2D/labelVector2D/labelVector2D.C -primitives/Vector2D/vector2D/vector2D.C +primitives/Vector2D/floats/vector2D.C +primitives/Vector2D/ints/labelVector2D.C primitives/complex/complex.C primitives/globalIndexAndTransform/globalIndexAndTransform.C diff --git a/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.C b/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.C index 66b58892fc9..59dc1035d82 100644 --- a/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.C +++ b/src/OpenFOAM/primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.C @@ -69,13 +69,13 @@ const Foam::labelSphericalTensor Foam::labelSphericalTensor::vsType::min template<> const Foam::labelSphericalTensor Foam::labelSphericalTensor::vsType::rootMax ( - labelSphericalTensor::uniform(sqrt(scalar(labelMax))) + labelSphericalTensor::uniform(::sqrt(double(labelMax))) ); template<> const Foam::labelSphericalTensor Foam::labelSphericalTensor::vsType::rootMin ( - labelSphericalTensor::uniform(-sqrt(scalar(labelMax))) + labelSphericalTensor::uniform(-::sqrt(double(labelMax))) ); template<> diff --git a/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C b/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C index df06cb3a5e1..0cdd46292f6 100644 --- a/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C +++ b/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C @@ -67,13 +67,13 @@ const Foam::labelSymmTensor Foam::labelSymmTensor::vsType::min template<> const Foam::labelSymmTensor Foam::labelSymmTensor::vsType::rootMax ( - labelSymmTensor::uniform(sqrt(scalar(labelMax))) + labelSymmTensor::uniform(::sqrt(double(labelMax))) ); template<> const Foam::labelSymmTensor Foam::labelSymmTensor::vsType::rootMin ( - labelSymmTensor::uniform(-sqrt(scalar(labelMax))) + labelSymmTensor::uniform(-::sqrt(double(labelMax))) ); template<> diff --git a/src/OpenFOAM/primitives/Tensor/ints/labelTensor.C b/src/OpenFOAM/primitives/Tensor/ints/labelTensor.C index 3adc0c66cff..1c3541d935e 100644 --- a/src/OpenFOAM/primitives/Tensor/ints/labelTensor.C +++ b/src/OpenFOAM/primitives/Tensor/ints/labelTensor.C @@ -68,13 +68,13 @@ const Foam::labelTensor Foam::labelTensor::vsType::min template<> const Foam::labelTensor Foam::labelTensor::vsType::rootMax ( - labelTensor::uniform(sqrt(scalar(labelMax))) + labelTensor::uniform(::sqrt(double(labelMax))) ); template<> const Foam::labelTensor Foam::labelTensor::vsType::rootMin ( - labelTensor::uniform(-sqrt(scalar(labelMax))) + labelTensor::uniform(-::sqrt(double(labelMax))) ); template<> diff --git a/src/OpenFOAM/primitives/Vector/Vector.H b/src/OpenFOAM/primitives/Vector/Vector.H index a254b9e855d..053865a2a85 100644 --- a/src/OpenFOAM/primitives/Vector/Vector.H +++ b/src/OpenFOAM/primitives/Vector/Vector.H @@ -171,7 +171,7 @@ public: inline Vector<Cmpt> cross(const Vector<Cmpt>& v2) const; - // Comparision Operations + // Comparison Operations //- Lexicographically compare \em a and \em b with order (x:y:z) static inline bool less_xyz diff --git a/src/OpenFOAM/primitives/Vector/VectorI.H b/src/OpenFOAM/primitives/Vector/VectorI.H index 4c33803f651..7ce8d60118d 100644 --- a/src/OpenFOAM/primitives/Vector/VectorI.H +++ b/src/OpenFOAM/primitives/Vector/VectorI.H @@ -170,7 +170,7 @@ Foam::Vector<Cmpt>::cross(const Vector<Cmpt>& v2) const } -// * * * * * * * * * * * * * Comparision Operations * * * * * * * * * * * * // +// * * * * * * * * * * * * * Comparison Operations * * * * * * * * * * * * * // template<class Cmpt> inline bool diff --git a/src/OpenFOAM/primitives/Vector/ints/labelVector.C b/src/OpenFOAM/primitives/Vector/ints/labelVector.C index c98aba46e75..6513f5eb3b0 100644 --- a/src/OpenFOAM/primitives/Vector/ints/labelVector.C +++ b/src/OpenFOAM/primitives/Vector/ints/labelVector.C @@ -32,47 +32,54 @@ License template<> const char* const Foam::labelVector::vsType::typeName = "labelVector"; -template<> -const char* const Foam::labelVector::vsType::componentNames[] = -{ - "x", "y", "z" -}; - -template<> -const Foam::labelVector Foam::labelVector::vsType::zero -( - labelVector::uniform(0) -); - -template<> -const Foam::labelVector Foam::labelVector::vsType::one -( - labelVector::uniform(1) -); - -template<> -const Foam::labelVector Foam::labelVector::vsType::max -( - labelVector::uniform(labelMax) -); - -template<> -const Foam::labelVector Foam::labelVector::vsType::min -( - labelVector::uniform(-labelMax) -); - -template<> -const Foam::labelVector Foam::labelVector::vsType::rootMax -( - labelVector::uniform(sqrt(scalar(labelMax))) -); - -template<> -const Foam::labelVector Foam::labelVector::vsType::rootMin -( - labelVector::uniform(-sqrt(scalar(labelMax))) -); - +#undef defineTraits +#define defineTraits(Type, Prefix) \ + \ + template<> \ + const char* const Foam::Vector<Type>::vsType::componentNames[] = \ + { \ + "x", "y", "z" \ + }; \ + \ + template<> \ + const Foam::Vector<Type> Foam::Vector<Type>::vsType::zero \ + ( \ + Vector<Type>::uniform(0) \ + ); \ + \ + template<> \ + const Foam::Vector<Type> Foam::Vector<Type>::vsType::one \ + ( \ + Vector<Type>::uniform(1) \ + ); \ + \ + template<> \ + const Foam::Vector<Type> Foam::Vector<Type>::vsType::max \ + ( \ + Vector<Type>::uniform(Prefix##Max) \ + ); \ + \ + template<> \ + const Foam::Vector<Type> Foam::Vector<Type>::vsType::min \ + ( \ + Vector<Type>::uniform(-Prefix##Max) \ + ); \ + \ + template<> \ + const Foam::Vector<Type> Foam::Vector<Type>::vsType::rootMax \ + ( \ + Vector<Type>::uniform(::sqrt(double(Prefix##Max))) \ + ); \ + \ + template<> \ + const Foam::Vector<Type> Foam::Vector<Type>::vsType::rootMin \ + ( \ + Vector<Type>::uniform(-::sqrt(double(Prefix##Max))) \ + ); + + +defineTraits(Foam::label, label); + +#undef defineTraits // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Vector/ints/labelVector.H b/src/OpenFOAM/primitives/Vector/ints/labelVector.H index d04f62e7bd1..b6ac6ec0ef4 100644 --- a/src/OpenFOAM/primitives/Vector/ints/labelVector.H +++ b/src/OpenFOAM/primitives/Vector/ints/labelVector.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef labelVector_H -#define labelVector_H +#ifndef Foam_labelVector_H +#define Foam_labelVector_H #include "label.H" #include "Vector.H" diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2D.H b/src/OpenFOAM/primitives/Vector2D/Vector2D.H index 2e807e22b6b..01ad98d2f61 100644 --- a/src/OpenFOAM/primitives/Vector2D/Vector2D.H +++ b/src/OpenFOAM/primitives/Vector2D/Vector2D.H @@ -153,6 +153,23 @@ public: const Vector2D<Cmpt>& b, const scalar tol = 1e-10 ) const; + + + // Comparison Operations + + //- Lexicographically compare \em a and \em b with order (x:y) + static inline bool less_xy + ( + const Vector2D<Cmpt>& a, + const Vector2D<Cmpt>& b + ); + + //- Lexicographically compare \em a and \em b with order (y:x) + static inline bool less_yx + ( + const Vector2D<Cmpt>& a, + const Vector2D<Cmpt>& b + ); }; diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2DI.H b/src/OpenFOAM/primitives/Vector2D/Vector2DI.H index 1877bce2717..bdd677986fc 100644 --- a/src/OpenFOAM/primitives/Vector2D/Vector2DI.H +++ b/src/OpenFOAM/primitives/Vector2D/Vector2DI.H @@ -126,13 +126,39 @@ Foam::Vector2D<Cmpt>::removeCollinear(const Vector2D<Cmpt>& unitVec) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Comparison Operations * * * * * * * * * * * * * // -namespace Foam +template<class Cmpt> +inline bool +Foam::Vector2D<Cmpt>::less_xy(const Vector2D<Cmpt>& a, const Vector2D<Cmpt>& b) { + return + ( + (a.x() < b.x()) + || (!(b.x() < a.x()) && (a.y() < b.y())) + ); +} + + +template<class Cmpt> +inline bool +Foam::Vector2D<Cmpt>::less_yx(const Vector2D<Cmpt>& a, const Vector2D<Cmpt>& b) +{ + return + ( + (a.y() < b.y()) + || (!(b.y() < a.y()) && (a.x() < b.x())) + ); +} + // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + template<class Cmpt> inline Cmpt operator&(const Vector2D<Cmpt>& v1, const Vector2D<Cmpt>& v2) { diff --git a/src/OpenFOAM/primitives/Vector2D/floats/vector2D.C b/src/OpenFOAM/primitives/Vector2D/floats/vector2D.C new file mode 100644 index 00000000000..dd0e46429e2 --- /dev/null +++ b/src/OpenFOAM/primitives/Vector2D/floats/vector2D.C @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2022 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "vector2D.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +#if defined(WM_DP) + +template<> +const char* const Foam::Vector2D<float>::vsType::typeName = "floatVector2D"; + +template<> +const char* const Foam::Vector2D<double>::vsType::typeName = "vector2D"; + +#else + +// WM_SP, WM_SPDP +template<> +const char* const Foam::Vector2D<float>::vsType::typeName = "vector2D"; + +template<> +const char* const Foam::Vector2D<double>::vsType::typeName = "doubleVector2D"; + +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef defineTraits +#define defineTraits(Type, Prefix) \ + \ + template<> \ + const char* const Foam::Vector2D<Type>::vsType::componentNames[] = \ + { \ + "x", "y" \ + }; \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::zero \ + ( \ + Vector2D<Type>::uniform(0) \ + ); \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::one \ + ( \ + Vector2D<Type>::uniform(1) \ + ); \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::max \ + ( \ + Vector2D<Type>::uniform(Prefix##VGREAT) \ + ); \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::min \ + ( \ + Vector2D<Type>::uniform(-Prefix##VGREAT) \ + ); \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::rootMax \ + ( \ + Vector2D<Type>::uniform(Prefix##ROOTVGREAT) \ + ); \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::rootMin \ + ( \ + Vector2D<Type>::uniform(-Prefix##ROOTVGREAT) \ + ); + + +defineTraits(float, floatScalar); +defineTraits(double, doubleScalar); + +#undef defineTraits + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Vector2D/vector2D/vector2D.H b/src/OpenFOAM/primitives/Vector2D/floats/vector2D.H similarity index 84% rename from src/OpenFOAM/primitives/Vector2D/vector2D/vector2D.H rename to src/OpenFOAM/primitives/Vector2D/floats/vector2D.H index b620ca5b592..870408c6069 100644 --- a/src/OpenFOAM/primitives/Vector2D/vector2D/vector2D.H +++ b/src/OpenFOAM/primitives/Vector2D/floats/vector2D.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef vector2D_H -#define vector2D_H +#ifndef Foam_vector2D_H +#define Foam_vector2D_H #include "scalar.H" #include "Vector2D.H" @@ -48,6 +48,15 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +//! \class Foam::floatVector2D +//! \brief A Vector2D of values with float precision +typedef Vector2D<float> floatVector2D; + +//! \class Foam::doubleVector2D +//! \brief A Vector2D of values with double precision +typedef Vector2D<double> doubleVector2D; + +// With float or double precision (depending on compilation) typedef Vector2D<scalar> vector2D; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/Vector2D/ints/labelVector2D.C b/src/OpenFOAM/primitives/Vector2D/ints/labelVector2D.C new file mode 100644 index 00000000000..86836ba48b8 --- /dev/null +++ b/src/OpenFOAM/primitives/Vector2D/ints/labelVector2D.C @@ -0,0 +1,88 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "labelVector2D.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template<> +const char* const Foam::labelVector2D::vsType::typeName = "labelVector2D"; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#undef defineTraits +#define defineTraits(Type, Prefix) \ + \ + template<> \ + const char* const Foam::Vector2D<Type>::vsType::componentNames[] = \ + { \ + "x", "y" \ + }; \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::zero \ + ( \ + Vector2D<Type>::uniform(0) \ + ); \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::one \ + ( \ + Vector2D<Type>::uniform(1) \ + ); \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::max \ + ( \ + Vector2D<Type>::uniform(Prefix##Max) \ + ); \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::min \ + ( \ + Vector2D<Type>::uniform(-Prefix##Max) \ + ); \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::rootMax \ + ( \ + Vector2D<Type>::uniform(::sqrt(double(Prefix##Max))) \ + ); \ + \ + template<> \ + const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::rootMin \ + ( \ + Vector2D<Type>::uniform(-::sqrt(double(Prefix##Max))) \ + ); + + +defineTraits(Foam::label, label); + +#undef defineTraits + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Vector2D/labelVector2D/labelVector2D.H b/src/OpenFOAM/primitives/Vector2D/ints/labelVector2D.H similarity index 97% rename from src/OpenFOAM/primitives/Vector2D/labelVector2D/labelVector2D.H rename to src/OpenFOAM/primitives/Vector2D/ints/labelVector2D.H index fae937db0f3..56345fb6591 100644 --- a/src/OpenFOAM/primitives/Vector2D/labelVector2D/labelVector2D.H +++ b/src/OpenFOAM/primitives/Vector2D/ints/labelVector2D.H @@ -34,8 +34,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef labelVector2D_H -#define labelVector2D_H +#ifndef Foam_labelVector2D_H +#define Foam_labelVector2D_H #include "label.H" #include "Vector2D.H" diff --git a/src/OpenFOAM/primitives/Vector2D/labelVector2D/labelVector2D.C b/src/OpenFOAM/primitives/Vector2D/labelVector2D/labelVector2D.C deleted file mode 100644 index 4b44f83275c..00000000000 --- a/src/OpenFOAM/primitives/Vector2D/labelVector2D/labelVector2D.C +++ /dev/null @@ -1,75 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2019 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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "labelVector2D.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template<> -const char* const Foam::labelVector2D::vsType::typeName = "labelVector2D"; - -template<> -const char* const Foam::labelVector2D::vsType::componentNames[] = { "x", "y" }; - -template<> -const Foam::labelVector2D Foam::labelVector2D::vsType::zero -( - labelVector2D::uniform(0) -); - -template<> -const Foam::labelVector2D Foam::labelVector2D::vsType::one -( - labelVector2D::uniform(1) -); - -template<> -const Foam::labelVector2D Foam::labelVector2D::vsType::max -( - labelVector2D::uniform(labelMax) -); - -template<> -const Foam::labelVector2D Foam::labelVector2D::vsType::min -( - labelVector2D::uniform(-labelMax) -); - -template<> -const Foam::labelVector2D Foam::labelVector2D::vsType::rootMax -( - labelVector2D::uniform(sqrt(scalar(labelMax))) -); - -template<> -const Foam::labelVector2D Foam::labelVector2D::vsType::rootMin -( - labelVector2D::uniform(-sqrt(scalar(labelMax))) -); - - -// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Vector2D/vector2D/vector2D.C b/src/OpenFOAM/primitives/Vector2D/vector2D/vector2D.C deleted file mode 100644 index a8e3eda22d9..00000000000 --- a/src/OpenFOAM/primitives/Vector2D/vector2D/vector2D.C +++ /dev/null @@ -1,78 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011-2016 OpenFOAM Foundation -------------------------------------------------------------------------------- -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 <http://www.gnu.org/licenses/>. - -Description - Vector2D of scalars. - -\*---------------------------------------------------------------------------*/ - -#include "vector2D.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template<> -const char* const Foam::vector2D::vsType::typeName = "vector2D"; - -template<> -const char* const Foam::vector2D::vsType::componentNames[] = {"x", "y"}; - -template<> -const Foam::vector2D Foam::vector2D::vsType::vsType::zero -( - vector2D::uniform(0) -); - -template<> -const Foam::vector2D Foam::vector2D::vsType::one -( - vector2D::uniform(1) -); - -template<> -const Foam::vector2D Foam::vector2D::vsType::max -( - vector2D::uniform(VGREAT) -); - -template<> -const Foam::vector2D Foam::vector2D::vsType::min -( - vector2D::uniform(-VGREAT) -); - -template<> -const Foam::vector2D Foam::vector2D::vsType::rootMax -( - vector2D::uniform(ROOTVGREAT) -); - -template<> -const Foam::vector2D Foam::vector2D::vsType::rootMin -( - vector2D::uniform(-ROOTVGREAT) -); - - -// ************************************************************************* // -- GitLab