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
fea969de
Commit
fea969de
authored
10 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
revert patch from #260: it breaks reading some of our BDF test cases
parent
b99aa61e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Geo/GModelIO_BDF.cpp
+21
-80
21 additions, 80 deletions
Geo/GModelIO_BDF.cpp
with
21 additions
and
80 deletions
Geo/GModelIO_BDF.cpp
+
21
−
80
View file @
fea969de
...
...
@@ -122,86 +122,28 @@ static int readElementBDF(FILE *fp, char *buffer, int keySize, int numVertices,
int
&
num
,
int
&
region
,
std
::
vector
<
MVertex
*>
&
vertices
,
std
::
map
<
int
,
MVertex
*>
&
vertexMap
)
{
fpos_t
position
;
char
ch
,
buffer2
[
256
],
buffer3
[
256
];
char
buffer2
[
256
],
buffer3
[
256
];
std
::
vector
<
char
*>
fields
;
int
nfields
=
0
,
sizediff
,
j
,
c
,
cont
;
int
format
=
getFormatBDF
(
buffer
,
keySize
);
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
buffer2
);
i
++
)
buffer2
[
i
]
=
buffer3
[
i
]
=
'\0'
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
buffer2
);
i
++
)
buffer2
[
i
]
=
buffer3
[
i
]
=
'\0'
;
readLineBDF
(
buffer
,
format
,
fields
);
sizediff
=
fields
.
size
();
cont
=
0
;
while
(
!
feof
(
fp
))
{
if
(
format
==
0
){
// free field
// bail out if fixed number of vertices are found
if
(
numVertices
>
0
&&
(
int
)
fields
.
size
()
-
2
==
numVertices
)
break
;
// read next line to check for automatic continuation
fgetpos
(
fp
,
&
position
);
j
=
0
;
while
(
j
<
8
)
{
ch
=
(
char
)
fgetc
(
fp
);
if
(
feof
(
fp
)
||
ch
!=
' '
)
break
;
j
++
;
if
(((
int
)
fields
.
size
()
-
2
<
abs
(
numVertices
))
||
(
numVertices
<
0
&&
(
fields
.
size
()
==
9
))){
if
(
fields
.
size
()
==
9
)
fields
.
pop_back
();
if
(
!
fgets
(
buffer2
,
sizeof
(
buffer2
),
fp
))
return
0
;
readLineBDF
(
buffer2
,
format
,
fields
);
}
fsetpos
(
fp
,
&
position
);
if
(
j
!=
7
)
break
;
}
else
if
(
format
==
1
){
// small field
if
(
sizediff
==
9
){
// normal continuation
fields
.
pop_back
();
}
else
if
(
sizediff
==
8
){
// read next line to check for automatic continuation
c
=
fgetc
(
fp
);
ch
=
(
char
)
c
;
if
(
feof
(
fp
))
break
;
ungetc
(
c
,
fp
);
if
(
ch
!=
'*'
)
break
;
}
else
{
break
;
}
}
else
if
(
format
==
2
){
// long field
if
(
sizediff
==
5
){
// normal continuation
fields
.
pop_back
();
}
else
if
(
sizediff
==
4
){
// read next line to check for automatic continuation
c
=
getc
(
fp
);
ch
=
(
char
)
c
;
if
(
feof
(
fp
))
break
;
ungetc
(
c
,
fp
);
if
(
ch
!=
'*'
)
break
;
}
else
{
break
;
}
}
// get continuation line
if
(
cont
==
0
)
{
if
(
!
fgets
(
buffer2
,
sizeof
(
buffer2
),
fp
))
break
;
nfields
=
fields
.
size
();
readLineBDF
(
buffer2
,
format
,
fields
);
sizediff
=
fields
.
size
()
-
nfields
;
cont
++
;
}
else
{
if
(
!
fgets
(
buffer3
,
sizeof
(
buffer3
),
fp
))
break
;
if
(((
int
)
fields
.
size
()
-
2
<
abs
(
numVertices
))
||
(
numVertices
<
0
&&
(
fields
.
size
()
==
17
))){
if
(
fields
.
size
()
==
17
)
fields
.
pop_back
();
if
(
!
fgets
(
buffer3
,
sizeof
(
buffer3
),
fp
))
return
0
;
readLineBDF
(
buffer3
,
format
,
fields
);
break
;
}
}
// negative 'numVertices' gives the minimum required number of vertices
if
((
int
)
fields
.
size
()
-
2
<
abs
(
numVertices
)){
Msg
::
Error
(
"Wrong number of vertices %d for element"
,
fields
.
size
()
-
2
);
...
...
@@ -214,8 +156,7 @@ static int readElementBDF(FILE *fp, char *buffer, int keySize, int numVertices,
strncpy
(
tmp
,
fields
[
0
],
cmax
);
num
=
atoi
(
tmp
);
strncpy
(
tmp
,
fields
[
1
],
cmax
);
region
=
atoi
(
tmp
);
for
(
unsigned
int
i
=
2
;
i
<
fields
.
size
();
i
++
){
strncpy
(
tmp
,
fields
[
i
],
cmax
);
n
[
i
-
2
]
=
atoi
(
tmp
);
strncpy
(
tmp
,
fields
[
i
],
cmax
);
n
[
i
-
2
]
=
atoi
(
tmp
);
}
// ignore the extra fields when we know how many vertices we need
...
...
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