1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM 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 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 List\<T\> is a 1D vector of objects of type T, where the size of the
27 vector is known and used for subscript bounds checking, etc.
29 \*---------------------------------------------------------------------------*/
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // Element access looping using [] for vector machines
40 #define List_FOR_ALL(f, i) \
41 register const label _n##i = (f).size();\
42 for (register label i=0; i<_n##i; i++) \
45 #define List_END_FOR_ALL }
47 #define List_ELEM(f, fp, i) (fp[i])
49 #define List_ACCESS(type, f, fp) \
50 type* const __restrict__ fp = (f).begin()
52 #define List_CONST_ACCESS(type, f, fp) \
53 const type* const __restrict__ fp = (f).begin()
57 // Pointer looping for scalar machines
59 #define List_FOR_ALL(f, i) \
60 register label i = (f).size(); \
64 #define List_END_FOR_ALL }
66 #define List_ELEM(f, fp, i) (*fp++)
68 #define List_ACCESS(type, f, fp) \
69 register type* __restrict__ fp = (f).begin()
71 #define List_CONST_ACCESS(type, f, fp) \
72 register const type* __restrict__ fp = (f).begin()
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 // ************************************************************************* //