vtkMesh.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 
67 
68 public:
69 
70  // Constructors
71 
72  //- Construct from components
73  vtkMesh(fvMesh& baseMesh, const word& setName = "");
74 
75  //- Disallow default bitwise copy construction
76  vtkMesh(const vtkMesh&) = delete;
77 
78 
79  // Member Functions
80 
81  // Access
82 
83  //- Whole mesh
84  const fvMesh& baseMesh() const
85  {
86  return baseMesh_;
87  }
88 
89  const fvMeshSubset& subsetter() const
90  {
91  return subsetter_;
92  }
93 
94  //- Check if running subMesh
95  bool useSubMesh() const
96  {
97  return setName_.size();
98  }
99 
100  //- Access either mesh or submesh
101  const fvMesh& mesh() const
102  {
103  if (useSubMesh())
104  {
105  return subsetter_.subMesh();
106  }
107  else
108  {
109  return baseMesh_;
110  }
111  }
112 
113 
114  // Edit
115 
116  //- Read mesh
118 
119 
120  //- Map volume field (does in fact do very little interpolation;
121  // just copied from fvMeshSubset)
122  template<class GeoField>
123  tmp<GeoField> interpolate(const GeoField& fld) const
124  {
125  if (useSubMesh())
126  {
127  tmp<GeoField> subFld = subsetter_.interpolate(fld);
128  subFld.ref().rename(fld.name());
129  return subFld;
130  }
131  else
132  {
133  return fld;
134  }
135  }
136 
137 
138  // Member Operators
139 
140  //- Disallow default bitwise assignment
141  void operator=(const vtkMesh&) = delete;
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #endif
152 
153 // ************************************************************************* //
const fvMesh & mesh() const
Access either mesh or submesh.
Definition: vtkMesh.H:100
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
vtkMesh(fvMesh &baseMesh, const word &setName="")
Construct from components.
tmp< GeoField > interpolate(const GeoField &fld) const
Map volume field (does in fact do very little interpolation;.
Definition: vtkMesh.H:122
polyMesh::readUpdateState readUpdate()
Read mesh.
const fvMeshSubset & subsetter() const
Definition: vtkMesh.H:88
const fvMesh & subMesh() const
Return reference to subset mesh.
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))
A class for handling words, derived from string.
Definition: word.H:59
bool useSubMesh() const
Check if running subMesh.
Definition: vtkMesh.H:94
Encapsulation of VTK mesh data. Holds mesh or meshsubset and polyhedral-cell decomposition on it...
Definition: vtkMesh.H:52
Post-processing mesh subset tool. Given the original mesh and the list of selected cells...
Definition: fvMeshSubset.H:73
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:95
const fvMesh & baseMesh() const
Whole mesh.
Definition: vtkMesh.H:83
readUpdateState
Enumeration defining the state of the mesh after a read update.
Definition: polyMesh.H:90
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.
void operator=(const vtkMesh &)=delete
Disallow default bitwise assignment.