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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::triSurfaceRegionSearch
29 
30 Description
31  Helper class to search on triSurface. Creates an octree for each region of
32  the surface and only searches on the specified regions.
33 
34 SourceFiles
35  triSurfaceRegionSearch.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef triSurfaceRegionSearch_H
40 #define triSurfaceRegionSearch_H
41 
42 #include "pointField.H"
43 #include "pointIndexHit.H"
44 #include "triSurfaceSearch.H"
45 #include "labelledTri.H"
46 #include "IndirectList.H"
47 #include "PtrList.H"
48 #include "indexedOctree.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class triSurfaceRegionSearch Declaration
57 \*---------------------------------------------------------------------------*/
58 
60 :
61  public triSurfaceSearch
62 {
63  // Private Typedefs
64 
67 
70 
72 
73 
74  // Private data
75 
76  //- Surface is split into patches by region
77  mutable PtrList<indirectTriSurface> indirectRegionPatches_;
78 
79  //- Search tree for each region
80  mutable PtrList<treeType> treeByRegion_;
81 
82 
83  // Private Member Functions
84 
85  //- No copy construct
87 
88  //- No copy assignment
89  void operator=(const triSurfaceRegionSearch&) = delete;
90 
91 
92 public:
93 
94  // Constructors
95 
96  //- Construct from surface. Holds reference to surface!
97  explicit triSurfaceRegionSearch(const triSurface&);
98 
99  //- Construct from surface and dictionary. Holds reference to surface!
101 
102 
103  //- Destructor
105 
106  //- Clear storage
107  void clearOut();
108 
109 
110  // Member Functions
111 
112  // Access
113 
114  //- Demand driven construction of octree for each region.
115  // Currently creates a tree for each region; could optimise
116  // by only constructing trees when they are in regionIndices
117  const PtrList<treeType>& treeByRegion() const;
118 
119  // Query
120 
121  //- Find the nearest point on the surface out of the regions
122  // supplied in the list regionIndices. Ignores regions that are
123  // not specified
124  void findNearest
125  (
126  const pointField& samples,
127  const scalarField& nearestDistSqr,
128  const labelList& regionIndices,
129  List<pointIndexHit>& info
130  ) const;
131 };
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
pointIndexHit.H
Foam::triSurfaceRegionSearch::treeByRegion
const PtrList< treeType > & treeByRegion() const
Demand driven construction of octree for each region.
Definition: triSurfaceRegionSearch.C:74
Foam::triSurfaceRegionSearch::findNearest
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.
Definition: triSurfaceRegionSearch.C:191
indexedOctree.H
Foam::triSurfaceRegionSearch::clearOut
void clearOut()
Clear storage.
Definition: triSurfaceRegionSearch.C:64
Foam::triSurfaceRegionSearch::~triSurfaceRegionSearch
~triSurfaceRegionSearch()
Destructor.
Definition: triSurfaceRegionSearch.C:58
Foam::triSurfaceRegionSearch
Helper class to search on triSurface. Creates an octree for each region of the surface and only searc...
Definition: triSurfaceRegionSearch.H:58
Foam::triSurfaceSearch
Helper class to search on triSurface.
Definition: triSurfaceSearch.H:58
Foam::Field< vector >
Foam::triSurface
Triangulated surface description with patch information.
Definition: triSurface.H:76
IndirectList.H
Foam::indexedOctree
Non-pointer based hierarchical recursive searching.
Definition: treeDataEdge.H:50
samples
scalarField samples(nIntervals, Zero)
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
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:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
pointField.H
Foam::treeDataPrimitivePatch
Encapsulation of data needed to search on PrimitivePatches.
Definition: treeDataPrimitivePatch.H:63
Foam::List< label >
triSurfaceSearch.H
PtrList.H
labelledTri.H
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79