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
0c307d45
Commit
0c307d45
authored
16 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
91140f26
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
Graphics/Mesh.cpp
+9
-12
9 additions, 12 deletions
Graphics/Mesh.cpp
Mesh/Generator.cpp
+25
-24
25 additions, 24 deletions
Mesh/Generator.cpp
with
34 additions
and
36 deletions
Graphics/Mesh.cpp
+
9
−
12
View file @
0c307d45
...
@@ -380,18 +380,16 @@ static void drawVoronoiDual(std::vector<T*> &elements)
...
@@ -380,18 +380,16 @@ static void drawVoronoiDual(std::vector<T*> &elements)
if
(
ele
->
getDim
()
==
2
){
if
(
ele
->
getDim
()
==
2
){
for
(
int
j
=
0
;
j
<
ele
->
getNumEdges
();
j
++
){
for
(
int
j
=
0
;
j
<
ele
->
getNumEdges
();
j
++
){
MEdge
e
=
ele
->
getEdge
(
j
);
MEdge
e
=
ele
->
getEdge
(
j
);
SVector3
p2p1
(
e
.
getVertex
(
1
)
->
x
()
-
e
.
getVertex
(
0
)
->
x
(),
SVector3
p2p1
(
e
.
getVertex
(
1
)
->
x
()
-
e
.
getVertex
(
0
)
->
x
(),
e
.
getVertex
(
1
)
->
y
()
-
e
.
getVertex
(
0
)
->
y
(),
e
.
getVertex
(
1
)
->
y
()
-
e
.
getVertex
(
0
)
->
y
(),
e
.
getVertex
(
1
)
->
z
()
-
e
.
getVertex
(
0
)
->
z
());
e
.
getVertex
(
1
)
->
z
()
-
e
.
getVertex
(
0
)
->
z
());
SVector3
pcp1
(
pc
.
x
()
-
e
.
getVertex
(
0
)
->
x
(),
SVector3
pcp1
(
pc
.
x
()
-
e
.
getVertex
(
0
)
->
x
(),
pc
.
y
()
-
e
.
getVertex
(
0
)
->
y
(),
pc
.
y
()
-
e
.
getVertex
(
0
)
->
y
(),
pc
.
z
()
-
e
.
getVertex
(
0
)
->
z
());
pc
.
z
()
-
e
.
getVertex
(
0
)
->
z
());
double
alpha
=
dot
(
pcp1
,
p2p1
)
/
dot
(
p2p1
,
p2p1
);
double
alpha
=
dot
(
pcp1
,
p2p1
)
/
dot
(
p2p1
,
p2p1
);
SPoint3
p
((
1
-
alpha
)
*
e
.
getVertex
(
0
)
->
x
()
+
alpha
*
e
.
getVertex
(
1
)
->
x
(),
SPoint3
p
((
1.
-
alpha
)
*
e
.
getVertex
(
0
)
->
x
()
+
alpha
*
e
.
getVertex
(
1
)
->
x
(),
(
1
-
alpha
)
*
e
.
getVertex
(
0
)
->
y
()
+
alpha
*
e
.
getVertex
(
1
)
->
y
(),
(
1.
-
alpha
)
*
e
.
getVertex
(
0
)
->
y
()
+
alpha
*
e
.
getVertex
(
1
)
->
y
(),
(
1
-
alpha
)
*
e
.
getVertex
(
0
)
->
z
()
+
alpha
*
e
.
getVertex
(
1
)
->
z
());
(
1.
-
alpha
)
*
e
.
getVertex
(
0
)
->
z
()
+
alpha
*
e
.
getVertex
(
1
)
->
z
());
glVertex3d
(
pc
.
x
(),
pc
.
y
(),
pc
.
z
());
glVertex3d
(
pc
.
x
(),
pc
.
y
(),
pc
.
z
());
glVertex3d
(
p
.
x
(),
p
.
y
(),
p
.
z
());
glVertex3d
(
p
.
x
(),
p
.
y
(),
p
.
z
());
}
}
...
@@ -417,7 +415,6 @@ static void drawVoronoiDual(std::vector<T*> &elements)
...
@@ -417,7 +415,6 @@ static void drawVoronoiDual(std::vector<T*> &elements)
gl2psDisable
(
GL2PS_LINE_STIPPLE
);
gl2psDisable
(
GL2PS_LINE_STIPPLE
);
}
}
// Routine to fill the smooth normal container
// Routine to fill the smooth normal container
template
<
class
T
>
template
<
class
T
>
...
...
This diff is collapsed.
Click to expand it.
Mesh/Generator.cpp
+
25
−
24
View file @
0c307d45
...
@@ -25,21 +25,22 @@
...
@@ -25,21 +25,22 @@
extern
Context_T
CTX
;
extern
Context_T
CTX
;
static
MVertex
*
isEquivalentTo
(
std
::
multimap
<
MVertex
*
,
MVertex
*>
&
m
,
MVertex
*
v
)
static
MVertex
*
isEquivalentTo
(
std
::
multimap
<
MVertex
*
,
MVertex
*>
&
m
,
MVertex
*
v
)
{
{
std
::
multimap
<
MVertex
*
,
MVertex
*>::
iterator
it
=
m
.
lower_bound
(
v
);
std
::
multimap
<
MVertex
*
,
MVertex
*>::
iterator
it
=
m
.
lower_bound
(
v
);
std
::
multimap
<
MVertex
*
,
MVertex
*>::
iterator
ite
=
m
.
upper_bound
(
v
);
std
::
multimap
<
MVertex
*
,
MVertex
*>::
iterator
ite
=
m
.
upper_bound
(
v
);
if
(
it
==
ite
)
return
v
;
if
(
it
==
ite
)
return
v
;
MVertex
*
res
=
it
->
second
;
++
it
;
MVertex
*
res
=
it
->
second
;
++
it
;
while
(
it
!=
ite
){
while
(
it
!=
ite
){
res
=
std
::
min
(
res
,
it
->
second
);
++
it
;
res
=
std
::
min
(
res
,
it
->
second
);
++
it
;
}
}
if
(
res
<
v
)
return
isEquivalentTo
(
m
,
res
)
;
if
(
res
<
v
)
return
isEquivalentTo
(
m
,
res
);
return
res
;
return
res
;
}
}
static
void
buildASetOfEquivalentMeshVertices
(
GFace
*
gf
,
std
::
multimap
<
MVertex
*
,
MVertex
*>
&
equivalent
,
std
::
map
<
GVertex
*
,
MVertex
*>
&
bm
)
static
void
buildASetOfEquivalentMeshVertices
(
GFace
*
gf
,
std
::
multimap
<
MVertex
*
,
MVertex
*>
&
equivalent
,
std
::
map
<
GVertex
*
,
MVertex
*>
&
bm
)
{
{
// an edge is degenerated when is length is considered to be
// an edge is degenerated when is length is considered to be
// zero. In some cases, a model edge can be considered as too
// zero. In some cases, a model edge can be considered as too
...
@@ -58,12 +59,11 @@ static void buildASetOfEquivalentMeshVertices ( GFace *gf , std::multimap<MVerte
...
@@ -58,12 +59,11 @@ static void buildASetOfEquivalentMeshVertices ( GFace *gf , std::multimap<MVerte
MVertex
*
va
=
*
((
*
it
)
->
getBeginVertex
()
->
mesh_vertices
.
begin
());
MVertex
*
va
=
*
((
*
it
)
->
getBeginVertex
()
->
mesh_vertices
.
begin
());
MVertex
*
vb
=
*
((
*
it
)
->
getEndVertex
()
->
mesh_vertices
.
begin
());
MVertex
*
vb
=
*
((
*
it
)
->
getEndVertex
()
->
mesh_vertices
.
begin
());
if
(
va
!=
vb
){
if
(
va
!=
vb
){
equivalent
.
insert
(
std
::
make_pair
(
va
,
vb
));
equivalent
.
insert
(
std
::
make_pair
(
va
,
vb
));
equivalent
.
insert
(
std
::
make_pair
(
vb
,
va
));
equivalent
.
insert
(
std
::
make_pair
(
vb
,
va
));
bm
[(
*
it
)
->
getBeginVertex
()]
=
va
;
bm
[(
*
it
)
->
getBeginVertex
()]
=
va
;
bm
[(
*
it
)
->
getEndVertex
()]
=
vb
;
bm
[(
*
it
)
->
getEndVertex
()]
=
vb
;
printf
(
"%d equivalent to %d
\n
"
,
va
->
getNum
(),
vb
->
getNum
());
printf
(
"%d equivalent to %d
\n
"
,
va
->
getNum
(),
vb
->
getNum
());
}
}
}
}
++
it
;
++
it
;
...
@@ -75,8 +75,8 @@ static void buildASetOfEquivalentMeshVertices ( GFace *gf , std::multimap<MVerte
...
@@ -75,8 +75,8 @@ static void buildASetOfEquivalentMeshVertices ( GFace *gf , std::multimap<MVerte
MVertex
*
va
=
*
((
*
it
)
->
getBeginVertex
()
->
mesh_vertices
.
begin
());
MVertex
*
va
=
*
((
*
it
)
->
getBeginVertex
()
->
mesh_vertices
.
begin
());
MVertex
*
vb
=
*
((
*
it
)
->
getEndVertex
()
->
mesh_vertices
.
begin
());
MVertex
*
vb
=
*
((
*
it
)
->
getEndVertex
()
->
mesh_vertices
.
begin
());
if
(
va
!=
vb
){
if
(
va
!=
vb
){
equivalent
.
insert
(
std
::
make_pair
(
va
,
vb
));
equivalent
.
insert
(
std
::
make_pair
(
va
,
vb
));
equivalent
.
insert
(
std
::
make_pair
(
vb
,
va
));
equivalent
.
insert
(
std
::
make_pair
(
vb
,
va
));
bm
[(
*
it
)
->
getBeginVertex
()]
=
va
;
bm
[(
*
it
)
->
getBeginVertex
()]
=
va
;
bm
[(
*
it
)
->
getEndVertex
()]
=
vb
;
bm
[(
*
it
)
->
getEndVertex
()]
=
vb
;
}
}
...
@@ -88,37 +88,38 @@ static void buildASetOfEquivalentMeshVertices ( GFace *gf , std::multimap<MVerte
...
@@ -88,37 +88,38 @@ static void buildASetOfEquivalentMeshVertices ( GFace *gf , std::multimap<MVerte
struct
geomTresholdVertexEquivalence
struct
geomTresholdVertexEquivalence
{
{
// Initial MVertex associated to one given MVertex
// Initial MVertex associated to one given MVertex
std
::
map
<
GVertex
*
,
MVertex
*>
backward_map
;
std
::
map
<
GVertex
*
,
MVertex
*>
backward_map
;
// initiate the forward and backward maps
// initiate the forward and backward maps
geomTresholdVertexEquivalence
(
GModel
*
g
);
geomTresholdVertexEquivalence
(
GModel
*
g
);
// restores the initial state
// restores the initial state
~
geomTresholdVertexEquivalence
();
~
geomTresholdVertexEquivalence
();
};
};
geomTresholdVertexEquivalence
::
geomTresholdVertexEquivalence
(
GModel
*
g
)
geomTresholdVertexEquivalence
::
geomTresholdVertexEquivalence
(
GModel
*
g
)
{
{
std
::
multimap
<
MVertex
*
,
MVertex
*>
equivalenceMap
;
std
::
multimap
<
MVertex
*
,
MVertex
*>
equivalenceMap
;
for
(
GModel
::
fiter
it
=
g
->
firstFace
();
it
!=
g
->
lastFace
();
++
it
)
for
(
GModel
::
fiter
it
=
g
->
firstFace
();
it
!=
g
->
lastFace
();
++
it
)
buildASetOfEquivalentMeshVertices
(
*
it
,
equivalenceMap
,
backward_map
);
buildASetOfEquivalentMeshVertices
(
*
it
,
equivalenceMap
,
backward_map
);
// build the structure that identifiate geometrically equivalent
// build the structure that identifiate geometrically equivalent
// mesh vertices.
// mesh vertices.
for
(
std
::
map
<
GVertex
*
,
MVertex
*>::
iterator
it
=
backward_map
.
begin
()
;
it
!=
backward_map
.
end
()
;
++
it
){
for
(
std
::
map
<
GVertex
*
,
MVertex
*>::
iterator
it
=
backward_map
.
begin
();
it
!=
backward_map
.
end
();
++
it
){
GVertex
*
g
=
it
->
first
;
GVertex
*
g
=
it
->
first
;
MVertex
*
v
=
it
->
second
;
MVertex
*
v
=
it
->
second
;
MVertex
*
other
=
isEquivalentTo
(
equivalenceMap
,
v
);
MVertex
*
other
=
isEquivalentTo
(
equivalenceMap
,
v
);
if
(
v
!=
other
){
if
(
v
!=
other
){
printf
(
"Finally : %d equivalent to %d
\n
"
,
v
->
getNum
(),
other
->
getNum
());
printf
(
"Finally : %d equivalent to %d
\n
"
,
v
->
getNum
(),
other
->
getNum
());
g
->
mesh_vertices
.
clear
();
g
->
mesh_vertices
.
clear
();
g
->
mesh_vertices
.
push_back
(
other
);
g
->
mesh_vertices
.
push_back
(
other
);
}
}
}
}
}
}
geomTresholdVertexEquivalence
::
~
geomTresholdVertexEquivalence
()
geomTresholdVertexEquivalence
::~
geomTresholdVertexEquivalence
()
{
{
// restore the initial data
// restore the initial data
for
(
std
::
map
<
GVertex
*
,
MVertex
*>::
iterator
it
=
backward_map
.
begin
()
;
it
!=
backward_map
.
end
()
;
++
it
){
for
(
std
::
map
<
GVertex
*
,
MVertex
*>::
iterator
it
=
backward_map
.
begin
();
it
!=
backward_map
.
end
()
;
++
it
){
GVertex
*
g
=
it
->
first
;
GVertex
*
g
=
it
->
first
;
MVertex
*
v
=
it
->
second
;
MVertex
*
v
=
it
->
second
;
g
->
mesh_vertices
.
clear
();
g
->
mesh_vertices
.
clear
();
...
...
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