FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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