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
ec860930
Commit
ec860930
authored
23 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
Fixed edge swapping bug in 3D initial mesh
parent
94614c9b
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
Mesh/3D_Coherence.cpp
+26
-64
26 additions, 64 deletions
Mesh/3D_Coherence.cpp
with
26 additions
and
64 deletions
Mesh/3D_Coherence.cpp
+
26
−
64
View file @
ec860930
// $Id: 3D_Coherence.cpp,v 1.1
7
2001-08-2
4 06:58:19
geuzaine Exp $
// $Id: 3D_Coherence.cpp,v 1.1
8
2001-08-2
8 15:09:47
geuzaine Exp $
#include
"Gmsh.h"
#include
"Gmsh.h"
#include
"Numeric.h"
#include
"Numeric.h"
...
@@ -17,7 +17,7 @@ static Face *TheFace;
...
@@ -17,7 +17,7 @@ static Face *TheFace;
static
List_T
*
Teti
;
static
List_T
*
Teti
;
List_T
*
Missing
,
*
MissingF
,
*
MissingS
;
List_T
*
Missing
,
*
MissingF
,
*
MissingS
;
Tree_T
*
EdgesTree
,
*
FacesTree
,
*
swaps
;
Tree_T
*
EdgesTree
,
*
FacesTree
,
*
swaps
,
*
touchedvertex
;
int
edges_quad
[
4
][
2
]
=
{
{
0
,
1
},
int
edges_quad
[
4
][
2
]
=
{
{
0
,
1
},
{
1
,
2
},
{
1
,
2
},
...
@@ -108,66 +108,21 @@ void find_quads (void *a, void *b){
...
@@ -108,66 +108,21 @@ void find_quads (void *a, void *b){
void
swap_quads
(
void
*
a
,
void
*
b
){
void
swap_quads
(
void
*
a
,
void
*
b
){
Edge
*
q
;
Edge
*
q
;
int
i
,
K
;
Simplex
*
s1
,
*
s2
;
Simplex
*
s1
,
*
s2
;
Vertex
*
temp
[
3
],
*
kk
[
3
];
q
=
(
Edge
*
)
a
;
q
=
(
Edge
*
)
a
;
List_Read
(
q
->
Simplexes
,
0
,
&
s1
);
List_Read
(
q
->
Simplexes
,
0
,
&
s1
);
List_Read
(
q
->
Simplexes
,
1
,
&
s2
);
List_Read
(
q
->
Simplexes
,
1
,
&
s2
);
K
=
-
1
;
if
(
Tree_Query
(
touchedvertex
,
&
q
->
V
[
0
]))
return
;
if
(
Tree_Query
(
touchedvertex
,
&
q
->
V
[
1
]))
return
;
for
(
i
=
0
;
i
<
3
;
i
++
){
if
(
Tree_Query
(
touchedvertex
,
&
q
->
O
[
0
]))
return
;
if
(
!
compareVertex
(
&
q
->
O
[
0
],
&
s1
->
V
[
i
]))
if
(
Tree_Query
(
touchedvertex
,
&
q
->
O
[
1
]))
return
;
K
=
i
;
temp
[
i
]
=
s1
->
V
[
i
];
}
/*
printf("s1 : %d %d %d ->",s1->V[0]->Num,s1->V[1]->Num,s1->V[2]->Num);
*/
kk
[
0
]
=
q
->
O
[
0
];
kk
[
1
]
=
(
K
==
2
)
?
s1
->
V
[
0
]
:
s1
->
V
[
K
+
1
];
kk
[
2
]
=
q
->
O
[
1
];
s1
->
V
[
0
]
=
kk
[
0
];
s1
->
V
[
1
]
=
kk
[
1
];
s1
->
V
[
2
]
=
kk
[
2
];
/*
printf("%d %d %d \n",s1->V[0]->Num,s1->V[1]->Num,s1->V[2]->Num);
*/
s1
->
F
[
0
].
V
[
0
]
=
s1
->
V
[
0
];
s1
->
F
[
0
].
V
[
1
]
=
s1
->
V
[
1
];
s1
->
F
[
0
].
V
[
2
]
=
s1
->
V
[
2
];
/*
printf("s2 : %d %d %d ->",s2->V[0]->Num,s2->V[1]->Num,s2->V[2]->Num);
*/
s2
->
V
[
0
]
=
q
->
O
[
1
];
s2
->
V
[
1
]
=
(
K
==
0
)
?
temp
[
2
]
:
temp
[
K
-
1
];
s2
->
V
[
2
]
=
q
->
O
[
0
];
/*
printf("%d %d %d \n",s2->V[0]->Num,s2->V[1]->Num,s2->V[2]->Num);
*/
s2
->
F
[
0
].
V
[
0
]
=
s2
->
V
[
0
];
s2
->
F
[
0
].
V
[
1
]
=
s2
->
V
[
1
];
s2
->
F
[
0
].
V
[
2
]
=
s2
->
V
[
2
];
qsort
(
s1
->
F
[
0
].
V
,
3
,
sizeof
(
Vertex
*
),
compareVertex
);
qsort
(
s2
->
F
[
0
].
V
,
3
,
sizeof
(
Vertex
*
),
compareVertex
);
List_Suppress
(
Missing
,
q
,
compareedge
);
q
->
V
[
0
]
=
q
->
O
[
0
];
q
->
V
[
1
]
=
q
->
O
[
1
];
}
Tree_Add
(
touchedvertex
,
&
q
->
V
[
0
]);
void
swap_quads2
(
void
*
a
,
void
*
b
){
Tree_Add
(
touchedvertex
,
&
q
->
V
[
1
]);
Edge
*
q
;
Tree_Add
(
touchedvertex
,
&
q
->
O
[
0
]);
Simplex
*
s1
,
*
s2
;
Tree_Add
(
touchedvertex
,
&
q
->
O
[
1
]);
q
=
(
Edge
*
)
a
;
List_Read
(
q
->
Simplexes
,
0
,
&
s1
);
List_Read
(
q
->
Simplexes
,
1
,
&
s2
);
if
(
memesens
(
s1
->
V
[
0
],
s1
->
V
[
1
],
s1
->
V
[
2
],
q
->
O
[
0
],
q
->
O
[
1
],
q
->
V
[
0
])){
if
(
memesens
(
s1
->
V
[
0
],
s1
->
V
[
1
],
s1
->
V
[
2
],
q
->
O
[
0
],
q
->
O
[
1
],
q
->
V
[
0
])){
s1
->
V
[
0
]
=
q
->
O
[
0
];
s1
->
V
[
0
]
=
q
->
O
[
0
];
...
@@ -208,15 +163,20 @@ void swap_quads2 (void *a, void *b){
...
@@ -208,15 +163,20 @@ void swap_quads2 (void *a, void *b){
}
}
void
create_Quads
(
Volume
*
V
){
int
create_Quads
(
Volume
*
V
){
int
i
;
int
i
,
n
;
Surface
*
S
;
Surface
*
S
;
swaps
=
Tree_Create
(
sizeof
(
Edge
),
compareedge
);
swaps
=
Tree_Create
(
sizeof
(
Edge
),
compareedge
);
touchedvertex
=
Tree_Create
(
sizeof
(
Vertex
*
),
compareVertex
);
for
(
i
=
0
;
i
<
List_Nbr
(
V
->
Surfaces
);
i
++
){
for
(
i
=
0
;
i
<
List_Nbr
(
V
->
Surfaces
);
i
++
){
List_Read
(
V
->
Surfaces
,
i
,
&
S
);
List_Read
(
V
->
Surfaces
,
i
,
&
S
);
Tree_Action
(
S
->
Edges
,
find_quads
);
Tree_Action
(
S
->
Edges
,
find_quads
);
}
}
Tree_Action
(
swaps
,
swap_quads2
);
Tree_Action
(
swaps
,
swap_quads
);
n
=
Tree_Nbr
(
swaps
);
Tree_Delete
(
swaps
);
Tree_Delete
(
touchedvertex
);
return
n
;
}
}
void
create_Fac
(
void
*
a
,
void
*
b
){
void
create_Fac
(
void
*
a
,
void
*
b
){
...
@@ -1144,7 +1104,7 @@ Simplex * Create_Simplex_MemeSens (Simplex * sold, Vertex * v1, Vertex * v2, Ver
...
@@ -1144,7 +1104,7 @@ Simplex * Create_Simplex_MemeSens (Simplex * sold, Vertex * v1, Vertex * v2, Ver
}
}
int
Coherence
(
Volume
*
v
,
Mesh
*
m
){
int
Coherence
(
Volume
*
v
,
Mesh
*
m
){
int
i
,
j
,
k
,
Np
,
Nh
;
int
i
,
j
,
k
,
Np
,
Nh
,
nb_swaps
=
0
;
Surface
*
s
;
Surface
*
s
;
//Vertex V1, V2, *ver1, *ver2 ;
//Vertex V1, V2, *ver1, *ver2 ;
Face
Face
;
Face
Face
;
...
@@ -1161,11 +1121,13 @@ int Coherence (Volume * v, Mesh * m){
...
@@ -1161,11 +1121,13 @@ int Coherence (Volume * v, Mesh * m){
Remise_A_Zero
();
Remise_A_Zero
();
create_Edges
(
v
);
MissingEdges
=
Missing_Edges
(
v
);
/* Edge Swapping */
/* Edge Swapping */
create_Quads
(
v
);
do
{
create_Edges
(
v
);
MissingEdges
=
Missing_Edges
(
v
);
nb_swaps
=
create_Quads
(
v
);
Msg
(
INFO
,
"Swapped %d edges"
,
nb_swaps
);
}
while
(
nb_swaps
);
/* Missing Edges */
/* Missing Edges */
create_Edges
(
v
);
create_Edges
(
v
);
...
...
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