MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / orient

Function orient

src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C:148–225  ·  view source on GitHub ↗

Specifically orient triSurfaces using a calculated point outside. Done since quite often triSurfaces not of consistent orientation which is (currently) necessary for sideness calculation

Source from the content-addressed store, hash-verified

146// Done since quite often triSurfaces not of consistent orientation which
147// is (currently) necessary for sideness calculation
148void Foam::shellSurfaces::orient()
149{
150 // Determine outside point.
151 boundBox overallBb = boundBox::invertedBox;
152
153 bool hasSurface = false;
154
155 forAll(shells_, shellI)
156 {
157 const searchableSurface& s = allGeometry_[shells_[shellI]];
158
159 if (modes_[shellI] != DISTANCE && isA<triSurfaceMesh>(s))
160 {
161 const triSurfaceMesh& shell = refCast<const triSurfaceMesh>(s);
162
163 if (shell.triSurface::size())
164 {
165 const pointField& points = shell.points();
166
167 hasSurface = true;
168
169 boundBox shellBb(points[0], points[0]);
170 // Assume surface is compact!
171 forAll(points, i)
172 {
173 const point& pt = points[i];
174 shellBb.min() = min(shellBb.min(), pt);
175 shellBb.max() = max(shellBb.max(), pt);
176 }
177
178 overallBb.min() = min(overallBb.min(), shellBb.min());
179 overallBb.max() = max(overallBb.max(), shellBb.max());
180 }
181 }
182 }
183
184 if (hasSurface)
185 {
186 const point outsidePt = overallBb.max() + overallBb.span();
187
188 //Info<< "Using point " << outsidePt << " to orient shells" << endl;
189
190 forAll(shells_, shellI)
191 {
192 const searchableSurface& s = allGeometry_[shells_[shellI]];
193
194 if (modes_[shellI] != DISTANCE && isA<triSurfaceMesh>(s))
195 {
196 triSurfaceMesh& shell = const_cast<triSurfaceMesh&>
197 (
198 refCast<const triSurfaceMesh>(s)
199 );
200
201 // Flip surface so outsidePt is outside.
202 bool anyFlipped = orientedSurface::orient
203 (
204 shell,
205 outsidePt,

Callers 2

shellSurfaces.CFile · 0.70
mainFunction · 0.50

Calls 9

sizeFunction · 0.85
minFunction · 0.85
maxFunction · 0.85
orientedSurfaceClass · 0.85
maxMethod · 0.80
forAllFunction · 0.50
pointsMethod · 0.45
spanMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected