contiguous.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 InClass
25  Foam::contiguous
26 
27 Description
28  Template function to specify if the data of a type are contiguous.
29 
30  The default function specifies that data are not contiguous.
31  This is specialised for the types (eg, primitives) with contiguous data.
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef contiguous_H
36 #define contiguous_H
37 
38 #include "int.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 // Forward declaration of friend functions and operators
48 template<class T, unsigned Size> class FixedList;
49 template<class T> class Pair;
50 
51 
52 //- Assume the data associated with type T are not contiguous
53 template<class T>
54 inline bool contiguous() {return false;}
55 
56 
57 // Data associated with primitive types (and simple fixed size containers
58 // - only size 2 defined here) are contiguous
59 
60 template<>
61 inline bool contiguous<bool>() {return true;}
62 template<>
63 inline bool contiguous<FixedList<bool, 2>>() {return true;}
64 template<>
65 inline bool contiguous<Pair<bool>>() {return true;}
66 
67 template<>
68 inline bool contiguous<char>() {return true;}
69 template<>
70 inline bool contiguous<FixedList<char, 2>>() {return true;}
71 template<>
72 inline bool contiguous<Pair<char>>() {return true;}
73 
74 template<>
75 inline bool contiguous<int8_t>() {return true;}
76 template<>
77 inline bool contiguous<FixedList<int8_t, 2>>() {return true;}
78 template<>
79 inline bool contiguous<Pair<int8_t>>() {return true;}
80 
81 template<>
82 inline bool contiguous<uint8_t>() {return true;}
83 template<>
84 inline bool contiguous<FixedList<uint8_t, 2>>() {return true;}
85 template<>
86 inline bool contiguous<Pair<uint8_t>>() {return true;}
87 
88 template<>
89 inline bool contiguous<int16_t>() {return true;}
90 template<>
91 inline bool contiguous<FixedList<int16_t, 2>>() {return true;}
92 template<>
93 inline bool contiguous<Pair<int16_t>>() {return true;}
94 
95 template<>
96 inline bool contiguous<uint16_t>() {return true;}
97 template<>
98 inline bool contiguous<FixedList<uint16_t, 2>>() {return true;}
99 template<>
100 inline bool contiguous<Pair<uint16_t>>() {return true;}
101 
102 template<>
103 inline bool contiguous<int32_t>() {return true;}
104 template<>
105 inline bool contiguous<FixedList<int32_t, 2>>() {return true;}
106 template<>
107 inline bool contiguous<Pair<int32_t>>() {return true;}
108 
109 template<>
110 inline bool contiguous<uint32_t>() {return true;}
111 template<>
112 inline bool contiguous<FixedList<uint32_t, 2>>() {return true;}
113 template<>
114 inline bool contiguous<Pair<uint32_t>>() {return true;}
115 
116 template<>
117 inline bool contiguous<int64_t>() {return true;}
118 template<>
119 inline bool contiguous<FixedList<int64_t, 2>>() {return true;}
120 template<>
121 inline bool contiguous<Pair<int64_t>>() {return true;}
122 
123 template<>
124 inline bool contiguous<uint64_t>() {return true;}
125 template<>
126 inline bool contiguous<FixedList<uint64_t, 2>>() {return true;}
127 template<>
128 inline bool contiguous<Pair<uint64_t>>() {return true;}
129 
130 template<>
131 inline bool contiguous<float>() {return true;}
132 template<>
133 inline bool contiguous<FixedList<float, 2>>() {return true;}
134 template<>
135 inline bool contiguous<Pair<float>>() {return true;}
136 
137 template<>
138 inline bool contiguous<double>() {return true;}
139 template<>
140 inline bool contiguous<FixedList<double, 2>>() {return true;}
141 template<>
142 inline bool contiguous<Pair<double>>() {return true;}
143 
144 template<>
145 inline bool contiguous<long double>() {return true;}
146 template<>
147 inline bool contiguous<FixedList<long double, 2>>() {return true;}
148 template<>
149 inline bool contiguous<Pair<long double>>() {return true;}
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
bool contiguous< uint64_t >()
Definition: contiguous.H:124
bool contiguous< char >()
Definition: contiguous.H:68
System integer.
bool contiguous< int64_t >()
Definition: contiguous.H:117
bool contiguous< uint32_t >()
Definition: contiguous.H:110
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: contiguous.H:49
bool contiguous< uint16_t >()
Definition: contiguous.H:96
bool contiguous< int32_t >()
Definition: contiguous.H:103
bool contiguous< bool >()
Definition: contiguous.H:61
bool contiguous()
contiguous
Definition: contiguous.H:54
bool contiguous< float >()
Definition: contiguous.H:131
bool contiguous< uint8_t >()
Definition: contiguous.H:82
bool contiguous< double >()
Definition: contiguous.H:138
bool contiguous< int8_t >()
Definition: contiguous.H:75
bool contiguous< long double >()
Definition: contiguous.H:145
bool contiguous< int16_t >()
Definition: contiguous.H:89
Namespace for OpenFOAM.