floatVectors.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 OpenFOAM Foundation
9  Copyright (C) 2018-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 "vector.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 #if defined(WM_DP)
34 
35 template<>
36 const char* const Foam::Vector<float>::vsType::typeName = "floatVector";
37 
38 template<>
39 const char* const Foam::Vector<double>::vsType::typeName = "vector";
40 
41 #else
42 
43 // WM_SP, WM_SPDP
44 template<>
45 const char* const Foam::Vector<float>::vsType::typeName = "vector";
46 
47 template<>
48 const char* const Foam::Vector<double>::vsType::typeName = "doubleVector";
49 
50 // or (TDB):
51 //
52 // #if defined(WM_SPDP)
53 // template<>
54 // const char* const Foam::Vector<double>::vsType::typeName = "solveVector";
55 // #else
56 // template<>
57 // const char* const Foam::Vector<double>::vsType::typeName = "doubleVector";
58 // #endif
59 
60 #endif
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 #undef defineTraits
65 #define defineTraits(Type, Prefix) \
66  \
67  template<> \
68  const char* const Foam::Vector<Type>::vsType::componentNames[] = \
69  { \
70  "x", "y", "z" \
71  }; \
72  \
73  template<> \
74  const Foam::Vector<Type> Foam::Vector<Type>::vsType::zero \
75  ( \
76  Vector<Type>::uniform(0) \
77  ); \
78  \
79  template<> \
80  const Foam::Vector<Type> Foam::Vector<Type>::vsType::one \
81  ( \
82  Vector<Type>::uniform(1) \
83  ); \
84  \
85  template<> \
86  const Foam::Vector<Type> Foam::Vector<Type>::vsType::max \
87  ( \
88  Vector<Type>::uniform(Prefix##VGREAT) \
89  ); \
90  \
91  template<> \
92  const Foam::Vector<Type> Foam::Vector<Type>::vsType::min \
93  ( \
94  Vector<Type>::uniform(-Prefix##VGREAT) \
95  ); \
96  \
97  template<> \
98  const Foam::Vector<Type> Foam::Vector<Type>::vsType::rootMax \
99  ( \
100  Vector<Type>::uniform(Prefix##ROOTVGREAT) \
101  ); \
102  \
103  template<> \
104  const Foam::Vector<Type> Foam::Vector<Type>::vsType::rootMin \
105  ( \
106  Vector<Type>::uniform(-Prefix##ROOTVGREAT) \
107  );
108 
109 
110 defineTraits(float, floatScalar);
111 defineTraits(double, doubleScalar);
112 
113 #undef defineTraits
114 
115 // ************************************************************************* //
float floatScalar
A typedef for float.
Definition: scalarFwd.H:43
double doubleScalar
A typedef for double.
Definition: scalarFwd.H:48
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross-product operators.
Definition: Vector.H:58
#define defineTraits(Type, Prefix)
Definition: floatVectors.C:58