Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
openfpm_io
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openfpm
openfpm_io
Commits
89411e76
Commit
89411e76
authored
Dec 17, 2017
by
incardon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing several IO bug
parent
fac23ddd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
48 deletions
+125
-48
src/GraphMLWriter/GraphMLWriter_unit_tests.hpp
src/GraphMLWriter/GraphMLWriter_unit_tests.hpp
+5
-0
src/VTKWriter/VTKWriter_grids_util.hpp
src/VTKWriter/VTKWriter_grids_util.hpp
+6
-5
src/VTKWriter/VTKWriter_unit_tests.hpp
src/VTKWriter/VTKWriter_unit_tests.hpp
+114
-43
No files found.
src/GraphMLWriter/GraphMLWriter_unit_tests.hpp
View file @
89411e76
...
...
@@ -68,6 +68,11 @@ struct ne_cp
static
const
std
::
string
name
[
max_prop
];
};
static
inline
bool
noPointers
()
{
return
true
;
}
//! type of the spatial information
typedef
float
s_type
;
};
...
...
src/VTKWriter/VTKWriter_grids_util.hpp
View file @
89411e76
...
...
@@ -435,10 +435,11 @@ template<unsigned int dims,typename T> inline void output_point(Point<dims,T> &
{
if
(
ft
==
file_type
::
ASCII
)
{
if
(
dims
==
2
)
v_out
<<
p
.
toString
()
<<
" 0.0"
<<
"
\n
"
;
else
v_out
<<
p
.
toString
()
<<
"
\n
"
;
v_out
<<
p
.
toString
();
size_t
i
=
dims
;
for
(
;
i
<
3
;
i
++
)
{
v_out
<<
" 0.0"
;}
v_out
<<
"
\n
"
;
}
else
{
...
...
@@ -455,7 +456,7 @@ template<unsigned int dims,typename T> inline void output_point(Point<dims,T> &
// we use float so we have to convert to float
/* coverity[dead_error_begin] */
auto
tmp
=
0.0
;
T
tmp
=
0.0
;
tmp
=
swap_endian_lt
(
tmp
);
v_out
.
write
((
const
char
*
)
&
tmp
,
sizeof
(
tmp
));
}
...
...
src/VTKWriter/VTKWriter_unit_tests.hpp
View file @
89411e76
...
...
@@ -64,6 +64,11 @@ struct vertex
}
static
inline
bool
noPointers
()
{
return
true
;
}
/*! \brief Initialize the VTKVertex
*
* \param x coordinate x
...
...
@@ -115,6 +120,11 @@ struct vertex2
}
static
inline
bool
noPointers
()
{
return
true
;
}
/*! \brief Initialize the VTKVertex
*
* \param x coordinate x
...
...
@@ -337,6 +347,11 @@ struct vertex3
}
static
inline
bool
noPointers
()
{
return
true
;
}
/*! \brief Initialize the VTKVertex
*
* \param
...
...
@@ -636,60 +651,116 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_grids)
Vcluster
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
getProcessUnitID
()
!=
0
)
return
;
{
return
;}
{
// Create box grids
Point
<
2
,
float
>
offset1
({
0.0
,
0.0
});
Point
<
2
,
float
>
spacing1
({
0.1
,
0.2
});
Box
<
2
,
size_t
>
d1
({
1
,
2
},{
14
,
15
});
// Create box grids
Point
<
2
,
float
>
offset2
({
5.0
,
7.0
});
Point
<
2
,
float
>
spacing2
({
0.2
,
0.1
});
Box
<
2
,
size_t
>
d2
({
2
,
1
},{
13
,
15
});
// Create box grids
Point
<
1
,
float
>
offset1
({
0.0
});
Point
<
1
,
float
>
spacing1
({
0.1
});
Box
<
1
,
size_t
>
d1
({
1
},{
14
});
// Create box grids
Point
<
1
,
float
>
offset2
({
5.0
,
7.0
});
Point
<
1
,
float
>
spacing2
({
0.2
,
0.1
});
Box
<
1
,
size_t
>
d2
({
2
},{
13
});
// Create box grids
Point
<
1
,
float
>
offset3
({
0.0
});
Point
<
1
,
float
>
spacing3
({
0.05
});
Box
<
1
,
size_t
>
d3
({
3
},{
11
});
// Create box grids
Point
<
1
,
float
>
offset4
({
5.0
});
Point
<
1
,
float
>
spacing4
({
0.1
});
Box
<
1
,
size_t
>
d4
({
1
},{
7
});
size_t
sz
[]
=
{
16
};
grid_cpu
<
1
,
Point_test
<
float
>>
g1
(
sz
);
g1
.
setMemory
();
fill_grid_some_data
(
g1
);
grid_cpu
<
1
,
Point_test
<
float
>>
g2
(
sz
);
g2
.
setMemory
();
fill_grid_some_data
(
g2
);
grid_cpu
<
1
,
Point_test
<
float
>>
g3
(
sz
);
g3
.
setMemory
();
fill_grid_some_data
(
g3
);
grid_cpu
<
1
,
Point_test
<
float
>>
g4
(
sz
);
g4
.
setMemory
();
fill_grid_some_data
(
g4
);
// Create box grids
Point
<
2
,
float
>
offset3
({
0.0
,
7.0
});
Point
<
2
,
float
>
spacing3
({
0.05
,
0.07
});
Box
<
2
,
size_t
>
d3
({
3
,
2
},{
11
,
10
});
// Create a writer and write
VTKWriter
<
boost
::
mpl
::
pair
<
grid_cpu
<
1
,
Point_test
<
float
>>
,
float
>
,
VECTOR_GRIDS
>
vtk_g
;
vtk_g
.
add
(
g1
,
offset1
,
spacing1
,
d1
);
vtk_g
.
add
(
g2
,
offset2
,
spacing2
,
d2
);
vtk_g
.
add
(
g3
,
offset3
,
spacing3
,
d3
);
vtk_g
.
add
(
g4
,
offset4
,
spacing4
,
d4
);
// Create box grids
Point
<
2
,
float
>
offset4
({
5.0
,
0.0
});
Point
<
2
,
float
>
spacing4
({
0.1
,
0.1
});
Box
<
2
,
size_t
>
d4
({
1
,
1
},{
7
,
7
});
openfpm
::
vector
<
std
::
string
>
prp_names
;
vtk_g
.
write
(
"vtk_grids_1d.vtk"
,
prp_names
);
size_t
sz
[]
=
{
16
,
16
};
grid_cpu
<
2
,
Point_test
<
float
>>
g1
(
sz
);
g1
.
setMemory
();
fill_grid_some_data
(
g1
);
grid_cpu
<
2
,
Point_test
<
float
>>
g2
(
sz
);
g2
.
setMemory
();
fill_grid_some_data
(
g2
);
grid_cpu
<
2
,
Point_test
<
float
>>
g3
(
sz
);
g3
.
setMemory
();
fill_grid_some_data
(
g3
);
grid_cpu
<
2
,
Point_test
<
float
>>
g4
(
sz
);
g4
.
setMemory
();
fill_grid_some_data
(
g4
);
#ifndef SE_CLASS3
// Create a writer and write
VTKWriter
<
boost
::
mpl
::
pair
<
grid_cpu
<
2
,
Point_test
<
float
>>
,
float
>
,
VECTOR_GRIDS
>
vtk_g
;
vtk_g
.
add
(
g1
,
offset1
,
spacing1
,
d1
);
vtk_g
.
add
(
g2
,
offset2
,
spacing2
,
d2
);
vtk_g
.
add
(
g3
,
offset3
,
spacing3
,
d3
);
vtk_g
.
add
(
g4
,
offset4
,
spacing4
,
d4
);
// Check that match
bool
test
=
compare
(
"vtk_grids_1d.vtk"
,
"test_data/vtk_grids_test_1d.vtk"
);
BOOST_REQUIRE_EQUAL
(
test
,
true
);
openfpm
::
vector
<
std
::
string
>
prp_names
;
vtk_g
.
write
(
"vtk_grids.vtk"
,
prp_names
);
#endif
}
#ifndef SE_CLASS3
{
// Check that match
bool
test
=
compare
(
"vtk_grids.vtk"
,
"test_data/vtk_grids_test.vtk"
);
BOOST_REQUIRE_EQUAL
(
test
,
true
);
// Create box grids
Point
<
2
,
float
>
offset1
({
0.0
,
0.0
});
Point
<
2
,
float
>
spacing1
({
0.1
,
0.2
});
Box
<
2
,
size_t
>
d1
({
1
,
2
},{
14
,
15
});
// Create box grids
Point
<
2
,
float
>
offset2
({
5.0
,
7.0
});
Point
<
2
,
float
>
spacing2
({
0.2
,
0.1
});
Box
<
2
,
size_t
>
d2
({
2
,
1
},{
13
,
15
});
// Create box grids
Point
<
2
,
float
>
offset3
({
0.0
,
7.0
});
Point
<
2
,
float
>
spacing3
({
0.05
,
0.07
});
Box
<
2
,
size_t
>
d3
({
3
,
2
},{
11
,
10
});
// Create box grids
Point
<
2
,
float
>
offset4
({
5.0
,
0.0
});
Point
<
2
,
float
>
spacing4
({
0.1
,
0.1
});
Box
<
2
,
size_t
>
d4
({
1
,
1
},{
7
,
7
});
size_t
sz
[]
=
{
16
,
16
};
grid_cpu
<
2
,
Point_test
<
float
>>
g1
(
sz
);
g1
.
setMemory
();
fill_grid_some_data
(
g1
);
grid_cpu
<
2
,
Point_test
<
float
>>
g2
(
sz
);
g2
.
setMemory
();
fill_grid_some_data
(
g2
);
grid_cpu
<
2
,
Point_test
<
float
>>
g3
(
sz
);
g3
.
setMemory
();
fill_grid_some_data
(
g3
);
grid_cpu
<
2
,
Point_test
<
float
>>
g4
(
sz
);
g4
.
setMemory
();
fill_grid_some_data
(
g4
);
#endif
// Create a writer and write
VTKWriter
<
boost
::
mpl
::
pair
<
grid_cpu
<
2
,
Point_test
<
float
>>
,
float
>
,
VECTOR_GRIDS
>
vtk_g
;
vtk_g
.
add
(
g1
,
offset1
,
spacing1
,
d1
);
vtk_g
.
add
(
g2
,
offset2
,
spacing2
,
d2
);
vtk_g
.
add
(
g3
,
offset3
,
spacing3
,
d3
);
vtk_g
.
add
(
g4
,
offset4
,
spacing4
,
d4
);
openfpm
::
vector
<
std
::
string
>
prp_names
;
vtk_g
.
write
(
"vtk_grids.vtk"
,
prp_names
);
#ifndef SE_CLASS3
// Check that match
bool
test
=
compare
(
"vtk_grids.vtk"
,
"test_data/vtk_grids_test.vtk"
);
BOOST_REQUIRE_EQUAL
(
test
,
true
);
#endif
}
{
...
...
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