![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00028 00029 namespace Foam 00030 { 00031 00032 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // 00033 00034 template<class Type> 00035 inline SubField<Type>::SubField 00036 ( 00037 const SubList<Type>& slist 00038 ) 00039 : 00040 SubList<Type>(slist) 00041 {} 00042 00043 template<class Type> 00044 inline SubField<Type>::SubField 00045 ( 00046 const UList<Type>& list, 00047 const label subSize 00048 ) 00049 : 00050 SubList<Type>(list, subSize) 00051 {} 00052 00053 00054 template<class Type> 00055 inline SubField<Type>::SubField 00056 ( 00057 const UList<Type>& list, 00058 const label subSize, 00059 const label startIndex 00060 ) 00061 : 00062 SubList<Type>(list, subSize, startIndex) 00063 {} 00064 00065 00066 template<class Type> 00067 inline SubField<Type>::SubField 00068 ( 00069 const SubField<Type>& sfield 00070 ) 00071 : 00072 refCount(), 00073 SubList<Type>(sfield) 00074 {} 00075 00076 00077 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00078 00079 // Return a null Field 00080 template<class Type> 00081 inline SubField<Type>& SubField<Type>::null() 00082 { 00083 SubField<Type>* nullPtr = reinterpret_cast<SubField<Type>*>(NULL); 00084 return *nullPtr; 00085 } 00086 00087 00088 template<class Type> 00089 inline tmp<Field<typename SubField<Type>::cmptType> > SubField<Type>::component 00090 ( 00091 const direction d 00092 ) const 00093 { 00094 return (reinterpret_cast<const Field<Type>&>(*this)).component(d); 00095 } 00096 00097 00098 template<class Type> 00099 inline tmp<Field<Type> > SubField<Type>::T() const 00100 { 00101 return (reinterpret_cast<const Field<Type>&>(*this)).T(); 00102 } 00103 00104 00105 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // 00106 00107 template<class Type> 00108 inline void SubField<Type>::operator=(const SubField<Type>& rhs) 00109 { 00110 UList<Type>::operator=(rhs); 00111 } 00112 00113 00114 // Allow cast to a const Field<Type>& 00115 template<class Type> 00116 inline SubField<Type>::operator const Field<Type>&() const 00117 { 00118 return *(reinterpret_cast<const Field<Type>*>(this)); 00119 } 00120 00121 00122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00123 00124 } // End namespace Foam 00125 00126 // ************************************************************************* //