Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77502453
read_config_parser.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Aug 14, 20:50
Size
2 KB
Mime Type
text/x-c
Expires
Fri, Aug 16, 20:50 (2 d)
Engine
blob
Format
Raw Data
Handle
19879917
Attached To
rDLMA Diffusion limited mixed aggregation
read_config_parser.cpp
View Options
#include <post.h>
namespace
post_p
{
void
postprocessing
::
read_config_parser
(
char
*
config_filename
)
{
std
::
ifstream
parser
(
config_filename
,
std
::
ifstream
::
in
);
int
count
=
0
;
std
::
string
str
;
std
::
vector
<
std
::
string
>
results
;
std
::
vector
<
std
::
string
>
xi_names
;
std
::
string
assigned_name
=
"assignedSeedStatus"
;
std
::
string
current_name
=
"currentSeedStatus"
;
std
::
string
diameter_name
=
"diameter"
;
std
::
string
attachments_name
=
"attachments"
;
std
::
vector
<
std
::
string
>
att_names
;
std
::
vector
<
int
>
xi_idx
(
dim
());
int
assigned_idx
;
int
current_idx
;
int
diameter_idx
;
int
attachments_idx
;
std
::
vector
<
int
>
att_idx
(
maxAttachments
());
for
(
int
axis
=
0
;
axis
<
dim
();
axis
++
)
xi_names
.
push_back
(
"x"
+
std
::
to_string
(
axis
));
for
(
int
att
=
1
;
att
<=
maxAttachments
();
att
++
)
att_names
.
push_back
(
"att_"
+
std
::
to_string
(
att
));
while
(
count
<
headers_
){
getline
(
parser
,
str
);
count
++
;
}
getline
(
parser
,
str
);
results
=
split_string_by_delimiter
(
str
,
','
);
for
(
int
i
=
0
;
i
<
results
.
size
();
i
++
){
if
(
results
[
i
]
==
assigned_name
)
assigned_idx
=
i
;
if
(
results
[
i
]
==
current_name
)
current_idx
=
i
;
if
(
results
[
i
]
==
diameter_name
)
diameter_idx
=
i
;
if
(
results
[
i
]
==
attachments_name
)
attachments_idx
=
i
;
for
(
int
axis
=
0
;
axis
<
dim
();
axis
++
){
if
(
results
[
i
]
==
xi_names
[
axis
])
xi_idx
[
axis
]
=
i
;
}
for
(
int
att
=
0
;
att
<
maxAttachments
();
att
++
){
if
(
results
[
i
]
==
att_names
[
att
])
att_idx
[
att
]
=
i
;
}
}
count
=
0
;
for
(
count
=
0
;
count
<
numParticles
();
count
++
){
getline
(
parser
,
str
);
results
=
split_string_by_delimiter
(
str
,
','
);
current_seed
(
count
)
=
stoi
(
results
[
current_idx
]);
original_seed
(
count
)
=
stoi
(
results
[
assigned_idx
]);
diameter
(
count
)
=
stod
(
results
[
diameter_idx
]);
numAttachments
(
count
)
=
stoi
(
results
[
attachments_idx
]);
for
(
int
axis
=
0
;
axis
<
dim
();
axis
++
)
pos
(
count
,
axis
)
=
stod
(
results
[
xi_idx
[
axis
]]);
for
(
int
att
=
0
;
att
<
maxAttachments
();
att
++
){
if
(
results
[
att_idx
[
att
]]
==
"NaN"
)
attachment
(
count
,
att
)
=
numParticles
();
else
attachment
(
count
,
att
)
=
stoi
(
results
[
att_idx
[
att
]]);
}
}
parser
.
close
();
}
}
Event Timeline
Log In to Comment