Skip to content
GitLab
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
c1964d78
Commit
c1964d78
authored
Aug 10, 2018
by
Mark OLESEN
Browse files
ENH: distinguish between face areaNormal/unitNormal in the code
parent
b81a2f2f
Changes
52
Hide whitespace changes
Inline
Side-by-side
applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
View file @
c1964d78
...
...
@@ -188,19 +188,17 @@ label findInternalFace(const primitiveMesh& mesh, const labelList& meshF)
bool
correctOrientation
(
const
pointField
&
points
,
const
cellShape
&
shape
)
{
// Get centre of shape.
point
cc
(
shape
.
centre
(
points
));
const
point
cc
(
shape
.
centre
(
points
));
// Get outwards pointing faces.
faceList
faces
(
shape
.
faces
());
for
All
(
faces
,
i
)
for
(
const
face
&
f
:
faces
)
{
const
face
&
f
=
faces
[
i
];
vector
n
(
f
.
normal
(
points
));
const
vector
areaNorm
(
f
.
areaNormal
(
points
));
// Check if vector from any point on face to cc points outwards
if
(((
points
[
f
[
0
]]
-
cc
)
&
n
)
<
0
)
if
(((
points
[
f
[
0
]]
-
cc
)
&
areaNorm
)
<
0
)
{
// Incorrectly oriented
return
false
;
...
...
applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
View file @
c1964d78
...
...
@@ -225,9 +225,10 @@ int main(int argc, char *argv[])
// Determine orientation of tri v.s. cell centre.
point
cc
(
cll
.
centre
(
points
));
point
fc
(
tri
.
centre
(
points
));
vector
fn
(
tri
.
normal
(
points
));
if
(((
fc
-
cc
)
&
fn
)
<
0
)
const
vector
areaNorm
(
tri
.
areaNormal
(
points
));
if
(((
fc
-
cc
)
&
areaNorm
)
<
0
)
{
// Boundary face points inwards. Flip.
boundaryFaces
[
facei
].
flip
();
...
...
applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C
View file @
c1964d78
...
...
@@ -1832,11 +1832,11 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
}
vector
correctNormal
=
calcSharedPatchNormal
(
vc1
,
vc2
);
correctNormal
/=
mag
(
correctN
ormal
);
correctNormal
.
n
ormal
ise
(
);
Info
<<
" cN "
<<
correctNormal
<<
endl
;
vector
fN
=
f
.
n
ormal
(
pts
);
vector
fN
=
f
.
areaN
ormal
(
pts
);
if
(
mag
(
fN
)
<
SMALL
)
{
...
...
@@ -1844,7 +1844,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
continue
;
}
fN
/=
mag
(
fN
);
fN
.
normalise
(
);
Info
<<
" fN "
<<
fN
<<
endl
;
if
((
fN
&
correctNormal
)
>
0
)
...
...
applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshZones.C
View file @
c1964d78
...
...
@@ -481,10 +481,9 @@ void Foam::conformalVoronoiMesh::calcFaceZones
norm
);
vector
fN
=
faces
[
facei
].
normal
(
mesh
.
points
());
fN
/=
mag
(
fN
)
+
SMALL
;
const
vector
areaNorm
=
faces
[
facei
].
areaNormal
(
mesh
.
points
());
if
((
norm
[
0
]
&
fN
)
<
0
)
if
((
norm
[
0
]
&
areaNorm
)
<
0
)
{
flipMap
[
facei
]
=
true
;
}
...
...
applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C
View file @
c1964d78
...
...
@@ -89,11 +89,9 @@ void Foam::conformationSurfaces::hasBoundedVolume
Info
<<
" Index = "
<<
surfaces_
[
s
]
<<
endl
;
Info
<<
" Offset = "
<<
regionOffset_
[
s
]
<<
endl
;
for
All
(
triSurf
,
sI
)
for
(
const
labelledTri
&
f
:
triSurf
)
{
const
label
patchID
=
triSurf
[
sI
].
region
()
+
regionOffset_
[
s
];
const
label
patchID
=
f
.
region
()
+
regionOffset_
[
s
];
// Don't include baffle surfaces in the calculation
if
...
...
@@ -102,15 +100,15 @@ void Foam::conformationSurfaces::hasBoundedVolume
!=
extendedFeatureEdgeMesh
::
BOTH
)
{
sum
+=
triSurf
[
sI
].
n
ormal
(
surfPts
);
sum
+=
f
.
areaN
ormal
(
surfPts
);
}
else
{
nBaffles
++
;
++
nBaffles
;
}
}
Info
<<
" has "
<<
nBaffles
<<
" baffles out of "
<<
triSurf
.
size
()
<<
" triangles"
<<
end
l
;
<<
triSurf
.
size
()
<<
" triangles"
<<
n
l
;
totalTriangles
+=
triSurf
.
size
();
}
...
...
applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C
View file @
c1964d78
...
...
@@ -271,8 +271,8 @@ Foam::label Foam::meshDualiser::addInternalFace
);
//pointField dualPoints(meshMod.points());
//vector n(newFace.
n
ormal(dualPoints));
//
n /= mag(n);
//
const
vector n(newFace.
unitN
ormal(dualPoints));
//
//Pout<< "Generated internal dualFace:" << dualFacei
// << " verts:" << newFace
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)
...
...
@@ -298,8 +298,8 @@ Foam::label Foam::meshDualiser::addInternalFace
);
//pointField dualPoints(meshMod.points());
//vector n(newFace.
n
ormal(dualPoints));
//
n /= mag(n);
//
const
vector n(newFace.
unitN
ormal(dualPoints));
//
//Pout<< "Generated internal dualFace:" << dualFacei
// << " verts:" << newFace
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)
...
...
@@ -355,8 +355,8 @@ Foam::label Foam::meshDualiser::addBoundaryFace
);
//pointField dualPoints(meshMod.points());
//vector n(newFace.
n
ormal(dualPoints));
//
n /= mag(n);
//
const
vector n(newFace.
unitN
ormal(dualPoints));
//
//Pout<< "Generated boundary dualFace:" << dualFacei
// << " verts:" << newFace
// << " points:" << UIndirectList<point>(meshMod.points(), newFace)
...
...
applications/utilities/surface/surfaceInflate/surfaceInflate.C
View file @
c1964d78
...
...
@@ -89,11 +89,8 @@ tmp<vectorField> calcVertexNormals(const triSurface& surf)
{
// Weighted average of normals of faces attached to the vertex
// Weight = fA / (mag(e0)^2 * mag(e1)^2);
tmp
<
vectorField
>
tpointNormals
(
new
pointField
(
surf
.
nPoints
(),
Zero
)
);
vectorField
&
pointNormals
=
tpointNormals
.
ref
();
auto
tpointNormals
=
tmp
<
vectorField
>::
New
(
surf
.
nPoints
(),
Zero
);
auto
&
pointNormals
=
tpointNormals
.
ref
();
const
pointField
&
points
=
surf
.
points
();
const
labelListList
&
pointFaces
=
surf
.
pointFaces
();
...
...
@@ -108,20 +105,20 @@ tmp<vectorField> calcVertexNormals(const triSurface& surf)
const
label
faceI
=
pFaces
[
fI
];
const
triFace
&
f
=
surf
[
faceI
];
vector
fN
=
f
.
n
ormal
(
points
);
vector
areaNorm
=
f
.
areaN
ormal
(
points
);
scalar
weight
=
calcVertexNormalWeight
(
f
,
meshPoints
[
pI
],
fN
,
areaNorm
,
points
);
pointNormals
[
pI
]
+=
weight
*
fN
;
pointNormals
[
pI
]
+=
weight
*
areaNorm
;
}
pointNormals
[
pI
]
/=
mag
(
pointNormals
[
pI
])
+
VSMALL
;
pointNormals
[
pI
]
.
normalise
()
;
}
return
tpointNormals
;
...
...
@@ -168,9 +165,9 @@ tmp<vectorField> calcPointNormals
// Get average edge normal
vector
n
=
Zero
;
for
All
(
eFaces
,
i
)
for
(
const
label
facei
:
eFaces
)
{
n
+=
s
.
faceNormals
()[
eF
ace
s
[
i
]
];
n
+=
s
.
faceNormals
()[
f
ace
i
];
}
n
/=
eFaces
.
size
();
...
...
src/OpenFOAM/meshes/polyMesh/polyMesh.C
View file @
c1964d78
...
...
@@ -1375,7 +1375,7 @@ bool Foam::polyMesh::pointInCell
vector
proj
=
p
-
faceTri
.
centre
();
if
((
faceTri
.
n
ormal
()
&
proj
)
>
0
)
if
((
faceTri
.
areaN
ormal
()
&
proj
)
>
0
)
{
return
false
;
}
...
...
@@ -1405,7 +1405,7 @@ bool Foam::polyMesh::pointInCell
vector
proj
=
p
-
faceTri
.
centre
();
if
((
faceTri
.
n
ormal
()
&
proj
)
>
0
)
if
((
faceTri
.
areaN
ormal
()
&
proj
)
>
0
)
{
return
false
;
}
...
...
src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
View file @
c1964d78
...
...
@@ -60,9 +60,9 @@ Foam::label Foam::cyclicPolyPatch::findMaxArea
forAll
(
faces
,
facei
)
{
scalar
areaSqr
=
magSqr
(
faces
[
facei
].
n
ormal
(
points
));
scalar
areaSqr
=
magSqr
(
faces
[
facei
].
areaN
ormal
(
points
));
if
(
a
reaSqr
>
maxA
reaSqr
)
if
(
maxA
reaSqr
<
a
reaSqr
)
{
maxAreaSqr
=
areaSqr
;
maxI
=
facei
;
...
...
@@ -81,7 +81,7 @@ void Foam::cyclicPolyPatch::calcTransforms()
vectorField
half0Areas
(
half0
.
size
());
forAll
(
half0
,
facei
)
{
half0Areas
[
facei
]
=
half0
[
facei
].
n
ormal
(
half0
.
points
());
half0Areas
[
facei
]
=
half0
[
facei
].
areaN
ormal
(
half0
.
points
());
}
// Half1
...
...
@@ -89,7 +89,7 @@ void Foam::cyclicPolyPatch::calcTransforms()
vectorField
half1Areas
(
half1
.
size
());
forAll
(
half1
,
facei
)
{
half1Areas
[
facei
]
=
half1
[
facei
].
n
ormal
(
half1
.
points
());
half1Areas
[
facei
]
=
half1
[
facei
].
areaN
ormal
(
half1
.
points
());
}
calcTransforms
...
...
@@ -260,19 +260,17 @@ void Foam::cyclicPolyPatch::calcTransforms
// use calculated normals.
vector
n0
=
findFaceMaxRadius
(
half0Ctrs
);
vector
n1
=
-
findFaceMaxRadius
(
half1Ctrs
);
n0
/=
mag
(
n0
)
+
VSMALL
;
n1
/=
mag
(
n1
)
+
VSMALL
;
n0
.
normalise
()
;
n1
.
normalise
()
;
if
(
debug
)
{
scalar
theta
=
radToDeg
(
acos
(
n0
&
n1
));
Pout
<<
"cyclicPolyPatch::calcTransforms :"
<<
" patch:"
<<
name
()
<<
" Specified rotation :"
<<
" n0:"
<<
n0
<<
" n1:"
<<
n1
<<
" swept angle: "
<<
theta
<<
" [deg]"
<<
endl
;
<<
" swept angle: "
<<
radToDeg
(
acos
(
n0
&
n1
))
<<
" [deg]"
<<
endl
;
}
// Extended tensor from two local coordinate systems calculated
...
...
@@ -420,18 +418,17 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
{
vector
n0
=
findFaceMaxRadius
(
half0Ctrs
);
vector
n1
=
-
findFaceMaxRadius
(
half1Ctrs
);
n0
/=
mag
(
n0
)
+
VSMALL
;
n1
/=
mag
(
n1
)
+
VSMALL
;
n0
.
normalise
()
;
n1
.
normalise
()
;
if
(
debug
)
{
scalar
theta
=
radToDeg
(
acos
(
n0
&
n1
));
Pout
<<
"cyclicPolyPatch::getCentresAndAnchors :"
<<
" patch:"
<<
name
()
<<
" Specified rotation :"
<<
" n0:"
<<
n0
<<
" n1:"
<<
n1
<<
" swept angle: "
<<
theta
<<
" [deg]"
<<
" swept angle: "
<<
radToDeg
(
acos
(
n0
&
n1
))
<<
" [deg]"
<<
endl
;
}
...
...
@@ -499,12 +496,10 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
// Determine the face with max area on both halves. These
// two faces are used to determine the transformation tensors
label
max0I
=
findMaxArea
(
pp0
.
points
(),
pp0
);
vector
n0
=
pp0
[
max0I
].
normal
(
pp0
.
points
());
n0
/=
mag
(
n0
)
+
VSMALL
;
const
vector
n0
=
pp0
[
max0I
].
unitNormal
(
pp0
.
points
());
label
max1I
=
findMaxArea
(
pp1
.
points
(),
pp1
);
vector
n1
=
pp1
[
max1I
].
normal
(
pp1
.
points
());
n1
/=
mag
(
n1
)
+
VSMALL
;
const
vector
n1
=
pp1
[
max1I
].
unitNormal
(
pp1
.
points
());
if
(
mag
(
n0
&
n1
)
<
1
-
matchTolerance
())
{
...
...
src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C
View file @
c1964d78
...
...
@@ -92,9 +92,9 @@ Foam::label Foam::oldCyclicPolyPatch::findMaxArea
forAll
(
faces
,
facei
)
{
scalar
areaSqr
=
magSqr
(
faces
[
facei
].
n
ormal
(
points
));
scalar
areaSqr
=
magSqr
(
faces
[
facei
].
areaN
ormal
(
points
));
if
(
a
reaSqr
>
maxA
reaSqr
)
if
(
maxA
reaSqr
<
a
reaSqr
)
{
maxAreaSqr
=
areaSqr
;
maxI
=
facei
;
...
...
@@ -359,12 +359,10 @@ void Foam::oldCyclicPolyPatch::getCentresAndAnchors
// Determine the face with max area on both halves. These
// two faces are used to determine the transformation tensors
label
max0I
=
findMaxArea
(
pp
.
points
(),
half0Faces
);
vector
n0
=
half0Faces
[
max0I
].
normal
(
pp
.
points
());
n0
/=
mag
(
n0
)
+
VSMALL
;
const
vector
n0
=
half0Faces
[
max0I
].
unitNormal
(
pp
.
points
());
label
max1I
=
findMaxArea
(
pp
.
points
(),
half1Faces
);
vector
n1
=
half1Faces
[
max1I
].
normal
(
pp
.
points
());
n1
/=
mag
(
n1
)
+
VSMALL
;
const
vector
n1
=
half1Faces
[
max1I
].
unitNormal
(
pp
.
points
());
if
(
mag
(
n0
&
n1
)
<
1
-
matchTolerance
())
{
...
...
src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshData.C
View file @
c1964d78
...
...
@@ -281,9 +281,9 @@ calcPointNormals() const
const
labelList
&
curFaces
=
pf
[
pointi
];
for
All
(
curFaces
,
facei
)
for
(
const
label
facei
:
curFaces
)
{
curNormal
+=
faceUnitNormals
[
curFaces
[
facei
]
]
;
curNormal
+=
faceUnitNormals
[
facei
];
}
curNormal
/=
mag
(
curNormal
)
+
VSMALL
;
...
...
@@ -425,7 +425,7 @@ calcFaceAreas() const
forAll
(
n
,
facei
)
{
n
[
facei
]
=
this
->
operator
[](
facei
).
n
ormal
(
points_
);
n
[
facei
]
=
this
->
operator
[](
facei
).
areaN
ormal
(
points_
);
}
if
(
debug
)
...
...
@@ -472,8 +472,7 @@ calcFaceNormals() const
forAll
(
n
,
facei
)
{
n
[
facei
]
=
this
->
operator
[](
facei
).
normal
(
points_
);
n
[
facei
]
/=
mag
(
n
[
facei
])
+
VSMALL
;
n
[
facei
]
=
this
->
operator
[](
facei
).
unitNormal
(
points_
);
}
if
(
debug
)
...
...
src/conversion/polyDualMesh/polyDualMesh.C
View file @
c1964d78
...
...
@@ -1006,8 +1006,9 @@ void Foam::polyDualMesh::calcDual
{
// Check orientation.
const
face
&
f
=
dynDualFaces
.
last
();
vector
n
=
f
.
normal
(
dualPoints
);
if
(((
mesh
.
points
()[
owner
]
-
dualPoints
[
f
[
0
]])
&
n
)
>
0
)
const
vector
areaNorm
=
f
.
areaNormal
(
dualPoints
);
if
(((
mesh
.
points
()[
owner
]
-
dualPoints
[
f
[
0
]])
&
areaNorm
)
>
0
)
{
WarningInFunction
<<
" on boundary edge:"
<<
edgeI
...
...
@@ -1121,8 +1122,9 @@ void Foam::polyDualMesh::calcDual
{
// Check orientation.
const
face
&
f
=
dynDualFaces
.
last
();
vector
n
=
f
.
normal
(
dualPoints
);
if
(((
mesh
.
points
()[
owner
]
-
dualPoints
[
f
[
0
]])
&
n
)
>
0
)
const
vector
areaNorm
=
f
.
areaNormal
(
dualPoints
);
if
(((
mesh
.
points
()[
owner
]
-
dualPoints
[
f
[
0
]])
&
areaNorm
)
>
0
)
{
WarningInFunction
<<
" on internal edge:"
<<
edgeI
...
...
src/dynamicMesh/meshCut/cellCuts/cellCuts.C
View file @
c1964d78
...
...
@@ -1363,28 +1363,26 @@ bool Foam::cellCuts::loopAnchorConsistent
// Create identity face for ease of calculation of normal etc.
face
f
(
identity
(
loopPts
.
size
()));
vector
n
orm
al
=
f
.
n
ormal
(
loopPts
);
point
ctr
=
f
.
centre
(
loopPts
);
const
vector
areaN
orm
=
f
.
areaN
ormal
(
loopPts
);
const
point
ctr
=
f
.
centre
(
loopPts
);
// Get average position of anchor points.
vector
avg
(
Zero
);
for
All
(
anchorPoints
,
ptI
)
for
(
const
label
pointi
:
anchorPoints
)
{
avg
+=
mesh
().
points
()[
anchorPoints
[
ptI
]
];
avg
+=
mesh
().
points
()[
pointi
];
}
avg
/=
anchorPoints
.
size
();
if
(((
avg
-
ctr
)
&
n
orm
al
)
>
0
)
if
(((
avg
-
ctr
)
&
areaN
orm
)
>
0
)
{
return
true
;
}
else
{
return
false
;
}
return
false
;
}
...
...
src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C
View file @
c1964d78
...
...
@@ -1646,7 +1646,7 @@ bool Foam::polyMeshGeometry::checkFaceTwist
// p[f[fpI]],
// p[f.nextLabel(fpI)],
// fc
// ).
n
ormal()
// ).
areaN
ormal()
// );
//
// scalar magTri = mag(triArea);
...
...
@@ -1721,7 +1721,7 @@ bool Foam::polyMeshGeometry::checkFaceTwist
p
[
f
[
fpI
]],
p
[
f
.
nextLabel
(
fpI
)],
fc
).
n
ormal
()
).
areaN
ormal
()
);
scalar
magTri
=
mag
(
triArea
);
...
...
@@ -1826,7 +1826,7 @@ bool Foam::polyMeshGeometry::checkTriangleTwist
p
[
f
[
fp
]],
p
[
f
.
nextLabel
(
fp
)],
fc
).
n
ormal
();
).
areaN
ormal
();
scalar
magTri
=
mag
(
prevN
);
...
...
@@ -1853,7 +1853,7 @@ bool Foam::polyMeshGeometry::checkTriangleTwist
p
[
f
[
fp
]],
p
[
f
.
nextLabel
(
fp
)],
fc
).
n
ormal
()
).
areaN
ormal
()
);
scalar
magTri
=
mag
(
triN
);
...
...
src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C
View file @
c1964d78
...
...
@@ -55,9 +55,8 @@ bool Foam::combineFaces::convexFace
const
face
&
f
)
{
// Get outwards pointing normal of f.
vector
n
=
f
.
normal
(
points
);
n
/=
mag
(
n
);
// Get outwards pointing normal of f, only the sign matters.
const
vector
areaNorm
=
f
.
areaNormal
(
points
);
// Get edge from f[0] to f[size-1];
vector
ePrev
(
points
[
f
.
first
()]
-
points
[
f
.
last
()]);
...
...
@@ -78,7 +77,7 @@ bool Foam::combineFaces::convexFace
{
vector
edgeNormal
=
ePrev
^
e10
;
if
((
edgeNormal
&
n
)
<
0
)
if
((
edgeNormal
&
areaNorm
)
<
0
)
{
// Concave. Check angle.
if
((
ePrev
&
e10
)
<
minConcaveCos
)
...
...
@@ -150,12 +149,10 @@ void Foam::combineFaces::regioniseFaces
// - small angle
if
(
p0
!=
-
1
&&
p0
==
p1
&&
!
patches
[
p0
].
coupled
())
{
vector
f0Normal
=
mesh_
.
faceAreas
()[
f0
];
f0Normal
/=
mag
(
f0Normal
);
vector
f1Normal
=
mesh_
.
faceAreas
()[
f1
];
f1Normal
/=
mag
(
f1Normal
);
vector
f0Normal
=
normalised
(
mesh_
.
faceAreas
()[
f0
]);
vector
f1Normal
=
normalised
(
mesh_
.
faceAreas
()[
f1
]);
if
((
f0Normal
&
f1Normal
)
>
minCos
)
if
((
f0Normal
&
f1Normal
)
>
minCos
)
{
Map
<
label
>::
const_iterator
f0Fnd
=
faceRegion
.
find
(
f0
);
...
...
src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C
View file @
c1964d78
...
...
@@ -835,11 +835,11 @@ void Foam::hexRef8::checkInternalOrientation
face
compactFace
(
identity
(
newFace
.
size
()));
pointField
compactPoints
(
meshMod
.
points
(),
newFace
);
vector
n
(
compactFace
.
n
ormal
(
compactPoints
));
const
vector
areaNorm
(
compactFace
.
areaN
ormal
(
compactPoints
));
vector
dir
(
neiPt
-
ownPt
);
const
vector
dir
(
neiPt
-
ownPt
);
if
((
dir
&
n
)
<
0
)
if
((
dir
&
areaNorm
)
<
0
)
{
FatalErrorInFunction
<<
"cell:"
<<
celli
<<
" old face:"
<<
facei
...
...
@@ -850,9 +850,9 @@ void Foam::hexRef8::checkInternalOrientation
<<
abort
(
FatalError
);
}
vector
fcToOwn
(
compactFace
.
centre
(
compactPoints
)
-
ownPt
);
const
vector
fcToOwn
(
compactFace
.
centre
(
compactPoints
)
-
ownPt
);
scalar
s
=
(
fcToOwn
&
n
)
/
(
dir
&
n
);
const
scalar
s
=
(
fcToOwn
&
areaNorm
)
/
(
dir
&
areaNorm
);
if
(
s
<
0
.
1
||
s
>
0
.
9
)
{
...
...
@@ -881,11 +881,11 @@ void Foam::hexRef8::checkBoundaryOrientation
face
compactFace
(
identity
(
newFace
.
size
()));
pointField
compactPoints
(
meshMod
.
points
(),
newFace
);
vector
n
(
compactFace
.
n
ormal
(
compactPoints
));
const
vector
areaNorm
(
compactFace
.
areaN
ormal
(
compactPoints
));
vector
dir
(
boundaryPt
-
ownPt
);
const
vector
dir
(
boundaryPt
-
ownPt
);
if
((
dir
&
n
)
<
0
)
if
((
dir
&
areaNorm
)
<
0
)
{
FatalErrorInFunction
<<
"cell:"
<<
celli
<<
" old face:"
<<
facei
...
...
@@ -896,9 +896,9 @@ void Foam::hexRef8::checkBoundaryOrientation
<<
abort
(
FatalError
);
}
vector
fcToOwn
(
compactFace
.
centre
(
compactPoints
)
-
ownPt
);
const
vector
fcToOwn
(
compactFace
.
centre
(
compactPoints
)
-
ownPt
);
scalar
s
=
(
fcToOwn
&
dir
)
/
magSqr
(
dir
);
const
scalar
s
=
(
fcToOwn
&
dir
)
/
magSqr
(
dir
);
if
(
s
<
0
.
7
||
s
>
1
.
3
)
{
...
...
src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C
View file @
c1964d78
...
...
@@ -150,8 +150,7 @@ void Foam::enrichedPatch::calcCutFaces() const
}
// Grab face normal
vector
normal
=
curLocalFace
.
normal
(
lp
);
normal
/=
mag
(
normal
);
const
vector
normal
=
curLocalFace
.
unitNormal
(
lp
);
while
(
edgeSeeds
.
size
())
{
...
...
src/fileFormats/stl/STLtriangleI.H
View file @
c1964d78
...
...
@@ -143,9 +143,8 @@ inline void Foam::STLtriangle::write
const
point
&
pt2
)
{
// calculate the normal ourselves
vector
norm
=
triPointRef
(
pt0
,
pt1
,
pt2
).
normal
();
norm
/=
mag
(
norm
)
+
VSMALL
;
// Calculate the normal ourselves
const
vector
norm
=
triPointRef
(
pt0
,
pt1
,
pt2
).
unitNormal
();
write
(
os
,
norm
,
pt0
,
pt1
,
pt2
);
}
...
...
src/fileFormats/vtk/read/vtkUnstructuredReader.C
View file @
c1964d78
...
...
@@ -979,10 +979,10 @@ void Foam::vtkUnstructuredReader::read(ISstream& inFile)
);