FreeFOAM The Cross-Platform CFD Toolkit
contiguous.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 // Forward declaration of friend functions and operators
46 template<class T, unsigned Size> class FixedList;
47 template<class T> class Pair;
48 
49 
50 //- Assume the data associated with type T are not contiguous
51 template<class T>
52 inline bool contiguous() {return false;}
53 
54 
55 // Data associated with primitive types (and simple fixed size containers
56 // - only size 2 defined here) are contiguous
57 
58 template<>
59 inline bool contiguous<bool>() {return true;}
60 template<>
61 inline bool contiguous<FixedList<bool, 2> >() {return true;}
62 template<>
63 inline bool contiguous<Pair<bool> >() {return true;}
64 
65 template<>
66 inline bool contiguous<char>() {return true;}
67 template<>
68 inline bool contiguous<FixedList<char, 2> >() {return true;}
69 template<>
70 inline bool contiguous<Pair<char> >() {return true;}
71 
72 template<>
73 inline bool contiguous<unsigned char>() {return true;}
74 template<>
75 inline bool contiguous<FixedList<unsigned char, 2> >() {return true;}
76 template<>
77 inline bool contiguous<Pair<unsigned char> >() {return true;}
78 
79 template<>
80 inline bool contiguous<short>() {return true;}
81 template<>
82 inline bool contiguous<FixedList<short, 2> >() {return true;}
83 template<>
84 inline bool contiguous<Pair<short> >() {return true;}
85 
86 template<>
87 inline bool contiguous<unsigned short>() {return true;}
88 template<>
89 inline bool contiguous<FixedList<unsigned short, 2> >() {return true;}
90 template<>
91 inline bool contiguous<Pair<unsigned short> >() {return true;}
92 
93 template<>
94 inline bool contiguous<int>() {return true;}
95 template<>
96 inline bool contiguous<FixedList<int, 2> >() {return true;}
97 template<>
98 inline bool contiguous<Pair<int> >() {return true;}
99 
100 template<>
101 inline bool contiguous<unsigned int>() {return true;}
102 template<>
103 inline bool contiguous<FixedList<unsigned int, 2> >() {return true;}
104 template<>
105 inline bool contiguous<Pair<unsigned int> >() {return true;}
106 
107 template<>
108 inline bool contiguous<long>() {return true;}
109 template<>
110 inline bool contiguous<FixedList<long, 2> >() {return true;}
111 template<>
112 inline bool contiguous<Pair<long> >() {return true;}
113 
114 template<>
115 inline bool contiguous<unsigned long>() {return true;}
116 template<>
117 inline bool contiguous<FixedList<unsigned long, 2> >() {return true;}
118 template<>
119 inline bool contiguous<Pair<unsigned long> >() {return true;}
120 
121 template<>
122 inline bool contiguous<long long>() {return true;}
123 template<>
124 inline bool contiguous<FixedList<long long, 2> >() {return true;}
125 template<>
126 inline bool contiguous<Pair<long long> >() {return true;}
127 
128 template<>
129 inline bool contiguous<unsigned long long>() {return true;}
130 template<>
131 inline bool contiguous<FixedList<unsigned long long, 2> >() {return true;}
132 template<>
133 inline bool contiguous<Pair<unsigned long long> >() {return true;}
134 
135 template<>
136 inline bool contiguous<float>() {return true;}
137 template<>
138 inline bool contiguous<FixedList<float, 2> >() {return true;}
139 template<>
140 inline bool contiguous<Pair<float> >() {return true;}
141 
142 template<>
143 inline bool contiguous<double>() {return true;}
144 template<>
145 inline bool contiguous<FixedList<double, 2> >() {return true;}
146 template<>
147 inline bool contiguous<Pair<double> >() {return true;}
148 
149 template<>
150 inline bool contiguous<long double>() {return true;}
151 template<>
152 inline bool contiguous<FixedList<long double, 2> >() {return true;}
153 template<>
154 inline bool contiguous<Pair<long double> >() {return true;}
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #endif
164 
165 // ************************ vim: set sw=4 sts=4 et: ************************ //