refinementFeatures.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-2016 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:
57 
58  // Private data
59 
60  //- Per shell the list of ranges
61  List<scalarField> distances_;
62 
63  //- Per shell per distance the refinement level
64  labelListList levels_;
65 
66  //- Edge
68 
69  //- Features points
71 
72  //- Region edge trees (demand driven)
74  regionEdgeTreesPtr_;
75 
76 
77  // Private Member Functions
78 
79  //- Read set of feature edge meshes
80  void read(const objectRegistry&, const PtrList<dictionary>&);
81 
82  //- Build edge tree and feature point tree
83  void buildTrees(const label);
84 
85  //- Find shell level higher than ptLevel
86  void findHigherLevel
87  (
88  const pointField& pt,
89  const label featI,
90  labelList& maxLevel
91  ) const;
92 
93 
94 protected:
95 
97  {
98  return edgeTrees_;
99  }
102  {
103  return pointTrees_;
104  }
105 
106 
108 
109 public:
110 
111  // Constructors
112 
113  //- Construct from description
115  (
116  const objectRegistry& io,
117  const PtrList<dictionary>& featDicts
118  );
119 
120 
121  // Member Functions
122 
123  // Access
124 
125  //- Per featureEdgeMesh the list of level
126  const labelListList& levels() const
127  {
128  return levels_;
129  }
130 
131  //- Per featureEdgeMesh the list of ranges
132  const List<scalarField>& distances() const
133  {
134  return distances_;
135  }
136 
137 
138  // Query
139 
140  //- Highest distance of all features
141  scalar maxDistance() const;
142 
143  //- Find nearest point on nearest feature edge. Sets:
144  //
145  // - nearFeature: index of feature mesh
146  // - nearInfo : location on feature edge and edge index
147  // (note: not feature edge index but index into edges()
148  // directly)
149  // - nearNormal : local feature edge normal
150  void findNearestEdge
151  (
152  const pointField& samples,
153  const scalarField& nearestDistSqr,
154  labelList& nearFeature,
156  vectorField& nearNormal
157  ) const;
158 
159  //- Find nearest point on nearest region edge. Sets:
160  //
161  // - nearFeature: index of feature mesh
162  // - nearInfo : location on feature edge and edge index
163  // (note: not feature edge index but index into edges()
164  // directly)
165  // - nearNormal : local feature edge normal
167  (
168  const pointField& samples,
169  const scalarField& nearestDistSqr,
170  labelList& nearFeature,
171  List<pointIndexHit>& nearInfo,
172  vectorField& nearNormal
173  ) const;
174 
175  //- Find nearest feature point. Sets:
176  //
177  // - nearFeature: index of feature mesh
178  // - nearInfo : location on feature point and point index.
179  // (note: not index into shapes().pointLabels() but index
180  // into points() directly)
181  void findNearestPoint
182  (
183  const pointField& samples,
184  const scalarField& nearestDistSqr,
185  labelList& nearFeature,
186  List<pointIndexHit>& nearInfo
187  ) const;
188 
189  //- Find shell level higher than ptLevel
190  void findHigherLevel
191  (
192  const pointField& pt,
193  const labelList& ptLevel,
194  labelList& maxLevel
195  ) const;
196 
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
const PtrList< indexedOctree< treeDataEdge > > & edgeTrees() 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.
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:47
Encapsulates queries for features.
scalarField samples(nIntervals, 0)
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:
const List< scalarField > & distances() const
Per featureEdgeMesh the list of ranges.
const PtrList< indexedOctree< treeDataPoint > > & pointTrees() const
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:62
const PtrList< indexedOctree< treeDataEdge > > & regionEdgeTrees() const
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
Registry of regIOobjects.
const labelListList & levels() const
Per featureEdgeMesh the list of level.
void findNearestEdge(const pointField &samples, const scalarField &nearestDistSqr, labelList &nearFeature, List< pointIndexHit > &nearInfo, vectorField &nearNormal) const
Find nearest point on nearest feature edge. Sets:
void findNearestRegionEdge(const pointField &samples, const scalarField &nearestDistSqr, labelList &nearFeature, List< pointIndexHit > &nearInfo, vectorField &nearNormal) const
Find nearest point on nearest region edge. Sets:
Namespace for OpenFOAM.