All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sampledSet.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::sampledSet
26 
27 Description
28  Holds list of sampling points which is filled at construction time.
29  Various implementations of this base class to e.g. get sampling points
30  at uniform distance along a line (lineUniformSet) or directly specified
31  (pointsSet)
32 
33  Each 'sampledSet' has a name and a specifier of how the axis should be
34  write (x/y/z component or all 3 components)
35 
36 SourceFiles
37  sampledSet.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef sampledSet_H
42 #define sampledSet_H
43 
44 #include "coordSet.H"
45 #include "typeInfo.H"
46 #include "runTimeSelectionTables.H"
47 #include "autoPtr.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward declaration of classes
55 class polyMesh;
56 class meshSearch;
57 
58 /*---------------------------------------------------------------------------*\
59  Class sampledSet Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class sampledSet
63 :
64  public coordSet
65 {
66  // Private Data
67 
68  //- Reference to mesh
69  const polyMesh& mesh_;
70 
71  //- Reference to mesh searching class
72  const meshSearch& searchEngine_;
73 
74 
75 protected:
76 
77  // Protected data
78 
79  //- Segment numbers
81 
82  //- Cell numbers
84 
85  //- Face numbers (-1 if not known)
87 
88 
89  // Protected Member Functions
90 
91  //- Sets sample data
92  void setSamples
93  (
94  const List<point>& samplingPts,
95  const labelList& samplingCells,
96  const labelList& samplingFaces,
97  const labelList& samplingSegments,
98  const scalarList& samplingCurveDist
99  );
100 
101 
102 public:
103 
104  //- Runtime type information
105  TypeName("sampledSet");
106 
107 
108  // Declare run-time constructor selection table
109 
111  (
112  autoPtr,
113  sampledSet,
114  word,
115  (
116  const word& name,
117  const polyMesh& mesh,
118  const meshSearch& searchEngine,
119  const dictionary& dict
120  ),
121  (name, mesh, searchEngine, dict)
122  );
123 
124 
125  //- Class used for the read-construction of
126  // PtrLists of sampledSet
127  class iNew
128  {
129  const polyMesh& mesh_;
130  const meshSearch& searchEngine_;
131 
132  public:
134  iNew(const polyMesh& mesh, const meshSearch& searchEngine)
135  :
136  mesh_(mesh),
137  searchEngine_(searchEngine)
138  {}
141  {
142  word name(is);
143  dictionary dict(is);
144  return sampledSet::New(name, mesh_, searchEngine_, dict);
145  }
146  };
147 
148 
149  // Constructors
150 
151  //- Construct from components
152  sampledSet
153  (
154  const word& name,
155  const polyMesh& mesh,
156  const meshSearch& searchEngine,
157  const word& axis
158  );
159 
160  //- Construct from dictionary
161  sampledSet
162  (
163  const word& name,
164  const polyMesh& mesh,
165  const meshSearch& searchEngine,
166  const dictionary& dict
167  );
168 
169  //- Clone
170  autoPtr<sampledSet> clone() const
171  {
173  return autoPtr<sampledSet>(nullptr);
174  }
175 
176 
177  // Selectors
178 
179  //- Return a reference to the selected sampledSet
180  static autoPtr<sampledSet> New
181  (
182  const word& name,
183  const polyMesh& mesh,
184  const meshSearch& searchEngine,
185  const dictionary& dict
186  );
187 
188 
189  //- Destructor
190  virtual ~sampledSet();
191 
192 
193  // Member Functions
195  const polyMesh& mesh() const
196  {
197  return mesh_;
198  }
200  const meshSearch& searchEngine() const
201  {
202  return searchEngine_;
203  }
205  const labelList& segments() const
206  {
207  return segments_;
208  }
210  const labelList& cells() const
211  {
212  return cells_;
213  }
215  const labelList& faces() const
216  {
217  return faces_;
218  }
219 
220  //- Output for debugging
221  Ostream& write(Ostream&) const;
222 };
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #endif
232 
233 // ************************************************************************* //
Various (local, not parallel) searches on polyMesh; uses (demand driven) octree to search...
Definition: meshSearch.H:57
dictionary dict
const polyMesh & mesh() const
Definition: sampledSet.H:194
word axis() const
Definition: coordSet.H:116
iNew(const polyMesh &mesh, const meshSearch &searchEngine)
Definition: sampledSet.H:133
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
static autoPtr< sampledSet > New(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict)
Return a reference to the selected sampledSet.
Definition: sampledSet.C:136
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual ~sampledSet()
Destructor.
Definition: sampledSet.C:129
void setSamples(const List< point > &samplingPts, const labelList &samplingCells, const labelList &samplingFaces, const labelList &samplingSegments, const scalarList &samplingCurveDist)
Sets sample data.
Definition: sampledSet.C:47
const labelList & faces() const
Definition: sampledSet.H:214
Ostream & write(Ostream &) const
Output for debugging.
Definition: sampledSet.C:197
Holds list of sampling positions.
Definition: coordSet.H:49
const labelList & segments() const
Definition: sampledSet.H:204
autoPtr< sampledSet > operator()(Istream &is) const
Definition: sampledSet.H:139
Holds list of sampling points which is filled at construction time. Various implementations of this b...
Definition: sampledSet.H:61
A class for handling words, derived from string.
Definition: word.H:59
TypeName("sampledSet")
Runtime type information.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Class used for the read-construction of.
Definition: sampledSet.H:126
labelList segments_
Segment numbers.
Definition: sampledSet.H:79
declareRunTimeSelectionTable(autoPtr, sampledSet, word,(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const dictionary &dict),(name, mesh, searchEngine, dict))
const word & name() const
Definition: coordSet.H:111
sampledSet(const word &name, const polyMesh &mesh, const meshSearch &searchEngine, const word &axis)
Construct from components.
Definition: sampledSet.C:94
const meshSearch & searchEngine() const
Definition: sampledSet.H:199
autoPtr< sampledSet > clone() const
Clone.
Definition: sampledSet.H:169
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
labelList cells_
Cell numbers.
Definition: sampledSet.H:82
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Macros to ease declaration of run-time selection tables.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
const labelList & cells() const
Definition: sampledSet.H:209
labelList faces_
Face numbers (-1 if not known)
Definition: sampledSet.H:85
Namespace for OpenFOAM.