FreeFOAM The Cross-Platform CFD Toolkit
shellSurfaces.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) 1991-2010 OpenCFD Ltd.
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 
40 #include <OpenFOAM/Tuple2.H>
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 class searchableSurfaces;
48 
49 /*---------------------------------------------------------------------------*\
50  Class shellSurfaces Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 {
55 public:
56 
57  // Public data types
58 
59  //- Volume refinement controls
61  {
62  INSIDE, // Refine all inside shell
63  OUTSIDE, // ,, outside
64  DISTANCE // Refine based on distance to shell
65  };
66 
67 
68 private:
69 
70  // Private data
71 
72  //- Reference to all geometry.
73  const searchableSurfaces& allGeometry_;
74 
75  //- Indices of surfaces that are shells
76  labelList shells_;
77 
78  //- Per shell whether to refine inside or outside
79  List<refineMode> modes_;
80 
81  //- Per shell the list of ranges
82  List<scalarField> distances_;
83 
84  //- Per shell per distance the refinement level
85  labelListList levels_;
86 
87 
88  // Private data
89 
90  //- refineMode names
91  static const NamedEnum<refineMode, 3> refineModeNames_;
92 
93 
94  // Private Member Functions
95 
96  //- Helper function for initialisation.
97  void setAndCheckLevels
98  (
99  const label shellI,
100  const List<Tuple2<scalar, label> >&
101  );
102 
103  void orient();
104 
105  void findHigherLevel
106  (
107  const pointField& pt,
108  const label shellI,
110  ) const;
111 
112 public:
113 
114  // Constructors
115 
116  //- Construct from components
118  (
119  const searchableSurfaces& allGeometry,
120  const labelList& shells,
121  const List<refineMode>& modes,
122  const List<scalarField>& distances,
123  const labelListList& levels
124  );
125 
126  //- Construct from geometry and dictionaries
128  (
129  const searchableSurfaces& allGeometry,
130  const PtrList<dictionary>& shellDicts
131  );
132 
133  //- Construct from geometry and dictionary
135  (
136  const searchableSurfaces& allGeometry,
137  const dictionary& shellsDict
138  );
139 
140 
141  // Member Functions
142 
143  // Access
144 
145  //const List<scalarField>& distances() const
146  //{
147  // return distances_;
148  //}
149  //
151  //const labelListList& levels() const
152  //{
153  // return levels_;
154  //}
155 
156 
157  // Query
158 
159  //- Highest shell level
160  label maxLevel() const;
161 
162  //- Find shell level higher than ptLevel
163  void findHigherLevel
164  (
165  const pointField& pt,
166  const labelList& ptLevel,
168  ) const;
169 
170 };
171 
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************ vim: set sw=4 sts=4 et: ************************ //