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 "SlicedGeometricField.H"
00028
00029
00030
00031 template
00032 <
00033 class Type,
00034 template<class> class PatchField,
00035 template<class> class SlicedPatchField,
00036 class GeoMesh
00037 >
00038 Foam::tmp<Foam::FieldField<PatchField, Type> >
00039 Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
00040 slicedBoundaryField
00041 (
00042 const Mesh& mesh,
00043 const Field<Type>& completeField,
00044 const bool preserveCouples
00045 )
00046 {
00047 tmp<FieldField<PatchField, Type> > tbf
00048 (
00049 new FieldField<PatchField, Type>(mesh.boundary().size())
00050 );
00051
00052 FieldField<PatchField, Type>& bf = tbf();
00053
00054 forAll (mesh.boundary(), patchi)
00055 {
00056 if (preserveCouples && mesh.boundary()[patchi].coupled())
00057 {
00058
00059 bf.set
00060 (
00061 patchi,
00062 PatchField<Type>::New
00063 (
00064 mesh.boundary()[patchi].type(),
00065 mesh.boundary()[patchi],
00066 *this
00067 )
00068 );
00069
00070
00071
00072
00073
00074 bf[patchi] = SlicedPatchField<Type>
00075 (
00076 mesh.boundary()[patchi],
00077 DimensionedField<Type, GeoMesh>::null(),
00078 completeField
00079 );
00080 }
00081 else
00082 {
00083 bf.set
00084 (
00085 patchi,
00086 new SlicedPatchField<Type>
00087 (
00088 mesh.boundary()[patchi],
00089 DimensionedField<Type, GeoMesh>::null(),
00090 completeField
00091 )
00092 );
00093 }
00094 }
00095
00096 return tbf;
00097 }
00098
00099
00100 template
00101 <
00102 class Type,
00103 template<class> class PatchField,
00104 template<class> class SlicedPatchField,
00105 class GeoMesh
00106 >
00107 Foam::tmp<Foam::FieldField<PatchField, Type> >
00108 Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
00109 slicedBoundaryField
00110 (
00111 const Mesh& mesh,
00112 const FieldField<PatchField, Type>& bField,
00113 const bool preserveCouples
00114 )
00115 {
00116 tmp<FieldField<PatchField, Type> > tbf
00117 (
00118 new FieldField<PatchField, Type>(mesh.boundary().size())
00119 );
00120
00121 FieldField<PatchField, Type>& bf = tbf();
00122
00123 forAll (mesh.boundary(), patchi)
00124 {
00125 if (preserveCouples && mesh.boundary()[patchi].coupled())
00126 {
00127
00128 bf.set
00129 (
00130 patchi,
00131 PatchField<Type>::New
00132 (
00133 mesh.boundary()[patchi].type(),
00134 mesh.boundary()[patchi],
00135 *this
00136 )
00137 );
00138
00139
00140 bf[patchi] == bField[patchi];
00141 }
00142 else
00143 {
00144
00145 bf.set
00146 (
00147 patchi,
00148 new SlicedPatchField<Type>
00149 (
00150 mesh.boundary()[patchi],
00151 DimensionedField<Type, GeoMesh>::null()
00152 )
00153 );
00154 bf[patchi].UList<Type>::operator=(bField[patchi]);
00155 }
00156 }
00157
00158 return tbf;
00159 }
00160
00161
00162
00163
00164 template
00165 <
00166 class Type,
00167 template<class> class PatchField,
00168 template<class> class SlicedPatchField,
00169 class GeoMesh
00170 >
00171 Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
00172 DimensionedInternalField::DimensionedInternalField
00173 (
00174 const IOobject& io,
00175 const Mesh& mesh,
00176 const dimensionSet& ds,
00177 const Field<Type>& iField
00178 )
00179 :
00180 DimensionedField<Type, GeoMesh>
00181 (
00182 io,
00183 mesh,
00184 ds,
00185 Field<Type>()
00186 )
00187 {
00188
00189 UList<Type>::operator=
00190 (
00191 typename Field<Type>::subField(iField, GeoMesh::size(mesh))
00192 );
00193 }
00194
00195
00196 template
00197 <
00198 class Type,
00199 template<class> class PatchField,
00200 template<class> class SlicedPatchField,
00201 class GeoMesh
00202 >
00203 Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
00204 SlicedGeometricField
00205 (
00206 const IOobject& io,
00207 const Mesh& mesh,
00208 const dimensionSet& ds,
00209 const Field<Type>& completeField,
00210 const bool preserveCouples
00211 )
00212 :
00213 GeometricField<Type, PatchField, GeoMesh>
00214 (
00215 io,
00216 mesh,
00217 ds,
00218 Field<Type>(),
00219 slicedBoundaryField(mesh, completeField, preserveCouples)
00220 )
00221 {
00222
00223 UList<Type>::operator=
00224 (
00225 typename Field<Type>::subField(completeField, GeoMesh::size(mesh))
00226 );
00227
00228 correctBoundaryConditions();
00229 }
00230
00231
00232 template
00233 <
00234 class Type,
00235 template<class> class PatchField,
00236 template<class> class SlicedPatchField,
00237 class GeoMesh
00238 >
00239 Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
00240 SlicedGeometricField
00241 (
00242 const IOobject& io,
00243 const Mesh& mesh,
00244 const dimensionSet& ds,
00245 const Field<Type>& completeIField,
00246 const Field<Type>& completeBField,
00247 const bool preserveCouples
00248 )
00249 :
00250 GeometricField<Type, PatchField, GeoMesh>
00251 (
00252 io,
00253 mesh,
00254 ds,
00255 Field<Type>(),
00256 slicedBoundaryField(mesh, completeBField, preserveCouples)
00257 )
00258 {
00259
00260 UList<Type>::operator=
00261 (
00262 typename Field<Type>::subField(completeIField, GeoMesh::size(mesh))
00263 );
00264
00265 correctBoundaryConditions();
00266 }
00267
00268
00269 template
00270 <
00271 class Type,
00272 template<class> class PatchField,
00273 template<class> class SlicedPatchField,
00274 class GeoMesh
00275 >
00276 Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
00277 SlicedGeometricField
00278 (
00279 const IOobject& io,
00280 const GeometricField<Type, PatchField, GeoMesh>& gf,
00281 const bool preserveCouples
00282 )
00283 :
00284 GeometricField<Type, PatchField, GeoMesh>
00285 (
00286 io,
00287 gf.mesh(),
00288 gf.dimensions(),
00289 Field<Type>(),
00290 slicedBoundaryField(gf.mesh(), gf.boundaryField(), preserveCouples)
00291 )
00292 {
00293
00294 UList<Type>::operator=(gf.internalField());
00295
00296 correctBoundaryConditions();
00297 }
00298
00299
00300 template
00301 <
00302 class Type,
00303 template<class> class PatchField,
00304 template<class> class SlicedPatchField,
00305 class GeoMesh
00306 >
00307 Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
00308 SlicedGeometricField
00309 (
00310 const SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>& gf
00311 )
00312 :
00313 GeometricField<Type, PatchField, GeoMesh>
00314 (
00315 gf,
00316 gf.mesh(),
00317 gf.dimensions(),
00318 Field<Type>(),
00319 slicedBoundaryField(gf.mesh(), gf.boundaryField(), true)
00320 )
00321 {
00322
00323 UList<Type>::operator=(gf.internalField());
00324 }
00325
00326
00327
00328
00329 template
00330 <
00331 class Type,
00332 template<class> class PatchField,
00333 template<class> class SlicedPatchField,
00334 class GeoMesh
00335 >
00336 Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
00337 ~SlicedGeometricField()
00338 {
00339
00340
00341 UList<Type>::operator=(UList<Type>(NULL, 0));
00342 }
00343
00344
00345 template
00346 <
00347 class Type,
00348 template<class> class PatchField,
00349 template<class> class SlicedPatchField,
00350 class GeoMesh
00351 >
00352 Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
00353 DimensionedInternalField::~DimensionedInternalField()
00354 {
00355
00356
00357 UList<Type>::operator=(UList<Type>(NULL, 0));
00358 }
00359
00360
00361
00362
00363 template
00364 <
00365 class Type,
00366 template<class> class PatchField,
00367 template<class> class SlicedPatchField,
00368 class GeoMesh
00369 >
00370 void Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
00371 correctBoundaryConditions()
00372 {
00373 GeometricField<Type, PatchField, GeoMesh>::correctBoundaryConditions();
00374 }
00375
00376
00377