foam to Tecplot360 converter
[OpenFOAM-1.6.x.git] / applications / utilities / postProcessing / dataConversion / foamToTecplot360 / vtkMesh.H
blob4f8d5625832262449d59c1108f09778242d1a675
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::vtkMesh
28 Description
29     Encapsulation of VTK mesh data. Holds mesh or meshsubset and
30     polyhedral-cell decomposition on it.
32 SourceFiles
33     vtkMesh.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef vtkMesh_H
38 #define vtkMesh_H
40 #include "fvMeshSubset.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 // Forward declaration of classes
48 class Time;
50 /*---------------------------------------------------------------------------*\
51                            Class vtkMesh Declaration
52 \*---------------------------------------------------------------------------*/
54 class vtkMesh
56     // Private data
58         //- Reference to mesh
59         fvMesh& baseMesh_;
61         //- Subsetting engine + sub-fvMesh
62         fvMeshSubset subsetter_;
64         //- Current cellSet (or empty)
65         const word setName_;
67 //        //- Current decomposition of topology
68 //        mutable autoPtr<vtkTopo> topoPtr_;
72     // Private Member Functions
74         //- Disallow default bitwise copy construct
75         vtkMesh(const vtkMesh&);
77         //- Disallow default bitwise assignment
78         void operator=(const vtkMesh&);
81 public:
83     // Constructors
85         //- Construct from components
86         vtkMesh(fvMesh& baseMesh, const word& setName = "");
89     // Member Functions
91         // Access
93             //- whole mesh
94             const fvMesh& baseMesh() const
95             {
96                 return baseMesh_;
97             }
99             const fvMeshSubset& subsetter() const
100             {
101                 return subsetter_;
102             }
104             //- Check if running subMesh
105             bool useSubMesh() const
106             {
107                 return setName_.size();
108             }
110 //            //- topology
111 //            const vtkTopo& topo() const
112 //            {
113 //                if (topoPtr_.empty())
114 //                {
115 //                    topoPtr_.reset(new vtkTopo(mesh()));
116 //                }
117 //                return topoPtr_();
118 //            }
120             //- Access either mesh or submesh
121             const fvMesh& mesh() const
122             {
123                 if (useSubMesh())
124                 {
125                     return subsetter_.subMesh();
126                 }
127                 else
128                 {
129                     return baseMesh_;
130                 }
131             }
133 //            //- Number of field cells
134 //            label nFieldCells() const
135 //            {
136 //                return topo().vertLabels().size();
137 //            }
139 //            //- Number of field points
140 //            label nFieldPoints() const
141 //            {
142 //                return mesh().nPoints() + topo().addPointCellLabels().size();
143 //            }
146         // Edit
148             //- Read mesh
149             polyMesh::readUpdateState readUpdate();
152             //- Map volume field (does in fact do very little interpolation;
153             //  just copied from fvMeshSubset)
154             template<class GeoField>
155             tmp<GeoField> interpolate(const GeoField& fld) const
156             {
157                 if (useSubMesh())
158                 {
159                     tmp<GeoField> subFld = subsetter_.interpolate(fld);
160                     subFld().rename(fld.name());
161                     return subFld;
162                 }
163                 else
164                 {
165                     return fld;
166                 }
167             }
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 } // End namespace Foam
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 #endif
179 // ************************************************************************* //