OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

SlicedGeometricField.H

Go 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::SlicedGeometricField
00027 
00028 Description
00029     Specialization of GeometricField which holds slices of given complete
00030     fields in a form that they act as a GeometricField.
00031 
00032     The destructor is wrapped to avoid deallocation of the storage of the
00033     complete fields when this is destroyed.
00034 
00035     SlicedGeometricField can only be instantiated with a valid form of
00036     SlicedPatchField to handle the slicing and storage deallocation of the
00037     boundary field.
00038 
00039 SourceFiles
00040     SlicedGeometricField.C
00041 
00042 \*---------------------------------------------------------------------------*/
00043 
00044 #ifndef SlicedGeometricField_H
00045 #define SlicedGeometricField_H
00046 
00047 #include "GeometricField.H"
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 namespace Foam
00052 {
00053 
00054 /*---------------------------------------------------------------------------*\
00055                      Class SlicedGeometricField Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 template
00059 <
00060     class Type,
00061     template<class> class PatchField,
00062     template<class> class SlicedPatchField,
00063     class GeoMesh
00064 >
00065 class SlicedGeometricField
00066 :
00067     public GeometricField<Type, PatchField, GeoMesh>
00068 {
00069 public:
00070 
00071     typedef typename GeoMesh::Mesh Mesh;
00072     typedef typename GeoMesh::BoundaryMesh BoundaryMesh;
00073 
00074     class DimensionedInternalField;
00075 
00076 
00077 private:
00078 
00079     // Private Member Functions
00080 
00081         //- Slice the given field and a create a PtrList of SlicedPatchField
00082         //  from which the boundary field is built
00083         tmp<FieldField<PatchField, Type> >  slicedBoundaryField
00084         (
00085             const Mesh& mesh,
00086             const Field<Type>& completeField,
00087             const bool preserveCouples
00088         );
00089 
00090         //- Slice the given field and a create a PtrList of SlicedPatchField
00091         //  from which the boundary field is built
00092         tmp<FieldField<PatchField, Type> >  slicedBoundaryField
00093         (
00094             const Mesh& mesh,
00095             const FieldField<PatchField, Type>& bField,
00096             const bool preserveCouples
00097         );
00098 
00100         //SlicedGeometricField(const SlicedGeometricField&);
00101 
00102         //- Disallow default bitwise assignment
00103         void operator=(const SlicedGeometricField&);
00104 
00105         //- Disallow standard assignment to GeometricField,
00106         //  == assignment is allowed.
00107         void operator=(const GeometricField<Type, PatchField, GeoMesh>&);
00108 
00109         //- Disallow standard assignment to tmp<GeometricField>,
00110         //  == assignment is allowed.
00111         void operator=(const tmp<GeometricField<Type, PatchField, GeoMesh> >&);
00112 
00113 
00114 public:
00115 
00116     // Constructors
00117 
00118         //- Construct from components and field to slice
00119         SlicedGeometricField
00120         (
00121             const IOobject&,
00122             const Mesh&,
00123             const dimensionSet&,
00124             const Field<Type>& completeField,
00125             const bool preserveCouples=true
00126         );
00127 
00128         //- Construct from components and separate fields to slice for the
00129         //  internal field and boundary field
00130         SlicedGeometricField
00131         (
00132             const IOobject&,
00133             const Mesh&,
00134             const dimensionSet&,
00135             const Field<Type>& completeIField,
00136             const Field<Type>& completeBField,
00137             const bool preserveCouples=true
00138         );
00139 
00140         //- Construct from GeometricField. Reuses full internal and
00141         //  patch fields except on couples (preserveCouples=true).
00142         SlicedGeometricField
00143         (
00144             const IOobject&,
00145             const GeometricField<Type, PatchField, GeoMesh>&,
00146             const bool preserveCouples=true
00147         );
00148 
00149         //- Construct as copy
00150         SlicedGeometricField
00151         (
00152             const SlicedGeometricField
00153             <
00154                 Type,
00155                 PatchField,
00156                 SlicedPatchField,
00157                 GeoMesh
00158             >&
00159         );
00160 
00161 
00162     // Destructor
00163 
00164         ~SlicedGeometricField();
00165 
00166 
00167     // Member functions
00168 
00169         //- Correct boundary field
00170         void correctBoundaryConditions();
00171 };
00172 
00173 
00174 /*---------------------------------------------------------------------------*\
00175        Class SlicedGeometricField::DimensionedInternalField Declaration
00176 \*---------------------------------------------------------------------------*/
00177 
00178 //- The internalField of a SlicedGeometricField
00179 template
00180 <
00181     class Type,
00182     template<class> class PatchField,
00183     template<class> class SlicedPatchField,
00184     class GeoMesh
00185 >
00186 class SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
00187 DimensionedInternalField
00188 :
00189     public GeometricField<Type, PatchField, GeoMesh>::DimensionedInternalField
00190 {
00191 
00192 public:
00193 
00194     // Constructors
00195 
00196         //- Construct from components and field to slice
00197         DimensionedInternalField
00198         (
00199             const IOobject&,
00200             const Mesh&,
00201             const dimensionSet&,
00202             const Field<Type>& iField
00203         );
00204 
00205 
00206     // Destructor
00207 
00208         ~DimensionedInternalField();
00209 };
00210 
00211 
00212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00213 
00214 } // End namespace Foam
00215 
00216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00217 
00218 #ifdef NoRepository
00219 #   include "SlicedGeometricField.C"
00220 #endif
00221 
00222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00223 
00224 #endif
00225 
00226 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd