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

vtkFoam.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::vtkFoam
00027 
00028 Description
00029 
00030 SourceFiles
00031     vtkFoam.C
00032     vtkFoamInsertNextPoint.H
00033     vtkFoamAddFields.H
00034     vtkFoamAddInternalMesh.H
00035     vtkFoamConvertFields.H
00036     vtkFoamConvertVolField.H
00037     vtkFoamConvertPatchFaceField.H
00038     vtkFoamConvertPointField.H
00039     vtkFoamConvertPatchPointField.H
00040 
00041 \*---------------------------------------------------------------------------*/
00042 
00043 #ifndef vtkFoam_H
00044 #define vtkFoam_H
00045 
00046 #include "className.H"
00047 #include "fileName.H"
00048 #include "volPointInterpolation.H"
00049 
00050 // * * * * * * * * * * * * * Forward Declarations  * * * * * * * * * * * * * //
00051 
00052 // VTK class forward declarations
00053 class vtkFoamReader;
00054 class vtkUnstructuredGrid;
00055 class vtkPoints;
00056 class vtkDataArraySelection;
00057 
00058 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00059 
00060 namespace Foam
00061 {
00062 
00063 // Foam class forward declarations
00064 class argList;
00065 class Time;
00066 class fvMesh;
00067 class IOobjectList;
00068 class polyPatch;
00069 
00070 
00071 /*---------------------------------------------------------------------------*\
00072                            Class vtkFoam Declaration
00073 \*---------------------------------------------------------------------------*/
00074 
00075 class vtkFoam
00076 {
00077     // Private data
00078 
00079         //- Access to the controlling vtkFoamReader
00080         vtkFoamReader *reader_;
00081 
00082         autoPtr<argList> argsPtr_;
00083         autoPtr<Time> dbPtr_;
00084         fvMesh* meshPtr_;
00085 
00086         //- Selected regions, [0] = internal mesh, [1-nPatches] = patches
00087         boolList selectedRegions_;
00088 
00089         //- Lables of cell-centres used as additional points when decomposing
00090         // polyhedra
00091         labelList addPointCellLabels_;
00092 
00093         //- Label of original cell the decomposed cells are split from
00094         labelList superCells_;
00095 
00096 
00097     // Private Member Functions
00098 
00099         //- Pad-out the time name to avoid bug in the GUI redraw
00100         static string padTimeString(const string&);
00101 
00102         //- Pad-out the patch name
00103         static string padPatchString(const string&);
00104 
00105         //- Find and set the selected time from all the methods of selection
00106         static void setSelectedTime
00107         (
00108             Time& runTime,
00109             vtkFoamReader* reader
00110         );
00111 
00112         //- Update the selected regions
00113         void updateSelectedRegions();
00114 
00115         //- Convert the mesh according to the list of selected regions
00116         void convertMesh();
00117 
00118         //- Add the internal mesh to the set of Outputs if selected
00119         void addInternalMesh(const fvMesh&, vtkUnstructuredGrid*);
00120 
00121         //- Add the internal patch to the set of Outputs if selected
00122         void addPatch(const polyPatch&, vtkUnstructuredGrid*);
00123 
00124         //- Add the fields in th selested time directory to the selection lists
00125         template<class GeoField>
00126         void addFields
00127         (
00128             vtkDataArraySelection *fieldSelection,
00129             const IOobjectList& objects
00130         );
00131 
00132         //- Convert the selected volFields
00133         template<class Type>
00134         void convertVolFields
00135         (
00136             const fvMesh& mesh,
00137             const volPointInterpolation& pInterp,
00138             const IOobjectList& objects,
00139             vtkDataArraySelection *fieldSelection
00140         );
00141 
00142         template<class Type>
00143         void convertVolField
00144         (
00145             const GeometricField<Type, fvPatchField, volMesh>& tf
00146         );
00147 
00148         template<class Type>
00149         void convertPatchFaceField
00150         (
00151             const word& name,
00152             const Field<Type>& tf,
00153             const label regioni
00154         );
00155 
00156         //- Convert the selected pointFields
00157         template<class Type>
00158         void convertPointFields
00159         (
00160             const fvMesh& mesh,
00161             const IOobjectList& objects,
00162             vtkDataArraySelection *fieldSelection
00163         );
00164 
00165         template<class Type>
00166         void convertPointField
00167         (
00168             const GeometricField<Type, pointPatchField, pointMesh>& ptf,
00169             const GeometricField<Type, fvPatchField, volMesh>& tf
00170         );
00171 
00172         template<class Type>
00173         void convertPatchPointField
00174         (
00175             const word& name,
00176             const Field<Type>& tf,
00177             const label regioni
00178         );
00179 
00180         //- Set the name of the Output vtkUnstructuredGrid
00181         void SetName(vtkUnstructuredGrid *vtkMesh, const char* name);
00182 
00183 
00184         //- Disallow default bitwise copy construct
00185         vtkFoam(const vtkFoam&);
00186 
00187         //- Disallow default bitwise assignment
00188         void operator=(const vtkFoam&);
00189 
00190 
00191 public:
00192 
00193     // Static data members
00194 
00195         ClassName("vtkFoam");
00196 
00197 
00198     // Constructors
00199 
00200         //- Construct from components
00201         vtkFoam(const char* const FileName, vtkFoamReader* reader);
00202 
00203 
00204     // Destructor
00205 
00206         ~vtkFoam();
00207 
00208 
00209     // Member Functions
00210 
00211         void UpdateInformation();
00212         void Update();
00213 };
00214 
00215 
00216 // * * * * * * * * * * * * * Template Specialisations  * * * * * * * * * * * //
00217 
00218 template<>
00219 void vtkFoam::convertVolField
00220 (
00221     const GeometricField<scalar, fvPatchField, volMesh>& sf
00222 );
00223 
00224 template<>
00225 void vtkFoam::convertPatchFaceField
00226 (
00227     const word& name,
00228     const Field<scalar>& sf,
00229     const label regioni
00230 );
00231 
00232 template<>
00233 void vtkFoam::convertPointField
00234 (
00235     const GeometricField<scalar, pointPatchField, pointMesh>& psf,
00236     const GeometricField<scalar, fvPatchField, volMesh>& sf
00237 );
00238 
00239 template<>
00240 void vtkFoam::convertPatchPointField
00241 (
00242     const word& name,
00243     const Field<scalar>& sf,
00244     const label regioni
00245 );
00246 
00247 
00248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00249 
00250 } // End namespace Foam
00251 
00252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00253 
00254 #endif
00255 
00256 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd