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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2018-2019 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::is_contiguous
28 
29 Description
30  A template class to specify that a data type can be considered as being
31  contiguous in memory.
32 
33  Normally only integral and floating-point types can be considered
34  contiguous, but some other types (eg, FixedList, Pair, Vector etc)
35  consisting purely of these fundamental types can be considered
36  as having a contiguous memory layout as well.
37 
38 Note
39  In OpenFOAM 1906 and earlier, the contiguous trait was handled
40  by templated \c contiguous global functions.
41 
42  While possible to mark this as deleted, this does not detect or
43  prevent specializations. Thus omit the usual housekeeping.
44 
45 Class
46  Foam::is_contiguous_label
47 
48 Description
49  A template class to specify if a data type is composed solely of
50  Foam::label elements.
51 
52 Class
53  Foam::is_contiguous_scalar
54 
55 Description
56  A template class to specify if a data type is composed solely of
57  Foam::scalar elements.
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef Foam_contiguous_H
62 #define Foam_contiguous_H
63 
64 #include "labelFwd.H"
65 #include "scalarFwd.H"
66 #include <type_traits>
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 // Base definition for (integral | floating-point) as contiguous
76 template<class T>
77 struct is_contiguous : std::is_arithmetic<T> {};
78 
79 
80 // Base definition for 'label'
81 template<class T>
82 struct is_contiguous_label : std::is_same<T, label> {};
83 
84 
85 // Base definition for 'scalar'
86 template<class T>
87 struct is_contiguous_scalar : std::is_same<T, scalar> {};
88 
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 } // End namespace Foam
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 #endif
97 
98 // ************************************************************************* //
Typedefs for label/uLabel without requiring label.H.
Typedefs for float/double/scalar without requiring scalar.H.
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition: contiguous.H:80
A template class to specify that a data type can be considered as being contiguous in memory...
Definition: contiguous.H:70
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:75
Namespace for OpenFOAM.