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
e7885d55
Commit
e7885d55
authored
21 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
Fix seg fault in Read_SMS
parent
a38242c3
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
Makefile
+2
-1
2 additions, 1 deletion
Makefile
Mesh/SMS.cpp
+39
-39
39 additions, 39 deletions
Mesh/SMS.cpp
with
41 additions
and
40 deletions
Makefile
+
2
−
1
View file @
e7885d55
# $Id: Makefile,v 1.31
3
2003-12-0
3 21:06:38
geuzaine Exp $
# $Id: Makefile,v 1.31
4
2003-12-0
4 15:55:27
geuzaine Exp $
#
#
# Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle
# Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle
#
#
...
@@ -171,6 +171,7 @@ distrib-win: clean all package-win distrib-msg
...
@@ -171,6 +171,7 @@ distrib-win: clean all package-win distrib-msg
objdump
-p
bin/gmsh.exe |
grep
DLL
objdump
-p
bin/gmsh.exe |
grep
DLL
distrib-mac
:
clean all package-mac distrib-msg
distrib-mac
:
clean all package-mac distrib-msg
${
POSTBUILD
}
otool
-L
bin/gmsh
otool
-L
bin/gmsh
package-unix
:
package-unix
:
...
...
This diff is collapsed.
Click to expand it.
Mesh/SMS.cpp
+
39
−
39
View file @
e7885d55
// $Id: SMS.cpp,v 1.1
5
2003-
06-14 04:37:42
geuzaine Exp $
// $Id: SMS.cpp,v 1.1
6
2003-
12-04 15:55:27
geuzaine Exp $
//
//
// Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2003 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -32,14 +32,6 @@
...
@@ -32,14 +32,6 @@
extern
Context_T
CTX
;
extern
Context_T
CTX
;
/*
Reads a SMS mesh file format.
Fills the Mesh structure and says
the interface that the state of the current
mesh is 3.
*/
#define ENTITY_VERTEX 0
#define ENTITY_VERTEX 0
#define ENTITY_EDGE 1
#define ENTITY_EDGE 1
#define ENTITY_FACE 2
#define ENTITY_FACE 2
...
@@ -73,7 +65,7 @@ void Read_VTK_File(char *file, Mesh * m)
...
@@ -73,7 +65,7 @@ void Read_VTK_File(char *file, Mesh * m)
sscanf
(
line
,
"%s %d %s"
,
dumline1
,
&
NbVertices
,
dumline2
);
sscanf
(
line
,
"%s %d %s"
,
dumline1
,
&
NbVertices
,
dumline2
);
Surface
*
surf
=
Create_Surface
(
1
,
MSH_SURF_DISCRETE
);
Surface
*
surf
=
Create_Surface
(
1
,
MSH_SURF_DISCRETE
);
surf
->
Generatrices
=
List_Create
(
1
,
1
,
sizeof
(
Curve
*
))
;
surf
->
Dirty
=
1
;
Tree_Add
(
m
->
Surfaces
,
&
surf
);
Tree_Add
(
m
->
Surfaces
,
&
surf
);
for
(
i
=
0
;
i
<
NbVertices
;
i
++
)
{
for
(
i
=
0
;
i
<
NbVertices
;
i
++
)
{
...
@@ -95,8 +87,8 @@ void Read_VTK_File(char *file, Mesh * m)
...
@@ -95,8 +87,8 @@ void Read_VTK_File(char *file, Mesh * m)
v4
=
NULL
;
v4
=
NULL
;
}
}
else
{
else
{
printf
(
"no quads man !
\n
"
);
Msg
(
GERROR
,
"No quads in VTK file, man!
"
);
exit
(
-
1
)
;
return
;
}
}
Simplex
*
s
=
Create_Simplex
(
v1
,
v2
,
v3
,
v4
);
Simplex
*
s
=
Create_Simplex
(
v1
,
v2
,
v3
,
v4
);
s
->
V
[
0
]
=
v1
;
s
->
V
[
0
]
=
v1
;
...
@@ -108,7 +100,7 @@ void Read_VTK_File(char *file, Mesh * m)
...
@@ -108,7 +100,7 @@ void Read_VTK_File(char *file, Mesh * m)
}
}
else
{
else
{
surf
=
Create_Surface
(
1
,
MSH_SURF_DISCRETE
);
surf
=
Create_Surface
(
1
,
MSH_SURF_DISCRETE
);
surf
->
Generatrices
=
List_Create
(
1
,
1
,
sizeof
(
Curve
*
))
;
surf
->
Dirty
=
1
;
Tree_Add
(
m
->
Surfaces
,
&
surf
);
Tree_Add
(
m
->
Surfaces
,
&
surf
);
}
}
Tree_Add
(
surf
->
Simplexes
,
&
s
);
Tree_Add
(
surf
->
Simplexes
,
&
s
);
...
@@ -119,6 +111,7 @@ void Read_VTK_File(char *file, Mesh * m)
...
@@ -119,6 +111,7 @@ void Read_VTK_File(char *file, Mesh * m)
m
->
status
=
2
;
m
->
status
=
2
;
Volume
*
vol
=
Create_Volume
(
1
,
MSH_VOLUME
);
Volume
*
vol
=
Create_Volume
(
1
,
MSH_VOLUME
);
vol
->
Dirty
=
1
;
vol
->
Surfaces
=
List_Create
(
1
,
1
,
sizeof
(
Surface
*
));
vol
->
Surfaces
=
List_Create
(
1
,
1
,
sizeof
(
Surface
*
));
List_Add
(
vol
->
Surfaces
,
&
surf
);
List_Add
(
vol
->
Surfaces
,
&
surf
);
Tree_Add
(
m
->
Volumes
,
&
vol
);
Tree_Add
(
m
->
Volumes
,
&
vol
);
...
@@ -138,12 +131,11 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
...
@@ -138,12 +131,11 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
List_T
*
AllEdges
,
*
AllFaces
;
List_T
*
AllEdges
,
*
AllFaces
;
Vertex
*
v1
=
NULL
,
*
v2
=
NULL
,
*
v3
=
NULL
,
*
v4
=
NULL
;
Vertex
*
v1
=
NULL
,
*
v2
=
NULL
,
*
v3
=
NULL
,
*
v4
=
NULL
;
fscanf
(
in
,
"%s %d"
,
line
,
&
Dummy
);
fscanf
(
in
,
"%s %d"
,
line
,
&
Dummy
);
fscanf
(
in
,
"%d %d %d %d %d"
,
&
NbRegions
,
&
NbFaces
,
&
NbEdges
,
&
NbVertices
,
fscanf
(
in
,
"%d %d %d %d %d"
,
&
NbRegions
,
&
NbFaces
,
&
NbEdges
,
&
NbVertices
,
&
NbPoints
);
&
NbPoints
);
Msg
(
INFO
,
"
r
eading a mesh in scorec format"
);
Msg
(
INFO
,
"
R
eading a mesh in scorec format"
);
Msg
(
INFO
,
"%d Vertices"
,
NbVertices
);
Msg
(
INFO
,
"%d Vertices"
,
NbVertices
);
for
(
i
=
0
;
i
<
NbVertices
;
i
++
)
{
for
(
i
=
0
;
i
<
NbVertices
;
i
++
)
{
...
@@ -155,7 +147,12 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
...
@@ -155,7 +147,12 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
Tree_Add
(
m
->
Vertices
,
&
vert
);
Tree_Add
(
m
->
Vertices
,
&
vert
);
switch
(
GEntityType
)
{
switch
(
GEntityType
)
{
case
0
:
case
0
:
Tree_Add
(
m
->
Points
,
&
vert
);
{
// we need to make a new one: vertices in m->Vertices and
// m->Points should never point to the same memory location
Vertex
*
pnt
=
Create_Vertex
(
i
,
x
,
y
,
z
,
1.0
,
1.0
);
Tree_Add
(
m
->
Points
,
&
pnt
);
}
break
;
break
;
case
1
:
case
1
:
fscanf
(
in
,
"%le"
,
&
u
);
fscanf
(
in
,
"%le"
,
&
u
);
...
@@ -169,7 +166,7 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
...
@@ -169,7 +166,7 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
}
}
}
}
Msg
(
INFO
,
"%d
E
dges"
,
NbEdges
);
Msg
(
INFO
,
"%d
e
dges"
,
NbEdges
);
AllEdges
=
List_Create
(
NbEdges
,
1
,
sizeof
(
Edge
));
AllEdges
=
List_Create
(
NbEdges
,
1
,
sizeof
(
Edge
));
Edge
e
;
Edge
e
;
...
@@ -206,18 +203,13 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
...
@@ -206,18 +203,13 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
if
((
c
=
FindCurve
(
GEntityId
,
m
)))
{
if
((
c
=
FindCurve
(
GEntityId
,
m
)))
{
}
}
else
{
else
{
c
=
c
=
Create_Curve
(
GEntityId
,
MSH_SEGM_DISCRETE
,
1
,
NULL
,
NULL
,
-
1
,
-
1
,
0
,
1
);
Create_Curve
(
GEntityId
,
MSH_SEGM_DISCRETE
,
1
,
NULL
,
NULL
,
-
1
,
-
1
,
c
->
Dirty
=
1
;
0
,
1
);
c
->
beg
=
v1
;
c
->
end
=
v2
;
Tree_Add
(
m
->
Curves
,
&
c
);
Tree_Add
(
m
->
Curves
,
&
c
);
}
}
s
->
iEnt
=
GEntityId
;
s
->
iEnt
=
GEntityId
;
// List_Add(v1->ListCurves,&c);
// List_Add(v2->ListCurves,&c);
Tree_Add
(
c
->
Simplexes
,
&
s
);
s
->
Num
=
i
;
s
->
Num
=
i
;
Tree_Add
(
c
->
Simplexes
,
&
s
);
}
}
}
}
}
}
...
@@ -225,11 +217,12 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
...
@@ -225,11 +217,12 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
AllFaces
=
List_Create
(
NbFaces
,
1
,
sizeof
(
Simplex
*
));
AllFaces
=
List_Create
(
NbFaces
,
1
,
sizeof
(
Simplex
*
));
Volume
*
vol
=
Create_Volume
(
1
,
MSH_VOLUME
);
Volume
*
vol
=
Create_Volume
(
1
,
MSH_VOLUME
);
vol
->
Dirty
=
1
;
vol
->
Surfaces
=
List_Create
(
1
,
1
,
sizeof
(
Surface
*
));
vol
->
Surfaces
=
List_Create
(
1
,
1
,
sizeof
(
Surface
*
));
Tree_Add
(
m
->
Volumes
,
&
vol
);
Tree_Add
(
m
->
Volumes
,
&
vol
);
FACE_DIMENSION
=
2
;
FACE_DIMENSION
=
2
;
Msg
(
INFO
,
"%d
F
aces"
,
NbFaces
);
Msg
(
INFO
,
"%d
f
aces"
,
NbFaces
);
for
(
int
i
=
0
;
i
<
NbFaces
;
i
++
)
{
for
(
int
i
=
0
;
i
<
NbFaces
;
i
++
)
{
fscanf
(
in
,
"%d"
,
&
GEntityId
);
fscanf
(
in
,
"%d"
,
&
GEntityId
);
if
(
GEntityId
)
{
if
(
GEntityId
)
{
...
@@ -283,7 +276,7 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
...
@@ -283,7 +276,7 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
v4
=
e
.
V
[
1
];
v4
=
e
.
V
[
1
];
}
}
else
{
else
{
Msg
(
FATAL
,
"Read mesh SMS exiting"
);
Msg
(
GERROR
,
"Wrong number pf edges on face (%d)"
,
NbEdgesOnFace
);
}
}
for
(
int
j
=
0
;
j
<
nbPts
;
j
++
)
{
for
(
int
j
=
0
;
j
<
nbPts
;
j
++
)
{
switch
(
GEntityType
)
{
switch
(
GEntityType
)
{
...
@@ -314,9 +307,9 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
...
@@ -314,9 +307,9 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
}
}
else
{
else
{
surf
=
Create_Surface
(
GEntityId
+
10000
,
MSH_SURF_DISCRETE
);
surf
=
Create_Surface
(
GEntityId
+
10000
,
MSH_SURF_DISCRETE
);
surf
->
Dirty
=
1
;
if
(
!
NbRegions
)
if
(
!
NbRegions
)
List_Add
(
vol
->
Surfaces
,
&
surf
);
List_Add
(
vol
->
Surfaces
,
&
surf
);
surf
->
Generatrices
=
List_Create
(
1
,
1
,
sizeof
(
Curve
*
));
Tree_Add
(
m
->
Surfaces
,
&
surf
);
Tree_Add
(
m
->
Surfaces
,
&
surf
);
}
}
Tree_Add
(
surf
->
Vertices
,
&
s
->
V
[
0
]);
Tree_Add
(
surf
->
Vertices
,
&
s
->
V
[
0
]);
...
@@ -328,7 +321,7 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
...
@@ -328,7 +321,7 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
}
}
Msg
(
INFO
,
"%d
R
egion"
,
NbRegions
);
Msg
(
INFO
,
"%d
r
egion"
,
NbRegions
);
for
(
int
i
=
0
;
i
<
NbRegions
;
i
++
)
{
for
(
int
i
=
0
;
i
<
NbRegions
;
i
++
)
{
fscanf
(
in
,
"%d"
,
&
GEntityId
);
fscanf
(
in
,
"%d"
,
&
GEntityId
);
...
@@ -349,11 +342,11 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
...
@@ -349,11 +342,11 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
v4
=
myS2
->
V
[
hh
];
v4
=
myS2
->
V
[
hh
];
}
}
if
(
!
v1
||
!
v2
||
!
v3
||
!
v4
)
{
if
(
!
v1
||
!
v2
||
!
v3
||
!
v4
)
{
printf
(
"%d
\n
"
,
NbFacesOnRegion
);
Msg
(
GERROR
,
"%d
\n
"
,
NbFacesOnRegion
);
printf
(
"%p %p %p %p
\n
"
,
v1
,
v2
,
v3
,
v4
);
Msg
(
GERROR
,
"%p %p %p %p
\n
"
,
v1
,
v2
,
v3
,
v4
);
printf
(
"%p %p %p
\n
"
,
myS1
->
V
[
0
],
myS1
->
V
[
1
],
myS1
->
V
[
2
]);
Msg
(
GERROR
,
"%p %p %p
\n
"
,
myS1
->
V
[
0
],
myS1
->
V
[
1
],
myS1
->
V
[
2
]);
printf
(
"%p %p %p
\n
"
,
myS2
->
V
[
0
],
myS2
->
V
[
1
],
myS2
->
V
[
2
]);
Msg
(
GERROR
,
"%p %p %p
\n
"
,
myS2
->
V
[
0
],
myS2
->
V
[
1
],
myS2
->
V
[
2
]);
assert
(
1
==
0
)
;
return
;
}
}
Simplex
*
s
=
Create_Simplex
(
v1
,
v2
,
v3
,
v4
);
Simplex
*
s
=
Create_Simplex
(
v1
,
v2
,
v3
,
v4
);
...
@@ -361,6 +354,7 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
...
@@ -361,6 +354,7 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
}
}
else
{
else
{
vol
=
Create_Volume
(
GEntityId
,
MSH_VOLUME
);
vol
=
Create_Volume
(
GEntityId
,
MSH_VOLUME
);
vol
->
Dirty
=
1
;
Tree_Add
(
m
->
Volumes
,
&
vol
);
Tree_Add
(
m
->
Volumes
,
&
vol
);
}
}
s
->
iEnt
=
GEntityId
;
s
->
iEnt
=
GEntityId
;
...
@@ -369,16 +363,22 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
...
@@ -369,16 +363,22 @@ void Read_Mesh_SMS(Mesh * m, FILE * in)
}
}
}
}
List_Delete
(
AllEdges
);
List_Delete
(
AllFaces
);
List_Delete
(
AllFaces
);
if
(
Tree_Nbr
(
m
->
Volumes
))
{
if
(
NbRegions
)
m
->
status
=
3
;
m
->
status
=
3
;
else
if
(
NbFaces
)
}
else
if
(
Tree_Nbr
(
m
->
Surfaces
))
{
m
->
status
=
2
;
m
->
status
=
2
;
else
if
(
NbEdges
)
}
else
if
(
Tree_Nbr
(
m
->
Curves
))
{
m
->
status
=
1
;
m
->
status
=
1
;
Msg
(
INFO
,
"Done."
);
}
else
if
(
Tree_Nbr
(
m
->
Points
))
m
->
status
=
0
;
else
m
->
status
=
-
1
;
}
}
#if 0
#if 0
...
...
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