Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
infrastructure
unsio
Commits
98aac0a0
Commit
98aac0a0
authored
May 14, 2019
by
LAMBERT Jean-charles
Browse files
Merge branch 'with_test' of
https://gitlab.lam.fr/jclamber/unsio
into with_test
parents
7f8e46b3
b8eb5821
Changes
14
Hide whitespace changes
Inline
Side-by-side
3rdparty/nemolight/src/filefn.c
View file @
98aac0a0
...
...
@@ -64,7 +64,7 @@ string root(string filename)
if
(
dotpos
!=
NULL
&&
strchr
(
dotpos
,
DIR_SEP
)
!=
NULL
)
dotpos
=
NULL
;
if
(
dotpos
==
NULL
)
return
(
scopy
(
filename
));
return
(
__nemo_
scopy
(
filename
));
else
return
(
substr
(
filename
,
0
,
(
dotpos
-
filename
)
-
1
));
}
...
...
@@ -79,7 +79,7 @@ string extension(string filename)
if
(
dotpos
==
NULL
)
return
(
""
);
else
return
(
scopy
(
dotpos
+
1
));
return
(
__nemo_
scopy
(
dotpos
+
1
));
}
string
head
(
string
filename
)
...
...
@@ -99,9 +99,9 @@ string tail(string filename)
slashpos
=
strrchr
(
filename
,
DIR_SEP
);
if
(
slashpos
==
NULL
)
return
(
scopy
(
filename
));
return
(
__nemo_
scopy
(
filename
));
else
return
(
scopy
(
slashpos
+
1
));
return
(
__nemo_
scopy
(
slashpos
+
1
));
}
...
...
@@ -121,7 +121,7 @@ string fullname(string filename)
char
*
outname
;
if
(
*
filename
==
DIR_SEP
)
return
scopy
(
filename
);
return
__nemo_
scopy
(
filename
);
if
(
getcwd
(
pathname
,
MAXPATHLEN
)
==
0
)
error
(
"Directory name too long (MAXPATHLEN=%d)"
,
MAXPATHLEN
);
n1
=
strlen
(
pathname
)
+
1
;
...
...
@@ -130,7 +130,7 @@ string fullname(string filename)
if
(
n1
+
n2
<
MAXPATHLEN
)
{
strcat
(
pathname
,
pathsep
);
strcat
(
pathname
,
filename
);
return
scopy
(
pathname
);
return
__nemo_
scopy
(
pathname
);
}
else
{
outname
=
(
char
*
)
allocate
(
n1
+
n2
+
1
);
sprintf
(
outname
,
"%s%c%s"
,
pathname
,
DIR_SEP
,
filename
);
...
...
@@ -180,7 +180,7 @@ string defext(string filename, string ext)
if
(
forceext
)
return
(
sconc
(
substr
(
filename
,
0
,
xp
-
filename
-
1
),
ext
));
else
return
(
scopy
(
filename
));
return
(
__nemo_
scopy
(
filename
));
}
...
...
3rdparty/nemolight/src/filesecret.c
View file @
98aac0a0
...
...
@@ -1035,7 +1035,7 @@ local itemptr readitem(stream str, itemptr first)
*
bufp
++
=
readitem
(
str
,
np
);
/* read next component */
}
*
bufp
=
NULL
;
/* terminate item vector */
res
=
makeitem
(
scopy
(
SetType
),
scopy
(
ItemTag
(
ip
)),
res
=
makeitem
(
__nemo_
scopy
(
SetType
),
__nemo_
scopy
(
ItemTag
(
ip
)),
copxstr
(
ibuf
,
sizeof
(
itemptr
)),
NULL
);
/* construct compound item */
freeitem
(
ip
,
TRUE
);
/* reclaim orig. header */
...
...
3rdparty/nemolight/src/getparam.c
View file @
98aac0a0
...
...
@@ -454,9 +454,9 @@ void initparam(string argv[], string defv[])
maxkeys
=
nkeys
-
1
;
keys
[
0
].
keyval
=
argv
[
0
];
keys
[
0
].
key
=
scopy
(
"argv0"
);
keys
[
0
].
key
=
__nemo_
scopy
(
"argv0"
);
keys
[
0
].
val
=
progname
=
tail
(
argv
[
0
]);
keys
[
0
].
help
=
scopy
(
"Program name"
);
keys
[
0
].
help
=
__nemo_
scopy
(
"Program name"
);
keys
[
0
].
count
=
0
;
keys
[
0
].
upd
=
0
;
nzeno
=
(
*
defv
[
0
]
==
';'
);
...
...
@@ -480,12 +480,12 @@ void initparam(string argv[], string defv[])
}
keys
[
i
].
keyval
=
defv
[
j
];
keys
[
i
].
key
=
scopy
(
parname
(
defv
[
j
]));
keys
[
i
].
val
=
scopy
(
parvalue
(
defv
[
j
]));
keys
[
i
].
key
=
__nemo_
scopy
(
parname
(
defv
[
j
]));
keys
[
i
].
val
=
__nemo_
scopy
(
parvalue
(
defv
[
j
]));
if
(
nzeno
)
keys
[
i
].
help
=
scopy
(
defv
[
j
+
1
]
+
1
);
keys
[
i
].
help
=
__nemo_
scopy
(
defv
[
j
+
1
]
+
1
);
else
keys
[
i
].
help
=
scopy
(
parhelp
(
defv
[
j
]));
keys
[
i
].
help
=
__nemo_
scopy
(
parhelp
(
defv
[
j
]));
keys
[
i
].
count
=
0
;
keys
[
i
].
upd
=
1
;
if
(
keys
[
i
].
key
[
strlen
(
keys
[
i
].
key
)
-
1
]
==
'#'
)
...
...
@@ -494,7 +494,7 @@ void initparam(string argv[], string defv[])
keys
[
i
].
indexed
=
-
2
;
/* not indexed */
keys
[
i
].
next
=
NULL
;
if
(
streq
(
keys
[
i
].
key
,
"VERSION"
))
{
/* special (last?) keyword */
version_i
=
scopy
(
keys
[
i
].
val
);
version_i
=
__nemo_
scopy
(
keys
[
i
].
val
);
keys
[
i
].
upd
=
0
;
maxkeys
--
;
}
...
...
@@ -532,7 +532,7 @@ void initparam(string argv[], string defv[])
if
(
keys
[
i
].
indexed
>=
-
1
)
error
(
"Cannot match indexed keywords by position"
);
free
(
keys
[
i
].
val
);
keys
[
i
].
val
=
scopy
(
argv
[
i
]);
keys
[
i
].
val
=
__nemo_
scopy
(
argv
[
i
]);
keys
[
i
].
count
++
;
}
}
else
{
/* match by name? */
...
...
@@ -544,7 +544,7 @@ void initparam(string argv[], string defv[])
if
(
keys
[
j
].
count
)
error
(
"Parameter
\"
%s
\"
duplicated"
,
name
);
free
(
keys
[
j
].
val
);
keys
[
j
].
val
=
scopy
(
parvalue
(
argv
[
i
]));
/* get value */
keys
[
j
].
val
=
__nemo_
scopy
(
parvalue
(
argv
[
i
]));
/* get value */
keys
[
j
].
count
++
;
}
else
if
(
j
=
set_indexed
(
name
,
&
idx
))
{
/* enter indexed keywords */
// process this indexed keyword
...
...
@@ -561,9 +561,9 @@ void initparam(string argv[], string defv[])
}
kw
->
next
=
(
keyword
*
)
allocate
(
sizeof
(
keyword
));
kw
=
kw
->
next
;
kw
->
keyval
=
scopy
(
argv
[
i
]);
kw
->
key
=
scopy
(
parname
(
argv
[
i
]));
kw
->
val
=
scopy
(
parvalue
(
argv
[
i
]));
kw
->
keyval
=
__nemo_
scopy
(
argv
[
i
]);
kw
->
key
=
__nemo_
scopy
(
parname
(
argv
[
i
]));
kw
->
val
=
__nemo_
scopy
(
parvalue
(
argv
[
i
]));
kw
->
help
=
0
;
kw
->
count
=
1
;
// indexed keywords are never 'original'
kw
->
upd
=
0
;
...
...
@@ -647,7 +647,7 @@ void initparam(string argv[], string defv[])
((
val
==
NULL
||
streq
(
val
,
""
))
&&
defflag
)
);
if
(
!
streq
(
keys
[
i
].
val
,
val
))
{
free
(
keys
[
i
].
val
);
keys
[
i
].
val
=
scopy
(
val
);
keys
[
i
].
val
=
__nemo_
scopy
(
val
);
keys
[
i
].
count
++
;
}
if
(
go
)
break
;
...
...
@@ -1397,7 +1397,7 @@ local void eval_keys(void)
*
c2
=
0
;
dprintf
(
3
,
"eval_keys: Modifying %s
\n
"
,
keys
[
i
].
val
);
free
(
keys
[
i
].
val
);
keys
[
i
].
val
=
scopy
(
newval
);
keys
[
i
].
val
=
__nemo_
scopy
(
newval
);
/* keys[i].count++; */
}
}
...
...
@@ -1828,7 +1828,7 @@ local void setparam (string par, string val, string prompt)
#endif
val
=
line
;
}
kw
->
val
=
scopy
(
val
);
kw
->
val
=
__nemo_
scopy
(
val
);
kw
->
upd
=
2
;
/* mark it as being updated */
#else
error
(
"setparam: not compiled into getparam.c"
);
...
...
@@ -2254,9 +2254,9 @@ local int addindexed(int i, string keyval, int idx)
}
kw
->
next
=
(
keyword
*
)
allocate
(
sizeof
(
keyword
));
kw
=
kw
->
next
;
kw
->
keyval
=
scopy
(
keyval
);
kw
->
key
=
scopy
(
parname
(
keyval
));
kw
->
val
=
scopy
(
parvalue
(
keyval
));
kw
->
keyval
=
__nemo_
scopy
(
keyval
);
kw
->
key
=
__nemo_
scopy
(
parname
(
keyval
));
kw
->
val
=
__nemo_
scopy
(
parvalue
(
keyval
));
kw
->
help
=
0
;
kw
->
count
=
1
;
kw
->
upd
=
0
;
...
...
@@ -2363,7 +2363,7 @@ local void readkeys(string mesg, bool first)
}
else
{
if
(
!
streq
(
keys
[
i
].
val
,
parvalue
(
keybuf
)))
{
/* if different */
free
(
keys
[
i
].
val
);
/* free old */
keys
[
i
].
val
=
scopy
(
parvalue
(
keybuf
));
/* and patch in */
keys
[
i
].
val
=
__nemo_
scopy
(
parvalue
(
keybuf
));
/* and patch in */
}
}
}
...
...
@@ -2863,7 +2863,7 @@ local void set_help(string arg)
{
char
*
cp
;
help_string
=
scopy
(
arg
);
help_string
=
__nemo_
scopy
(
arg
);
if
((
cp
=
strpbrk
(
help_string
,
"0123456789"
))
!=
NULL
)
/* isnum? */
help_level
=
atoi
(
cp
);
/* if so, change help_level */
}
...
...
@@ -2909,7 +2909,7 @@ local void set_debug(string arg)
local
void
set_yapp
(
string
arg
)
{
yapp_string
=
scopy
(
arg
);
yapp_string
=
__nemo_
scopy
(
arg
);
yapp_dev
=
atoi
(
yapp_string
);
}
...
...
3rdparty/nemolight/src/history.c
View file @
98aac0a0
...
...
@@ -133,7 +133,7 @@ int app_history(string s)
dprintf
(
1
,
"app_history: null history string
\n
"
);
return
nhist
;
}
histbuf
[
nhist
]
=
scopy
(
s
);
histbuf
[
nhist
]
=
__nemo_
scopy
(
s
);
freeup
[
nhist
]
=
TRUE
;
dprintf
(
9
,
"app_history: histbuf[%d] = %s
\n
"
,
nhist
,
s
);
nhist
++
;
...
...
@@ -162,7 +162,7 @@ void reset_history()
void
set_headline
(
string
s
)
{
headline
=
scopy
(
s
);
headline
=
__nemo_
scopy
(
s
);
}
/*
...
...
3rdparty/nemolight/src/inc/strlib.h
View file @
98aac0a0
...
...
@@ -12,7 +12,7 @@
/* Contents: */
/* */
/* getmem(nbytes) malloc with error checking */
/* scopy(source) returns a copy of source */
/*
__nemo_
scopy(source) returns a copy of source */
/* sconc(s1,s2) concatenates its arguments */
/* substr(s, p1, p2) returns substring from p1-p2 */
/* findstr(text, pat) finds index of pat in text */
...
...
@@ -22,7 +22,7 @@
#define _strlib_h
extern
char
*
getmem
(
int
nbytes
);
extern
string
scopy
(
const
char
*
s
);
extern
string
__nemo_
scopy
(
const
char
*
s
);
extern
string
sconc
(
char
*
s1
,
char
*
s2
);
extern
string
substr
(
char
*
s
,
int
p1
,
int
p2
);
extern
int
findstr
(
char
*
text
,
char
*
pat
);
...
...
3rdparty/nemolight/src/io_get_put.c
View file @
98aac0a0
...
...
@@ -53,7 +53,7 @@ int put_data_select(char * outfile,
int
rtype
,
char
*
io_out
[],
bool
*
save_one
,
FILE
*
outstr
[],
FILE
*
__io_
outstr
[],
int
MAXIO
,
t_ion_data
*
ion
)
{
...
...
@@ -72,8 +72,8 @@ int put_data_select(char * outfile,
/* Open the file for writing */
if
((
no_io
=
get_old_file
(
outfile
,
io_out
,
save_one
,
outstr
,
MAXIO
))
<
0
)
no_io
=
get_new_file
(
outfile
,
io_out
,
save_one
,
outstr
,
"w"
,
MAXIO
);
if
((
no_io
=
get_old_file
(
outfile
,
io_out
,
save_one
,
__io_
outstr
,
MAXIO
))
<
0
)
no_io
=
get_new_file
(
outfile
,
io_out
,
save_one
,
__io_
outstr
,
"w"
,
MAXIO
);
/* print out what it is doing */
if
(
I_io
)
...
...
@@ -120,30 +120,30 @@ int put_data_select(char * outfile,
get_history_input_file
(
hist_file
);
}
/* put the history */
put_history
(
outstr
[
no_io
]);
put_history
(
__io_
outstr
[
no_io
]);
}
/* Save the snapshot */
put_set
(
outstr
[
no_io
],
SnapShotTag
);
put_set
(
__io_
outstr
[
no_io
],
SnapShotTag
);
put_set
(
outstr
[
no_io
],
ParametersTag
);
put_set
(
__io_
outstr
[
no_io
],
ParametersTag
);
if
(
T_io
)
{
if
(
(
B_io
&&
(
*
ion
->
bits
&
TimeBit
))
||
!
B_io
)
{
put_data
(
outstr
[
no_io
],
TimeTag
,
OutType
,
ion
->
timu
,
0
);
put_data
(
__io_
outstr
[
no_io
],
TimeTag
,
OutType
,
ion
->
timu
,
0
);
}
else
{
dprintf
(
1
,
"WARNING ### TimeBit control does not exist.
\n
"
);
}
}
put_data
(
outstr
[
no_io
],
NobjTag
,
IntType
,
ion
->
nbody
,
0
);
put_tes
(
outstr
[
no_io
],
ParametersTag
);
put_data
(
__io_
outstr
[
no_io
],
NobjTag
,
IntType
,
ion
->
nbody
,
0
);
put_tes
(
__io_
outstr
[
no_io
],
ParametersTag
);
put_set
(
outstr
[
no_io
],
ParticlesTag
);
/* start particle output */
put_data
(
outstr
[
no_io
],
CoordSystemTag
,
IntType
,
&
coordsys
,
0
);
put_set
(
__io_
outstr
[
no_io
],
ParticlesTag
);
/* start particle output */
put_data
(
__io_
outstr
[
no_io
],
CoordSystemTag
,
IntType
,
&
coordsys
,
0
);
if
(
M_io
)
{
/* Masses */
if
(
(
B_io
&&
(
*
ion
->
bits
&
MassBit
))
||
!
B_io
)
{
put_data
(
outstr
[
no_io
],
MassTag
,
OutType
,
ion
->
mass
,
*
ion
->
nbody
,
0
);
put_data
(
__io_
outstr
[
no_io
],
MassTag
,
OutType
,
ion
->
mass
,
*
ion
->
nbody
,
0
);
}
else
{
dprintf
(
1
,
"WARNING ### MassBit control does not exist.
\n
"
);
...
...
@@ -152,7 +152,7 @@ int put_data_select(char * outfile,
if
(
XV_io
)
{
/* PhaseSpace */
if
(
(
B_io
&&
(
*
ion
->
bits
&
PhaseSpaceBit
))
||
!
B_io
)
{
put_data
(
outstr
[
no_io
],
PhaseSpaceTag
,
OutType
,
ion
->
phase
,
*
ion
->
nbody
,
2
,
NDIM
,
0
);
put_data
(
__io_
outstr
[
no_io
],
PhaseSpaceTag
,
OutType
,
ion
->
phase
,
*
ion
->
nbody
,
2
,
NDIM
,
0
);
/* free(phasep); */
}
else
{
...
...
@@ -162,7 +162,7 @@ int put_data_select(char * outfile,
if
(
X_io
)
{
/* Positions */
if
(
(
B_io
&&
(
*
ion
->
bits
&
PosBit
))
||
!
B_io
)
{
put_data
(
outstr
[
no_io
],
PosTag
,
OutType
,
ion
->
pos
,
*
ion
->
nbody
,
NDIM
,
0
);
put_data
(
__io_
outstr
[
no_io
],
PosTag
,
OutType
,
ion
->
pos
,
*
ion
->
nbody
,
NDIM
,
0
);
}
else
{
dprintf
(
1
,
"WARNING ### PosBit control does not exist.
\n
"
);
...
...
@@ -171,7 +171,7 @@ int put_data_select(char * outfile,
if
(
V_io
)
{
/* Velocities */
if
(
(
B_io
&&
(
*
ion
->
bits
&
VelBit
))
||
!
B_io
)
{
put_data
(
outstr
[
no_io
],
VelTag
,
OutType
,
ion
->
vel
,
*
ion
->
nbody
,
NDIM
,
0
);
put_data
(
__io_
outstr
[
no_io
],
VelTag
,
OutType
,
ion
->
vel
,
*
ion
->
nbody
,
NDIM
,
0
);
}
else
{
dprintf
(
1
,
"WARNING ### VelBit control does not exist.
\n
"
);
...
...
@@ -180,7 +180,7 @@ int put_data_select(char * outfile,
if
(
P_io
)
{
/* Potentials */
if
(
(
B_io
&&
(
*
ion
->
bits
&
PotentialBit
))
||
!
B_io
)
{
put_data
(
outstr
[
no_io
],
PotentialTag
,
OutType
,
ion
->
pot
,
*
ion
->
nbody
,
0
);
put_data
(
__io_
outstr
[
no_io
],
PotentialTag
,
OutType
,
ion
->
pot
,
*
ion
->
nbody
,
0
);
}
else
{
dprintf
(
1
,
"WARNING ### PotentialBit control does not exist.
\n
"
);
...
...
@@ -189,7 +189,7 @@ int put_data_select(char * outfile,
if
(
A_io
)
{
/* Accelerations */
if
(
(
B_io
&&
(
*
ion
->
bits
&
AccelerationBit
))
||
!
B_io
)
{
put_data
(
outstr
[
no_io
],
AccelerationTag
,
OutType
,
ion
->
acc
,
*
ion
->
nbody
,
NDIM
,
0
);
put_data
(
__io_
outstr
[
no_io
],
AccelerationTag
,
OutType
,
ion
->
acc
,
*
ion
->
nbody
,
NDIM
,
0
);
}
else
{
dprintf
(
1
,
"WARNING ### AccelerationBit control does not exist.
\n
"
);
...
...
@@ -198,7 +198,7 @@ int put_data_select(char * outfile,
if
(
AUX_io
)
{
/* Aux */
if
(
(
B_io
&&
(
*
ion
->
bits
&
AuxBit
))
||
!
B_io
)
{
put_data
(
outstr
[
no_io
],
AuxTag
,
OutType
,
ion
->
aux
,
*
ion
->
nbody
,
0
);
put_data
(
__io_
outstr
[
no_io
],
AuxTag
,
OutType
,
ion
->
aux
,
*
ion
->
nbody
,
0
);
}
else
{
dprintf
(
1
,
"WARNING ### AuxBit control does not exist.
\n
"
);
...
...
@@ -207,7 +207,7 @@ int put_data_select(char * outfile,
if
(
K_io
)
{
/* Keys */
if
(
(
B_io
&&
(
*
ion
->
bits
&
KeyBit
))
||
!
B_io
)
{
put_data
(
outstr
[
no_io
],
KeyTag
,
IntType
,
ion
->
keys
,
*
ion
->
nbody
,
0
);
put_data
(
__io_
outstr
[
no_io
],
KeyTag
,
IntType
,
ion
->
keys
,
*
ion
->
nbody
,
0
);
}
else
{
dprintf
(
1
,
"WARNING ### KeyBit control does not exist.
\n
"
);
...
...
@@ -216,7 +216,7 @@ int put_data_select(char * outfile,
if
(
D_io
)
{
/* Density */
if
(
(
B_io
&&
(
*
ion
->
bits
&
DensBit
))
||
!
B_io
)
{
put_data
(
outstr
[
no_io
],
DensityTag
,
OutType
,
ion
->
dens
,
*
ion
->
nbody
,
0
);
put_data
(
__io_
outstr
[
no_io
],
DensityTag
,
OutType
,
ion
->
dens
,
*
ion
->
nbody
,
0
);
}
else
{
dprintf
(
1
,
"WARNING ### DensBit control does not exist.
\n
"
);
...
...
@@ -225,19 +225,19 @@ int put_data_select(char * outfile,
if
(
EPS_io
)
{
/* EPS */
if
(
(
B_io
&&
(
*
ion
->
bits
&
EpsBit
))
||
!
B_io
)
{
put_data
(
outstr
[
no_io
],
EpsTag
,
OutType
,
ion
->
eps
,
*
ion
->
nbody
,
0
);
put_data
(
__io_
outstr
[
no_io
],
EpsTag
,
OutType
,
ion
->
eps
,
*
ion
->
nbody
,
0
);
}
else
{
dprintf
(
1
,
"WARNING ### EpsBit control does not exist.
\n
"
);
}
}
put_tes
(
outstr
[
no_io
],
ParticlesTag
);
put_tes
(
__io_
outstr
[
no_io
],
ParticlesTag
);
put_tes
(
outstr
[
no_io
],
SnapShotTag
);
put_tes
(
__io_
outstr
[
no_io
],
SnapShotTag
);
/* flush IO */
fflush
(
outstr
[
no_io
]);
fflush
(
__io_
outstr
[
no_io
]);
save_one
[
no_io
]
=
TRUE
;
...
...
@@ -252,7 +252,7 @@ int get_data_select(char * infile,
int
rtype
,
/* real type : 1=real*4 | 2=real*8 */
char
*
io_in
[],
bool
read_one
[],
FILE
*
instr
[],
FILE
*
__io_
instr
[],
int
MAXIO
,
t_ion_data
*
ion
)
{
...
...
@@ -279,8 +279,8 @@ int get_data_select(char * infile,
i_jump
=
sizeof
(
int
);
/* Open the file for reading */
if
((
no_io
=
get_old_file
(
infile
,
io_in
,
read_one
,
instr
,
MAXIO
))
<
0
)
{
no_io
=
get_new_file
(
infile
,
io_in
,
read_one
,
instr
,
"r"
,
MAXIO
);
if
((
no_io
=
get_old_file
(
infile
,
io_in
,
read_one
,
__io_
instr
,
MAXIO
))
<
0
)
{
no_io
=
get_new_file
(
infile
,
io_in
,
read_one
,
__io_
instr
,
"r"
,
MAXIO
);
}
CURRENT_IO
=
no_io
;
...
...
@@ -291,20 +291,20 @@ int get_data_select(char * infile,
/* read the snapshot */
#if 0
reset_history();
fprintf(stderr,"nhist : %d\n",get_history(instr[no_io]));
fprintf(stderr,"nhist : %d\n",get_history(
__io_
instr[no_io]));
histo = (char **) ask_history();
for (i=0; i<get_history(instr[no_io]); i++) {
for (i=0; i<get_history(
__io_
instr[no_io]); i++) {
fprintf(stderr,"histo : <%s>\n",histo[i]);
}
#endif
for
(;;)
{
get_history
(
instr
[
no_io
]);
get_history
(
__io_
instr
[
no_io
]);
while
(
get_tag_ok
(
instr
[
no_io
],
HeadlineTag
))
headline
=
__nemo_get_string
(
instr
[
no_io
],
HeadlineTag
);
while
(
get_tag_ok
(
__io_
instr
[
no_io
],
HeadlineTag
))
headline
=
__nemo_get_string
(
__io_
instr
[
no_io
],
HeadlineTag
);
if
(
!
get_tag_ok
(
instr
[
no_io
],
SnapShotTag
))
{
if
(
!
get_tag_ok
(
__io_
instr
[
no_io
],
SnapShotTag
))
{
if
(
!
read_one
[
no_io
])
{
fprintf
(
stderr
,
"SnapshotTag error ## [get_data_select]
\n
"
);
fprintf
(
stderr
,
"%s is not a NEMO SNAPSHOT
\n
"
,
io_in
[
no_io
]);
...
...
@@ -314,15 +314,15 @@ int get_data_select(char * infile,
dprintf
(
1
,
"WARNING!! end of snapshot reached.
\n
"
);
return
0
;
}
/* !get_tag_ok(instr[no_io], SnapShotTag)... */
}
/* !get_tag_ok(
__io_
instr[no_io], SnapShotTag)... */
else
{
read_one
[
no_io
]
=
TRUE
;
/* File has been read at least one time */
}
get_set
(
instr
[
no_io
],
SnapShotTag
);
get_set
(
__io_
instr
[
no_io
],
SnapShotTag
);
get_set
(
instr
[
no_io
],
ParametersTag
);
get_set
(
__io_
instr
[
no_io
],
ParametersTag
);
if
(
T_io
)
{
/* time step */
if
(
!
get_data_time
(
instr
[
no_io
],
OutType
,
rtype
*
4
,
&
ion
->
timu
))
{
if
(
!
get_data_time
(
__io_
instr
[
no_io
],
OutType
,
rtype
*
4
,
&
ion
->
timu
))
{
dprintf
(
1
,
"### Snapshot WARNING ### No Time
\n
"
);
status
=
-
1
;
}
...
...
@@ -332,7 +332,7 @@ int get_data_select(char * infile,
}
get_data_nbody
(
instr
[
no_io
],
IntType
,
sizeof
(
int
),
/*(int*)*/
&
nbodyptr
);
get_data_nbody
(
__io_
instr
[
no_io
],
IntType
,
sizeof
(
int
),
/*(int*)*/
&
nbodyptr
);
if
(
SP_io
)
{
if
(
strcmp
(
ion
->
SelectionString123
,
"all"
))
{
...
...
@@ -361,8 +361,8 @@ int get_data_select(char * infile,
if
(
!
streq
(
ion
->
selt
,
"all"
)
&&
!
within
(
real_time
,
ion
->
selt
,
TIMEFUZZ
))
{
dprintf
(
1
,
"Info : skipping time step [%.4f]
\n
"
,
real_time
);
get_tes
(
instr
[
no_io
],
ParametersTag
);
get_tes
(
instr
[
no_io
],
SnapShotTag
);
get_tes
(
__io_
instr
[
no_io
],
ParametersTag
);
get_tes
(
__io_
instr
[
no_io
],
SnapShotTag
);
if
(
SP_io
)
{
/* stuff on Selected Particles */
free
((
int
*
)
SelectedPart
);
}
...
...
@@ -370,14 +370,14 @@ int get_data_select(char * infile,
}
}
get_tes
(
instr
[
no_io
],
ParametersTag
);
get_tes
(
__io_
instr
[
no_io
],
ParametersTag
);
if
(
get_tag_ok
(
instr
[
no_io
],
ParticlesTag
))
{
get_set
(
instr
[
no_io
],
ParticlesTag
);
if
(
get_tag_ok
(
__io_
instr
[
no_io
],
ParticlesTag
))
{
get_set
(
__io_
instr
[
no_io
],
ParticlesTag
);
/* get masses */
if
(
M_io
)
{
if
(
!
get_data_mass
(
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
mass
))
{
if
(
!
get_data_mass
(
__io_
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
mass
))
{
dprintf
(
1
,
"### Snapshot WARNING ### No Mass
\n
"
);
status
=
-
1
;
/*exit(1);*/
...
...
@@ -397,7 +397,7 @@ int get_data_select(char * infile,
if
(
X_io
||
V_io
||
XV_io
)
{
/* test PHASE SPACE Coordinates */
if
(
get_data_phase
(
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
phaseptr
,
NDIM
))
{
if
(
get_data_phase
(
__io_
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
phaseptr
,
NDIM
))
{
keybits
|=
PhaseSpaceBit
;
/* got PhaseSpace */
if
(
X_io
)
{
keybits
|=
PosBit
;
/* got Pos */
...
...
@@ -466,7 +466,7 @@ int get_data_select(char * infile,
if
(
X_io
)
{
/* test PosTag */
if
(
get_data_pos
(
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
(
ion
->
pos
),
NDIM
))
{
if
(
get_data_pos
(
__io_
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
(
ion
->
pos
),
NDIM
))
{
keybits
|=
PosBit
;
/* got Pos */
if
(
SP_io
)
{
for
(
i
=
0
;
i
<
nBodySelected
;
i
++
)
{
...
...
@@ -485,7 +485,7 @@ int get_data_select(char * infile,
if
(
V_io
)
{
/* test VelTag */
if
(
get_data_vel
(
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
vel
,
NDIM
))
{
if
(
get_data_vel
(
__io_
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
vel
,
NDIM
))
{
keybits
|=
VelBit
;
/* got Vel */
if
(
SP_io
)
{
for
(
i
=
0
;
i
<
nBodySelected
;
i
++
)
{
...
...
@@ -506,7 +506,7 @@ int get_data_select(char * infile,
/* get potential array */
if
(
P_io
)
{
if
(
!
get_data_pot
(
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
pot
))
{
if
(
!
get_data_pot
(
__io_
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
pot
))
{
dprintf
(
1
,
"### Snapshot WARNING ### No Potential
\n
"
);
status
=
-
1
;
/*exit(1);*/
...
...
@@ -524,7 +524,7 @@ int get_data_select(char * infile,
}
/* get acceleration array */
if
(
A_io
)
{
if
(
!
get_data_acc
(
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
acc
,
NDIM
))
{
if
(
!
get_data_acc
(
__io_
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
acc
,
NDIM
))
{
dprintf
(
1
,
"### Snapshot WARNING ### No Acceleration
\n
"
);
status
=
-
1
;
/*exit(1);*/
...
...
@@ -542,7 +542,7 @@ int get_data_select(char * infile,
}
/* get auxiliary array */
if
(
AUX_io
)
{
if
(
!
get_data_aux
(
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
aux
))
{
if
(
!
get_data_aux
(
__io_
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
aux
))
{
dprintf
(
1
,
"### Snapshot WARNING ### No Auxiliary
\n
"
);
status
=
-
1
;
/*exit(1);*/
...
...
@@ -560,7 +560,7 @@ int get_data_select(char * infile,
}
/* get keys array */
if
(
K_io
)
{
if
(
!
get_data_keys
(
instr
[
no_io
],
IntType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
keys
))
{
if
(
!
get_data_keys
(
__io_
instr
[
no_io
],
IntType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
keys
))
{
dprintf
(
1
,
"### Snapshot WARNING ### No Keys
\n
"
);
status
=
-
1
;
/*exit(1);*/
...
...
@@ -578,7 +578,7 @@ int get_data_select(char * infile,
}
/* get density array */
if
(
D_io
)
{
if
(
!
get_data_dens
(
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
dens
))
{
if
(
!
get_data_dens
(
__io_
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
dens
))
{
dprintf
(
1
,
"### Snapshot WARNING ### No Density
\n
"
);
status
=
-
1
;
/*exit(1);*/
...
...
@@ -596,7 +596,7 @@ int get_data_select(char * infile,
}
/* get epses */
if
(
EPS_io
)
{
if
(
!
get_data_eps
(
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
eps
))
{
if
(
!
get_data_eps
(
__io_
instr
[
no_io
],
OutType
,
*
nbodyptr
,
rtype
*
4
,
&
ion
->
eps
))
{
dprintf
(
1
,
"### Snapshot WARNING ### No Eps
\n
"
);
status
=
-
1
;
/*exit(1);*/
...
...
@@ -612,15 +612,15 @@ int get_data_select(char * infile,
}
}
}
get_tes
(
instr
[
no_io
],
ParticlesTag
);
}
/* get_tag_ok(instr[no_io], ParticlesTag */
get_tes
(
__io_
instr
[
no_io
],
ParticlesTag
);
}
/* get_tag_ok(
__io_
instr[no_io], ParticlesTag */
else
{
dprintf
(
1
,
"### Snapshot WARNING ### no ParticlesTag
\n
"
);
status
=
-
2
;
}
/* get out of the loop */
get_tes
(
instr
[
no_io
],
SnapShotTag
);
get_tes
(
__io_
instr
[
no_io
],
SnapShotTag
);
break
;
}
/* for(;;) */
...
...
@@ -638,7 +638,7 @@ int get_data_select(char * infile,
maxbodies
[
CURRENT_IO
]
=
*
nbodyptr
;
}
/* get_tes(instr[no_io], SnapShotTag); */
/* get_tes(
__io_
instr[no_io], SnapShotTag); */
free
(
nbodyptr
);
return
status
;
...
...
3rdparty/nemolight/src/io_get_put_f.c
View file @
98aac0a0
...
...
@@ -49,7 +49,7 @@ int put_data_select_f(char * outfile,
int
rtype
,
char
*
io_out
[],
bool
*
save_one
,
FILE
*
outstr
[],
FILE
*
__io_
outstr
[],
int
MAXIO
)
{
int
coordsys
=
CSCode
(
Cartesian
,
NDIM
,
2
),
...
...
@@ -69,8 +69,8 @@ int put_data_select_f(char * outfile,