1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
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
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/>.
28 Encapsulation of VTK mesh data. Holds mesh or meshsubset and
29 polyhedral-cell decomposition on it.
34 \*---------------------------------------------------------------------------*/
40 #include "fvMeshSubset.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Forward declaration of classes
50 /*---------------------------------------------------------------------------*\
51 Class vtkMesh Declaration
52 \*---------------------------------------------------------------------------*/
61 //- Subsetting engine + sub-fvMesh
62 fvMeshSubset subsetter_;
64 //- Current cellSet (or empty)
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&);
85 //- Construct from components
86 vtkMesh(fvMesh& baseMesh, const word& setName = "");
94 const fvMesh& baseMesh() const
99 const fvMeshSubset& subsetter() const
104 //- Check if running subMesh
105 bool useSubMesh() const
107 return setName_.size();
111 const vtkTopo& topo() const
113 if (topoPtr_.empty())
115 topoPtr_.reset(new vtkTopo(mesh()));
120 //- Access either mesh or submesh
121 const fvMesh& mesh() const
125 return subsetter_.subMesh();
133 //- Number of field cells
134 label nFieldCells() const
136 return topo().cellTypes().size();
139 //- Number of field points
140 label nFieldPoints() const
142 return mesh().nPoints() + topo().addPointCellLabels().size();
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
159 tmp<GeoField> subFld = subsetter_.interpolate(fld);
160 subFld().rename(fld.name());
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 } // End namespace Foam
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 // ************************************************************************* //