FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

contiguous.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 InClass
00025     Foam::contiguous
00026 
00027 Description
00028     Template function to specify if the data of a type are contiguous.
00029 
00030     The default function specifies that data are not contiguous.
00031     This is specialised for the types (eg, primitives) with contiguous data.
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef contiguous_H
00036 #define contiguous_H
00037 
00038 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00039 
00040 namespace Foam
00041 {
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 // Forward declaration of friend functions and operators
00046 template<class T, unsigned Size> class FixedList;
00047 template<class T> class Pair;
00048 
00049 
00050 //- Assume the data associated with type T are not contiguous
00051 template<class T>
00052 inline bool contiguous()                                   {return false;}
00053 
00054 
00055 // Data associated with primitive types (and simple fixed size containers
00056 //  - only size 2 defined here) are contiguous
00057 
00058 template<>
00059 inline bool contiguous<bool>()                              {return true;}
00060 template<>
00061 inline bool contiguous<FixedList<bool, 2> >()               {return true;}
00062 template<>
00063 inline bool contiguous<Pair<bool> >()                       {return true;}
00064 
00065 template<>
00066 inline bool contiguous<char>()                              {return true;}
00067 template<>
00068 inline bool contiguous<FixedList<char, 2> >()               {return true;}
00069 template<>
00070 inline bool contiguous<Pair<char> >()                       {return true;}
00071 
00072 template<>
00073 inline bool contiguous<unsigned char>()                     {return true;}
00074 template<>
00075 inline bool contiguous<FixedList<unsigned char, 2> >()      {return true;}
00076 template<>
00077 inline bool contiguous<Pair<unsigned char> >()              {return true;}
00078 
00079 template<>
00080 inline bool contiguous<short>()                             {return true;}
00081 template<>
00082 inline bool contiguous<FixedList<short, 2> >()              {return true;}
00083 template<>
00084 inline bool contiguous<Pair<short> >()                      {return true;}
00085 
00086 template<>
00087 inline bool contiguous<unsigned short>()                    {return true;}
00088 template<>
00089 inline bool contiguous<FixedList<unsigned short, 2> >()     {return true;}
00090 template<>
00091 inline bool contiguous<Pair<unsigned short> >()             {return true;}
00092 
00093 template<>
00094 inline bool contiguous<int>()                               {return true;}
00095 template<>
00096 inline bool contiguous<FixedList<int, 2> >()                {return true;}
00097 template<>
00098 inline bool contiguous<Pair<int> >()                        {return true;}
00099 
00100 template<>
00101 inline bool contiguous<unsigned int>()                      {return true;}
00102 template<>
00103 inline bool contiguous<FixedList<unsigned int, 2> >()       {return true;}
00104 template<>
00105 inline bool contiguous<Pair<unsigned int> >()               {return true;}
00106 
00107 template<>
00108 inline bool contiguous<long>()                              {return true;}
00109 template<>
00110 inline bool contiguous<FixedList<long, 2> >()               {return true;}
00111 template<>
00112 inline bool contiguous<Pair<long> >()                       {return true;}
00113 
00114 template<>
00115 inline bool contiguous<unsigned long>()                     {return true;}
00116 template<>
00117 inline bool contiguous<FixedList<unsigned long, 2> >()      {return true;}
00118 template<>
00119 inline bool contiguous<Pair<unsigned long> >()              {return true;}
00120 
00121 template<>
00122 inline bool contiguous<long long>()                         {return true;}
00123 template<>
00124 inline bool contiguous<FixedList<long long, 2> >()          {return true;}
00125 template<>
00126 inline bool contiguous<Pair<long long> >()                  {return true;}
00127 
00128 template<>
00129 inline bool contiguous<unsigned long long>()                {return true;}
00130 template<>
00131 inline bool contiguous<FixedList<unsigned long long, 2> >() {return true;}
00132 template<>
00133 inline bool contiguous<Pair<unsigned long long> >()         {return true;}
00134 
00135 template<>
00136 inline bool contiguous<float>()                             {return true;}
00137 template<>
00138 inline bool contiguous<FixedList<float, 2> >()              {return true;}
00139 template<>
00140 inline bool contiguous<Pair<float> >()                      {return true;}
00141 
00142 template<>
00143 inline bool contiguous<double>()                            {return true;}
00144 template<>
00145 inline bool contiguous<FixedList<double, 2> >()             {return true;}
00146 template<>
00147 inline bool contiguous<Pair<double> >()                     {return true;}
00148 
00149 template<>
00150 inline bool contiguous<long double>()                       {return true;}
00151 template<>
00152 inline bool contiguous<FixedList<long double, 2> >()        {return true;}
00153 template<>
00154 inline bool contiguous<Pair<long double> >()                {return true;}
00155 
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 } // End namespace Foam
00160 
00161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00162 
00163 #endif
00164 
00165 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines