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

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