DynamicFieldI.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "DynamicField.H"
00028
00029
00030
00031 namespace Foam
00032 {
00033
00034
00035
00036 template<class Type>
00037 DynamicField<Type>::DynamicField()
00038 :
00039 Field<Type>(),
00040 capacity_(0)
00041 {}
00042
00043
00044 template<class Type>
00045 DynamicField<Type>::DynamicField(const label size)
00046 :
00047 Field<Type>(size),
00048 capacity_(Field<Type>::size())
00049 {
00050 Field<Type>::size(0);
00051 }
00052
00053
00054 template<class Type>
00055 inline Foam::DynamicField<Type>::DynamicField
00056 (
00057 const UList<Type>& lst
00058 )
00059 :
00060 Field<Type>(lst),
00061 capacity_(Field<Type>::size())
00062 {}
00063
00064
00065 template<class Type>
00066 inline Foam::DynamicField<Type>::DynamicField
00067 (
00068 const Xfer<List<Type> >& lst
00069 )
00070 :
00071 Field<Type>(lst),
00072 capacity_(Field<Type>::size())
00073 {}
00074
00075
00076 template<class Type>
00077 DynamicField<Type>::DynamicField
00078 (
00079 const UList<Type>& mapF,
00080 const labelList& mapAddressing
00081 )
00082 :
00083 Field<Type>(mapF, mapAddressing),
00084 capacity_(Field<Type>::size())
00085 {}
00086
00087
00088 template<class Type>
00089 DynamicField<Type>::DynamicField
00090 (
00091 const UList<Type>& mapF,
00092 const labelListList& mapAddressing,
00093 const scalarListList& weights
00094 )
00095 :
00096 Field<Type>(mapF, mapAddressing, weights),
00097 capacity_(Field<Type>::size())
00098 {}
00099
00100
00101
00102 template<class Type>
00103 DynamicField<Type>::DynamicField
00104 (
00105 const UList<Type>& mapF,
00106 const FieldMapper& map
00107 )
00108 :
00109 DynamicField<Type>(mapF, map),
00110 capacity_(Field<Type>::size())
00111 {}
00112
00113
00114 template<class Type>
00115 DynamicField<Type>::DynamicField(const DynamicField<Type>& f)
00116 :
00117 Field<Type>(f),
00118 capacity_(Field<Type>::size())
00119 {}
00120
00121
00122 template<class Type>
00123 DynamicField<Type>::DynamicField(DynamicField<Type>& f, bool reUse)
00124 :
00125 Field<Type>(f, reUse),
00126 capacity_(Field<Type>::size())
00127 {}
00128
00129
00130 template<class Type>
00131 DynamicField<Type>::DynamicField(const Xfer<DynamicField<Type> >& f)
00132 :
00133 Field<Type>(f),
00134 capacity_(Field<Type>::size())
00135 {}
00136
00137
00138
00139
00140 template<class Type>
00141 Foam::label DynamicField<Type>::capacity() const
00142 {
00143 return capacity_;
00144 }
00145
00146
00147 template<class Type>
00148 void DynamicField<Type>::append(const Type& t)
00149 {
00150 label elemI = Field<Type>::size();
00151 setSize(elemI + 1);
00152
00153 this->operator[](elemI) = t;
00154 }
00155
00156
00157
00158
00159 template<class Type>
00160 void DynamicField<Type>::operator=(const DynamicField<Type>& rhs)
00161 {
00162 if (this == &rhs)
00163 {
00164 FatalErrorIn("DynamicField<Type>::operator=(const DynamicField<Type>&)")
00165 << "attempted assignment to self"
00166 << abort(FatalError);
00167 }
00168
00169 Field<Type>::operator=(rhs);
00170 capacity_ = Field<Type>::size();
00171 }
00172
00173
00174 template<class Type>
00175 void DynamicField<Type>::operator=(const UList<Type>& rhs)
00176 {
00177 Field<Type>::operator=(rhs);
00178 capacity_ = Field<Type>::size();
00179 }
00180
00181
00182 template<class Type>
00183 void DynamicField<Type>::operator=(const tmp<DynamicField>& rhs)
00184 {
00185 if (this == &(rhs()))
00186 {
00187 FatalErrorIn("DynamicField<Type>::operator=(const tmp<DynamicField>&)")
00188 << "attempted assignment to self"
00189 << abort(FatalError);
00190 }
00191
00192
00193 DynamicField* fieldPtr = rhs.ptr();
00194 List<Type>::transfer(*fieldPtr);
00195 delete fieldPtr;
00196 capacity_ = Field<Type>::size();
00197 }
00198
00199
00200 template<class Type>
00201 Type& DynamicField<Type>::operator[](const label i)
00202 {
00203 return Field<Type>::operator[](i);
00204 }
00205
00206
00207 template<class Type>
00208 const Type& DynamicField<Type>::operator[](const label i) const
00209 {
00210 return Field<Type>::operator[](i);
00211 }
00212
00213
00214
00215
00216
00217
00218
00219 }
00220
00221
Copyright © 2000-2009 OpenCFD Ltd