snappyVoxelMeshDriver.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) 2018 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::snappyVoxelMeshDriver
28 
29 Description
30  Equivalent of snappyRefineDriver but operating on a voxel mesh.
31 
32  Used to estimate cell size count from refinement (currently).
33 
34 SourceFiles
35  snappyVoxelMeshDriver.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef snappyVoxelMeshDriver_H
40 #define snappyVoxelMeshDriver_H
41 
42 #include "labelList.H"
43 #include "DynamicList.H"
44 #include "labelVector.H"
45 #include "boundBox.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declarations
53 class refinementParameters;
54 class layerParameters;
55 class meshRefinement;
56 
57 /*---------------------------------------------------------------------------*\
58  Class snappyVoxelMeshDriver Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 {
63  // Private data
64 
65  //- Mesh+surface
66  meshRefinement& meshRefiner_;
67 
68  //- From surface region to patch
69  const labelList globalToMasterPatch_;
70 
71  //- From surface region to patch
72  const labelList globalToSlavePatch_;
73 
74  //- Bounding box
75  boundBox bb_;
76 
77  //- Number of voxels
78  labelVector n_;
79 
80  //- Per voxel the refinement level
81  labelList voxelLevel_;
82 
83  //- Per insersected voxel the originating surface
84  labelList globalRegion_;
85 
86 
87  // Private Member Functions
88 
89  void addNeighbours
90  (
91  const labelList& cellLevel,
92  const labelVector& voxel,
93  const label voxeli,
95  ) const;
96 
97  tmp<pointField> voxelCentres() const;
98 
99  void isInside
100  (
101  const pointField& voxelCentres,
102  boolList& isVoxelInMesh
103  ) const;
104 
105  void markSurfaceRefinement
106  (
107  labelList& voxelLevel,
108  labelList& globalRegion
109  ) const;
110 
111  void findVoxels
112  (
113  const labelList& voxelLevel,
114  const pointField& locationsOutsideMesh,
115  labelList& voxels
116  ) const;
117 
118  void floodFill
119  (
120  const label voxeli,
121  const label newLevel,
122  labelList& voxelLevel
123  ) const;
124 
125  void max
126  (
127  const labelList& maxLevel,
128  labelList& voxelLevel
129  ) const;
130 
131  labelList count(const labelList& voxelLevel) const;
132 
133 
134  //- No copy construct
136 
137  //- No copy assignment
138  void operator=(const snappyVoxelMeshDriver&) = delete;
139 
140 
141 public:
142 
143  //- Runtime type information
144  ClassName("snappyVoxelMeshDriver");
145 
146 
147  // Constructors
148 
149  //- Construct from components
151  (
152  meshRefinement& meshRefiner,
153  const labelUList& globalToMasterPatch,
154  const labelUList& globalToSlavePatch
155  );
156 
157 
158  // Member Functions
159 
160  void doRefine(const refinementParameters& refineParams);
161 
162  //void doLayers(const layerParameters& layerParams);
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:55
labelVector.H
Foam::snappyVoxelMeshDriver::doRefine
void doRefine(const refinementParameters &refineParams)
Definition: snappyVoxelMeshDriver.C:460
labelList.H
Foam::Field< vector >
Foam::refinementParameters
Simple container to keep together refinement specific information.
Definition: refinementParameters.H:58
Foam::snappyVoxelMeshDriver::ClassName
ClassName("snappyVoxelMeshDriver")
Runtime type information.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::snappyVoxelMeshDriver
Equivalent of snappyRefineDriver but operating on a voxel mesh.
Definition: snappyVoxelMeshDriver.H:60
boundBox.H
Foam::Vector< label >
Foam::List< label >
Foam::meshRefinement
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
Definition: meshRefinement.H:85
Foam::UList< label >
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
DynamicList.H