Loading...
Searching...
No Matches
faceShading.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) 2015 OpenFOAM Foundation
9 Copyright (C) 2017-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::faceShading
29
30Description
31 Helper class to calculate visible faces for global, sun-like illumination.
32
33 faceShading uses the transmissivity value in the boundaryRadiationProperties
34 in order to evaluate which faces are "hit" by the "direction" vector.
35 NOTE: Only transmissivity values of zero are considered for opaque walls.
36
37SourceFiles
38 faceShading.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef faceShading_H
43#define faceShading_H
44
46#include "DynamicField.H"
47#include "triSurface.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54// Forward Declarations
55class fvMesh;
56class polyMesh;
58/*---------------------------------------------------------------------------*\
59 Class faceShading Declaration
60\*---------------------------------------------------------------------------*/
61
62class faceShading
63{
64 // Private Data
65
66 //- Reference to mesh
67 const fvMesh& mesh_;
68
69 //- Patches to check for visibility
70 const labelList patchIDs_;
71
72 //- FaceZones to check for visibility
73 const labelList zoneIDs_;
74
75 //- Direction
76 vector direction_;
77
78 //- Faces directly hit by vector direction
79 labelList rayStartFaces_;
80
81
82 // Private Member Functions
83
84 //- Calculate ray start faces
85 void calculate();
86
87 //- Construct a triSurface from selected faces on patches or faceZones.
88 // Resulting surface has regioning with mesh patches first, faceZones
89 // second.
90 triSurface triangulate
91 (
92 const labelUList& faceIDs,
93 const bitSet& flipMap
94 ) const;
95
96 //- Find opaque faces by looking at the radiation properties.
97 bitSet selectOpaqueFaces
98 (
99 const radiation::boundaryRadiationProperties& boundaryRadiation,
100 const labelUList& patchIDs,
101 const labelUList& zoneIDs
102 ) const;
103
104 //- Pick up candidate faces that might be blocking visibility for
105 // other faces:
106 // - if transmissivity is 0
107 // - (optional) if pointing wrong way
108 void selectFaces
109 (
110 const bool useNormal,
111 const bitSet& isCandidateFace,
112 const labelUList& patchIDs,
113 const labelUList& zoneIDs,
114
115 labelList& faceIDs,
116 bitSet& flipMap
117 ) const;
118
119 //- Write rays
120 void writeRays
121 (
122 const fileName& fName,
123 const DynamicField<point>& endCf,
124 const pointField& myFc
125 );
126
127 //- No copy construct
128 faceShading(const faceShading&) = delete;
129
130 //- No copy assignment
131 void operator=(const faceShading&) = delete;
132
133
134public:
135
136 // Declare name of the class and its debug switch
137 ClassName("faceShading");
138
139
140 // Constructors
141
142 //- Helper: return all uncoupled patches
144
145 //- Construct from mesh and vector to 'sun'. All uncoupled patches
146 // are checked for visibility. faceZones are ignored.
147 faceShading
148 (
149 const fvMesh& mesh,
150 const vector& dir
151 );
152
153 //- Construct from mesh and vector to 'sun' and selected patches
154 // and faceZones.
155 faceShading
156 (
157 const fvMesh& mesh,
159 const labelList& zoneIDs,
160 const vector& dir
161 );
162
163
164 //- Destructor
165 ~faceShading() = default;
166
167
168 // Member Functions
169
170 // Access
171
172 //- Const access to direction
173 const vector direction() const
174 {
175 return direction_;
176 }
177
178 //- Non-const access to direction
180 {
181 return direction_;
182 }
183
184 //- Const access to rayStartFaces
185 const labelList& rayStartFaces() const
186 {
187 return rayStartFaces_;
188 }
189
190
191 //- Recalculate rayStartFaces using direction vector
192 void correct();
193};
194
195
196// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197
198} // End namespace Foam
199
200// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201
202#endif
203
204// ************************************************************************* //
labelList patchIDs
Dynamically sized Field. Similar to DynamicList, but inheriting from a Field instead of a List.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition bitSet.H:61
vector & direction()
Non-const access to direction.
const labelList & rayStartFaces() const
Const access to rayStartFaces.
void correct()
Recalculate rayStartFaces using direction vector.
static labelList nonCoupledPatches(const polyMesh &mesh)
Helper: return all uncoupled patches.
~faceShading()=default
Destructor.
ClassName("faceShading")
const vector direction() const
Const access to direction.
A class for handling file names.
Definition fileName.H:75
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Triangulated surface description with patch information.
Definition triSurface.H:74
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition className.H:74
dynamicFvMesh & mesh
const labelIOList & zoneIDs
Definition correctPhi.H:59
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
vectorField pointField
pointField is a vectorField.
Vector< scalar > vector
Definition vector.H:57
UList< label > labelUList
A UList of labels.
Definition UList.H:75