Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
806bee60
Commit
806bee60
authored
12 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
add reading gzipped dt-file.
Former-commit-id: d2bdb7236a297a4f0928dfaa73117c6eb6982b02
parent
393d4826
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
test.c
+24
-0
24 additions, 0 deletions
test.c
with
24 additions
and
0 deletions
test.c
+
24
−
0
View file @
806bee60
...
@@ -371,6 +371,26 @@ void read_id ( char *fname , struct part *parts , int N ) {
...
@@ -371,6 +371,26 @@ void read_id ( char *fname , struct part *parts , int N ) {
void
read_dt
(
char
*
fname
,
struct
part
*
parts
,
int
N
)
{
void
read_dt
(
char
*
fname
,
struct
part
*
parts
,
int
N
)
{
#ifdef HAVE_ZLIB
gzFile
*
fd
;
char
buff
[
1024
];
int
k
;
/* Open the given file. */
if
(
(
fd
=
gzopen
(
fname
,
"r"
)
)
==
NULL
)
error
(
"Failed to open dt file"
);
/* Read the coordinates into the part positions. */
for
(
k
=
0
;
k
<
N
;
k
++
)
{
if
(
gzgets
(
fd
,
buff
,
1024
)
==
NULL
)
error
(
"Error reading id file."
);
if
(
sscanf
(
buff
,
"%ef"
,
&
parts
[
k
].
dt
)
!=
1
)
error
(
"Error parsing dt file."
);
}
/* Wrap it up. */
gzclose
(
fd
);
#else
FILE
*
fd
;
FILE
*
fd
;
int
k
;
int
k
;
...
@@ -384,6 +404,10 @@ void read_dt ( char *fname , struct part *parts , int N ) {
...
@@ -384,6 +404,10 @@ void read_dt ( char *fname , struct part *parts , int N ) {
error
(
"Error reading dt file."
);
error
(
"Error reading dt file."
);
}
}
/* Wrap it up. */
fclose
(
fd
);
#endif
}
}
...
...
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