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