refinementFeatures.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-2020 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::refinementFeatures
26 
27 Description
28  Encapsulates queries for features.
29 
30 SourceFiles
31  refinementFeatures.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef refinementFeatures_H
36 #define refinementFeatures_H
37 
39 #include "indexedOctree.H"
40 #include "treeDataEdge.H"
41 #include "treeDataPoint.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class refinementFeatures Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 :
54  public PtrList<extendedFeatureEdgeMesh>
55 {
56  // Private Data
57 
58  //- Per shell the list of ranges
59  List<scalarField> distances_;
60 
61  //- Per shell per distance the refinement level
62  labelListList levels_;
63 
64  //- Edge
66 
67  //- Features points
69 
70  //- Region edge trees (demand driven)
72  regionEdgeTreesPtr_;
73 
74 
75  // Private Member Functions
76 
77  //- Read set of feature edge meshes
78  void read(const objectRegistry&, const PtrList<dictionary>&);
79 
80  //- Build edge tree and feature point tree
81  void buildTrees(const label);
82 
83  //- Find shell level higher than ptLevel
84  void findHigherLevel
85  (
86  const pointField& pt,
87  const label featI,
88  labelList& maxLevel
89  ) const;
90 
91 
92 protected:
93 
95  {
96  return edgeTrees_;
97  }
98 
100  {
101  return pointTrees_;
102  }
103 
104 
106 
107 public:
108 
109  // Constructors
110 
111  //- Construct from description
113  (
114  const objectRegistry& io,
115  const PtrList<dictionary>& featDicts
116  );
117 
118 
119  // Member Functions
120 
121  // Access
122 
123  //- Per featureEdgeMesh the list of level
124  const labelListList& levels() const
125  {
126  return levels_;
127  }
128 
129  //- Per featureEdgeMesh the list of ranges
130  const List<scalarField>& distances() const
131  {
132  return distances_;
133  }
134 
135 
136  // Query
137 
138  //- Highest distance of all features
139  scalar maxDistance() const;
140 
141  //- Find nearest point on nearest feature edge. Sets:
142  //
143  // - nearFeature: index of feature mesh
144  // - nearInfo : location on feature edge and edge index
145  // (note: not feature edge index but index into edges()
146  // directly)
147  // - nearNormal : local feature edge normal
148  void findNearestEdge
149  (
150  const pointField& samples,
151  const scalarField& nearestDistSqr,
152  labelList& nearFeature,
154  vectorField& nearNormal
155  ) const;
156 
157  //- Find nearest point on nearest region edge. Sets:
158  //
159  // - nearFeature: index of feature mesh
160  // - nearInfo : location on feature edge and edge index
161  // (note: not feature edge index but index into edges()
162  // directly)
163  // - nearNormal : local feature edge normal
165  (
166  const pointField& samples,
167  const scalarField& nearestDistSqr,
168  labelList& nearFeature,
169  List<pointIndexHit>& nearInfo,
170  vectorField& nearNormal
171  ) const;
172 
173  //- Find nearest feature point. Sets:
174  //
175  // - nearFeature: index of feature mesh
176  // - nearInfo : location on feature point and point index.
177  // (note: not index into shapes().pointLabels() but index
178  // into points() directly)
179  void findNearestPoint
180  (
181  const pointField& samples,
182  const scalarField& nearestDistSqr,
183  labelList& nearFeature,
184  List<pointIndexHit>& nearInfo
185  ) const;
186 
187  //- Find shell level higher than ptLevel
188  void findHigherLevel
189  (
190  const pointField& pt,
191  const labelList& ptLevel,
192  labelList& maxLevel
193  ) const;
194 
195 };
196 
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 } // End namespace Foam
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #endif
205 
206 // ************************************************************************* //
const PtrList< indexedOctree< treeDataPoint > > & pointTrees() const
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
refinementFeatures(const objectRegistry &io, const PtrList< dictionary > &featDicts)
Construct from description.
scalar maxDistance() const
Highest distance of all features.
void findNearestPoint(const pointField &samples, const scalarField &nearestDistSqr, labelList &nearFeature, List< pointIndexHit > &nearInfo) const
Find nearest feature point. Sets:
Tuple2< scalar, label > nearInfo
Private class for finding nearest.
Encapsulates queries for features.
scalarField samples(nIntervals, 0)
const List< scalarField > & distances() const
Per featureEdgeMesh the list of ranges.
const PtrList< indexedOctree< treeDataEdge > > & edgeTrees() const
void findNearestRegionEdge(const pointField &samples, const scalarField &nearestDistSqr, labelList &nearFeature, List< pointIndexHit > &nearInfo, vectorField &nearNormal) const
Find nearest point on nearest region edge. Sets:
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:70
const PtrList< indexedOctree< treeDataEdge > > & regionEdgeTrees() const
void findNearestEdge(const pointField &samples, const scalarField &nearestDistSqr, labelList &nearFeature, List< pointIndexHit > &nearInfo, vectorField &nearNormal) const
Find nearest point on nearest feature edge. Sets:
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Registry of regIOobjects.
const labelListList & levels() const
Per featureEdgeMesh the list of level.
Namespace for OpenFOAM.