46 void Foam::faceShading::writeRays
48 const fileName& fName,
49 const DynamicField<point>& endCf,
55 Pout<<
"Dumping rays to " <<
os.name() <<
endl;
67 const List<labelHashSet>& includeAllFacesPerPatch
70 const polyBoundaryMesh&
bMesh = mesh_.boundaryMesh();
73 DynamicList<labelledTri> triangles(mesh_.nBoundaryFaces());
77 for (
const label patchI : includePatches)
84 if (includeAllFacesPerPatch[patchI].size())
86 for (
const label patchFaceI : includeAllFacesPerPatch[patchI])
88 const face&
f =
patch[patchFaceI];
94 f.triangles(
points, nTri, triFaces);
96 for (
const face&
f : triFaces)
100 labelledTri(
f[0],
f[1],
f[2], newPatchI)
112 triSurface rawSurface(triangles, mesh_.points());
117 rawSurface.localFaces(),
118 rawSurface.localPoints()
122 surface.patches().setSize(newPatchI);
126 for (
const label patchI : includePatches)
130 if (includeAllFacesPerPatch[patchI].size())
132 surface.patches()[newPatchI].name() =
patch.name();
133 surface.patches()[newPatchI].geometricType() =
patch.type();
143 void Foam::faceShading::calculate()
145 const radiation::boundaryRadiationProperties& boundaryRadiation =
150 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
152 DynamicList<point> dynCf(nFaces);
153 DynamicList<label> dynFacesI;
157 const polyPatch& pp =
patches[patchI];
160 if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
162 const tmp<scalarField> tt =
163 boundaryRadiation.transmissivity(patchI);
170 if (((direction_ & nf) > 0) && (t[faceI] == 0.0))
172 dynFacesI.append(faceI + pp.start());
173 dynCf.append(cf[faceI]);
180 label numberPotentialHits = nFaces;
182 reduce(numberPotentialHits, sumOp<label>());
184 Info<<
"Number of 'potential' direct hits : "
185 << numberPotentialHits <<
endl;
188 hitFacesIds.transfer(dynFacesI);
203 boundBox(mesh_.points(),
false)
218 dict.
add(
"mergeDistance", SMALL);
221 List<labelHashSet> includeAllFacesPerPatch(
patches.size());
225 const polyPatch& pp =
patches[patchI];
226 if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
228 includePatches.insert(patchI);
230 const tmp<scalarField> tt =
231 boundaryRadiation.transmissivity(patchI);
236 if (tau[faceI] == 0.0)
238 includeAllFacesPerPatch[patchI].insert(faceI);
247 includeAllFacesPerPatch
255 mesh_.time().constant(),
270 scalar maxBounding = 5.0*
mag(mesh_.bounds().max() - mesh_.bounds().min());
272 reduce(maxBounding, maxOp<scalar>());
275 DynamicList<label> rayStartFace(nFaces + 0.01*nFaces);
281 DynamicField<point> start(nFaces);
282 DynamicField<point>
end(start.size());
283 DynamicList<label> startIndex(start.size());
288 for (; i < Cfs.size(); i++)
290 const point& fc = Cfs[i];
292 const label myFaceId = hitFacesIds[i];
294 const vector d(direction_*maxBounding);
296 start.append(fc - 0.001*d);
298 startIndex.append(myFaceId);
306 List<pointIndexHit> hitInfo(startIndex.size());
314 if (!hitInfo[rayI].hit())
316 rayStartFace.append(startIndex[rayI]);
325 mesh_.time().path()/
"allVisibleFaces.obj",
336 rayStartFaces_.transfer(rayStartFace);
340 tmp<volScalarField> thitFaces
347 mesh_.time().timeName(),
358 volScalarField::Boundary& hitFacesBf = hitFaces.boundaryFieldRef();
361 for (
const label faceI : rayStartFaces_)
365 hitFacesBf[
patchID][faceI - pp.start()] = 1.0;
370 label totalHitFaces = rayStartFaces_.size();
372 reduce(totalHitFaces, sumOp<label>());
374 Info<<
"Total number of hit faces : " << totalHitFaces <<
endl;
380 Foam::faceShading::faceShading
389 rayStartFaces_(hitFaceList)
393 Foam::faceShading::faceShading