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
b5a8c6ba
Commit
b5a8c6ba
authored
13 years ago
by
Bastien Gorissen
Browse files
Options
Downloads
Patches
Plain Diff
Bug fix matching et haut ordre
parent
89563a67
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
Geo/GeomMeshMatcher.cpp
+16
-14
16 additions, 14 deletions
Geo/GeomMeshMatcher.cpp
with
16 additions
and
14 deletions
Geo/GeomMeshMatcher.cpp
+
16
−
14
View file @
b5a8c6ba
...
@@ -148,20 +148,20 @@ GeomMeshMatcher::matchEdges(GModel* m1, GModel* m2,
...
@@ -148,20 +148,20 @@ GeomMeshMatcher::matchEdges(GModel* m1, GModel* m2,
std
::
vector
<
GEdge
*>
common_edges
;
std
::
vector
<
GEdge
*>
common_edges
;
std
::
vector
<
std
::
list
<
GEdge
*>
>
lists
;
std
::
vector
<
std
::
list
<
GEdge
*>
>
lists
;
if
(
v1
==
v2
)
{
if
(
v1
==
v2
)
{
Msg
::
Debug
(
"Found a closed curve"
);
Msg
::
Debug
(
"Found a closed curve"
);
closed_curves
.
push_back
(
e1
);
closed_curves
.
push_back
(
e1
);
for
(
GModel
::
eiter
eit2
=
m2
->
firstEdge
();
eit2
!=
m2
->
lastEdge
();
eit2
++
)
{
for
(
GModel
::
eiter
eit2
=
m2
->
firstEdge
();
eit2
!=
m2
->
lastEdge
();
eit2
++
)
{
GEdge
*
e2
=
(
GEdge
*
)
*
eit2
;
GEdge
*
e2
=
(
GEdge
*
)
*
eit2
;
GVertex
*
v3
=
e2
->
getBeginVertex
();
GVertex
*
v3
=
e2
->
getBeginVertex
();
GVertex
*
v4
=
e2
->
getEndVertex
();
GVertex
*
v4
=
e2
->
getEndVertex
();
if
(
v3
==
v4
)
{
if
(
v3
==
v4
)
{
Msg
::
Debug
(
"Found a loop (%i) in the mesh %i %i"
,
e2
->
tag
(),
v3
->
tag
(),
v3
->
tag
());
Msg
::
Debug
(
"Found a loop (%i) in the mesh %i %i"
,
e2
->
tag
(),
v3
->
tag
(),
v3
->
tag
());
common_edges
.
push_back
(
e2
);
common_edges
.
push_back
(
e2
);
}
}
}
}
}
else
{
}
else
{
//if (coresp_v->count(vfindMatching<GVertex*>(*coresp_v,v1)1) > 0 && coresp_v->count(v2) > 0) {
//if (coresp_v->count(vfindMatching<GVertex*>(*coresp_v,v1)1) > 0 && coresp_v->count(v2) > 0) {
...
@@ -176,7 +176,7 @@ GeomMeshMatcher::matchEdges(GModel* m1, GModel* m2,
...
@@ -176,7 +176,7 @@ GeomMeshMatcher::matchEdges(GModel* m1, GModel* m2,
lists
.
push_back
((
findMatching
<
GVertex
*>
(
*
coresp_v
,
v2
))
->
edges
());
lists
.
push_back
((
findMatching
<
GVertex
*>
(
*
coresp_v
,
v2
))
->
edges
());
}
}
if
(
ok1
&&
ok2
)
if
(
ok1
&&
ok2
)
getIntersection
<
GEdge
*>
(
common_edges
,
lists
);
getIntersection
<
GEdge
*>
(
common_edges
,
lists
);
}
}
GEdge
*
choice
=
0
;
GEdge
*
choice
=
0
;
...
@@ -233,13 +233,13 @@ GeomMeshMatcher:: matchFaces(GModel* m1, GModel* m2,
...
@@ -233,13 +233,13 @@ GeomMeshMatcher:: matchFaces(GModel* m1, GModel* m2,
GFace
*
f1
=
(
GFace
*
)
*
fit
;
GFace
*
f1
=
(
GFace
*
)
*
fit
;
num_total_faces
++
;
num_total_faces
++
;
std
::
vector
<
std
::
list
<
GFace
*>
>
lists
;
std
::
vector
<
std
::
list
<
GFace
*>
>
lists
;
std
::
list
<
GEdge
*>
boundary_edges
=
f1
->
edges
();
std
::
list
<
GEdge
*>
boundary_edges
=
f1
->
edges
();
for
(
std
::
list
<
GEdge
*>::
iterator
boundary_edge
=
boundary_edges
.
begin
();
for
(
std
::
list
<
GEdge
*>::
iterator
boundary_edge
=
boundary_edges
.
begin
();
boundary_edge
!=
boundary_edges
.
end
();
boundary_edge
++
)
{
boundary_edge
!=
boundary_edges
.
end
();
boundary_edge
++
)
{
// if (boundary_edge->getBeginVertex() == boundary_edge->getEndVertex() &&
// if (boundary_edge->getBeginVertex() == boundary_edge->getEndVertex() &&
if
(
!
(
*
boundary_edge
)
->
isSeam
(
f1
))
if
(
!
(
*
boundary_edge
)
->
isSeam
(
f1
))
lists
.
push_back
(
findMatching
<
GEdge
*>
(
*
coresp_e
,
*
boundary_edge
)
->
faces
());
lists
.
push_back
(
findMatching
<
GEdge
*>
(
*
coresp_e
,
*
boundary_edge
)
->
faces
());
}
}
...
@@ -284,7 +284,7 @@ GeomMeshMatcher:: matchFaces(GModel* m1, GModel* m2,
...
@@ -284,7 +284,7 @@ GeomMeshMatcher:: matchFaces(GModel* m1, GModel* m2,
}
}
// ------------------------------------------------------------[ Matching regions ]
// ------------------------------------------------------------[ Matching regions ]
std
::
vector
<
Pair
<
GRegion
*
,
GRegion
*>
>*
std
::
vector
<
Pair
<
GRegion
*
,
GRegion
*>
>*
GeomMeshMatcher
::
matchRegions
(
GModel
*
m1
,
GModel
*
m2
,
GeomMeshMatcher
::
matchRegions
(
GModel
*
m1
,
GModel
*
m2
,
...
@@ -602,7 +602,7 @@ static void copy_vertices (GEdge* to, GEdge* from, std::map<MVertex*,MVertex*> &
...
@@ -602,7 +602,7 @@ static void copy_vertices (GEdge* to, GEdge* from, std::map<MVertex*,MVertex*> &
GPoint
gp
=
to
->
closestPoint
(
SPoint3
(
v_from
->
x
(),
v_from
->
y
(),
v_from
->
z
()),
t
);
GPoint
gp
=
to
->
closestPoint
(
SPoint3
(
v_from
->
x
(),
v_from
->
y
(),
v_from
->
z
()),
t
);
MEdgeVertex
*
v_to
=
new
MEdgeVertex
(
gp
.
x
(),
gp
.
y
(),
gp
.
z
(),
to
,
gp
.
u
()
);
MEdgeVertex
*
v_to
=
new
MEdgeVertex
(
gp
.
x
(),
gp
.
y
(),
gp
.
z
(),
to
,
gp
.
u
()
);
to
->
mesh_vertices
.
push_back
(
v_to
);
to
->
mesh_vertices
.
push_back
(
v_to
);
_mesh_to_geom
[
v_from
]
=
v_to
;
_mesh_to_geom
[
v_from
]
=
v_to
;
}
}
for
(
int
i
=
0
;
i
<
from
->
mesh_vertices
.
size
();
i
++
){
for
(
int
i
=
0
;
i
<
from
->
mesh_vertices
.
size
();
i
++
){
...
@@ -639,8 +639,8 @@ static void copy_vertices (GFace *geom, GFace *mesh, std::map<MVertex*,MVertex*>
...
@@ -639,8 +639,8 @@ static void copy_vertices (GFace *geom, GFace *mesh, std::map<MVertex*,MVertex*>
}
}
template
<
class
ELEMENT
>
template
<
class
ELEMENT
>
static
void
copy_elements
(
std
::
vector
<
ELEMENT
*>
&
to
,
static
void
copy_elements
(
std
::
vector
<
ELEMENT
*>
&
to
,
std
::
vector
<
ELEMENT
*>
&
from
,
std
::
vector
<
ELEMENT
*>
&
from
,
std
::
map
<
MVertex
*
,
MVertex
*>
&
_mesh_to_geom
){
std
::
map
<
MVertex
*
,
MVertex
*>
&
_mesh_to_geom
){
MElementFactory
toto
;
MElementFactory
toto
;
to
.
clear
();
to
.
clear
();
...
@@ -662,7 +662,7 @@ void copy_vertices (GModel *geom, GModel *mesh, std::map<MVertex*,MVertex*> &_me
...
@@ -662,7 +662,7 @@ void copy_vertices (GModel *geom, GModel *mesh, std::map<MVertex*,MVertex*> &_me
std
::
vector
<
Pair
<
GVertex
*
,
GVertex
*>
>
*
coresp_v
,
std
::
vector
<
Pair
<
GVertex
*
,
GVertex
*>
>
*
coresp_v
,
std
::
vector
<
Pair
<
GEdge
*
,
GEdge
*>
>
*
coresp_e
,
std
::
vector
<
Pair
<
GEdge
*
,
GEdge
*>
>
*
coresp_e
,
std
::
vector
<
Pair
<
GFace
*
,
GFace
*>
>
*
coresp_f
){
std
::
vector
<
Pair
<
GFace
*
,
GFace
*>
>
*
coresp_f
){
// copy all elements
// copy all elements
for
(
int
i
=
0
;
i
<
coresp_v
->
size
();
++
i
)
for
(
int
i
=
0
;
i
<
coresp_v
->
size
();
++
i
)
copy_vertices
((
*
coresp_v
)[
i
].
first
(),(
*
coresp_v
)[
i
].
second
(),
_mesh_to_geom
);
copy_vertices
((
*
coresp_v
)[
i
].
first
(),(
*
coresp_v
)[
i
].
second
(),
_mesh_to_geom
);
...
@@ -684,7 +684,7 @@ void copy_elements (GModel *geom, GModel *mesh, std::map<MVertex*,MVertex*> &_me
...
@@ -684,7 +684,7 @@ void copy_elements (GModel *geom, GModel *mesh, std::map<MVertex*,MVertex*> &_me
for
(
int
i
=
0
;
i
<
coresp_e
->
size
();
++
i
)
for
(
int
i
=
0
;
i
<
coresp_e
->
size
();
++
i
)
copy_elements
<
MLine
>
((
*
coresp_e
)[
i
].
first
()
->
lines
,(
*
coresp_e
)[
i
].
second
()
->
lines
,
_mesh_to_geom
);
copy_elements
<
MLine
>
((
*
coresp_e
)[
i
].
first
()
->
lines
,(
*
coresp_e
)[
i
].
second
()
->
lines
,
_mesh_to_geom
);
for
(
int
i
=
0
;
i
<
coresp_f
->
size
();
++
i
){
for
(
int
i
=
0
;
i
<
coresp_f
->
size
();
++
i
){
copy_elements
<
MTriangle
>
((
*
coresp_f
)[
i
].
first
()
->
triangles
,(
*
coresp_f
)[
i
].
second
()
->
triangles
,
_mesh_to_geom
);
copy_elements
<
MTriangle
>
((
*
coresp_f
)[
i
].
first
()
->
triangles
,(
*
coresp_f
)[
i
].
second
()
->
triangles
,
_mesh_to_geom
);
copy_elements
<
MQuadrangle
>
((
*
coresp_f
)[
i
].
first
()
->
quadrangles
,(
*
coresp_f
)[
i
].
second
()
->
quadrangles
,
_mesh_to_geom
);
copy_elements
<
MQuadrangle
>
((
*
coresp_f
)[
i
].
first
()
->
quadrangles
,(
*
coresp_f
)[
i
].
second
()
->
quadrangles
,
_mesh_to_geom
);
...
@@ -713,10 +713,12 @@ int GeomMeshMatcher::match(GModel *geom, GModel *mesh)
...
@@ -713,10 +713,12 @@ int GeomMeshMatcher::match(GModel *geom, GModel *mesh)
// This will match SURFACES
// This will match SURFACES
std
::
vector
<
Pair
<
GFace
*
,
GFace
*>
>
*
coresp_f
=
matchFaces
(
geom
,
mesh
,
coresp_e
,
ok
);
std
::
vector
<
Pair
<
GFace
*
,
GFace
*>
>
*
coresp_f
=
matchFaces
(
geom
,
mesh
,
coresp_e
,
ok
);
matchRegions
(
geom
,
mesh
,
coresp_f
,
ok
);
matchRegions
(
geom
,
mesh
,
coresp_f
,
ok
);
std
::
map
<
MVertex
*
,
MVertex
*>
_mesh_to_geom
;
std
::
map
<
MVertex
*
,
MVertex
*>
_mesh_to_geom
;
copy_vertices
(
geom
,
mesh
,
_mesh_to_geom
,
coresp_v
,
coresp_e
,
coresp_f
);
copy_vertices
(
geom
,
mesh
,
_mesh_to_geom
,
coresp_v
,
coresp_e
,
coresp_f
);
copy_elements
(
geom
,
mesh
,
_mesh_to_geom
,
coresp_v
,
coresp_e
,
coresp_f
);
copy_elements
(
geom
,
mesh
,
_mesh_to_geom
,
coresp_v
,
coresp_e
,
coresp_f
);
geom
->
removeDuplicateMeshVertices
(
1e-8
);
return
1
;
return
1
;
}
}
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