1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 List\<T\> is a 1D vector of objects of type T, where the size of the
26 vector is known and used for subscript bounds checking, etc.
28 \*---------------------------------------------------------------------------*/
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 // Element access looping using [] for vector machines
39 #define List_FOR_ALL(f, i) \
40 register const label _n##i = (f).size();\
41 for (register label i=0; i<_n##i; i++) \
44 #define List_END_FOR_ALL }
46 #define List_ELEM(f, fp, i) (fp[i])
48 #define List_ACCESS(type, f, fp) \
49 type* const __restrict__ fp = (f).begin()
51 #define List_CONST_ACCESS(type, f, fp) \
52 const type* const __restrict__ fp = (f).begin()
56 // Pointer looping for scalar machines
58 #define List_FOR_ALL(f, i) \
59 register label i = (f).size(); \
63 #define List_END_FOR_ALL }
65 #define List_ELEM(f, fp, i) (*fp++)
67 #define List_ACCESS(type, f, fp) \
68 register type* __restrict__ fp = (f).begin()
70 #define List_CONST_ACCESS(type, f, fp) \
71 register const type* __restrict__ fp = (f).begin()
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
80 // ************************************************************************* //