FreeFOAM The Cross-Platform CFD Toolkit
searchablePlate.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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::searchablePlate
26 
27 Description
28  Searching on finite plate. Plate has to be aligned with coordinate
29  axes.
30  Plate defined as origin and span. One of the components of span has
31  to be 0 which defines the normal direction. E.g.
32 
33  span = (Sx Sy 0) // plate in x-y plane
34  origin = (Ox Oy Oz)
35 
36  now plane is from (Ox Oy Oz) to (Ox+Sx Oy+Sy Oz)
37 
38 SourceFiles
39  searchablePlate.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef searchablePlate_H
44 #define searchablePlate_H
45 
46 #include "searchableSurface.H"
47 #include <meshTools/treeBoundBox.H>
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward declaration of classes
55 
56 /*---------------------------------------------------------------------------*\
57  Class searchablePlate Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 :
62  public searchableSurface
63 {
64 private:
65 
66  // Private Member Data
67 
68  const point origin_;
69 
70  const vector span_;
71 
72  //- Coordinate direction which is normal
73  const direction normalDir_;
74 
75  mutable wordList regions_;
76 
77 
78  // Private Member Functions
79 
80  //- Calculate normal direction from span
81  static direction calcNormal(const point&);
82 
83  pointIndexHit findNearest
84  (
85  const point& sample,
86  const scalar nearestDistSqr
87  ) const;
88 
89  pointIndexHit findLine
90  (
91  const point& start,
92  const point& end
93  ) const;
94 
95 
96  //- Disallow default bitwise copy construct
98 
99  //- Disallow default bitwise assignment
100  void operator=(const searchablePlate&);
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("searchablePlate");
107 
108 
109  // Constructors
110 
111  //- Construct from components
113  (
114  const IOobject& io,
115  const point& origin,
116  const point& span
117  );
118 
119  //- Construct from dictionary (used by searchableSurface)
121  (
122  const IOobject& io,
123  const dictionary& dict
124  );
125 
126  // Destructor
127 
128  virtual ~searchablePlate();
129 
130 
131  // Member Functions
132 
133  virtual const wordList& regions() const;
134 
135  //- Whether supports volume type below
136  virtual bool hasVolumeType() const
137  {
138  return false;
139  }
140 
141  //- Range of local indices that can be returned.
142  virtual label size() const
143  {
144  return 1;
145  }
146 
147  //- Get representative set of element coordinates
148  // Usually the element centres (should be of length size()).
149  virtual pointField coordinates() const
150  {
151  return pointField(1, origin_);
152  }
153 
154 
155  // Multiple point queries.
156 
157  virtual void findNearest
158  (
159  const pointField& sample,
160  const scalarField& nearestDistSqr,
162  ) const;
163 
164  virtual void findLine
165  (
166  const pointField& start,
167  const pointField& end,
169  ) const;
170 
171  virtual void findLineAny
172  (
173  const pointField& start,
174  const pointField& end,
176  ) const;
177 
178  //- Get all intersections in order from start to end.
179  virtual void findLineAll
180  (
181  const pointField& start,
182  const pointField& end,
184  ) const;
185 
186  //- From a set of points and indices get the region
187  virtual void getRegion
188  (
189  const List<pointIndexHit>&,
190  labelList& region
191  ) const;
192 
193  //- From a set of points and indices get the normal
194  virtual void getNormal
195  (
196  const List<pointIndexHit>&,
198  ) const;
199 
200  //- Determine type (inside/outside/mixed) for point. unknown if
201  // cannot be determined (e.g. non-manifold surface)
202  virtual void getVolumeType
203  (
204  const pointField&,
206  ) const;
207 
208 
209  // regIOobject implementation
210 
211  bool writeData(Ostream&) const
212  {
213  notImplemented("searchablePlate::writeData(Ostream&) const");
214  return false;
215  }
216 
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************ vim: set sw=4 sts=4 et: ************************ //