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-2014 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
62 
63  //- Per shell per distance the refinement level
65 
66  //- Edge
68 
69  //- Features points
71 
72  //- Region edge trees (demand driven)
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  }
100 
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  // - nearFeature: index of feature mesh
145  // - nearInfo : location on feature edge and edge index
146  // (note: not feature edge index but index into
147  // edges() directly)
148  // - nearNormal : local feature edge normal
149  void findNearestEdge
150  (
151  const pointField& samples,
152  const scalarField& nearestDistSqr,
153  labelList& nearFeature,
155  vectorField& nearNormal
156  ) const;
157 
158  //- Find nearest point on nearest region edge. Sets
159  // - nearFeature: index of feature mesh
160  // - nearInfo : location on feature edge and edge index
161  // (note: not feature edge index but index into
162  // edges() directly)
163  // - nearNormal : local feature edge normal
165  (
166  const pointField& samples,
167  const scalarField& nearestDistSqr,
168  labelList& nearFeature,
170  vectorField& nearNormal
171  ) const;
172 
173  //- Find nearest feature point. Sets
174  // - nearFeature: index of feature mesh
175  // - nearInfo : location on feature point and point index.
176  // (note: not index into shapes().pointLabels() but
177  // index into points() directly)
178  void findNearestPoint
179  (
180  const pointField& samples,
181  const scalarField& nearestDistSqr,
182  labelList& nearFeature,
184  ) const;
185 
186  //- Find shell level higher than ptLevel
187  void findHigherLevel
188  (
189  const pointField& pt,
190  const labelList& ptLevel,
191  labelList& maxLevel
192  ) const;
193 
194 };
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
Foam::refinementFeatures::refinementFeatures
refinementFeatures(const objectRegistry &io, const PtrList< dictionary > &featDicts)
Construct from description.
Definition: refinementFeatures.C:430
Foam::refinementFeatures::findNearestPoint
void findNearestPoint(const pointField &samples, const scalarField &nearestDistSqr, labelList &nearFeature, List< pointIndexHit > &nearInfo) const
Find nearest feature point. Sets.
Definition: refinementFeatures.C:699
indexedOctree.H
Foam::refinementFeatures::buildTrees
void buildTrees(const label)
Build edge tree and feature point tree.
Definition: refinementFeatures.C:246
Foam::refinementFeatures::maxDistance
scalar maxDistance() const
Highest distance of all features.
Definition: refinementFeatures.C:766
Foam::refinementFeatures::distances_
List< scalarField > distances_
Per shell the list of ranges.
Definition: refinementFeatures.H:60
extendedFeatureEdgeMesh.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::refinementFeatures::edgeTrees_
PtrList< indexedOctree< treeDataEdge > > edgeTrees_
Edge.
Definition: refinementFeatures.H:66
samples
scalarField samples(nIntervals, 0)
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
treeDataPoint.H
Foam::refinementFeatures::edgeTrees
const PtrList< indexedOctree< treeDataEdge > > & edgeTrees() const
Definition: refinementFeatures.H:95
Foam::refinementFeatures::distances
const List< scalarField > & distances() const
Per featureEdgeMesh the list of ranges.
Definition: refinementFeatures.H:131
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
Foam::refinementFeatures::pointTrees_
PtrList< indexedOctree< treeDataPoint > > pointTrees_
Features points.
Definition: refinementFeatures.H:69
treeDataEdge.H
Foam::refinementFeatures::read
void read(const objectRegistry &, const PtrList< dictionary > &)
Read set of feature edge meshes.
Definition: refinementFeatures.C:34
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::refinementFeatures::regionEdgeTreesPtr_
autoPtr< PtrList< indexedOctree< treeDataEdge > > > regionEdgeTreesPtr_
Region edge trees (demand driven)
Definition: refinementFeatures.H:73
Foam::refinementFeatures::levels_
labelListList levels_
Per shell per distance the refinement level.
Definition: refinementFeatures.H:63
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::refinementFeatures::regionEdgeTrees
const PtrList< indexedOctree< treeDataEdge > > & regionEdgeTrees() const
Definition: refinementFeatures.C:302
Foam::refinementFeatures::findNearestRegionEdge
void findNearestRegionEdge(const pointField &samples, const scalarField &nearestDistSqr, labelList &nearFeature, List< pointIndexHit > &nearInfo, vectorField &nearNormal) const
Find nearest point on nearest region edge. Sets.
Definition: refinementFeatures.C:584
Foam::refinementFeatures
Encapsulates queries for features.
Definition: refinementFeatures.H:51
Foam::List< scalarField >
Foam::refinementFeatures::levels
const labelListList & levels() const
Per featureEdgeMesh the list of level.
Definition: refinementFeatures.H:125
Foam::Tuple2
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:47
Foam::refinementFeatures::findHigherLevel
void findHigherLevel(const pointField &pt, const label featI, labelList &maxLevel) const
Find shell level higher than ptLevel.
Definition: refinementFeatures.C:356
Foam::refinementFeatures::findNearestEdge
void findNearestEdge(const pointField &samples, const scalarField &nearestDistSqr, labelList &nearFeature, List< pointIndexHit > &nearInfo, vectorField &nearNormal) const
Find nearest point on nearest feature edge. Sets.
Definition: refinementFeatures.C:525
Foam::refinementFeatures::pointTrees
const PtrList< indexedOctree< treeDataPoint > > & pointTrees() const
Definition: refinementFeatures.H:100