vector2D.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "vector2D.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 #if defined(WM_DP)
34 
35 template<>
36 const char* const Foam::Vector2D<float>::vsType::typeName = "floatVector2D";
37 
38 template<>
39 const char* const Foam::Vector2D<double>::vsType::typeName = "vector2D";
40 
41 #else
42 
43 // WM_SP, WM_SPDP
44 template<>
45 const char* const Foam::Vector2D<float>::vsType::typeName = "vector2D";
46 
47 template<>
48 const char* const Foam::Vector2D<double>::vsType::typeName = "doubleVector2D";
49 
50 #endif
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 #undef defineTraits
55 #define defineTraits(Type, Prefix) \
56  \
57  template<> \
58  const char* const Foam::Vector2D<Type>::vsType::componentNames[] = \
59  { \
60  "x", "y" \
61  }; \
62  \
63  template<> \
64  const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::zero \
65  ( \
66  Vector2D<Type>::uniform(0) \
67  ); \
68  \
69  template<> \
70  const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::one \
71  ( \
72  Vector2D<Type>::uniform(1) \
73  ); \
74  \
75  template<> \
76  const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::max \
77  ( \
78  Vector2D<Type>::uniform(Prefix##VGREAT) \
79  ); \
80  \
81  template<> \
82  const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::min \
83  ( \
84  Vector2D<Type>::uniform(-Prefix##VGREAT) \
85  ); \
86  \
87  template<> \
88  const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::rootMax \
89  ( \
90  Vector2D<Type>::uniform(Prefix##ROOTVGREAT) \
91  ); \
92  \
93  template<> \
94  const Foam::Vector2D<Type> Foam::Vector2D<Type>::vsType::rootMin \
95  ( \
96  Vector2D<Type>::uniform(-Prefix##ROOTVGREAT) \
97  );
98 
99 
100 defineTraits(float, floatScalar);
101 defineTraits(double, doubleScalar);
102 
103 #undef defineTraits
104 
105 // ************************************************************************* //
float floatScalar
A typedef for float.
Definition: scalarFwd.H:43
double doubleScalar
A typedef for double.
Definition: scalarFwd.H:48
Templated 2D Vector derived from VectorSpace adding construction from 2 components, element access using x() and y() member functions and the inner-product (dot-product).
Definition: Vector2D.H:51
#define defineTraits(Type, Prefix)
Definition: vector2D.C:48