vtkPVblockMesh.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2017 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::vtkPVblockMesh
29 
30 Description
31  The backend for the vtkPVblockMeshReader reader module -
32  providing a paraview reader interface for OpenFOAM blockMesh.
33 
34  The block reader module can assist when creating a blockMeshDict
35  for use with the blockMesh utility. As well as blocks, it can be
36  used to visualize edges,corners and patch names.
37 
38  There is no native VTK equivalent for this functionality.
39 
40 SourceFiles
41  vtkPVblockMesh.C
42  vtkPVblockMeshConvert.C
43 
44  // Needed by VTK:
45  vtkDataArrayTemplateImplicit.txx
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef vtkPVblockMesh_H
50 #define vtkPVblockMesh_H
51 
52 #include "foamPvCore.H"
53 
54 // * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
55 
56 class vtkDataArraySelection;
57 class vtkDataSet;
58 class vtkPoints;
59 class vtkPVblockMeshReader;
60 class vtkRenderer;
61 class vtkTextActor;
62 class vtkMultiBlockDataSet;
63 class vtkPolyData;
64 class vtkUnstructuredGrid;
65 class vtkIndent;
66 
67 template<class T> class vtkSmartPointer;
68 
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 
71 namespace Foam
72 {
73 
74 // OpenFOAM class forward declarations
75 class argList;
76 class Time;
77 class blockMesh;
78 
79 template<class Type> class List;
80 
81 /*---------------------------------------------------------------------------*\
82  Class vtkPVblockMesh Declaration
83 \*---------------------------------------------------------------------------*/
84 
85 class vtkPVblockMesh
86 :
87  private foamPvCore
88 {
89  // Private Data
90 
91  //- Access to the controlling vtkPVblockMeshReader
92  vtkPVblockMeshReader* reader_;
93 
94  //- OpenFOAM time control
95  autoPtr<Time> dbPtr_;
96 
97  //- OpenFOAM mesh
98  blockMesh* meshPtr_;
99 
100  //- The mesh region
101  word meshRegion_;
102 
103  //- The mesh directory for the region
104  fileName meshDir_;
105 
106  //- First instance and size of bleckMesh blocks
107  // used to index into blockStatus_
108  arrayRange rangeBlocks_;
109 
110  //- First instance and size of CurvedEdges (only partially used)
111  arrayRange rangeEdges_;
112 
113  //- First instance and size of block corners (only partially used)
114  arrayRange rangeCorners_;
115 
116  //- List of patch names for rendering to window
117  List<vtkSmartPointer<vtkTextActor>> patchTextActors_;
118 
119  //- List of point numbers for rendering to window
120  List<vtkSmartPointer<vtkTextActor>> pointTextActors_;
121 
122 
123  // Private Member Functions
124 
125  //- Reset data counters
126  void resetCounters();
127 
128  //- OpenFOAM mesh
129  void updateFoamMesh();
130 
131  //- Internal block info
132  void updateInfoBlocks(vtkDataArraySelection* select);
133 
134  //- Block curved edges info
135  void updateInfoEdges(vtkDataArraySelection* select);
136 
137  //- Mesh blocks
138  void convertMeshBlocks(vtkMultiBlockDataSet*, int& blockNo);
139 
140  //- Mesh curved edges
141  void convertMeshEdges(vtkMultiBlockDataSet*, int& blockNo);
142 
143  //- Mesh corners
144  void convertMeshCorners(vtkMultiBlockDataSet*, int& blockNo);
145 
146 
147  //- No copy construct
148  vtkPVblockMesh(const vtkPVblockMesh&) = delete;
149 
150  //- No copy assignment
151  void operator=(const vtkPVblockMesh&) = delete;
152 
153 
154 public:
155 
156  //- Static data members
157 
158  ClassName("vtkPVblockMesh");
159 
160 
161  // Constructors
162 
163  //- Construct from components
165  (
166  const char* const FileName,
167  vtkPVblockMeshReader* reader
168  );
169 
170 
171  //- Destructor
172  ~vtkPVblockMesh();
173 
174 
175  // Member Functions
176 
177  //- Update
178  void updateInfo();
179 
180  void Update(vtkMultiBlockDataSet* output);
181 
182  //- Final part of Update(), after any last minute rendering.
183  void UpdateFinalize();
184 
185  //- Add/remove patch names to/from the view
186  void renderPatchNames(vtkRenderer* renderer, const bool show);
187 
188  //- Add/remove point numbers to/from the view
189  void renderPointNumbers(vtkRenderer* renderer, const bool show);
190 
191 
192  // Access
193 
194  //- Debug information
195  void PrintSelf(ostream&, vtkIndent) const;
196 
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
Foam::vtkPVblockMesh::~vtkPVblockMesh
~vtkPVblockMesh()
Destructor.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
foamPvCore.H
Helpers for OpenFOAM reader interfaces in ParaView.
Foam::foamPvCore::arrayRange
Bookkeeping for GUI checklists and multi-block organization.
Definition: foamPvCore.H:77
vtkSmartPointer
Definition: runTimePostProcessing.H:148
Foam::foamPvCore
Definition: foamPvCore.H:71
Foam::vtkPVblockMesh::PrintSelf
void PrintSelf(ostream &, vtkIndent) const
Debug information.
Foam::vtkPVblockMesh::renderPatchNames
void renderPatchNames(vtkRenderer *renderer, const bool show)
Add/remove patch names to/from the view.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vtkPVblockMesh::ClassName
ClassName("vtkPVblockMesh")
Static data members.
Foam::vtkPVblockMesh
The backend for the vtkPVblockMeshReader reader module - providing a paraview reader interface for Op...
Definition: vtkPVblockMesh.H:84
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::vtkPVblockMesh::UpdateFinalize
void UpdateFinalize()
Final part of Update(), after any last minute rendering.
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:102
Foam::vtkPVblockMesh::renderPointNumbers
void renderPointNumbers(vtkRenderer *renderer, const bool show)
Add/remove point numbers to/from the view.
Foam::vtkPVblockMesh::updateInfo
void updateInfo()
Update.
Foam::vtkPVblockMesh::Update
void Update(vtkMultiBlockDataSet *output)
Foam::blockMesh
A multi-block mesh generator.
Definition: blockMesh.H:64