Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
436fe6a4
Commit
436fe6a4
authored
16 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix orientation of surface mesh for OCC models
parent
b97f687c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Mesh/meshGFace.cpp
+43
-22
43 additions, 22 deletions
Mesh/meshGFace.cpp
doc/VERSIONS.txt
+3
-2
3 additions, 2 deletions
doc/VERSIONS.txt
with
46 additions
and
24 deletions
Mesh/meshGFace.cpp
+
43
−
22
View file @
436fe6a4
...
@@ -1418,31 +1418,52 @@ void orientMeshGFace::operator()(GFace *gf)
...
@@ -1418,31 +1418,52 @@ void orientMeshGFace::operator()(GFace *gf)
if
(
gf
->
geomType
()
==
GEntity
::
ProjectionFace
)
return
;
if
(
gf
->
geomType
()
==
GEntity
::
ProjectionFace
)
return
;
// surface orientions in OCC are not consistent with the orientation
// of the bounding edges, so just leave them unchanged:
if
(
gf
->
getNativeType
()
==
GEntity
::
OpenCascadeModel
)
return
;
// in old versions we did not reorient transfinite surface meshes;
// in old versions we did not reorient transfinite surface meshes;
// we could add the following to provide backward compatibility:
// we could add the following to provide backward compatibility:
// if(gf->meshAttributes.Method == MESH_TRANSFINITE) return;
// if(gf->meshAttributes.Method == MESH_TRANSFINITE) return;
// orients the mesh to match the orientation of the first edge
if
(
gf
->
getNativeType
()
==
GEntity
::
OpenCascadeModel
){
std
::
list
<
GEdge
*>
edges
=
gf
->
edges
();
// surface orientions in OCC do not seem to be consistent with the
std
::
list
<
int
>
ori
=
gf
->
orientations
();
// orientation of the bounding edges, so we compare the normals
if
(
edges
.
empty
()
||
ori
.
empty
())
return
;
// pointwise in an element
GEdge
*
ge
=
*
edges
.
begin
();
for
(
int
i
=
0
;
i
<
gf
->
getNumMeshElements
();
i
++
){
GVertex
*
beg
=
ge
->
getBeginVertex
();
MElement
*
e
=
gf
->
getMeshElement
(
i
);
GVertex
*
end
=
ge
->
getEndVertex
();
for
(
int
j
=
0
;
j
<
e
->
getNumVertices
();
j
++
){
if
(
!
beg
||
beg
->
mesh_vertices
.
empty
()
||
!
end
||
end
->
mesh_vertices
.
empty
())
return
;
MVertex
*
v
=
e
->
getVertex
(
j
);
MVertex
*
v1
=
beg
->
mesh_vertices
[
0
];
SPoint2
param
;
MVertex
*
v2
=
ge
->
mesh_vertices
.
empty
()
?
end
->
mesh_vertices
[
0
]
:
ge
->
mesh_vertices
[
0
];
if
(
reparamMeshVertexOnFace
(
v
,
gf
,
param
)){
int
sign
=
*
ori
.
begin
();
SVector3
ne
=
e
->
getFace
(
0
).
normal
();
MEdge
ref
(
sign
>
0
?
v1
:
v2
,
sign
>
0
?
v2
:
v1
);
SVector3
nf
=
gf
->
normal
(
param
);
if
(
shouldRevert
(
ref
,
gf
->
triangles
)
||
shouldRevert
(
ref
,
gf
->
quadrangles
)){
if
(
dot
(
ne
,
nf
)
<
0
){
Msg
::
Debug
(
"Reverting orientation of mesh in face %d"
,
gf
->
tag
());
Msg
::
Debug
(
"Reverting orientation of mesh in face %d"
,
gf
->
tag
());
for
(
unsigned
int
i
=
0
;
i
<
gf
->
triangles
.
size
();
i
++
)
for
(
int
k
=
0
;
k
<
gf
->
getNumMeshElements
();
k
++
)
gf
->
triangles
[
i
]
->
revert
();
gf
->
getMeshElement
(
k
)
->
revert
();
for
(
unsigned
int
i
=
0
;
i
<
gf
->
quadrangles
.
size
();
i
++
)
}
gf
->
quadrangles
[
i
]
->
revert
();
return
;
}
}
}
Msg
::
Warning
(
"Could not orient mesh in face %d"
,
gf
->
tag
());
}
else
{
// orient the mesh to match the orientation of the first edge
std
::
list
<
GEdge
*>
edges
=
gf
->
edges
();
std
::
list
<
int
>
ori
=
gf
->
orientations
();
if
(
edges
.
empty
()
||
ori
.
empty
())
return
;
GEdge
*
ge
=
*
edges
.
begin
();
GVertex
*
beg
=
ge
->
getBeginVertex
();
GVertex
*
end
=
ge
->
getEndVertex
();
if
(
!
beg
||
beg
->
mesh_vertices
.
empty
()
||
!
end
||
end
->
mesh_vertices
.
empty
())
return
;
MVertex
*
v1
=
beg
->
mesh_vertices
[
0
];
MVertex
*
v2
=
ge
->
mesh_vertices
.
empty
()
?
end
->
mesh_vertices
[
0
]
:
ge
->
mesh_vertices
[
0
];
int
sign
=
*
ori
.
begin
();
MEdge
ref
(
sign
>
0
?
v1
:
v2
,
sign
>
0
?
v2
:
v1
);
if
(
shouldRevert
(
ref
,
gf
->
triangles
)
||
shouldRevert
(
ref
,
gf
->
quadrangles
)){
Msg
::
Debug
(
"Reverting orientation of mesh in face %d"
,
gf
->
tag
());
for
(
unsigned
int
i
=
0
;
i
<
gf
->
triangles
.
size
();
i
++
)
gf
->
triangles
[
i
]
->
revert
();
for
(
unsigned
int
i
=
0
;
i
<
gf
->
quadrangles
.
size
();
i
++
)
gf
->
quadrangles
[
i
]
->
revert
();
}
}
}
}
}
This diff is collapsed.
Click to expand it.
doc/VERSIONS.txt
+
3
−
2
View file @
436fe6a4
$Id: VERSIONS.txt,v 1.3
8
2009-03-1
3 08:04:38
geuzaine Exp $
$Id: VERSIONS.txt,v 1.3
9
2009-03-1
5 10:36:40
geuzaine Exp $
(?): removed GSL dependency (Gmsh now simply requires Blas and
(?): removed GSL dependency (Gmsh now simply requires Blas and
Lapack); new per-window visibility; added support for composite window
Lapack); new per-window visibility; added support for composite window
printing and background images; fixes for string options in parser.
printing and background images; fixes for string options in parser;
fixed surface mesh orientation for Open Cascade models.
2.3.0 (Jan 23, 2009): major graphics and GUI code refactoring; new
2.3.0 (Jan 23, 2009): major graphics and GUI code refactoring; new
full-quad/hexa subdivision algorithm (removed Mesh.RecombineAlgo);
full-quad/hexa subdivision algorithm (removed Mesh.RecombineAlgo);
...
...
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