Loading...
Searching...
No Matches
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-2025 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::is_contiguous
28
29Description
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
38Note
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
45Class
46 Foam::is_contiguous_label
47
48Description
49 A template class to specify if a data type is composed solely of
50 Foam::label elements.
51
52Class
53 Foam::is_contiguous_scalar
54
55Description
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
70namespace Foam
71{
72
73// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74
75// Base definition for (integral | floating-point) as contiguous
76template<class T>
77struct is_contiguous : std::is_arithmetic<T> {};
78
79//- The is_contiguous value of Type (after stripping of qualifiers)
80template<class T>
81inline constexpr bool is_contiguous_v
83
84
85// Base definition for 'label'
86template<class T>
87struct is_contiguous_label : std::is_same<label, std::remove_cv_t<T>> {};
88
89
90// Base definition for 'scalar'
91template<class T>
92struct is_contiguous_scalar : std::is_same<scalar, std::remove_cv_t<T>> {};
93
94
95// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96
97} // End namespace Foam
98
99// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100
101#endif
102
103// ************************************************************************* //
Typedefs for label/uLabel without requiring label.H.
Namespace for OpenFOAM.
constexpr bool is_contiguous_v
The is_contiguous value of Type (after stripping of qualifiers).
Definition contiguous.H:77
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:82
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition contiguous.H:87
A template class to specify that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70