1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 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
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
29 Encapsulation of VTK mesh data. Holds mesh or meshsubset and
30 polyhedral-cell decomposition on it.
35 \*---------------------------------------------------------------------------*/
41 #include "fvMeshSubset.H"
42 #include "pointMesh.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of classes
52 /*---------------------------------------------------------------------------*\
53 Class vtkMesh Declaration
54 \*---------------------------------------------------------------------------*/
63 //- Demand driven pointMesh
64 mutable autoPtr<pointMesh> pointMeshPtr_;
66 //- Subsetting engine + sub-fvMesh
67 fvMeshSubset subsetter_;
69 //- Current cellSet (or empty)
72 //- Current decomposition of topology
73 mutable autoPtr<vtkTopo> topoPtr_;
77 // Private Member Functions
79 //- Disallow default bitwise copy construct
80 vtkMesh(const vtkMesh&);
82 //- Disallow default bitwise assignment
83 void operator=(const vtkMesh&);
90 //- Construct from components
91 vtkMesh(fvMesh& baseMesh, const word& setName = "");
99 const fvMesh& baseMesh() const
104 const pointMesh& basePointMesh() const
106 if (!pointMeshPtr_.valid())
108 pointMeshPtr_.reset(new pointMesh(baseMesh_));
110 return pointMeshPtr_();
113 const fvMeshSubset& subsetter() const
118 //- Check if running subMesh
119 bool useSubMesh() const
121 return setName_.size() > 0;
125 const vtkTopo& topo() const
127 if (!topoPtr_.valid())
129 topoPtr_.reset(new vtkTopo(mesh()));
134 //- Access either mesh or submesh
135 const fvMesh& mesh() const
139 return subsetter_.subMesh();
147 //- Access either pointMesh of base or pointMesh of subset
148 const pointMesh& pMesh() const
152 return subsetter_.subPointMesh();
156 return basePointMesh();
160 //- Number of field cells
161 label nFieldCells() const
163 return topo().cellTypes().size();
166 //- Number of field points
167 label nFieldPoints() const
169 return pMesh().size() + topo().addPointCellLabels().size();
176 polyMesh::readUpdateState readUpdate();
179 //- Map volume field (does in fact do very little interpolation;
180 // just copied from fvMeshSubset)
181 template<class GeoField>
182 tmp<GeoField> interpolate(const GeoField& fld) const
186 tmp<GeoField> subFld = subsetter_.interpolate(fld);
187 subFld().rename(fld.name());
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 } // End namespace Foam
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 // ************************************************************************* //