triSurfaceRegionSearch.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) 2011-2013 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::triSurfaceRegionSearch
26 
27 Description
28  Helper class to search on triSurface. Creates an octree for each region of
29  the surface and only searches on the specified regions.
30 
31 SourceFiles
32  triSurfaceRegionSearch.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef triSurfaceRegionSearch_H
37 #define triSurfaceRegionSearch_H
38 
39 #include "pointField.H"
40 #include "pointIndexHit.H"
41 #include "triSurfaceSearch.H"
42 #include "labelledTri.H"
43 #include "IndirectList.H"
44 #include "PtrList.H"
45 #include "indexedOctree.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class triSurfaceRegionSearch Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  public triSurfaceSearch
59 {
60  // Private typedefs
61 
62  typedef PrimitivePatch
63  <
66  const pointField&
68 
71 
73 
74 
75  // Private data
76 
77  //- Surface is split into patches by region
78  mutable PtrList<indirectTriSurface> indirectRegionPatches_;
79 
80  //- Search tree for each region
81  mutable PtrList<treeType> treeByRegion_;
82 
83 
84  // Private Member Functions
85 
86  //- Disallow default bitwise copy construct
88 
89  //- Disallow default bitwise assignment
90  void operator=(const triSurfaceRegionSearch&);
91 
92 
93 public:
94 
95  // Constructors
96 
97  //- Construct from surface. Holds reference to surface!
98  explicit triSurfaceRegionSearch(const triSurface&);
99 
100  //- Construct from surface and dictionary. Holds reference to surface!
102 
103 
104  //- Destructor
106 
107  //- Clear storage
108  void clearOut();
109 
110 
111  // Member Functions
112 
113  // Access
114 
115  //- Demand driven construction of octree for each region.
116  // @todo Currently creates a tree for each region; could optimise
117  // by only constructing trees when they are in regionIndices
118  const PtrList<treeType>& treeByRegion() const;
119 
120 
121  // Query
122 
123  //- Find the nearest point on the surface out of the regions
124  // supplied in the list regionIndices. Ignores regions that are
125  // not specified
126  void findNearest
127  (
128  const pointField& samples,
129  const scalarField& nearestDistSqr,
130  const labelList& regionIndices,
131  List<pointIndexHit>& info
132  ) const;
133 };
134 
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
A List with indirect addressing.
Definition: IndirectList.H:102
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
Triangulated surface description with patch information.
Definition: triSurface.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Helper class to search on triSurface. Creates an octree for each region of the surface and only searc...
Namespace for OpenFOAM.
dictionary dict
Triangle with additional region number.
Definition: labelledTri.H:49
void findNearest(const pointField &samples, const scalarField &nearestDistSqr, const labelList &regionIndices, List< pointIndexHit > &info) const
Find the nearest point on the surface out of the regions.
Encapsulation of data needed to search on PrimitivePatches.
Non-pointer based hierarchical recursive searching.
Definition: treeDataEdge.H:47
A list of faces which address into the list of points.
scalarField samples(nIntervals, 0)
const PtrList< treeType > & treeByRegion() const
Demand driven construction of octree for each region.
Helper class to search on triSurface.