refinementRegions.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-2021 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::refinementRegions
26 
27 Description
28  Encapsulates queries for volume refinement ('refine all cells within
29  shell').
30 
31 SourceFiles
32  refinementRegions.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef refinementRegions_H
37 #define refinementRegions_H
38 
39 #include "Tuple2.H"
40 #include "triSurfaceMesh.H"
41 #include "triSurfaceFieldsFwd.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 class searchableSurfaces;
49 
50 /*---------------------------------------------------------------------------*\
51  Class refinementRegions Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 {
56 public:
57 
58  // Public data types
59 
60  //- Volume refinement controls
61  enum class refineMode
62  {
63  inside, // Refine all inside shell
64  outside, // ,, outside
65  distance, // Refine based on distance to shell
66  insideSpan, // Refine based on distance internal span
67  outsideSpan // Refine based on distance external span
68  };
69 
70 
71 private:
72 
73  // Private Data
74 
75  //- Reference to all geometry.
76  const searchableSurfaces& allGeometry_;
77 
78  //- Indices of surfaces that are shells
79  labelList shells_;
80 
81  //- Per shell whether to refine inside or outside
82  List<refineMode> modes_;
83 
84  //- Per shell the list of ranges
85  List<scalarField> distances_;
86 
87  //- Per shell per distance the refinement level
88  labelListList levels_;
89 
90  //- Number of cells across span for refinement mode span
91  labelList cellsAcrossSpan_;
92 
93  //- Surface closness field for refinement mode span
95 
96 
97  // Private Data
98 
99  //- refineMode names
100  static const NamedEnum<refineMode, 5> refineModeNames_;
101 
102 
103  // Private Member Functions
104 
105  //- Helper function for initialisation.
106  void setAndCheckLevels(const label shelli, const dictionary& dict);
107 
108  //- Specifically orient triSurfaces using a calculated point outside.
109  // Done since quite often triSurfaces not of consistent orientation
110  // which is (currently) necessary for sideness calculation
111  void orient();
112 
113  //- Interpolate the surface closeness field to the given point
114  scalar interpolate
115  (
116  const triSurfaceMesh& tris,
117  const triSurfacePointScalarField& closeness,
118  const point& pt,
119  const label index
120  ) const;
121 
122  //- Find maximum level of a shell
123  void findHigherLevel
124  (
125  const pointField& pt,
126  const label shelli,
127  const scalar level0EdgeLength,
129  ) const;
130 
131 
132 public:
133 
134  // Constructors
135 
136  //- Construct from geometry and dictionary
138  (
139  const searchableSurfaces& allGeometry,
140  const dictionary& shellsDict
141  );
142 
143 
144  // Member Functions
145 
146  // Query
147 
148  //- Highest shell level
149  label maxLevel() const;
150 
151  //- Find shell level higher than ptLevel
152  void findHigherLevel
153  (
154  const pointField& pt,
155  const labelList& ptLevel,
156  const scalar level0EdgeLength,
157  labelList& maxLevel
158  ) const;
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Encapsulates queries for volume refinement (&#39;refine all cells within shell&#39;).
A surface geometry formed of discrete facets, e.g. triangles and/or quadrilaterals, defined in a file using formats such as Wavefront OBJ, or stereolithography STL.
refinementRegions(const searchableSurfaces &allGeometry, const dictionary &shellsDict)
Construct from geometry and dictionary.
refineMode
Volume refinement controls.
Container for searchableSurfaces.
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
label maxLevel() const
Highest shell level.
Namespace for OpenFOAM.