Ubuntu 14.04 LTS Japanese Remix
on VMWare Fusion v8.5.2 (4635224)
on OS X El Captian v10.11.4
GNU bash, version 4.3.11(1)-release
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
(also for g++)
ADDA v.1.3b6
This article is related to ADDA (light scattering simulator based on the discrete dipole approximation).
Related: http://qiita.com/7of9/items/9537252c79f5318d8f55
Related: http://qiita.com/7of9/items/4966f131d405cd89ee07
I am writing a tool to read Chpoint file based on the code written in SaveIterChpoint() of iterative.c
.
https://github.com/adda-team/adda/blob/master/src/iterative.c
In the writing code, scalars[i].size
and vectors[i].size
are used to write scalars[i] and vectors[i] in the file as follows:
static void SaveIterChpoint(void)
{
...
// write specific scalars
for (i=0;i<params[ind_m].sc_N;i++) fwrite(scalars[i].ptr,scalars[i].size,1,chp_file);
...
for (i=0;i<params[ind_m].vec_N;i++) if (fwrite(vectors[i].ptr,vectors[i].size,local_nRows,chp_file)!=local_nRows)
...
The problem in reading the Chpoint file is that both the scalars[i].size
and vectors[i].size
ARE NOT written in the file.
Therefore I have to come up with some idea to obtain the values of scalars[i].size
and vectors[i].size
from somewhere else in order to read the Chpoint file.
(Update: Dec. 02, 2016)
At least, following values need to be written as auxiliary information to read the Chpoint file:
- params[ind_m].sc_N
- scalars[i].size
- params[ind_m].vec_N
- vectors[i].size