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
420e75c3
Commit
420e75c3
authored
18 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
much faster element deletion algorithm
parent
786f5a45
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Geo/GModel.cpp
+18
-51
18 additions, 51 deletions
Geo/GModel.cpp
Geo/GModel.h
+1
-2
1 addition, 2 deletions
Geo/GModel.h
with
19 additions
and
53 deletions
Geo/GModel.cpp
+
18
−
51
View file @
420e75c3
// $Id: GModel.cpp,v 1.1
8
2006-11-0
1 22:19:26
geuzaine Exp $
// $Id: GModel.cpp,v 1.1
9
2006-11-0
2 18:28:08
geuzaine Exp $
//
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
//
...
...
@@ -82,67 +82,34 @@ GVertex * GModel::vertexByTag(int n) const
}
template
<
class
T
>
static
bool
remove
Element
(
M
Element
*
e
,
std
::
vector
<
T
*>
&
vec
)
static
void
remove
Invisible
Element
s
(
std
::
vector
<
T
*>
&
elements
)
{
typename
std
::
vector
<
T
*>::
iterator
it
=
std
::
find
(
vec
.
begin
(),
vec
.
end
(),
e
);
if
(
it
==
vec
.
end
())
return
false
;
vec
.
erase
(
it
);
delete
e
;
return
true
;
}
bool
GModel
::
remove
(
MElement
*
e
)
{
switch
(
e
->
getDim
()){
case
3
:
for
(
riter
it
=
firstRegion
();
it
!=
lastRegion
();
++
it
){
if
(
removeElement
(
e
,
(
*
it
)
->
tetrahedra
))
return
true
;
if
(
removeElement
(
e
,
(
*
it
)
->
hexahedra
))
return
true
;
if
(
removeElement
(
e
,
(
*
it
)
->
prisms
))
return
true
;
if
(
removeElement
(
e
,
(
*
it
)
->
pyramids
))
return
true
;
}
break
;
case
2
:
for
(
fiter
it
=
firstFace
();
it
!=
lastFace
();
++
it
){
if
(
removeElement
(
e
,
(
*
it
)
->
triangles
))
return
true
;
if
(
removeElement
(
e
,
(
*
it
)
->
quadrangles
))
return
true
;
}
break
;
case
1
:
for
(
eiter
it
=
firstEdge
();
it
!=
lastEdge
();
++
it
){
if
(
removeElement
(
e
,
(
*
it
)
->
lines
))
return
true
;
}
break
;
std
::
vector
<
T
*>
tmp
;
for
(
unsigned
int
i
=
0
;
i
<
elements
.
size
();
i
++
){
if
(
elements
[
i
]
->
getVisibility
())
tmp
.
push_back
(
elements
[
i
]);
else
delete
elements
[
i
];
}
return
false
;
elements
.
clear
();
elements
=
tmp
;
}
void
GModel
::
removeInvisible
()
{
// FIXME: should make this faster
std
::
vector
<
MElement
*>
ele
;
for
(
riter
it
=
firstRegion
();
it
!=
lastRegion
();
++
it
){
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
tetrahedra
.
size
();
i
++
)
if
(
!
(
*
it
)
->
tetrahedra
[
i
]
->
getVisibility
())
ele
.
push_back
((
*
it
)
->
tetrahedra
[
i
]);
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
hexahedra
.
size
();
i
++
)
if
(
!
(
*
it
)
->
hexahedra
[
i
]
->
getVisibility
())
ele
.
push_back
((
*
it
)
->
hexahedra
[
i
]);
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
prisms
.
size
();
i
++
)
if
(
!
(
*
it
)
->
prisms
[
i
]
->
getVisibility
())
ele
.
push_back
((
*
it
)
->
prisms
[
i
]);
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
pyramids
.
size
();
i
++
)
if
(
!
(
*
it
)
->
pyramids
[
i
]
->
getVisibility
())
ele
.
push_back
((
*
it
)
->
pyramids
[
i
]);
removeInvisibleElements
((
*
it
)
->
tetrahedra
);
removeInvisibleElements
((
*
it
)
->
hexahedra
);
removeInvisibleElements
((
*
it
)
->
prisms
);
removeInvisibleElements
((
*
it
)
->
pyramids
);
}
for
(
fiter
it
=
firstFace
();
it
!=
lastFace
();
++
it
){
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
triangles
.
size
();
i
++
)
if
(
!
(
*
it
)
->
triangles
[
i
]
->
getVisibility
())
ele
.
push_back
((
*
it
)
->
triangles
[
i
]);
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
quadrangles
.
size
();
i
++
)
if
(
!
(
*
it
)
->
quadrangles
[
i
]
->
getVisibility
())
ele
.
push_back
((
*
it
)
->
quadrangles
[
i
]);
removeInvisibleElements
((
*
it
)
->
triangles
);
removeInvisibleElements
((
*
it
)
->
quadrangles
);
}
for
(
eiter
it
=
firstEdge
();
it
!=
lastEdge
();
++
it
){
for
(
unsigned
int
i
=
0
;
i
<
(
*
it
)
->
lines
.
size
();
i
++
)
if
(
!
(
*
it
)
->
lines
[
i
]
->
getVisibility
())
ele
.
push_back
((
*
it
)
->
lines
[
i
]);
removeInvisibleElements
((
*
it
)
->
lines
);
}
for
(
unsigned
int
i
=
0
;
i
<
ele
.
size
();
i
++
)
remove
(
ele
[
i
]);
std
::
vector
<
GRegion
*>
r
;
for
(
riter
it
=
firstRegion
();
it
!=
lastRegion
();
++
it
)
...
...
This diff is collapsed.
Click to expand it.
Geo/GModel.h
+
1
−
2
View file @
420e75c3
...
...
@@ -90,9 +90,8 @@ class GModel
void
remove
(
GFace
*
f
)
{
faces
.
erase
(
std
::
find
(
firstFace
(),
lastFace
(),
f
));
}
void
remove
(
GEdge
*
e
)
{
edges
.
erase
(
std
::
find
(
firstEdge
(),
lastEdge
(),
e
));
}
void
remove
(
GVertex
*
v
)
{
vertices
.
erase
(
std
::
find
(
firstVertex
(),
lastVertex
(),
v
));
}
bool
remove
(
MElement
*
e
);
// Deletes all invisble
stuff (
entities and elements
)
// Deletes all invisble entities and
mesh
elements
void
removeInvisible
();
// Renumber all the mesh vertices in a continuous sequence
...
...
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