vtkPVFoamAddToSelection.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 \*---------------------------------------------------------------------------*/
25 
26 #ifndef vtkPVFoamAddToSelection_H
27 #define vtkPVFoamAddToSelection_H
28 
29 // OpenFOAM includes
30 #include "IOobjectList.H"
31 #include "SortableList.H"
32 #include "surfaceFields.H"
33 
34 // VTK includes
35 #include "vtkDataArraySelection.h"
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 template<class Type>
40 Foam::label Foam::vtkPVFoam::addToSelection
41 (
42  vtkDataArraySelection *select,
43  const IOobjectList& objectLst,
44  const string& suffix
45 )
46 {
47  SortableList<word> names(objectLst.names(Type::typeName));
48 
49  forAll(names, nameI)
50  {
51  if (suffix.size())
52  {
53  select->AddArray
54  (
55  (names[nameI] + suffix).c_str()
56  );
57  }
58  else
59  {
60  select->AddArray
61  (
62  (names[nameI]).c_str()
63  );
64  }
65  }
66 
67  return names.size();
68 }
69 
70 
71 template<template<class> class patchType, class meshType>
72 void Foam::vtkPVFoam::addFieldsToSelection
73 (
74  vtkDataArraySelection *select,
75  const IOobjectList& objects,
76  const string& suffix
77 )
78 {
79  addToSelection<GeometricField<scalar, patchType, meshType>>
80  (
81  select,
82  objects,
83  suffix
84  );
85 
86  addToSelection<GeometricField<vector, patchType, meshType>>
87  (
88  select,
89  objects,
90  suffix
91  );
92 
93  addToSelection<GeometricField<sphericalTensor, patchType, meshType>>
94  (
95  select,
96  objects,
97  suffix
98  );
99 
100  addToSelection<GeometricField<symmTensor, patchType, meshType>>
101  (
102  select,
103  objects,
104  suffix
105  );
106 
107  addToSelection<GeometricField<tensor, patchType, meshType>>
108  (
109  select,
110  objects,
111  suffix
112  );
113 }
114 
115 
116 template<template<class> class patchType, class meshType>
117 void Foam::vtkPVFoam::addInternalFieldsToSelection
118 (
119  vtkDataArraySelection *select,
120  const IOobjectList& objects,
121  const string& suffix
122 )
123 {
124  addToSelection
125  <
126  typename
128  >
129  (
130  select,
131  objects,
132  suffix
133  );
134 
135  addToSelection
136  <
137  typename
139  >
140  (
141  select,
142  objects,
143  suffix
144  );
145 
146  addToSelection
147  <
148  typename
150  >
151  (
152  select,
153  objects,
154  suffix
155  );
156 
157  addToSelection
158  <
159  typename
161  >
162  (
163  select,
164  objects,
165  suffix
166  );
167 
168  addToSelection
169  <
170  typename
172  >
173  (
174  select,
175  objects,
176  suffix
177  );
178 }
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #endif
184 
185 // ************************************************************************* //
Foam::surfaceFields.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:50
A list that is sorted upon construction or when explicitly requested with the sort() method...
Definition: List.H:80
wordList names() const
Return the list of names of the IOobjects.
Definition: IOobjectList.C:213
objects
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...