vtkMesh.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::vtkMesh
26 
27 Description
28  Encapsulation of VTK mesh data. Holds mesh or meshsubset and
29  polyhedral-cell decomposition on it.
30 
31 SourceFiles
32  vtkMesh.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef vtkMesh_H
37 #define vtkMesh_H
38 
39 #include "fvMeshSubset.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of classes
47 class Time;
48 
49 /*---------------------------------------------------------------------------*\
50  Class vtkMesh Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class vtkMesh
54 {
55  // Private data
56 
57  //- Reference to mesh
58  fvMesh& baseMesh_;
59 
60  //- Subsetting engine + sub-fvMesh
61  fvMeshSubset subsetter_;
62 
63  //- Current cellSet (or empty)
64  const word setName_;
65 
66 // //- Current decomposition of topology
67 // mutable autoPtr<vtkTopo> topoPtr_;
68 
69 
70 
71  // Private Member Functions
72 
73  //- Disallow default bitwise copy construct
74  vtkMesh(const vtkMesh&);
75 
76  //- Disallow default bitwise assignment
77  void operator=(const vtkMesh&);
78 
79 
80 public:
81 
82  // Constructors
83 
84  //- Construct from components
85  vtkMesh(fvMesh& baseMesh, const word& setName = "");
86 
87 
88  // Member Functions
89 
90  // Access
91 
92  //- Whole mesh
93  const fvMesh& baseMesh() const
94  {
95  return baseMesh_;
96  }
97 
98  const fvMeshSubset& subsetter() const
99  {
100  return subsetter_;
101  }
102 
103  //- Check if running subMesh
104  bool useSubMesh() const
105  {
106  return setName_.size();
107  }
108 
109 // //- topology
110 // const vtkTopo& topo() const
111 // {
112 // if (topoPtr_.empty())
113 // {
114 // topoPtr_.reset(new vtkTopo(mesh()));
115 // }
116 // return topoPtr_();
117 // }
118 
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  }
131 
132 // //- Number of field cells
133 // label nFieldCells() const
134 // {
135 // return topo().vertLabels().size();
136 // }
137 //
138 // //- Number of field points
139 // label nFieldPoints() const
140 // {
141 // return mesh().nPoints() + topo().addPointCellLabels().size();
142 // }
143 
144 
145  // Edit
146 
147  //- Read mesh
149 
150 
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  }
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
static tmp< GeometricField< Type, fvPatchField, volMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &, const fvMesh &sMesh, const labelList &patchMap, const labelList &cellMap, const labelList &faceMap)
Map volume field.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
A class for handling words, derived from string.
Definition: word.H:59
const fvMesh & subMesh() const
Return reference to subset mesh.
Namespace for OpenFOAM.
polyMesh::readUpdateState readUpdate()
Read mesh.
Encapsulation of VTK mesh data. Holds mesh or meshsubset and polyhedral-cell decomposition on it...
Definition: vtkMesh.H:52
readUpdateState
Enumeration defining the state of the mesh after a read update.
Definition: polyMesh.H:88
const fvMesh & mesh() const
Access either mesh or submesh.
Definition: vtkMesh.H:119
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject( name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE ))
tmp< GeoField > interpolate(const GeoField &fld) const
Map volume field (does in fact do very little interpolation;.
Definition: vtkMesh.H:153
const fvMeshSubset & subsetter() const
Definition: vtkMesh.H:97
bool useSubMesh() const
Check if running subMesh.
Definition: vtkMesh.H:103
const fvMesh & baseMesh() const
Whole mesh.
Definition: vtkMesh.H:92
A class for managing temporary objects.
Definition: PtrList.H:118
Post-processing mesh subset tool. Given the original mesh and the list of selected cells...
Definition: fvMeshSubset.H:71