shellSurfaces.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::shellSurfaces
26 
27 Description
28  Encapsulates queries for volume refinement ('refine all cells within
29  shell').
30 
31 SourceFiles
32  shellSurfaces.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef shellSurfaces_H
37 #define shellSurfaces_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 shellSurfaces Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class shellSurfaces
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
107  (
108  const label shelli,
110  );
111 
112  //- Specifically orient triSurfaces using a calculated point outside.
113  // Done since quite often triSurfaces not of consistent orientation
114  // which is (currently) necessary for sideness calculation
115  void orient();
116 
117  //- Interpolate the surface closeness field to the given point
118  scalar interpolate
119  (
120  const triSurfaceMesh& tris,
121  const triSurfacePointScalarField& closeness,
122  const point& pt,
123  const label index
124  ) const;
125 
126  //- Find maximum level of a shell
127  void findHigherLevel
128  (
129  const pointField& pt,
130  const label shelli,
131  const scalar level0EdgeLength,
133  ) const;
134 
135 
136 public:
137 
138  // Constructors
139 
140  //- Construct from geometry and dictionary
142  (
143  const searchableSurfaces& allGeometry,
144  const dictionary& shellsDict
145  );
146 
147 
148  // Member Functions
149 
150  // Query
151 
152  //- Highest shell level
153  label maxLevel() const;
154 
155  //- Find shell level higher than ptLevel
156  void findHigherLevel
157  (
158  const pointField& pt,
159  const labelList& ptLevel,
160  const scalar level0EdgeLength,
161  labelList& maxLevel
162  ) const;
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
shellSurfaces(const searchableSurfaces &allGeometry, const dictionary &shellsDict)
Construct from geometry and dictionary.
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
A 2-tuple for storing two objects of different types.
Definition: HashTable.H:65
refineMode
Volume refinement controls.
Definition: shellSurfaces.H:60
label maxLevel() const
Highest shell level.
IOoject and searching on triSurface.
Container for searchableSurfaces.
Encapsulates queries for volume refinement (&#39;refine all cells within shell&#39;).
Definition: shellSurfaces.H:53
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
Namespace for OpenFOAM.