OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 InClass
00026     Foam::contiguous
00027 
00028 Description
00029     Template function to specify if the data of a type are contiguous.
00030 
00031     The default function specifies that data are not contiguous.
00032     This is specialised for the types (eg, primitives) with contiguous data.
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef contiguous_H
00037 #define contiguous_H
00038 
00039 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00040 
00041 namespace Foam
00042 {
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 // Forward declaration of friend functions and operators
00047 template<class T, unsigned Size> class FixedList;
00048 template<class T> class Pair;
00049 
00050 
00051 //- Assume the data associated with type T are not contiguous
00052 template<class T>
00053 inline bool contiguous()                                   {return false;}
00054 
00055 
00056 // Data associated with primitive types (and simple fixed size containers
00057 //  - only size 2 defined here) are contiguous
00058 
00059 template<>
00060 inline bool contiguous<bool>()                              {return true;}
00061 template<>
00062 inline bool contiguous<FixedList<bool, 2> >()               {return true;}
00063 template<>
00064 inline bool contiguous<Pair<bool> >()                       {return true;}
00065 
00066 template<>
00067 inline bool contiguous<char>()                              {return true;}
00068 template<>
00069 inline bool contiguous<FixedList<char, 2> >()               {return true;}
00070 template<>
00071 inline bool contiguous<Pair<char> >()                       {return true;}
00072 
00073 template<>
00074 inline bool contiguous<unsigned char>()                     {return true;}
00075 template<>
00076 inline bool contiguous<FixedList<unsigned char, 2> >()      {return true;}
00077 template<>
00078 inline bool contiguous<Pair<unsigned char> >()              {return true;}
00079 
00080 template<>
00081 inline bool contiguous<short>()                             {return true;}
00082 template<>
00083 inline bool contiguous<FixedList<short, 2> >()              {return true;}
00084 template<>
00085 inline bool contiguous<Pair<short> >()                      {return true;}
00086 
00087 template<>
00088 inline bool contiguous<unsigned short>()                    {return true;}
00089 template<>
00090 inline bool contiguous<FixedList<unsigned short, 2> >()     {return true;}
00091 template<>
00092 inline bool contiguous<Pair<unsigned short> >()             {return true;}
00093 
00094 template<>
00095 inline bool contiguous<int>()                               {return true;}
00096 template<>
00097 inline bool contiguous<FixedList<int, 2> >()                {return true;}
00098 template<>
00099 inline bool contiguous<Pair<int> >()                        {return true;}
00100 
00101 template<>
00102 inline bool contiguous<unsigned int>()                      {return true;}
00103 template<>
00104 inline bool contiguous<FixedList<unsigned int, 2> >()       {return true;}
00105 template<>
00106 inline bool contiguous<Pair<unsigned int> >()               {return true;}
00107 
00108 template<>
00109 inline bool contiguous<long>()                              {return true;}
00110 template<>
00111 inline bool contiguous<FixedList<long, 2> >()               {return true;}
00112 template<>
00113 inline bool contiguous<Pair<long> >()                       {return true;}
00114 
00115 template<>
00116 inline bool contiguous<unsigned long>()                     {return true;}
00117 template<>
00118 inline bool contiguous<FixedList<unsigned long, 2> >()      {return true;}
00119 template<>
00120 inline bool contiguous<Pair<unsigned long> >()              {return true;}
00121 
00122 template<>
00123 inline bool contiguous<long long>()                         {return true;}
00124 template<>
00125 inline bool contiguous<FixedList<long long, 2> >()          {return true;}
00126 template<>
00127 inline bool contiguous<Pair<long long> >()                  {return true;}
00128 
00129 template<>
00130 inline bool contiguous<unsigned long long>()                {return true;}
00131 template<>
00132 inline bool contiguous<FixedList<unsigned long long, 2> >() {return true;}
00133 template<>
00134 inline bool contiguous<Pair<unsigned long long> >()         {return true;}
00135 
00136 template<>
00137 inline bool contiguous<float>()                             {return true;}
00138 template<>
00139 inline bool contiguous<FixedList<float, 2> >()              {return true;}
00140 template<>
00141 inline bool contiguous<Pair<float> >()                      {return true;}
00142 
00143 template<>
00144 inline bool contiguous<double>()                            {return true;}
00145 template<>
00146 inline bool contiguous<FixedList<double, 2> >()             {return true;}
00147 template<>
00148 inline bool contiguous<Pair<double> >()                     {return true;}
00149 
00150 template<>
00151 inline bool contiguous<long double>()                       {return true;}
00152 template<>
00153 inline bool contiguous<FixedList<long double, 2> >()        {return true;}
00154 template<>
00155 inline bool contiguous<Pair<long double> >()                {return true;}
00156 
00157 
00158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00159 
00160 } // End namespace Foam
00161 
00162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00163 
00164 #endif
00165 
00166 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd