volumeFilter.C
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) 2019 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 // OpenFOAM includes
29 #include "volumeFilter.H"
30 #include "runTimePostProcessing.H"
31 
32 // VTK includes
33 #include "vtkCellData.h"
34 #include "vtkCellDataToPointData.h"
35 #include "vtkCompositeDataGeometryFilter.h"
36 #include "vtkCompositeDataSet.h"
37 #include "vtkCompositePolyDataMapper.h"
38 #include "vtkMultiPieceDataSet.h"
39 #include "vtkPointData.h"
40 #include "vtkPolyData.h"
41 #include "vtkPolyDataMapper.h"
42 #include "vtkSmartPointer.h"
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
47 (
48  const runTimePostProcessing& parent,
49  const dictionary& dict,
50  const HashPtrTable<Function1<vector>>& colours
51 )
52 :
53  surface(parent, dict, colours)
54 {}
55 
56 
57 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
58 
61 (
62  Foam::vtk::vtuAdaptor& adaptor
63 ) const
64 {
66 
67  multiPiece->SetNumberOfPieces(Pstream::nProcs());
68  multiPiece->SetPiece
69  (
70  Pstream::myProcNo(),
71  adaptor.internal(parent().mesh())
72  );
73 
74  return multiPiece;
75 }
76 
77 
79 (
80  vtkDataSet* piece,
81  const vtk::vtuAdaptor& adaptor,
82  const regIOobject* ioptr,
83  const word& fieldName
84 ) const
85 {
86  return (piece && ioptr) &&
87  (
88  addDimField<scalar>
89  (
90  piece, adaptor, ioptr, fieldName
91  )
92  || addDimField<vector>
93  (
94  piece, adaptor, ioptr, fieldName
95  )
96  || addDimField<sphericalTensor>
97  (
98  piece, adaptor, ioptr, fieldName
99  )
100  || addDimField<symmTensor>
101  (
102  piece, adaptor, ioptr, fieldName
103  )
104  || addDimField<tensor>
105  (
106  piece, adaptor, ioptr, fieldName
107  )
108  );
109 }
110 
111 
113 (
114  vtkMultiPieceDataSet* piece,
115  const vtk::vtuAdaptor& adaptor,
116  const regIOobject* ioptr,
117  const word& fieldName
118 ) const
119 {
120  return (piece && ioptr) &&
121  (
122  addDimField<scalar>
123  (
124  piece, adaptor, ioptr, fieldName
125  )
126  || addDimField<vector>
127  (
128  piece, adaptor, ioptr, fieldName
129  )
130  || addDimField<sphericalTensor>
131  (
132  piece, adaptor, ioptr, fieldName
133  )
134  || addDimField<symmTensor>
135  (
136  piece, adaptor, ioptr, fieldName
137  )
138  || addDimField<tensor>
139  (
140  piece, adaptor, ioptr, fieldName
141  )
142  );
143 }
144 
145 
146 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
vtkSmartPointer
Definition: runTimePostProcessing.H:148
Foam::functionObjects::runTimePostPro::volumeFilter::mesh
vtkSmartPointer< vtkMultiPieceDataSet > mesh(Foam::vtk::vtuAdaptor &adaptor) const
Return a vtu mesh with addressing information stored in adaptor.
Definition: volumeFilter.C:61
Foam::functionObjects::runTimePostPro::volumeFilter::volumeFilter
volumeFilter(const volumeFilter &)=delete
No copy construct.
Foam::functionObjects::runTimePostPro::volumeFilter::addDimField
bool addDimField(vtkDataSet *piece, const vtk::vtuAdaptor &adaptor, const regIOobject *ioptr, const word &fieldName) const
Definition: volumeFilter.C:79
Foam::Function1
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:56
Foam::functionObjects::runTimePostProcessing
Generate images during run-time.
Definition: runTimePostProcessing.H:170
Foam::functionObjects::runTimePostPro::surface
Visualisation of surface data with additional routines for handling parallel distributed data.
Definition: surface.H:180
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:67
runTimePostProcessing.H
volumeFilter.H
Foam::HashPtrTable
A HashTable of pointers to objects of type <T>.
Definition: HashPtrTable.H:54
Foam::vtk::vtuAdaptor
Bookkeeping for vtkUnstructuredGrid.
Definition: foamVtkVtuAdaptor.H:78
Foam::vtk::vtuAdaptor::internal
vtkSmartPointer< vtkUnstructuredGrid > internal(const fvMesh &mesh, const bool decompPoly=false)
Internal mesh as vtkUnstructuredGrid.
Definition: foamVtkVtuAdaptorI.H:101