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
79 
80  //- Search tree for each region
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 // ************************************************************************* //
Foam::triSurfaceRegionSearch::triSurfaceRegionSearch
triSurfaceRegionSearch(const triSurfaceRegionSearch &)
Disallow default bitwise copy construct.
Foam::triSurfaceRegionSearch::treeByRegion_
PtrList< treeType > treeByRegion_
Search tree for each region.
Definition: triSurfaceRegionSearch.H:80
pointIndexHit.H
Foam::triSurfaceRegionSearch::treeByRegion
const PtrList< treeType > & treeByRegion() const
Demand driven construction of octree for each region.
Definition: triSurfaceRegionSearch.C:71
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:186
indexedOctree.H
Foam::triSurfaceRegionSearch::clearOut
void clearOut()
Clear storage.
Definition: triSurfaceRegionSearch.C:61
Foam::triSurfaceRegionSearch::~triSurfaceRegionSearch
~triSurfaceRegionSearch()
Destructor.
Definition: triSurfaceRegionSearch.C:55
Foam::triSurfaceRegionSearch
Helper class to search on triSurface. Creates an octree for each region of the surface and only searc...
Definition: triSurfaceRegionSearch.H:55
Foam::triSurfaceSearch
Helper class to search on triSurface.
Definition: triSurfaceSearch.H:55
samples
scalarField samples(nIntervals, 0)
Foam::triSurfaceRegionSearch::indirectTriSurface
PrimitivePatch< labelledTri, IndirectList, const pointField & > indirectTriSurface
Definition: triSurfaceRegionSearch.H:66
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::triSurface
Triangulated surface description with patch information.
Definition: triSurface.H:57
Foam::triSurfaceRegionSearch::operator=
void operator=(const triSurfaceRegionSearch &)
Disallow default bitwise assignment.
Foam::IndirectList
A List with indirect addressing.
Definition: IndirectList.H:102
IndirectList.H
Foam::indexedOctree
Non-pointer based hierarchical recursive searching.
Definition: treeDataTriSurface.H:47
Foam::PtrList
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
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::triSurfaceRegionSearch::treeDataIndirectTriSurface
treeDataPrimitivePatch< indirectTriSurface > treeDataIndirectTriSurface
Definition: triSurfaceRegionSearch.H:69
pointField.H
Foam::treeDataPrimitivePatch
Encapsulation of data needed to search on PrimitivePatches.
Definition: treeDataPrimitivePatch.H:61
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::labelledTri
Triangle with additional region number.
Definition: labelledTri.H:49
triSurfaceSearch.H
PtrList.H
Foam::triSurfaceRegionSearch::treeType
indexedOctree< treeDataIndirectTriSurface > treeType
Definition: triSurfaceRegionSearch.H:71
labelledTri.H
Foam::triSurfaceRegionSearch::indirectRegionPatches_
PtrList< indirectTriSurface > indirectRegionPatches_
Surface is split into patches by region.
Definition: triSurfaceRegionSearch.H:77
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88