Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / applications / utilities / postProcessing / dataConversion / foamToTecplot360 / vtkMesh.H
blob6234bd6dfc187291782da9a4534b97f734cf323f
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::vtkMesh
27 Description
28     Encapsulation of VTK mesh data. Holds mesh or meshsubset and
29     polyhedral-cell decomposition on it.
31 SourceFiles
32     vtkMesh.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef vtkMesh_H
37 #define vtkMesh_H
39 #include "fvMeshSubset.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 // Forward declaration of classes
47 class Time;
49 /*---------------------------------------------------------------------------*\
50                            Class vtkMesh Declaration
51 \*---------------------------------------------------------------------------*/
53 class vtkMesh
55     // Private data
57         //- Reference to mesh
58         fvMesh& baseMesh_;
60         //- Subsetting engine + sub-fvMesh
61         fvMeshSubset subsetter_;
63         //- Current cellSet (or empty)
64         const word setName_;
66 //        //- Current decomposition of topology
67 //        mutable autoPtr<vtkTopo> topoPtr_;
71     // Private Member Functions
73         //- Disallow default bitwise copy construct
74         vtkMesh(const vtkMesh&);
76         //- Disallow default bitwise assignment
77         void operator=(const vtkMesh&);
80 public:
82     // Constructors
84         //- Construct from components
85         vtkMesh(fvMesh& baseMesh, const word& setName = "");
88     // Member Functions
90         // Access
92             //- whole mesh
93             const fvMesh& baseMesh() const
94             {
95                 return baseMesh_;
96             }
98             const fvMeshSubset& subsetter() const
99             {
100                 return subsetter_;
101             }
103             //- Check if running subMesh
104             bool useSubMesh() const
105             {
106                 return setName_.size();
107             }
109 //            //- topology
110 //            const vtkTopo& topo() const
111 //            {
112 //                if (topoPtr_.empty())
113 //                {
114 //                    topoPtr_.reset(new vtkTopo(mesh()));
115 //                }
116 //                return topoPtr_();
117 //            }
119             //- Access either mesh or submesh
120             const fvMesh& mesh() const
121             {
122                 if (useSubMesh())
123                 {
124                     return subsetter_.subMesh();
125                 }
126                 else
127                 {
128                     return baseMesh_;
129                 }
130             }
132 //            //- Number of field cells
133 //            label nFieldCells() const
134 //            {
135 //                return topo().vertLabels().size();
136 //            }
138 //            //- Number of field points
139 //            label nFieldPoints() const
140 //            {
141 //                return mesh().nPoints() + topo().addPointCellLabels().size();
142 //            }
145         // Edit
147             //- Read mesh
148             polyMesh::readUpdateState readUpdate();
151             //- Map volume field (does in fact do very little interpolation;
152             //  just copied from fvMeshSubset)
153             template<class GeoField>
154             tmp<GeoField> interpolate(const GeoField& fld) const
155             {
156                 if (useSubMesh())
157                 {
158                     tmp<GeoField> subFld = subsetter_.interpolate(fld);
159                     subFld().rename(fld.name());
160                     return subFld;
161                 }
162                 else
163                 {
164                     return fld;
165                 }
166             }
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 } // End namespace Foam
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 #endif
178 // ************************************************************************* //