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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
a1b34789
Commit
a1b34789
authored
11 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
don't crash if extruded entity is a duplicate
parent
67d4c248
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Geo/Geo.cpp
+47
-56
47 additions, 56 deletions
Geo/Geo.cpp
with
47 additions
and
56 deletions
Geo/Geo.cpp
+
47
−
56
View file @
a1b34789
...
@@ -2184,12 +2184,13 @@ static List_T* GetCompoundUniqueEdges(Surface *ps)
...
@@ -2184,12 +2184,13 @@ static List_T* GetCompoundUniqueEdges(Surface *ps)
// Added by Trevor Strickler
// Added by Trevor Strickler
// This function returns a pointer to an allocated List_T type that
// contains an ordered list of unique edges for a compound surface.
// This function returns a pointer to an allocated List_T type that contains an
// The edges are grouped into loops if there is more than one loop.
// ordered list of unique edges for a compound surface. The edges are grouped
// The order is in order around a loop.
// into loops if there is more than one loop. The order is in order around a
// Only one problem: Sometimes holes can be selected as the first loop,
// loop.
// though this should not create many real problems on a copied top surface.
// Only one problem: Sometimes holes can be selected as the first loop, though
// this should not create many real problems on a copied top surface.
static
List_T
*
GetOrderedUniqueEdges
(
Surface
*
s
)
static
List_T
*
GetOrderedUniqueEdges
(
Surface
*
s
)
{
{
List_T
*
unique
=
GetCompoundUniqueEdges
(
s
);
List_T
*
unique
=
GetCompoundUniqueEdges
(
s
);
...
@@ -2341,7 +2342,6 @@ static void MaxNumSurface(void *a, void *b)
...
@@ -2341,7 +2342,6 @@ static void MaxNumSurface(void *a, void *b)
}
}
// Modified by Trevor Strickler
static
void
ReplaceDuplicatePoints
(
std
::
map
<
int
,
int
>
*
v_report
=
0
)
static
void
ReplaceDuplicatePoints
(
std
::
map
<
int
,
int
>
*
v_report
=
0
)
{
{
// FIXME: This routine is in fact logically wrong (the compareTwoPoints
// FIXME: This routine is in fact logically wrong (the compareTwoPoints
...
@@ -2370,8 +2370,7 @@ static void ReplaceDuplicatePoints(std::map<int, int> * v_report = 0)
...
@@ -2370,8 +2370,7 @@ static void ReplaceDuplicatePoints(std::map<int, int> * v_report = 0)
else
{
else
{
Tree_Suppress
(
GModel
::
current
()
->
getGEOInternals
()
->
Points
,
&
v
);
Tree_Suppress
(
GModel
::
current
()
->
getGEOInternals
()
->
Points
,
&
v
);
Tree_Insert
(
points2delete
,
&
v
);
Tree_Insert
(
points2delete
,
&
v
);
// Trevor Strickler
if
(
v_report
){
// keep track of changes
if
(
v_report
){
std
::
map
<
int
,
int
>::
iterator
m_it
=
v_report
->
find
(
v
->
Num
);
std
::
map
<
int
,
int
>::
iterator
m_it
=
v_report
->
find
(
v
->
Num
);
if
(
m_it
!=
v_report
->
end
()){
if
(
m_it
!=
v_report
->
end
()){
Vertex
**
v_rep
=
(
Vertex
**
)
Tree_PQuery
(
allNonDuplicatedPoints
,
&
v
);
Vertex
**
v_rep
=
(
Vertex
**
)
Tree_PQuery
(
allNonDuplicatedPoints
,
&
v
);
...
@@ -2484,9 +2483,7 @@ static void ReplaceDuplicatePoints(std::map<int, int> * v_report = 0)
...
@@ -2484,9 +2483,7 @@ static void ReplaceDuplicatePoints(std::map<int, int> * v_report = 0)
Tree_Delete
(
allNonDuplicatedPoints
);
Tree_Delete
(
allNonDuplicatedPoints
);
}
}
//Modified by Trevor Strickler
static
void
ReplaceDuplicateCurves
(
std
::
map
<
int
,
int
>
*
c_report
=
0
)
static
void
ReplaceDuplicateCurves
(
std
::
map
<
int
,
int
>
*
c_report
=
0
)
{
{
Curve
*
c
,
*
c2
,
**
pc
,
**
pc2
;
Curve
*
c
,
*
c2
,
**
pc
,
**
pc2
;
Surface
*
s
;
Surface
*
s
;
...
@@ -2519,8 +2516,8 @@ static void ReplaceDuplicateCurves(std::map<int, int> * c_report = 0)
...
@@ -2519,8 +2516,8 @@ static void ReplaceDuplicateCurves(std::map<int, int> * c_report = 0)
Tree_Suppress
(
GModel
::
current
()
->
getGEOInternals
()
->
Curves
,
&
c2
);
Tree_Suppress
(
GModel
::
current
()
->
getGEOInternals
()
->
Curves
,
&
c2
);
Tree_Insert
(
curves2delete
,
&
c
);
Tree_Insert
(
curves2delete
,
&
c
);
Tree_Insert
(
curves2delete
,
&
c2
);
Tree_Insert
(
curves2delete
,
&
c2
);
// Trevor Strickler
if
(
c_report
){
if
(
c_report
){
// keep track of changes
std
::
map
<
int
,
int
>::
iterator
m_it
=
c_report
->
find
(
c
->
Num
);
std
::
map
<
int
,
int
>::
iterator
m_it
=
c_report
->
find
(
c
->
Num
);
if
(
m_it
!=
c_report
->
end
()){
if
(
m_it
!=
c_report
->
end
()){
Curve
**
c_rep
=
(
Curve
**
)
Tree_PQuery
(
allNonDuplicatedCurves
,
&
c
);
Curve
**
c_rep
=
(
Curve
**
)
Tree_PQuery
(
allNonDuplicatedCurves
,
&
c
);
...
@@ -2623,7 +2620,6 @@ static void ReplaceDuplicateCurves(std::map<int, int> * c_report = 0)
...
@@ -2623,7 +2620,6 @@ static void ReplaceDuplicateCurves(std::map<int, int> * c_report = 0)
Tree_Delete
(
allNonDuplicatedCurves
);
Tree_Delete
(
allNonDuplicatedCurves
);
}
}
// Modified By Trevor Strickler
static
void
ReplaceDuplicateSurfaces
(
std
::
map
<
int
,
int
>
*
s_report
=
0
)
static
void
ReplaceDuplicateSurfaces
(
std
::
map
<
int
,
int
>
*
s_report
=
0
)
{
{
Surface
*
s
,
*
s2
,
**
ps
,
**
ps2
;
Surface
*
s
,
*
s2
,
**
ps
,
**
ps2
;
...
@@ -2645,8 +2641,8 @@ static void ReplaceDuplicateSurfaces(std::map<int, int> *s_report = 0)
...
@@ -2645,8 +2641,8 @@ static void ReplaceDuplicateSurfaces(std::map<int, int> *s_report = 0)
else
{
else
{
Tree_Suppress
(
GModel
::
current
()
->
getGEOInternals
()
->
Surfaces
,
&
s
);
Tree_Suppress
(
GModel
::
current
()
->
getGEOInternals
()
->
Surfaces
,
&
s
);
Tree_Insert
(
surfaces2delete
,
&
s
);
Tree_Insert
(
surfaces2delete
,
&
s
);
// Trevor Strickler
if
(
s_report
){
if
(
s_report
){
// keep track of changes
std
::
map
<
int
,
int
>::
iterator
m_it
=
(
*
s_report
).
find
(
s
->
Num
);
std
::
map
<
int
,
int
>::
iterator
m_it
=
(
*
s_report
).
find
(
s
->
Num
);
if
(
m_it
!=
s_report
->
end
()){
if
(
m_it
!=
s_report
->
end
()){
Surface
**
s_rep
=
(
Surface
**
)
Tree_PQuery
(
allNonDuplicatedSurfaces
,
&
s
);
Surface
**
s_rep
=
(
Surface
**
)
Tree_PQuery
(
allNonDuplicatedSurfaces
,
&
s
);
...
@@ -2741,9 +2737,6 @@ static void ReplaceDuplicateSurfaces(std::map<int, int> *s_report = 0)
...
@@ -2741,9 +2737,6 @@ static void ReplaceDuplicateSurfaces(std::map<int, int> *s_report = 0)
Tree_Delete
(
allNonDuplicatedSurfaces
);
Tree_Delete
(
allNonDuplicatedSurfaces
);
}
}
// Trevor Strickler added argument to return select changed shape nums
// this is needed to set chapeau correctly in situations where chapeau gets replaced!
// report has a default argument of zero.
static
void
ReplaceAllDuplicates
(
std
::
vector
<
std
::
map
<
int
,
int
>
>
&
report
)
static
void
ReplaceAllDuplicates
(
std
::
vector
<
std
::
map
<
int
,
int
>
>
&
report
)
{
{
std
::
map
<
int
,
int
>
*
vertex_report
=
0
;
std
::
map
<
int
,
int
>
*
vertex_report
=
0
;
...
@@ -2761,9 +2754,6 @@ static void ReplaceAllDuplicates(std::vector<std::map<int, int> > &report)
...
@@ -2761,9 +2754,6 @@ static void ReplaceAllDuplicates(std::vector<std::map<int, int> > &report)
ReplaceDuplicateSurfaces
(
surface_report
);
ReplaceDuplicateSurfaces
(
surface_report
);
}
}
// overloaded ReplaceAllDuplicates to keep old functionality with no danger of
// default pointer argument = 0
void
ReplaceAllDuplicates
()
void
ReplaceAllDuplicates
()
{
{
std
::
vector
<
std
::
map
<
int
,
int
>
>
report
;
std
::
vector
<
std
::
map
<
int
,
int
>
>
report
;
...
@@ -2771,7 +2761,6 @@ void ReplaceAllDuplicates()
...
@@ -2771,7 +2761,6 @@ void ReplaceAllDuplicates()
ReplaceAllDuplicates
(
report
);
ReplaceAllDuplicates
(
report
);
}
}
// Extrusion routines
// Extrusion routines
void
ProtudeXYZ
(
double
&
x
,
double
&
y
,
double
&
z
,
ExtrudeParams
*
e
)
void
ProtudeXYZ
(
double
&
x
,
double
&
y
,
double
&
z
,
ExtrudeParams
*
e
)
...
@@ -2950,9 +2939,6 @@ int Extrude_ProtudePoint(int type, int ip,
...
@@ -2950,9 +2939,6 @@ int Extrude_ProtudePoint(int type, int ip,
}
}
c
->
end
=
chapeau
;
c
->
end
=
chapeau
;
break
;
break
;
// case ANALYTICAL:
//
// break;
default
:
default
:
Msg
::
Error
(
"Unknown extrusion type"
);
Msg
::
Error
(
"Unknown extrusion type"
);
return
pv
->
Num
;
return
pv
->
Num
;
...
@@ -2967,17 +2953,20 @@ int Extrude_ProtudePoint(int type, int ip,
...
@@ -2967,17 +2953,20 @@ int Extrude_ProtudePoint(int type, int ip,
List_Reset
(
ListOfTransformedPoints
);
List_Reset
(
ListOfTransformedPoints
);
int
chap_num
=
chapeau
->
Num
;
int
chap_num
=
chapeau
->
Num
;
int
body_num
=
c
->
Num
;
if
(
CTX
::
instance
()
->
geom
.
autoCoherence
&&
final
){
if
(
CTX
::
instance
()
->
geom
.
autoCoherence
&&
final
){
// Trevor Strickler added to fix replaced Chapeau
std
::
vector
<
std
::
map
<
int
,
int
>
>
report
(
3
);
std
::
vector
<
std
::
map
<
int
,
int
>
>
report
(
3
);
report
[
0
][
chapeau
->
Num
]
=
chap_num
;
report
[
0
][
chap_num
]
=
chap_num
;
report
[
1
][
body_num
]
=
body_num
;
ReplaceAllDuplicates
(
report
);
ReplaceAllDuplicates
(
report
);
std
::
map
<
int
,
int
>::
iterator
m_it
=
(
report
[
0
]
)
.
find
(
chap_num
);
std
::
map
<
int
,
int
>::
iterator
m_it
=
report
[
0
].
find
(
chap_num
);
if
(
m_it
!=
(
report
[
0
]
)
.
end
()
)
if
(
m_it
!=
report
[
0
].
end
())
chap_num
=
(
report
[
0
]
)
[
chap_num
];
chap_num
=
report
[
0
][
chap_num
];
else
else
chap_num
=
0
;
chap_num
=
0
;
if
(
report
[
1
][
body_num
]
!=
body_num
)
*
pc
=
*
prc
=
NULL
;
}
}
return
chap_num
;
return
chap_num
;
}
}
...
@@ -3148,17 +3137,20 @@ int Extrude_ProtudeCurve(int type, int ic,
...
@@ -3148,17 +3137,20 @@ int Extrude_ProtudeCurve(int type, int ic,
*
ps
=
s
;
*
ps
=
s
;
int
chap_num
=
chapeau
->
Num
;
int
chap_num
=
chapeau
->
Num
;
int
body_num
=
s
->
Num
;
if
(
CTX
::
instance
()
->
geom
.
autoCoherence
&&
final
){
if
(
CTX
::
instance
()
->
geom
.
autoCoherence
&&
final
){
// Trevor Strickler added to fix replaced Chapeau
std
::
vector
<
std
::
map
<
int
,
int
>
>
report
(
3
);
std
::
vector
<
std
::
map
<
int
,
int
>
>
report
(
3
);
(
report
[
1
])[
chap_num
]
=
chap_num
;
report
[
1
][
chap_num
]
=
chap_num
;
report
[
2
][
body_num
]
=
body_num
;
ReplaceAllDuplicates
(
report
);
ReplaceAllDuplicates
(
report
);
std
::
map
<
int
,
int
>::
iterator
m_it
=
(
report
[
1
]
)
.
find
(
chap_num
);
std
::
map
<
int
,
int
>::
iterator
m_it
=
report
[
1
].
find
(
chap_num
);
if
(
m_it
!=
(
report
[
1
]
)
.
end
()
)
if
(
m_it
!=
report
[
1
].
end
())
chap_num
=
(
report
[
1
]
)
[
chap_num
];
chap_num
=
report
[
1
][
chap_num
];
else
else
chap_num
=
0
;
chap_num
=
0
;
if
(
report
[
2
][
body_num
]
!=
body_num
)
*
ps
=
NULL
;
}
}
return
chap_num
;
return
chap_num
;
...
@@ -3350,13 +3342,12 @@ int Extrude_ProtudeSurface(int type, int is,
...
@@ -3350,13 +3342,12 @@ int Extrude_ProtudeSurface(int type, int is,
int
chap_num
=
chapeau
->
Num
;
int
chap_num
=
chapeau
->
Num
;
if
(
CTX
::
instance
()
->
geom
.
autoCoherence
){
if
(
CTX
::
instance
()
->
geom
.
autoCoherence
){
// Trevor Strickler added to fix replaced Chapeau
std
::
vector
<
std
::
map
<
int
,
int
>
>
report
(
3
);
std
::
vector
<
std
::
map
<
int
,
int
>
>
report
(
3
);
(
report
[
2
]
)
[
chap_num
]
=
chap_num
;
report
[
2
][
chap_num
]
=
chap_num
;
ReplaceAllDuplicates
(
report
);
ReplaceAllDuplicates
(
report
);
std
::
map
<
int
,
int
>::
iterator
m_it
=
(
report
[
2
]).
find
(
chap_num
);
std
::
map
<
int
,
int
>::
iterator
m_it
=
(
report
[
2
]).
find
(
chap_num
);
if
(
m_it
!=
(
report
[
2
]
)
.
end
()
)
if
(
m_it
!=
report
[
2
].
end
())
chap_num
=
(
report
[
2
]
)
[
chap_num
];
chap_num
=
report
[
2
][
chap_num
];
else
else
chap_num
=
0
;
chap_num
=
0
;
}
}
...
@@ -3461,7 +3452,6 @@ void ExtrudeShapes(int type, List_T *list_in,
...
@@ -3461,7 +3452,6 @@ void ExtrudeShapes(int type, List_T *list_in,
case
MSH_SURF_DISCRETE
:
case
MSH_SURF_DISCRETE
:
case
MSH_SURF_COMPOUND
:
case
MSH_SURF_COMPOUND
:
{
{
// if statement by Trevor Strickler
if
(
shape
.
Type
==
MSH_SURF_COMPOUND
){
if
(
shape
.
Type
==
MSH_SURF_COMPOUND
){
if
(
!
(
e
&&
e
->
mesh
.
ExtrudeMesh
)){
if
(
!
(
e
&&
e
->
mesh
.
ExtrudeMesh
)){
Msg
::
Error
(
"Impossible to extrude compound entity %d without also extruding mesh!"
,
Msg
::
Error
(
"Impossible to extrude compound entity %d without also extruding mesh!"
,
...
@@ -3886,7 +3876,7 @@ void setSurfaceGeneratrices(Surface *s, List_T *loops)
...
@@ -3886,7 +3876,7 @@ void setSurfaceGeneratrices(Surface *s, List_T *loops)
s
->
Generatrices
=
List_Create
(
4
,
4
,
sizeof
(
Curve
*
));
s
->
Generatrices
=
List_Create
(
4
,
4
,
sizeof
(
Curve
*
));
List_Delete
(
s
->
GeneratricesByTag
);
List_Delete
(
s
->
GeneratricesByTag
);
s
->
GeneratricesByTag
=
List_Create
(
4
,
4
,
sizeof
(
int
));
s
->
GeneratricesByTag
=
List_Create
(
4
,
4
,
sizeof
(
int
));
//trevor strickler
if
(
s
->
Typ
==
MSH_SURF_COMPOUND
){
if
(
s
->
Typ
==
MSH_SURF_COMPOUND
){
s
->
Generatrices
=
GetOrderedUniqueEdges
(
s
);
s
->
Generatrices
=
GetOrderedUniqueEdges
(
s
);
if
(
!
List_Nbr
(
s
->
Generatrices
)){
if
(
!
List_Nbr
(
s
->
Generatrices
)){
...
@@ -3894,6 +3884,7 @@ void setSurfaceGeneratrices(Surface *s, List_T *loops)
...
@@ -3894,6 +3884,7 @@ void setSurfaceGeneratrices(Surface *s, List_T *loops)
return
;
return
;
}
}
}
}
for
(
int
i
=
0
;
i
<
nbLoop
;
i
++
)
{
for
(
int
i
=
0
;
i
<
nbLoop
;
i
++
)
{
int
iLoop
;
int
iLoop
;
List_Read
(
loops
,
i
,
&
iLoop
);
List_Read
(
loops
,
i
,
&
iLoop
);
...
...
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