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

Function pointInCell

src/OpenFOAM/meshes/polyMesh/polyMesh.C:1283–1390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1281
1282
1283bool Foam::polyMesh::pointInCell
1284(
1285 const point& p,
1286 label celli,
1287 const cellDecomposition decompMode
1288) const
1289{
1290 switch (decompMode)
1291 {
1292 case FACE_PLANES:
1293 {
1294 return primitiveMesh::pointInCell(p, celli);
1295 }
1296 break;
1297
1298 case FACE_CENTRE_TRIS:
1299 {
1300 // only test that point is on inside of plane defined by cell face
1301 // triangles
1302 const cell& cFaces = cells()[celli];
1303
1304 forAll(cFaces, cFacei)
1305 {
1306 label facei = cFaces[cFacei];
1307 const face& f = faces_[facei];
1308 const point& fc = faceCentres()[facei];
1309 bool isOwn = (owner_[facei] == celli);
1310
1311 forAll(f, fp)
1312 {
1313 label pointi;
1314 label nextPointi;
1315
1316 if (isOwn)
1317 {
1318 pointi = f[fp];
1319 nextPointi = f.nextLabel(fp);
1320 }
1321 else
1322 {
1323 pointi = f.nextLabel(fp);
1324 nextPointi = f[fp];
1325 }
1326
1327 triPointRef faceTri
1328 (
1329 points()[pointi],
1330 points()[nextPointi],
1331 fc
1332 );
1333
1334 vector proj = p - faceTri.centre();
1335
1336 if ((faceTri.normal() & proj) > 0)
1337 {
1338 return false;
1339 }
1340 }

Callers 3

polyMesh.CFile · 0.70
genSamplesFunction · 0.50
genSamplesFunction · 0.50

Calls 7

findTetFacePtFunction · 0.85
nextLabelMethod · 0.80
faceTriMethod · 0.80
forAllFunction · 0.50
centreMethod · 0.45
normalMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected