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