Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
0db70bd8
Commit
0db70bd8
authored
Nov 19, 2013
by
andy
Browse files
ENH: primitive/poly-Mesh - updated find cell routines
parent
0a5eacf7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/meshes/polyMesh/polyMesh.C
View file @
0db70bd8
...
...
@@ -1351,8 +1351,10 @@ bool Foam::polyMesh::pointInCell
case
FACECENTRETETS
:
{
const
point
&
cc
=
cellCentres
()[
cellI
];
// only test that point is on inside of plane defined by cell face
// triangles
const
cell
&
cFaces
=
cells
()[
cellI
];
forAll
(
cFaces
,
cFaceI
)
{
label
faceI
=
cFaces
[
cFaceI
];
...
...
@@ -1376,31 +1378,61 @@ bool Foam::polyMesh::pointInCell
nextPointI
=
f
[
fp
];
}
if
(
tetPointRef
(
points
()[
nextPointI
],
points
()[
pointI
],
fc
,
cc
).
inside
(
p
)
)
const
point
&
p0
=
points
()[
pointI
];
const
point
&
p1
=
points
()[
nextPointI
];
const
point
&
p2
=
fc
;
vector
twoFaceArea
=
(
p1
-
p0
)
^
(
p2
-
p0
);
point
centre
=
(
p0
+
p1
+
p2
)
/
3
.
0
;
vector
proj
=
p
-
centre
;
if
((
twoFaceArea
&
proj
)
>
0
)
{
return
tru
e
;
return
fals
e
;
}
}
}
return
fals
e
;
return
tru
e
;
}
break
;
case
FACEDIAGTETS
:
{
label
tetFaceI
,
tetPtI
;
findTetFacePt
(
cellI
,
p
,
tetFaceI
,
tetPtI
);
// only test that point is on inside of plane defined by cell face
// triangles
const
cell
&
cFaces
=
cells
()[
cellI
];
forAll
(
cFaces
,
cFaceI
)
{
label
faceI
=
cFaces
[
cFaceI
];
const
face
&
f
=
faces_
[
faceI
];
for
(
label
tetPtI
=
1
;
tetPtI
<
f
.
size
()
-
1
;
tetPtI
++
)
{
// Get tetIndices of face triangle
tetIndices
faceTetIs
(
polyMeshTetDecomposition
::
triangleTetIndices
(
*
this
,
faceI
,
cellI
,
tetPtI
)
);
triPointRef
faceTri
=
faceTetIs
.
faceTri
(
*
this
);
vector
proj
=
p
-
faceTri
.
centre
();
if
((
faceTri
.
normal
()
&
proj
)
>
0
)
{
return
false
;
}
}
}
return
t
etFaceI
!=
-
1
;
return
t
rue
;
}
break
;
}
...
...
src/OpenFOAM/meshes/primitiveMesh/primitiveMeshFindCell.C
View file @
0db70bd8
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2013
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -66,8 +66,6 @@ bool Foam::primitiveMesh::pointInCell(const point& p, label celli) const
const
vectorField
&
cf
=
faceCentres
();
const
vectorField
&
Sf
=
faceAreas
();
bool
inCell
=
true
;
forAll
(
f
,
facei
)
{
label
nFace
=
f
[
facei
];
...
...
@@ -77,10 +75,14 @@ bool Foam::primitiveMesh::pointInCell(const point& p, label celli) const
{
normal
=
-
normal
;
}
inCell
=
inCell
&&
((
normal
&
proj
)
<=
0
);
if
((
normal
&
proj
)
>
0
)
{
return
false
;
}
}
return
inCell
;
return
true
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment