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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2018-2019 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 Class
28  Foam::is_contiguous
29 
30 Description
31  A template class to specify that a data type can be considered as being
32  contiguous in memory.
33 
34  Normally only integral and floating-point types can be considered
35  contiguous, but some other types (eg, FixedList, Pair, Vector etc)
36  consisting purely of these fundamental types can be considered
37  as having a contiguous memory layout as well.
38 
39 Note
40  In OpenFOAM 1906 and earlier, the contiguous trait was handled
41  by templated \c contiguous global functions.
42 
43  While possible to mark this as deleted, this does not detect or
44  prevent specializations. Thus omit the usual housekeeping.
45 
46 Class
47  Foam::is_contiguous_label
48 
49 Description
50  A template class to specify if a data type is composed solely of
51  Foam::label elements.
52 
53 Class
54  Foam::is_contiguous_scalar
55 
56 Description
57  A template class to specify if a data type is composed solely of
58  Foam::scalar elements.
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef contiguous_H
63 #define contiguous_H
64 
65 #include "scalar.H"
66 #include "label.H"
67 #include <type_traits>
68 
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 
71 namespace Foam
72 {
73 
74 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75 
76 // Base definition for (integral | floating-point) as contiguous
77 template<class T>
78 struct is_contiguous
79 :
80  std::is_arithmetic<T>
81 {};
82 
83 
84 // Base definition for 'label'
85 template<class T>
87 :
88  std::is_same<T, label>
89 {};
90 
91 
92 // Base definition for 'scalar'
93 template<class T>
95 :
96  std::is_same<T, scalar>
97 {};
98 
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 } // End namespace Foam
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 #endif
107 
108 // ************************************************************************* //
Foam::is_contiguous_label
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:83
scalar.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::is_contiguous_scalar
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition: contiguous.H:91
label.H
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75