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-2020 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 //- Assume the data associated with type T are not contiguous
52 template<class T>
53 inline bool contiguous() {return false;}
54 
55 
56 // Data associated with primitive types (and simple fixed size containers
57 // - only size 2 defined here) are contiguous
58 
59 template<>
60 inline bool contiguous<bool>() {return true;}
61 template<>
62 inline bool contiguous<FixedList<bool, 2>>() {return true;}
63 template<>
64 inline bool contiguous<Pair<bool>>() {return true;}
65 
66 template<>
67 inline bool contiguous<char>() {return true;}
68 template<>
69 inline bool contiguous<FixedList<char, 2>>() {return true;}
70 template<>
71 inline bool contiguous<Pair<char>>() {return true;}
72 
73 template<>
74 inline bool contiguous<int8_t>() {return true;}
75 template<>
76 inline bool contiguous<FixedList<int8_t, 2>>() {return true;}
77 template<>
78 inline bool contiguous<Pair<int8_t>>() {return true;}
79 
80 template<>
81 inline bool contiguous<uint8_t>() {return true;}
82 template<>
83 inline bool contiguous<FixedList<uint8_t, 2>>() {return true;}
84 template<>
85 inline bool contiguous<Pair<uint8_t>>() {return true;}
86 
87 template<>
88 inline bool contiguous<int16_t>() {return true;}
89 template<>
90 inline bool contiguous<FixedList<int16_t, 2>>() {return true;}
91 template<>
92 inline bool contiguous<Pair<int16_t>>() {return true;}
93 
94 template<>
95 inline bool contiguous<uint16_t>() {return true;}
96 template<>
97 inline bool contiguous<FixedList<uint16_t, 2>>() {return true;}
98 template<>
99 inline bool contiguous<Pair<uint16_t>>() {return true;}
100 
101 template<>
102 inline bool contiguous<int32_t>() {return true;}
103 template<>
104 inline bool contiguous<FixedList<int32_t, 2>>() {return true;}
105 template<>
106 inline bool contiguous<Pair<int32_t>>() {return true;}
107 
108 template<>
109 inline bool contiguous<uint32_t>() {return true;}
110 template<>
111 inline bool contiguous<FixedList<uint32_t, 2>>() {return true;}
112 template<>
113 inline bool contiguous<Pair<uint32_t>>() {return true;}
114 
115 template<>
116 inline bool contiguous<int64_t>() {return true;}
117 template<>
118 inline bool contiguous<FixedList<int64_t, 2>>() {return true;}
119 template<>
120 inline bool contiguous<Pair<int64_t>>() {return true;}
121 
122 template<>
123 inline bool contiguous<uint64_t>() {return true;}
124 template<>
125 inline bool contiguous<FixedList<uint64_t, 2>>() {return true;}
126 template<>
127 inline bool contiguous<Pair<uint64_t>>() {return true;}
128 
129 template<>
130 inline bool contiguous<float>() {return true;}
131 template<>
132 inline bool contiguous<FixedList<float, 2>>() {return true;}
133 template<>
134 inline bool contiguous<Pair<float>>() {return true;}
135 
136 template<>
137 inline bool contiguous<double>() {return true;}
138 template<>
139 inline bool contiguous<FixedList<double, 2>>() {return true;}
140 template<>
141 inline bool contiguous<Pair<double>>() {return true;}
142 
143 template<>
144 inline bool contiguous<long double>() {return true;}
145 template<>
146 inline bool contiguous<FixedList<long double, 2>>() {return true;}
147 template<>
148 inline bool contiguous<Pair<long double>>() {return true;}
149 
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 } // End namespace Foam
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
System integer.
Namespace for OpenFOAM.
bool contiguous< int8_t >()
Definition: contiguous.H:74
bool contiguous< uint64_t >()
Definition: contiguous.H:123
bool contiguous< int64_t >()
Definition: contiguous.H:116
bool contiguous< long double >()
Definition: contiguous.H:144
bool contiguous< uint8_t >()
Definition: contiguous.H:81
bool contiguous< double >()
Definition: contiguous.H:137
bool contiguous()
contiguous
Definition: contiguous.H:53
bool contiguous< uint16_t >()
Definition: contiguous.H:95
bool contiguous< int16_t >()
Definition: contiguous.H:88
bool contiguous< uint32_t >()
Definition: contiguous.H:109
bool contiguous< float >()
Definition: contiguous.H:130
bool contiguous< int32_t >()
Definition: contiguous.H:102
bool contiguous< bool >()
Definition: contiguous.H:60
bool contiguous< char >()
Definition: contiguous.H:67