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

patchWriter.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::patchWriter
00026 
00027 Description
00028     Write patch fields
00029 
00030 SourceFiles
00031     patchWriter.C
00032     patchWriterTemplates.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef patchWriter_H
00037 #define patchWriter_H
00038 
00039 #include <OpenFOAM/pointMesh.H>
00040 #include <OpenFOAM/OFstream.H>
00041 #include <finiteVolume/volFields.H>
00042 #include <OpenFOAM/pointFields.H>
00043 #include "vtkMesh.H"
00044 #include <OpenFOAM/indirectPrimitivePatch.H>
00045 #include <OpenFOAM/PrimitivePatchInterpolation_.H>
00046 
00047 using namespace Foam;
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 namespace Foam
00052 {
00053 
00054 class volPointInterpolation;
00055 
00056 /*---------------------------------------------------------------------------*\
00057                            Class patchWriter Declaration
00058 \*---------------------------------------------------------------------------*/
00059 
00060 class patchWriter
00061 {
00062     const vtkMesh& vMesh_;
00063 
00064     const bool binary_;
00065 
00066     const bool nearCellValue_;
00067 
00068     const fileName fName_;
00069 
00070     const labelList patchIDs_;
00071 
00072     std::ofstream os_;
00073 
00074     label nPoints_;
00075 
00076     label nFaces_;
00077 
00078 public:
00079 
00080     // Constructors
00081 
00082         //- Construct from components
00083         patchWriter
00084         (
00085             const vtkMesh&,
00086             const bool binary,
00087             const bool nearCellValue,
00088             const fileName&,
00089             const labelList& patchIDs
00090         );
00091 
00092 
00093     // Member Functions
00094 
00095         std::ofstream& os()
00096         {
00097             return os_;
00098         }
00099 
00100         label nPoints() const
00101         {
00102             return nPoints_;
00103         }
00104 
00105         label nFaces() const
00106         {
00107             return nFaces_;
00108         }
00109 
00110         //- Write cellIDs
00111         void writePatchIDs();
00112 
00113         //- Write volFields
00114         template<class Type>
00115         void write
00116         (
00117             const PtrList<GeometricField<Type, fvPatchField, volMesh> >&
00118         );
00119 
00120         //- Write pointFields
00121         template<class Type>
00122         void write
00123         (
00124             const PtrList<GeometricField<Type, pointPatchField, pointMesh> >&
00125         );
00126 
00127         //- Interpolate and write volFields
00128         template<class Type>
00129         void write
00130         (
00131             const PrimitivePatchInterpolation<primitivePatch>&,
00132             const PtrList<GeometricField<Type, fvPatchField, volMesh> >&
00133         );
00134 };
00135 
00136 
00137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00138 
00139 } // End namespace Foam
00140 
00141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00142 
00143 #ifdef NoRepository
00144 #   include "patchWriterTemplates.C"
00145 #endif
00146 
00147 
00148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00149 
00150 #endif
00151 
00152 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines