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
10e3e7f5
Commit
10e3e7f5
authored
16 years ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
inconsistent orientation
parent
f0bff1d6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/meshTools/triSurface/orientedSurface/orientedSurface.C
+70
-37
70 additions, 37 deletions
src/meshTools/triSurface/orientedSurface/orientedSurface.C
src/meshTools/triSurface/orientedSurface/orientedSurface.H
+9
-0
9 additions, 0 deletions
src/meshTools/triSurface/orientedSurface/orientedSurface.H
with
79 additions
and
37 deletions
src/meshTools/triSurface/orientedSurface/orientedSurface.C
+
70
−
37
View file @
10e3e7f5
...
@@ -175,6 +175,51 @@ Foam::labelList Foam::orientedSurface::edgeToFace
...
@@ -175,6 +175,51 @@ Foam::labelList Foam::orientedSurface::edgeToFace
}
}
void
Foam
::
orientedSurface
::
walkSurface
(
const
triSurface
&
s
,
const
label
startFaceI
,
labelList
&
flipState
)
{
// List of faces that were changed in the last iteration.
labelList
changedFaces
(
1
,
startFaceI
);
// List of edges that were changed in the last iteration.
labelList
changedEdges
;
while
(
true
)
{
changedEdges
=
faceToEdge
(
s
,
changedFaces
);
if
(
debug
)
{
Pout
<<
"From changedFaces:"
<<
changedFaces
.
size
()
<<
" to changedEdges:"
<<
changedEdges
.
size
()
<<
endl
;
}
if
(
changedEdges
.
empty
())
{
break
;
}
changedFaces
=
edgeToFace
(
s
,
changedEdges
,
flipState
);
if
(
debug
)
{
Pout
<<
"From changedEdges:"
<<
changedEdges
.
size
()
<<
" to changedFaces:"
<<
changedFaces
.
size
()
<<
endl
;
}
if
(
changedFaces
.
empty
())
{
break
;
}
}
}
void
Foam
::
orientedSurface
::
propagateOrientation
void
Foam
::
orientedSurface
::
propagateOrientation
(
(
const
triSurface
&
s
,
const
triSurface
&
s
,
...
@@ -228,42 +273,8 @@ void Foam::orientedSurface::propagateOrientation
...
@@ -228,42 +273,8 @@ void Foam::orientedSurface::propagateOrientation
<<
endl
;
<<
endl
;
}
}
// Walk the surface from nearestFaceI, changing the flipstate.
// List of faces that were changed in the last iteration.
walkSurface
(
s
,
nearestFaceI
,
flipState
);
labelList
changedFaces
(
1
,
nearestFaceI
);
// List of edges that were changed in the last iteration.
labelList
changedEdges
;
while
(
true
)
{
changedEdges
=
faceToEdge
(
s
,
changedFaces
);
if
(
debug
)
{
Pout
<<
"From changedFaces:"
<<
changedFaces
.
size
()
<<
" to changedEdges:"
<<
changedEdges
.
size
()
<<
endl
;
}
if
(
changedEdges
.
empty
())
{
break
;
}
changedFaces
=
edgeToFace
(
s
,
changedEdges
,
flipState
);
if
(
debug
)
{
Pout
<<
"From changedEdges:"
<<
changedEdges
.
size
()
<<
" to changedFaces:"
<<
changedFaces
.
size
()
<<
endl
;
}
if
(
changedFaces
.
empty
())
{
break
;
}
}
}
}
...
@@ -352,6 +363,26 @@ bool Foam::orientedSurface::orient
...
@@ -352,6 +363,26 @@ bool Foam::orientedSurface::orient
const
bool
orientOutside
const
bool
orientOutside
)
)
{
{
bool
anyFlipped
=
false
;
// Do initial flipping to make triangles consistent. Otherwise if the
// nearest is e.g. on an edge inbetween inconsistent triangles it might
// make the wrong decision.
if
(
s
.
size
()
>
0
)
{
// Whether face has to be flipped.
// UNVISITED: unvisited
// NOFLIP: no need to flip
// FLIP: need to flip
labelList
flipState
(
s
.
size
(),
UNVISITED
);
flipState
[
0
]
=
NOFLIP
;
walkSurface
(
s
,
0
,
flipState
);
anyFlipped
=
flipSurface
(
s
,
flipState
);
}
// Whether face has to be flipped.
// Whether face has to be flipped.
// UNVISITED: unvisited
// UNVISITED: unvisited
// NOFLIP: no need to flip
// NOFLIP: no need to flip
...
@@ -410,7 +441,9 @@ bool Foam::orientedSurface::orient
...
@@ -410,7 +441,9 @@ bool Foam::orientedSurface::orient
}
}
// Now finally flip triangles according to flipState.
// Now finally flip triangles according to flipState.
return
flipSurface
(
s
,
flipState
);
bool
geomFlipped
=
flipSurface
(
s
,
flipState
);
return
anyFlipped
||
geomFlipped
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/meshTools/triSurface/orientedSurface/orientedSurface.H
+
9
−
0
View file @
10e3e7f5
...
@@ -94,6 +94,15 @@ class orientedSurface
...
@@ -94,6 +94,15 @@ class orientedSurface
labelList
&
flip
labelList
&
flip
);
);
//- Walk from face across connected faces. Change orientation to be
// consistent with startFaceI.
static
void
walkSurface
(
const
triSurface
&
s
,
const
label
startFaceI
,
labelList
&
flipState
);
//- Given nearest point and face check orientation to nearest face
//- Given nearest point and face check orientation to nearest face
// and flip if nessecary (only marked in flipState) and propagate.
// and flip if nessecary (only marked in flipState) and propagate.
static
void
propagateOrientation
static
void
propagateOrientation
...
...
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