|
|
|
SubListI.HGo 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 \*---------------------------------------------------------------------------*/ 00026 00027 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // 00028 00029 template<class T> 00030 inline Foam::SubList<T>::SubList 00031 ( 00032 const UList<T>& list, 00033 const label subSize 00034 ) 00035 : 00036 UList<T>(list.v_, subSize) 00037 { 00038 # ifdef FULLDEBUG 00039 list.checkSize(subSize); 00040 # endif 00041 } 00042 00043 00044 template<class T> 00045 inline Foam::SubList<T>::SubList 00046 ( 00047 const UList<T>& list, 00048 const label subSize, 00049 const label startIndex 00050 ) 00051 : 00052 UList<T>(&(list.v_[startIndex]), subSize) 00053 { 00054 # ifdef FULLDEBUG 00055 00056 // Artificially allow the start of a zero-sized subList to be 00057 // one past the end of the original list. 00058 if (subSize) 00059 { 00060 list.checkStart(startIndex); 00061 list.checkSize(startIndex + subSize); 00062 } 00063 else 00064 { 00065 // Start index needs to fall between 0 and size. One position 00066 // behind the last element is allowed 00067 list.checkSize(startIndex); 00068 } 00069 # endif 00070 } 00071 00072 00073 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00074 00075 template<class T> 00076 inline const Foam::SubList<T>& Foam::SubList<T>::null() 00077 { 00078 return *reinterpret_cast< SubList<T>* >(0); 00079 } 00080 00081 00082 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // 00083 00084 template<class T> 00085 inline Foam::SubList<T>::operator const Foam::List<T>&() const 00086 { 00087 return *reinterpret_cast< const List<T>* >(this); 00088 } 00089 00090 00091 template<class T> 00092 inline void Foam::SubList<T>::operator=(const T& t) 00093 { 00094 UList<T>::operator=(t); 00095 } 00096 00097 00098 // ************************************************************************* // |