Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
7922f845
Commit
7922f845
authored
12 years ago
by
laurence
Browse files
Options
Downloads
Patches
Plain Diff
ENH: sortedEdgeFaces: now picks a direction with the largest angle with the edge
parent
08655f27
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSortEdges.C
+43
-11
43 additions, 11 deletions
...OAM/meshes/primitiveMesh/PatchTools/PatchToolsSortEdges.C
with
43 additions
and
11 deletions
src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsSortEdges.C
+
43
−
11
View file @
7922f845
...
@@ -66,15 +66,31 @@ Foam::PatchTools::sortedEdgeFaces
...
@@ -66,15 +66,31 @@ Foam::PatchTools::sortedEdgeFaces
vector
e2
=
e
.
vec
(
localPoints
);
vector
e2
=
e
.
vec
(
localPoints
);
e2
/=
mag
(
e2
)
+
VSMALL
;
e2
/=
mag
(
e2
)
+
VSMALL
;
// Get opposite vertex for 0th face
// Get the vertex on 0th face that forms a vector with the first
const
Face
&
f
=
localFaces
[
faceNbs
[
0
]];
// edge point that has the largest angle with the edge
label
fp0
=
findIndex
(
f
,
e
[
0
]);
const
Face
&
f0
=
localFaces
[
faceNbs
[
0
]];
label
fp1
=
f
.
fcIndex
(
fp0
);
label
vertI
=
(
f
[
fp1
]
!=
e
[
1
]
?
f
[
fp1
]
:
f
[
f
.
fcIndex
(
fp1
)]);
scalar
maxAngle
=
GREAT
;
vector
maxAngleEdgeDir
(
vector
::
max
);
forAll
(
f0
,
fpI
)
{
if
(
f0
[
fpI
]
!=
e
.
start
())
{
const
vector
faceEdgeDir
=
localPoints
[
f0
[
fpI
]]
-
edgePt
;
const
scalar
angle
=
faceEdgeDir
&
e2
;
if
(
angle
<
maxAngle
)
{
maxAngle
=
angle
;
maxAngleEdgeDir
=
faceEdgeDir
;
}
}
}
// Get vector normal both to e2 and to edge from opposite vertex
// Get vector normal both to e2 and to edge from opposite vertex
// to edge (will be x-axis of our coordinate system)
// to edge (will be x-axis of our coordinate system)
vector
e0
=
e2
^
(
localPoints
[
vertI
]
-
edgePt
)
;
vector
e0
=
e2
^
maxAngleEdgeDir
;
e0
/=
mag
(
e0
)
+
VSMALL
;
e0
/=
mag
(
e0
)
+
VSMALL
;
// Get y-axis of coordinate system
// Get y-axis of coordinate system
...
@@ -87,13 +103,29 @@ Foam::PatchTools::sortedEdgeFaces
...
@@ -87,13 +103,29 @@ Foam::PatchTools::sortedEdgeFaces
for
(
label
nbI
=
1
;
nbI
<
faceNbs
.
size
();
nbI
++
)
for
(
label
nbI
=
1
;
nbI
<
faceNbs
.
size
();
nbI
++
)
{
{
// Get opposite vertex
// Get the vertex on face that forms a vector with the first
// edge point that has the largest angle with the edge
const
Face
&
f
=
localFaces
[
faceNbs
[
nbI
]];
const
Face
&
f
=
localFaces
[
faceNbs
[
nbI
]];
label
fp0
=
findIndex
(
f
,
e
[
0
]);
label
fp1
=
f
.
fcIndex
(
fp0
);
label
vertI
=
(
f
[
fp1
]
!=
e
[
1
]
?
f
[
fp1
]
:
f
[
f
.
fcIndex
(
fp1
)]);
vector
vec
=
e2
^
(
localPoints
[
vertI
]
-
edgePt
);
maxAngle
=
GREAT
;
maxAngleEdgeDir
=
vector
::
max
;
forAll
(
f
,
fpI
)
{
if
(
f
[
fpI
]
!=
e
.
start
())
{
const
vector
faceEdgeDir
=
localPoints
[
f
[
fpI
]]
-
edgePt
;
const
scalar
angle
=
faceEdgeDir
&
e2
;
if
(
angle
<
maxAngle
)
{
maxAngle
=
angle
;
maxAngleEdgeDir
=
faceEdgeDir
;
}
}
}
vector
vec
=
e2
^
maxAngleEdgeDir
;
vec
/=
mag
(
vec
)
+
VSMALL
;
vec
/=
mag
(
vec
)
+
VSMALL
;
faceAngles
[
nbI
]
=
pseudoAngle
faceAngles
[
nbI
]
=
pseudoAngle
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment