47 Foam::cellShapeControl::cellShapeControl
50 const cvControls& foamyHexMeshControls,
51 const searchableSurfaces& allGeometry,
52 const conformationSurfaces& geometryToConformTo
57 foamyHexMeshControls.foamyHexMeshDict().subDict(
"motionControl")
60 allGeometry_(allGeometry),
61 geometryToConformTo_(geometryToConformTo),
62 defaultCellSize_(foamyHexMeshControls.defaultCellSize()),
63 minimumCellSize_(foamyHexMeshControls.minimumCellSize()),
69 subDict(
"shapeControlFunctions"),
93 cellSizes[i] = cellSize(pts[i]);
105 shapeControlMesh_.barycentricCoords(pt, bary, ch);
109 if (shapeControlMesh_.dimension() < 3)
111 size = sizeAndAlignment_.cellSize(pt);
113 else if (shapeControlMesh_.is_infinite(ch))
138 size = sizeAndAlignment_.cellSize(pt);
142 label nFarPoints = 0;
143 for (label pI = 0; pI < 4; ++pI)
145 if (ch->vertex(pI)->farPoint())
153 for (label pI = 0; pI < 4; ++pI)
157 size = ch->vertex(pI)->targetCellSize();
166 size += bary[pI]*ch->vertex(pI)->targetCellSize();
180 shapeControlMesh_.barycentricCoords(pt, bary, ch);
184 if (shapeControlMesh_.dimension() < 3 || shapeControlMesh_.is_infinite(ch))
190 label nFarPoints = 0;
191 for (label pI = 0; pI < 4; ++pI)
193 if (ch->vertex(pI)->farPoint())
213 for (label pI = 0; pI < 4; ++pI)
215 if (bary[pI] > SMALL)
217 tri += triad(bary[pI]*ch->vertex(pI)->alignment());
252 shapeControlMesh_.barycentricCoords(pt, bary, ch);
257 if (shapeControlMesh_.dimension() < 3 || shapeControlMesh_.is_infinite(ch))
260 size = sizeAndAlignment_.cellSize(pt);
265 label nFarPoints = 0;
266 for (label pI = 0; pI < 4; ++pI)
268 if (ch->vertex(pI)->farPoint())
276 for (label pI = 0; pI < 4; ++pI)
280 size = ch->vertex(pI)->targetCellSize();
281 alignment = ch->vertex(pI)->alignment();
289 for (label pI = 0; pI < 4; ++pI)
291 size += bary[pI]*ch->vertex(pI)->targetCellSize();
293 if (bary[pI] > SMALL)
295 tri += triad(bary[pI]*ch->vertex(pI)->alignment());
315 for (label dir = 0; dir < 3; dir++)
319 if (!v.set(dir) || size == 0)
323 scalar dotProd = GREAT;
326 dotProd = v[1] & v[2];
328 v[dir] = v[1] ^ v[2];
332 dotProd = v[0] & v[2];
334 v[dir] = v[0] ^ v[2];
338 dotProd = v[0] & v[1];
340 v[dir] = v[0] ^ v[1];
346 Pout<<
"Dot prod = " << dotProd <<
endl;