Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sbalzarini Lab
S
Software
P
Parallel Computing
OpenFPM
openfpm_io
Commits
d968727b
Commit
d968727b
authored
Aug 20, 2021
by
incardon
Browse files
Merge branch 'develop' of
ssh://git.mpi-cbg.de/openfpm/openfpm_io
into develop
parents
48e5e891
41fcad3e
Pipeline
#3453
failed with stages
in 2 minutes and 13 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/RawReader/InitGridWithPixel.hpp
View file @
d968727b
...
...
@@ -41,9 +41,9 @@ inline bool exists_test (const std::string& name) {
* #pixels per dimension.
* @return Std::vector containing the count of pixels for each dimension as it was read from the csv file.
*/
std
::
vector
<
size_
t
>
get_size
(
const
std
::
string
&
path_to_file
)
std
::
vector
<
in
t
>
get_size
(
const
std
::
string
&
path_to_file
)
{
std
::
vector
<
size_
t
>
stack_dimst_1d
;
std
::
vector
<
in
t
>
stack_dimst_1d
;
// check if file exists and stream input csv file
if
(
!
exists_test
(
path_to_file
)){
std
::
cout
<<
"------------------------------------------------------------------------"
<<
std
::
endl
;
...
...
@@ -67,7 +67,7 @@ std::vector<size_t> get_size(const std::string & path_to_file)
while
(
getline
(
file
,
field
)
)
// 1 field per axis
{
std
::
istringstream
iss
(
field
);
size_
t
val
;
in
t
val
;
iss
>>
val
;
stack_dimst_1d
.
push_back
(
val
);
// add the #pixels for current axis to the array
}
...
...
@@ -89,7 +89,7 @@ std::vector<size_t> get_size(const std::string & path_to_file)
* manually or loaded from a csv file before (see: #get_size())
*/
template
<
size_t
Phi_0
,
typename
grid_type
>
void
load_pixel_onto_grid
(
grid_type
&
grid
,
std
::
string
file_name
,
std
::
vector
<
size_
t
>
&
stack_dims
)
void
load_pixel_onto_grid
(
grid_type
&
grid
,
std
::
string
file_name
,
std
::
vector
<
in
t
>
&
stack_dims
)
{
constexpr
size_t
x
=
0
;
constexpr
size_t
y
=
1
;
...
...
@@ -107,7 +107,7 @@ void load_pixel_onto_grid(grid_type & grid, std::string file_name, std::vector <
auto
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
rank
()
==
0
)
{
for
(
size_
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
for
(
in
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
{
std
::
cout
<<
"# grid points in dimension "
<<
d
<<
" = "
<<
grid
.
size
(
d
)
<<
std
::
endl
;
}
...
...
@@ -121,14 +121,14 @@ void load_pixel_onto_grid(grid_type & grid, std::string file_name, std::vector <
std
::
vector
<
BYTE
>
pixel_line
;
// one x-line of the image stack which will be read
size_t
sz_img
[
grid_type
::
dims
];
for
(
size_
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
for
(
in
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
{
sz_img
[
d
]
=
stack_dims
[
d
];
}
grid_sm
<
grid_type
::
dims
,
void
>
ginfo_image
(
sz_img
);
// in order to get the image related key later on
double
refinement
[
grid_type
::
dims
];
for
(
size_
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
for
(
in
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
{
refinement
[
d
]
=
(
double
)
grid
.
size
(
d
)
/
(
double
)
stack_dims
[
d
];
// get the factor, by which the grid resolution differs from the image stack resolution
if
(
v_cl
.
rank
()
==
0
)
std
::
cout
<<
"effective refinement in dimension "
<<
d
<<
" = "
<<
refinement
[
d
]
<<
std
::
endl
;
...
...
@@ -141,7 +141,7 @@ void load_pixel_onto_grid(grid_type & grid, std::string file_name, std::vector <
// In case a patch starts within a group of nodes to which same pixel-value should be assigned, get the
// respective rest-offset
size_
t
rest_offset
=
(
size_
t
)
(
fmod
(
gkey
.
get
(
0
),
refinement
[
x
]));
// get the remainder
in
t
rest_offset
=
(
in
t
)
(
fmod
(
gkey
.
get
(
0
),
refinement
[
x
]));
// get the remainder
// get l as the length of one x-line of the original image stack for the specific patch on the processor
...
...
@@ -154,7 +154,7 @@ void load_pixel_onto_grid(grid_type & grid, std::string file_name, std::vector <
// in case that the grid has a different resolution than the underlying image stack:
// create a key which is used to get the offset for the file reading
// the indices in this key are corrected by the refinement factor
for
(
size_
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
for
(
in
t
d
=
0
;
d
<
grid_type
::
dims
;
d
++
)
{
gkey
.
set_d
(
d
,
floor
(
gkey
.
get
(
d
)
/
refinement
[
d
]));
}
...
...
@@ -172,7 +172,7 @@ void load_pixel_onto_grid(grid_type & grid, std::string file_name, std::vector <
// run over a whole grid-line in x and assign pixel values from pixel_line to grid nodes
// if the grid is finer in x as the image stack, the same pixel value from pixel_line is
// assigned refinement[x] times
for
(
size_
t
k
=
0
;
k
<
patch_size
;
++
k
)
for
(
in
t
k
=
0
;
k
<
patch_size
;
++
k
)
{
auto
key
=
dom
.
get
();
// get the correct index of the pixel to be read from pixel_line by considering a potential rest-offset,
...
...
src/VTKWriter/VTKWriter_grids_util.hpp
View file @
d968727b
...
...
@@ -855,7 +855,7 @@ struct meta_prop_new<I, ele_g,St,T[N1],is_writable>
{
v_outToEncode_
<<
" "
<<
vg
.
get
(
k
).
g
.
template
get
<
I
::
value
>(
it
.
get
())[
i1
];}
if
(
N1
==
2
)
{
v_outToEncode_
<<
(
decltype
(
vg
.
get
(
k
).
g
.
template
get
<
I
::
value
>(
it
.
get
())[
0
]))
0
;}
{
v_outToEncode_
<<
" "
<<
(
decltype
(
vg
.
get
(
k
).
g
.
template
get
<
I
::
value
>(
it
.
get
())[
0
]))
0
;}
v_outToEncode_
<<
"
\n
"
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment