![]() |
|
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 Class 00026 SubField 00027 00028 Description 00029 SubField is a Field obtained as a section of another Field. Thus it is 00030 itself unallocated so that no storage is allocated or de-allocated 00031 during it's use. To achieve this behaviour, SubField is derived from 00032 UnallocatedField rather than Field. 00033 00034 SourceFiles 00035 SubFieldI.H 00036 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef SubField_H 00040 #define SubField_H 00041 00042 #include "Field.H" 00043 #include "SubList.H" 00044 #include "Field.H" 00045 00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00047 00048 namespace Foam 00049 { 00050 00051 /*---------------------------------------------------------------------------*\ 00052 Class SubField Declaration 00053 \*---------------------------------------------------------------------------*/ 00054 00055 template<class Type> 00056 class SubField 00057 : 00058 public refCount, 00059 public SubList<Type> 00060 { 00061 00062 public: 00063 00064 //- Component type 00065 typedef typename pTraits<Type>::cmptType cmptType; 00066 00067 00068 // Constructors 00069 00070 //- Construct from UnallocatedField and SubField size 00071 inline SubField 00072 ( 00073 const SubList<Type>& slist 00074 ); 00075 00076 //- Construct from UnallocatedField and SubField size 00077 inline SubField 00078 ( 00079 const UList<Type>& list, 00080 const label subSize 00081 ); 00082 00083 //- Construct from UnallocatedField, start and end indices 00084 inline SubField 00085 ( 00086 const UList<Type>& list, 00087 const label subSize, 00088 const label startIndex 00089 ); 00090 00091 //- Construct as copy 00092 inline SubField 00093 ( 00094 const SubField<Type>& sfield 00095 ); 00096 00097 00098 // Member functions 00099 00100 //- Return a null SubField 00101 static inline SubField<Type>& null(); 00102 00103 //- Return a component field of the field 00104 inline tmp<Field<cmptType> > component(const direction) const; 00105 00106 //- Return the field transpose (only defined for second rank tensors) 00107 tmp<Field<Type> > T() const; 00108 00109 00110 // Member operators 00111 00112 //- Assignment from UList operator. Takes linear time. 00113 inline void operator=(const SubField<Type>&); 00114 00115 //- Allow cast to a const Field<Type>& 00116 inline operator const Field<Type>&() const; 00117 }; 00118 00119 00120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00121 00122 } // End namespace Foam 00123 00124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00125 00126 #include "SubFieldI.H" 00127 00128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00129 00130 #endif 00131 00132 // ************************************************************************* //