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 \*---------------------------------------------------------------------------*/ 00025 00026 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // 00027 00028 template<class Type> 00029 inline Foam::SubField<Type>::SubField 00030 ( 00031 const SubList<Type>& list 00032 ) 00033 : 00034 SubList<Type>(list) 00035 {} 00036 00037 00038 template<class Type> 00039 inline Foam::SubField<Type>::SubField 00040 ( 00041 const UList<Type>& list 00042 ) 00043 : 00044 SubList<Type>(list, list.size()) 00045 {} 00046 00047 00048 template<class Type> 00049 inline Foam::SubField<Type>::SubField 00050 ( 00051 const UList<Type>& list, 00052 const label subSize 00053 ) 00054 : 00055 SubList<Type>(list, subSize) 00056 {} 00057 00058 00059 template<class Type> 00060 inline Foam::SubField<Type>::SubField 00061 ( 00062 const UList<Type>& list, 00063 const label subSize, 00064 const label startIndex 00065 ) 00066 : 00067 SubList<Type>(list, subSize, startIndex) 00068 {} 00069 00070 00071 template<class Type> 00072 inline Foam::SubField<Type>::SubField 00073 ( 00074 const SubField<Type>& sfield 00075 ) 00076 : 00077 refCount(), 00078 SubList<Type>(sfield) 00079 {} 00080 00081 00082 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00083 00084 template<class Type> 00085 inline const Foam::SubField<Type>& Foam::SubField<Type>::null() 00086 { 00087 return *reinterpret_cast< SubField<Type>* >(0); 00088 } 00089 00090 00091 template<class Type> 00092 inline Foam::tmp<Foam::Field<typename Foam::SubField<Type>::cmptType> > 00093 Foam::SubField<Type>::component 00094 ( 00095 const direction d 00096 ) const 00097 { 00098 return (reinterpret_cast<const Field<Type>&>(*this)).component(d); 00099 } 00100 00101 00102 template<class Type> 00103 inline Foam::tmp<Foam::Field<Type> > Foam::SubField<Type>::T() const 00104 { 00105 return (reinterpret_cast<const Field<Type>&>(*this)).T(); 00106 } 00107 00108 00109 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // 00110 00111 template<class Type> 00112 inline void Foam::SubField<Type>::operator=(const SubField<Type>& rhs) 00113 { 00114 UList<Type>::operator=(rhs); 00115 } 00116 00117 00118 template<class Type> 00119 inline Foam::SubField<Type>::operator const Foam::Field<Type>&() const 00120 { 00121 return *reinterpret_cast< const Field<Type>* >(this); 00122 } 00123 00124 00125 // ************************ vim: set sw=4 sts=4 et: ************************ //