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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2014 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::refinementFeatures
28
29Description
30 Encapsulates queries for features.
31
32SourceFiles
33 refinementFeatures.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef refinementFeatures_H
38#define refinementFeatures_H
39
41#include "indexedOctree.H"
42#include "treeDataEdge.H"
43#include "treeDataPoint.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Class refinementFeatures Declaration
52\*---------------------------------------------------------------------------*/
55:
56 public PtrList<extendedFeatureEdgeMesh>
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 //- Dry-run mode?
73 const bool dryRun_;
74
75 //- Region edge trees (demand driven)
77 regionEdgeTreesPtr_;
78
79
80 // Private Member Functions
81
82 //- Read set of feature edge meshes
83 void read(const objectRegistry&, const PtrList<dictionary>&);
84
85 //- Build edge tree and feature point tree
86 void buildTrees(const label);
87
88 //- Find shell level higher than ptLevel
89 void findHigherLevel
90 (
91 const pointField& pt,
92 const label featI,
93 labelList& maxLevel
94 ) const;
95
96
97protected:
100 {
101 return edgeTrees_;
102 }
105 {
106 return pointTrees_;
107 }
108
109
111
112public:
113
114 // Constructors
115
116 //- Construct from description
118 (
119 const objectRegistry& io,
120 const PtrList<dictionary>& featDicts,
121 const bool dryRun = false
122 );
123
124
125 // Member Functions
126
127 // Access
128
129 //- Per featureEdgeMesh the list of level
130 const labelListList& levels() const
131 {
132 return levels_;
133 }
134
135 //- Per featureEdgeMesh the list of ranges
136 const List<scalarField>& distances() const
137 {
138 return distances_;
139 }
140
141
142 // Query
143
144 //- Highest distance of all features
145 scalar maxDistance() const;
146
147 //- Find nearest point on nearest feature edge. Sets
148 // - nearFeature: index of feature mesh
149 // - nearInfo : location on feature edge and edge index
150 // (note: not feature edge index but index into
151 // edges() directly)
152 // - nearNormal : local feature edge normal
153 void findNearestEdge
154 (
155 const pointField& samples,
156 const scalarField& nearestDistSqr,
157 labelList& nearFeature,
158 List<pointIndexHit>& nearInfo,
159 vectorField& nearNormal
160 ) const;
161
162 //- Find nearest point on nearest region edge. Sets
163 // - nearFeature: index of feature mesh
164 // - nearInfo : location on feature edge and edge index
165 // (note: not feature edge index but index into
166 // edges() directly)
167 // - nearNormal : local feature edge normal
169 (
170 const pointField& samples,
171 const scalarField& nearestDistSqr,
172 labelList& nearFeature,
173 List<pointIndexHit>& nearInfo,
174 vectorField& nearNormal
175 ) const;
176
177 //- Find nearest feature point. Sets
178 // - nearFeature: index of feature mesh
179 // - nearInfo : location on feature point and point index.
180 // (note: not index into shapes().pointLabels() but
181 // index into points() directly)
183 (
184 const pointField& samples,
185 const scalarField& nearestDistSqr,
186 labelList& nearFeature,
187 List<pointIndexHit>& nearInfo
188 ) const;
189
190 //- Find shell level higher than ptLevel
191 void findHigherLevel
192 (
193 const pointField& pt,
194 const labelList& ptLevel,
195 labelList& maxLevel
196 ) const;
197
198 // Other
199
200 //- Check sizes - return true if error and stream to os
201 bool checkSizes
202 (
203 const scalar maxRatio,
204 const boundBox& meshBb,
205 const bool report,
206 Ostream& os
207 ) const;
208};
209
210
211// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212
213} // End namespace Foam
214
215// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216
217#endif
218
219// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:64
Registry of regIOobjects.
Encapsulates queries for features.
void findNearestPoint(const pointField &samples, const scalarField &nearestDistSqr, labelList &nearFeature, List< pointIndexHit > &nearInfo) const
Find nearest feature point. Sets.
const PtrList< indexedOctree< treeDataEdge > > & edgeTrees() const
bool checkSizes(const scalar maxRatio, const boundBox &meshBb, const bool report, Ostream &os) const
Check sizes - return true if error and stream to os.
scalar maxDistance() const
Highest distance of all features.
void findNearestRegionEdge(const pointField &samples, const scalarField &nearestDistSqr, labelList &nearFeature, List< pointIndexHit > &nearInfo, vectorField &nearNormal) const
Find nearest point on nearest region edge. Sets.
const List< scalarField > & distances() const
Per featureEdgeMesh the list of ranges.
void findNearestEdge(const pointField &samples, const scalarField &nearestDistSqr, labelList &nearFeature, List< pointIndexHit > &nearInfo, vectorField &nearNormal) const
Find nearest point on nearest feature edge. Sets.
const PtrList< indexedOctree< treeDataEdge > > & regionEdgeTrees() const
const PtrList< indexedOctree< treeDataPoint > > & pointTrees() const
const labelListList & levels() const
Per featureEdgeMesh the list of level.
OBJstream os(runTime.globalPath()/outputName)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
scalarField samples(nIntervals, Zero)