1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, 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 // ************************************************************************* //