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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::is_contiguous
29
30Description
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
39Note
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
46Class
47 Foam::is_contiguous_label
48
49Description
50 A template class to specify if a data type is composed solely of
51 Foam::label elements.
52
53Class
54 Foam::is_contiguous_scalar
55
56Description
57 A template class to specify if a data type is composed solely of
58 Foam::scalar elements.
59
60\*---------------------------------------------------------------------------*/
61
62#ifndef Foam_contiguous_H
63#define Foam_contiguous_H
64
65#include "scalarFwd.H"
66#include "labelFwd.H"
67#include <type_traits>
68
69// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70
71namespace Foam
72{
73
74// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76// Base definition for (integral | floating-point) as contiguous
77template<class T>
78struct is_contiguous
79:
80 std::is_arithmetic<T>
81{};
82
84// Base definition for 'label'
85template<class T>
87:
88 std::is_same<T, label>
89{};
90
92// Base definition for 'scalar'
93template<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// ************************************************************************* //
Typedefs for label/uLabel without requiring label.H.
Namespace for OpenFOAM.
Typedefs for float/double/scalar without requiring scalar.H.
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:86
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition: contiguous.H:94
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:78