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
ffcab9ac
Commit
ffcab9ac
authored
Aug 02, 2016
by
Pietro Incardona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing test
parent
ca2becb0
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1249 additions
and
1086 deletions
+1249
-1086
gc_out2_test.html
gc_out2_test.html
+1
-2
gc_out3_test.html
gc_out3_test.html
+1
-2
gc_out4_test.html
gc_out4_test.html
+1
-2
gc_out5_test.html
gc_out5_test.html
+1
-2
gc_out6_test.html
gc_out6_test.html
+1
-2
gc_out7_test.html
gc_out7_test.html
+3
-6
gc_out_test.html
gc_out_test.html
+1
-2
gc_plot2_out_test.html
gc_plot2_out_test.html
+1
-2
src/CSVWriter/CSVWriter.hpp
src/CSVWriter/CSVWriter.hpp
+3
-1
src/CSVWriter/CSVWriter_unit_tests.hpp
src/CSVWriter/CSVWriter_unit_tests.hpp
+25
-0
src/CSVWriter/csv_multiarray.hpp
src/CSVWriter/csv_multiarray.hpp
+19
-9
src/Makefile.am
src/Makefile.am
+2
-2
src/Plot/GoogleChart.hpp
src/Plot/GoogleChart.hpp
+80
-18
src/VTKWriter/VTKWriter_grids.hpp
src/VTKWriter/VTKWriter_grids.hpp
+3
-1
src/VTKWriter/VTKWriter_grids_util.hpp
src/VTKWriter/VTKWriter_grids_util.hpp
+154
-169
src/VTKWriter/VTKWriter_point_set.hpp
src/VTKWriter/VTKWriter_point_set.hpp
+3
-1
src/VTKWriter/VTKWriter_unit_tests.hpp
src/VTKWriter/VTKWriter_unit_tests.hpp
+86
-1
vtk_points_test.vtk
vtk_points_test.vtk
+864
-864
No files found.
gc_out2_test.html
View file @
ffcab9ac
...
...
@@ -25,8 +25,7 @@ var options0= {
title
:
'
Example
'
,
vAxis
:
{
title
:
'
Y Axis
'
},
hAxis
:
{
title
:
'
X Axis
'
},
seriesType
:
'
bars
'
,
};
seriesType
:
'
bars
'
};
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'
chart_div0
'
));
chart
.
draw
(
data0
,
options0
);
}
</script>
</head>
...
...
gc_out3_test.html
View file @
ffcab9ac
...
...
@@ -25,8 +25,7 @@ var options0= {
title
:
'
Example
'
,
vAxis
:
{
title
:
'
Y Axis
'
},
hAxis
:
{
title
:
'
X Axis
'
},
seriesType
:
''
,
};
seriesType
:
''
};
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'
chart_div0
'
));
chart
.
draw
(
data0
,
options0
);
}
</script>
</head>
...
...
gc_out4_test.html
View file @
ffcab9ac
...
...
@@ -25,8 +25,7 @@ var options0= {
title
:
''
,
vAxis
:
{
title
:
''
},
hAxis
:
{
title
:
''
},
seriesType
:
''
,
};
seriesType
:
''
};
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'
chart_div0
'
));
chart
.
draw
(
data0
,
options0
);
}
</script>
</head>
...
...
gc_out5_test.html
View file @
ffcab9ac
...
...
@@ -25,8 +25,7 @@ var options0= {
title
:
''
,
vAxis
:
{
title
:
''
},
hAxis
:
{
title
:
''
},
seriesType
:
''
,
};
seriesType
:
''
};
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'
chart_div0
'
));
chart
.
draw
(
data0
,
options0
);
}
</script>
</head>
...
...
gc_out6_test.html
View file @
ffcab9ac
...
...
@@ -25,8 +25,7 @@ var options0= {
title
:
''
,
vAxis
:
{
title
:
''
},
hAxis
:
{
title
:
''
},
seriesType
:
''
,
};
seriesType
:
''
};
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'
chart_div0
'
));
chart
.
draw
(
data0
,
options0
);
}
</script>
</head>
...
...
gc_out7_test.html
View file @
ffcab9ac
...
...
@@ -54,22 +54,19 @@ title : 'Example',
vAxis
:
{
title
:
'
Y Axis
'
},
hAxis
:
{
title
:
'
X Axis
'
},
seriesType
:
'
bars
'
,
series
:
{
3
:
{
type
:
'
line
'
}}
};
series
:
{
3
:
{
type
:
'
line
'
}}};
var
options1
=
{
title
:
'
Example
'
,
vAxis
:
{
title
:
'
Y Axis
'
},
hAxis
:
{
title
:
'
X Axis
'
},
seriesType
:
'
bars
'
,
series
:
{
3
:
{
type
:
'
line
'
}}
};
series
:
{
3
:
{
type
:
'
line
'
}}};
var
options2
=
{
title
:
'
Example
'
,
vAxis
:
{
title
:
'
Y Axis
'
},
hAxis
:
{
title
:
'
X Axis
'
},
seriesType
:
'
bars
'
,
series
:
{
3
:
{
type
:
'
line
'
}}
};
series
:
{
3
:
{
type
:
'
line
'
}}};
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'
chart_div0
'
));
chart
.
draw
(
data0
,
options0
);
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'
chart_div1
'
));
chart
.
draw
(
data1
,
options1
);
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'
chart_div2
'
));
chart
.
draw
(
data2
,
options2
);
...
...
gc_out_test.html
View file @
ffcab9ac
...
...
@@ -26,8 +26,7 @@ title : 'Example',
vAxis
:
{
title
:
'
Y Axis
'
},
hAxis
:
{
title
:
'
X Axis
'
},
seriesType
:
'
bars
'
,
series
:
{
3
:
{
type
:
'
line
'
}}
};
series
:
{
3
:
{
type
:
'
line
'
}}};
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'
chart_div0
'
));
chart
.
draw
(
data0
,
options0
);
}
</script>
</head>
...
...
gc_plot2_out_test.html
View file @
ffcab9ac
...
...
@@ -32,8 +32,7 @@ vAxis: {title: 'Y Axis'},
hAxis
:
{
title
:
'
X Axis
'
},
curveType
:
'
function
'
,
lineWidth
:
1
,
intervals
:
{
'
style
'
:
'
area
'
},
};
intervals
:
{
'
style
'
:
'
area
'
}};
var
chart
=
new
google
.
visualization
.
ComboChart
(
document
.
getElementById
(
'
chart_div0
'
));
chart
.
draw
(
data0
,
options0
);
}
</script>
</head>
...
...
src/CSVWriter/CSVWriter.hpp
View file @
ffcab9ac
...
...
@@ -17,6 +17,7 @@
#include <boost/mpl/for_each.hpp>
#include "csv_multiarray.hpp"
#include "util.hpp"
#include "is_csv_writable.hpp"
#define CSV_WRITER 0x30000
...
...
@@ -60,8 +61,9 @@ struct csv_prp
// Remove the reference from the column type
typedef
typename
boost
::
remove_reference
<
col_type
>::
type
col_rtype
;
typedef
typename
std
::
remove_all_extents
<
col_rtype
>::
type
base_col_rtype
;
csv_value_str
<
col_rtype
>
(
obj
.
template
get
<
T
::
value
>(),
str
);
csv_value_str
<
col_rtype
,
is_csv_writable
<
base_col_rtype
>::
value
>
(
obj
.
template
get
<
T
::
value
>(),
str
);
}
};
...
...
src/CSVWriter/CSVWriter_unit_tests.hpp
View file @
ffcab9ac
...
...
@@ -9,6 +9,7 @@ BOOST_AUTO_TEST_SUITE( csv_writer_test )
BOOST_AUTO_TEST_CASE
(
csv_writer_particles
)
{
{
// Allocate a property vector
auto
v_prp
=
allocate_openfpm_prp
(
16
);
// Vector of position
...
...
@@ -30,7 +31,31 @@ BOOST_AUTO_TEST_CASE( csv_writer_particles )
bool
test
=
compare
(
"csv_out.csv"
,
"csv_out_test.csv"
);
BOOST_REQUIRE_EQUAL
(
true
,
test
);
}
{
// Allocate a property vector
auto
v_prp
=
allocate_openfpm_aggregate_with_complex
(
16
);
// Vector of position
openfpm
::
vector
<
Point
<
3
,
float
>>
v_pos
;
// create a positional vector
for
(
size_t
i
=
0
;
i
<
v_prp
.
size
()
;
i
++
)
{
Point
<
3
,
float
>
p
({
1.0
,
2.0
,
3.0
});
v_pos
.
add
(
p
);
}
// CSVWriter test
CSVWriter
<
openfpm
::
vector
<
Point
<
3
,
float
>>
,
openfpm
::
vector
<
aggregate
<
float
,
float
,
float
,
float
,
float
[
3
],
float
[
3
][
3
],
openfpm
::
vector
<
int
>>
>
>
csv_writer
;
// Write the CSV
csv_writer
.
write
(
"csv_out_unk.csv"
,
v_pos
,
v_prp
);
bool
test
=
compare
(
"csv_out_unk.csv"
,
"csv_out_unk_test.csv"
);
BOOST_REQUIRE_EQUAL
(
true
,
test
);
}
}
...
...
src/CSVWriter/csv_multiarray.hpp
View file @
ffcab9ac
...
...
@@ -124,7 +124,7 @@ struct csv_col_str<T[N1][N2][N3][N4]>
* Will produce ",1.0,2.0,3.0"
*
*/
template
<
typename
T
>
template
<
typename
T
,
bool
is_writable
>
struct
csv_value_str
{
inline
csv_value_str
(
T
&
v
,
std
::
stringstream
&
str
)
...
...
@@ -134,8 +134,8 @@ struct csv_value_str
};
//! Partial specialization for N=1 1D-Array
template
<
typename
T
,
size_t
N1
>
struct
csv_value_str
<
T
[
N1
]
>
template
<
typename
T
,
size_t
N1
,
bool
is_writable
>
struct
csv_value_str
<
T
[
N1
]
,
is_writable
>
{
inline
csv_value_str
(
const
T
v
[
N1
],
std
::
stringstream
&
str
)
{
...
...
@@ -145,8 +145,8 @@ struct csv_value_str<T[N1]>
};
//! Partial specialization for N=2 2D-Array
template
<
typename
T
,
size_t
N1
,
size_t
N2
>
struct
csv_value_str
<
T
[
N1
][
N2
]
>
template
<
typename
T
,
size_t
N1
,
size_t
N2
,
bool
is_writable
>
struct
csv_value_str
<
T
[
N1
][
N2
]
,
is_writable
>
{
inline
csv_value_str
(
const
T
v
[
N1
][
N2
],
std
::
stringstream
&
str
)
{
...
...
@@ -161,8 +161,8 @@ struct csv_value_str<T[N1][N2]>
};
//! Partial specialization for N=3
template
<
typename
T
,
size_t
N1
,
size_t
N2
,
size_t
N3
>
struct
csv_value_str
<
T
[
N1
][
N2
][
N3
]
>
template
<
typename
T
,
size_t
N1
,
size_t
N2
,
size_t
N3
,
bool
is_writable
>
struct
csv_value_str
<
T
[
N1
][
N2
][
N3
]
,
is_writable
>
{
inline
csv_value_str
(
const
T
v
[
N1
][
N2
][
N3
],
std
::
stringstream
&
str
)
{
...
...
@@ -180,8 +180,8 @@ struct csv_value_str<T[N1][N2][N3]>
};
//! Partial specialization for N=4
template
<
typename
T
,
size_t
N1
,
size_t
N2
,
size_t
N3
,
size_t
N4
>
struct
csv_value_str
<
T
[
N1
][
N2
][
N3
][
N4
]
>
template
<
typename
T
,
size_t
N1
,
size_t
N2
,
size_t
N3
,
size_t
N4
,
bool
is_writable
>
struct
csv_value_str
<
T
[
N1
][
N2
][
N3
][
N4
]
,
is_writable
>
{
inline
csv_value_str
(
const
T
v
[
N1
][
N2
][
N3
][
N4
],
std
::
stringstream
&
str
)
{
...
...
@@ -201,4 +201,14 @@ struct csv_value_str<T[N1][N2][N3][N4]>
}
};
//! Partial specialization for unknown property
template
<
typename
T
>
struct
csv_value_str
<
T
,
false
>
{
inline
csv_value_str
(
const
T
v
,
std
::
stringstream
&
str
)
{
str
<<
","
<<
0.0
;
}
};
#endif
/* CSV_MULTIARRAY_COPY_HPP_ */
src/Makefile.am
View file @
ffcab9ac
...
...
@@ -7,9 +7,9 @@ io_CXXFLAGS = $(CUDA_CFLAGS) $(INCLUDES_PATH) $(BOOST_CPPFLAGS) -I/usr/local/inc
io_CFLAGS
=
$(CUDA_CFLAGS)
io_LDADD
=
$(LINKLIBS)
nobase_include_HEADERS
=
CSVWriter/csv_multiarray.hpp CSVWriter/CSVWriter.hpp
\
nobase_include_HEADERS
=
CSVWriter/csv_multiarray.hpp CSVWriter/CSVWriter.hpp
CSVWriter/is_csv_writable.hpp
\
GraphMLWriter/GraphMLWriter.hpp util.hpp
\
VTKWriter/VTKWriter.hpp VTKWriter/VTKWriter_dist_graph.hpp VTKWriter/VTKWriter_graph.hpp VTKWriter/VTKWriter_point_set.hpp VTKWriter/VTKWriter_grids.hpp VTKWriter/VTKWriter_grids_st.hpp VTKWriter/VTKWriter_grids_util.hpp VTKWriter/VTKWriter_vector_box.hpp HDF5_XdmfWriter/HDF5_XdmfWriter.hpp HDF5_XdmfWriter/HDF5_XdmfWriter_point_set.hpp HDF5_XdmfWriter/HDF5_XdmfWriter_util.hpp
\
VTKWriter/VTKWriter.hpp VTKWriter/VTKWriter_dist_graph.hpp VTKWriter/VTKWriter_graph.hpp VTKWriter/VTKWriter_point_set.hpp VTKWriter/VTKWriter_grids.hpp VTKWriter/VTKWriter_grids_st.hpp VTKWriter/VTKWriter_grids_util.hpp VTKWriter/VTKWriter_vector_box.hpp
VTKWriter/is_vtk_writable.hpp
HDF5_XdmfWriter/HDF5_XdmfWriter.hpp HDF5_XdmfWriter/HDF5_XdmfWriter_point_set.hpp HDF5_XdmfWriter/HDF5_XdmfWriter_util.hpp
\
Plot/GoogleChart.hpp Plot/util.hpp
...
...
src/Plot/GoogleChart.hpp
View file @
ffcab9ac
...
...
@@ -14,6 +14,10 @@
#define GGRAPH_COLUMS 1
#define GGRAPH_POINTS 2
#define GC_ZOOM std::string("explorer: {actions: ['dragToZoom', 'rightClickToReset'],axis: 'horizontal,vertical',keepInBounds: true, maxZoomIn: 128.0}")
#define GC_X_LOG std::string("hAxis: { logscale: true }")
#define GC_Y_LOG std::string("vAxis: { logscale: true }")
/*! \brief Google chart options
*
*/
...
...
@@ -58,6 +62,9 @@ struct GCoptions
//! more
std
::
string
more
;
//! curve type
std
::
string
curveType
=
"function"
;
GCoptions
&
operator
=
(
const
GCoptions
&
opt
)
{
title
=
opt
.
title
;
...
...
@@ -190,7 +197,7 @@ class GoogleChart
}
data
<<
"data"
<<
i
<<
".addRows([
\n
"
;
for
(
size_t
i
=
0
;
i
<
y
.
size
()
;
i
++
)
for
(
size_t
i
=
0
;
i
<
y
.
size
()
&&
x
.
size
()
;
i
++
)
{
for
(
size_t
j
=
0
;
j
<
y
.
get
(
i
).
size
()
+
1
;
j
++
)
...
...
@@ -215,13 +222,14 @@ class GoogleChart
std
::
string
get_colums_bar_option
(
const
GCoptions
&
opt
)
{
std
::
stringstream
str
;
str
<<
"title : '"
<<
opt
.
title
<<
"'
,
\n
"
;
str
<<
"
vAxis: {title: '"
<<
opt
.
yAxis
<<
"'},
\n
"
;
str
<<
"
hAxis: {title: '"
<<
opt
.
xAxis
<<
"'},
\n
"
;
str
<<
"
seriesType: '"
<<
opt
.
stype
<<
"',
\n
"
;
str
<<
"title : '"
<<
opt
.
title
<<
"'"
;
str
<<
"
,
\n
vAxis: {title: '"
<<
opt
.
yAxis
<<
"'}
"
;
str
<<
"
,
\n
hAxis: {title: '"
<<
opt
.
xAxis
<<
"'}
"
;
str
<<
"
,
\n
seriesType: '"
<<
opt
.
stype
<<
"'
"
;
if
(
opt
.
stypeext
.
size
()
!=
0
)
str
<<
"series: "
<<
opt
.
stypeext
<<
"
\n
"
;
str
<<
opt
.
more
;
str
<<
",
\n
series: "
<<
opt
.
stypeext
;
if
(
opt
.
more
.
size
()
!=
0
)
str
<<
",
\n
"
<<
opt
.
more
;
return
str
.
str
();
}
...
...
@@ -229,21 +237,22 @@ class GoogleChart
std
::
string
get_points_plot_option
(
const
GCoptions
&
opt
)
{
std
::
stringstream
str
;
str
<<
"title : '"
<<
opt
.
title
<<
"'
,
\n
"
;
str
<<
"
vAxis: {title: '"
<<
opt
.
yAxis
<<
"'},
\n
"
;
str
<<
"
hAxis: {title: '"
<<
opt
.
xAxis
<<
"'},
\n
"
;
str
<<
"
curveType: 'function',
\n
"
;
str
<<
"title : '"
<<
opt
.
title
<<
"'"
;
str
<<
"
,
\n
vAxis: {title: '"
<<
opt
.
yAxis
<<
"'}
"
;
str
<<
"
,
\n
hAxis: {title: '"
<<
opt
.
xAxis
<<
"'}
"
;
str
<<
"
,
\n
curveType: '"
<<
opt
.
curveType
<<
"'
"
;
str
<<
"
lineWidth: "
<<
opt
.
lineWidth
<<
",
\n
"
;
str
<<
"
,
\n
lineWidth: "
<<
opt
.
lineWidth
;
if
(
opt
.
intervalsext
.
size
()
!=
0
)
str
<<
"
intervals: "
<<
opt
.
intervalsext
<<
",
\n
"
;
str
<<
"
,
\n
intervals: "
<<
opt
.
intervalsext
;
else
str
<<
"
intervals: "
<<
"{ 'style':'area' }"
<<
",
\n
"
;
str
<<
"
,
\n
intervals: "
<<
"{ 'style':'area' }
"
;
if
(
opt
.
intervalext
.
size
()
!=
0
)
str
<<
"interval: "
<<
opt
.
intervalext
<<
"
\n
"
;
str
<<
"
,
\n
interval: "
<<
opt
.
intervalext
<<
"
\n
"
;
str
<<
opt
.
more
;
if
(
opt
.
more
.
size
()
!=
0
)
str
<<
",
\n
"
<<
opt
.
more
;
return
str
.
str
();
}
...
...
@@ -405,11 +414,64 @@ public:
set_of_graphs
.
last
().
opt
=
opt
;
}
/*! \brief Add lines graph
*
* \param y A vector of vectors of values. each vector is a graph of points
*
* \param x Give a name or number to each x value, so can be a string or a number
*
* \param opt Graph options
*
*/
template
<
typename
X
,
typename
Y
>
void
AddLines
(
openfpm
::
vector
<
X
>
&
x
,
openfpm
::
vector
<
Y
>
&
y
,
const
GCoptions
&
opt
)
{
openfpm
::
vector
<
std
::
string
>
yn
;
if
(
y
.
size
()
==
0
)
{
std
::
cerr
<<
"Error: "
<<
__FILE__
<<
":"
<<
__LINE__
<<
" vector y must be filled"
<<
std
::
endl
;
return
;
}
for
(
size_t
i
=
0
;
i
<
y
.
last
().
size
()
;
i
++
)
yn
.
add
(
std
::
string
(
"line"
)
+
std
::
to_string
(
i
));
if
(
y
.
size
()
==
0
)
return
;
// number of points
size_t
np
=
y
.
last
().
size
();
for
(
size_t
j
=
0
;
j
<
y
.
size
()
;
j
++
)
{
if
(
y
.
get
(
j
).
size
()
!=
np
)
std
::
cerr
<<
__FILE__
<<
":"
<<
__LINE__
<<
" Error all the graph must have the same number of points "
<<
np
<<
"!="
<<
y
.
get
(
j
).
size
()
<<
std
::
endl
;
}
openfpm
::
vector
<
openfpm
::
vector
<
X
>>
swap
;
// swap the vector
// Each vector is a graph
// It is different from the other call where each vector
// has multiple value for the same point
for
(
size_t
i
=
0
;
i
<
np
;
i
++
)
{
swap
.
add
();
for
(
size_t
j
=
0
;
j
<
y
.
size
()
;
j
++
)
{
swap
.
last
().
add
(
y
.
get
(
j
).
get
(
i
));
}
}
AddLinesGraph
(
x
,
swap
,
yn
,
opt
);
}
/*! \brief Add a simple lines graph
*
* \param y A vector of vectors of values. The size of y indicate how many x values
* we have, while the internal vector can store multiple
realizations
,
*
or min and max, for
error bar
* we have, while the internal vector can store multiple
value of the same point
,
*
for example
error bar
*
* \param x Give a name or number to each x value, so can be a string or a number
*
...
...
src/VTKWriter/VTKWriter_grids.hpp
View file @
ffcab9ac
...
...
@@ -10,6 +10,7 @@
#include <boost/mpl/pair.hpp>
#include "VTKWriter_grids_util.hpp"
#include "is_vtk_writable.hpp"
/*! \brief It store one grid
*
...
...
@@ -76,8 +77,9 @@ struct prop_out_g
void
operator
()(
T
&
t
)
const
{
typedef
typename
boost
::
mpl
::
at
<
typename
ele_g
::
value_type
::
value_type
::
type
,
boost
::
mpl
::
int_
<
T
::
value
>>::
type
ptype
;
typedef
typename
std
::
remove_all_extents
<
ptype
>::
type
base_ptype
;
meta_prop
<
boost
::
mpl
::
int_
<
T
::
value
>
,
ele_g
,
St
,
ptype
>
m
(
vg
,
v_out
);
meta_prop
<
boost
::
mpl
::
int_
<
T
::
value
>
,
ele_g
,
St
,
ptype
,
is_vtk_writable
<
base_ptype
>::
value
>
m
(
vg
,
v_out
);
}
void
lastProp
()
...
...
src/VTKWriter/VTKWriter_grids_util.hpp
View file @
ffcab9ac
This diff is collapsed.
Click to expand it.
src/VTKWriter/VTKWriter_point_set.hpp
View file @
ffcab9ac
...
...
@@ -10,6 +10,7 @@
#include <boost/mpl/pair.hpp>
#include "VTKWriter_grids_util.hpp"
#include "is_vtk_writable.hpp"
/*! \brief Store the couple of vector position and properties
*
...
...
@@ -90,8 +91,9 @@ struct prop_out_v
void
operator
()(
T
&
t
)
const
{
typedef
typename
boost
::
mpl
::
at
<
typename
ele_v
::
value_type
::
value_type
::
type
,
boost
::
mpl
::
int_
<
T
::
value
>>::
type
ptype
;
typedef
typename
std
::
remove_all_extents
<
ptype
>::
type
base_ptype
;
meta_prop
<
boost
::
mpl
::
int_
<
T
::
value
>
,
ele_v
,
St
,
ptype
>
m
(
vv
,
v_out
);
meta_prop
<
boost
::
mpl
::
int_
<
T
::
value
>
,
ele_v
,
St
,
ptype
,
is_vtk_writable
<
base_ptype
>::
value
>
m
(
vv
,
v_out
);
}
void
lastProp
()
...
...
src/VTKWriter/VTKWriter_unit_tests.hpp
View file @
ffcab9ac
...
...
@@ -508,7 +508,7 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_vector_box)
* \param g Grid to fill
*
*/
void
fill_grid_some_data
(
grid_cpu
<
2
,
Point_test
<
float
>>
&
g
)
template
<
typename
grid_type
>
void
fill_grid_some_data
(
grid_type
&
g
)
{
typedef
Point_test
<
float
>
p
;
...
...
@@ -748,8 +748,74 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_grids)
bool
test
=
compare
(
"vtk_grids_prp.vtk"
,
"vtk_grids_prp_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
,
aggregate
<
float
,
float
,
float
,
float
,
float
[
3
],
float
[
3
][
3
],
openfpm
::
vector
<
int
>>
>
g1
(
sz
);
g1
.
setMemory
();
fill_grid_some_data
(
g1
);
grid_cpu
<
2
,
aggregate
<
float
,
float
,
float
,
float
,
float
[
3
],
float
[
3
][
3
],
openfpm
::
vector
<
int
>>
>
g2
(
sz
);
g2
.
setMemory
();
fill_grid_some_data
(
g2
);
grid_cpu
<
2
,
aggregate
<
float
,
float
,
float
,
float
,
float
[
3
],
float
[
3
][
3
],
openfpm
::
vector
<
int
>>
>
g3
(
sz
);
g3
.
setMemory
();
fill_grid_some_data
(
g3
);
grid_cpu
<
2
,
aggregate
<
float
,
float
,
float
,
float
,
float
[
3
],
float
[
3
][
3
],
openfpm
::
vector
<
int
>>
>
g4
(
sz
);
g4
.
setMemory
();
fill_grid_some_data
(
g4
);
// Create a writer and write
VTKWriter
<
boost
::
mpl
::
pair
<
grid_cpu
<
2
,
aggregate
<
float
,
float
,
float
,
float
,
float
[
3
],
float
[
3
][
3
],
openfpm
::
vector
<
int
>>
>
,
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
);
vtk_g
.
write
(
"vtk_grids_unk.vtk"
);
// Check that match
bool
test
=
compare
(
"vtk_grids_unk.vtk"
,
"vtk_grids_test.vtk"
);
BOOST_REQUIRE_EQUAL
(
test
,
true
);
}
// Try
{
bool
ret
=
is_vtk_writable
<
Point
<
3
,
float
>>::
value
;
BOOST_REQUIRE_EQUAL
(
ret
,
true
);
ret
=
is_vtk_writable
<
Point
<
3
,
double
>>::
value
;
BOOST_REQUIRE_EQUAL
(
ret
,
true
);
int
dims
=
vtk_dims
<
Point
<
3
,
float
>>::
value
;
BOOST_REQUIRE_EQUAL
(
dims
,
3
);
dims
=
vtk_dims
<
long
int
>::
value
;
BOOST_REQUIRE_EQUAL
(
dims
,
1
);
}
}
BOOST_AUTO_TEST_CASE
(
vtk_writer_use_point_set
)
{
{
...
...
@@ -760,6 +826,7 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set )
openfpm
::
vector
<
aggregate
<
float
,
float
[
3
]
>>
v1pp
;
openfpm
::
vector
<
aggregate
<
float
,
float
[
3
]
>>
v2pp
;
openfpm
::
vector
<
aggregate
<
float
,
float
[
3
]
>>
v3pp
;
openfpm
::
vector
<
aggregate
<
float
,
Point
<
3
,
float
>>>
v4pp
;
// set the seed
// create the random generator engine
...
...
@@ -773,6 +840,7 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set )
v1pp
.
resize
(
100
);
v2pp
.
resize
(
100
);
v3pp
.
resize
(
100
);
v4pp
.
resize
(
100
);
for
(
size_t
i
=
0
;
i
<
v1ps
.
size
();
i
++
)
{
...
...
@@ -802,6 +870,11 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set )
v3pp
.
template
get
<
1
>(
i
)[
0
]
=
rng
.
GetUniform
();
v3pp
.
template
get
<
1
>(
i
)[
1
]
=
rng
.
GetUniform
();
v3pp
.
template
get
<
1
>(
i
)[
2
]
=
rng
.
GetUniform
();
v4pp
.
template
get
<
0
>(
i
)
=
rng
.
GetUniform
();
v4pp
.
template
get
<
1
>(
i
).
get
(
0
)
=
rng
.
GetUniform
();
v4pp
.
template
get
<
1
>(
i
).
get
(
1
)
=
rng
.
GetUniform
();
v4pp
.
template
get
<
1
>(
i
).
get
(
2
)
=
rng
.
GetUniform
();
}
// Create a writer and write
...
...
@@ -815,6 +888,18 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set )
// Check that match
bool
test
=
compare
(
"vtk_points.vtk"
,
"vtk_points_test.vtk"
);
BOOST_REQUIRE_EQUAL
(
test
,
true
);
// Create a writer and write
VTKWriter
<
boost
::
mpl
::
pair
<
openfpm
::
vector
<
Point
<
3
,
double
>>
,
openfpm
::
vector
<
aggregate
<
float
,
Point
<
3
,
float
>>>>
,
VECTOR_POINTS
>
vtk_v2
;
vtk_v2
.
add
(
v1ps
,
v4pp
,
75
);
vtk_v2
.
write
(
"vtk_points_pp.vtk"
);
// Check that match
test
=
compare
(
"vtk_points_pp.vtk"
,
"vtk_points_pp_test.vtk"
);
BOOST_REQUIRE_EQUAL
(
test
,
true
);
}
}
...
...
vtk_points_test.vtk
View file @
ffcab9ac
This diff is collapsed.
Click to expand it.
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