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
f8a9ae64
Commit
f8a9ae64
authored
Feb 06, 2016
by
Pietro Incardona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VTK writer for a set of point or particles
parent
45f102f9
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1299 additions
and
6 deletions
+1299
-6
.gitignore
.gitignore
+0
-1
src/VTKWriter.hpp
src/VTKWriter.hpp
+2
-0
src/VTKWriter_grids.hpp
src/VTKWriter_grids.hpp
+9
-4
src/VTKWriter_grids_util.hpp
src/VTKWriter_grids_util.hpp
+4
-1
src/VTKWriter_unit_tests.hpp
src/VTKWriter_unit_tests.hpp
+73
-0
vtk_points_test.vtk
vtk_points_test.vtk
+1211
-0
No files found.
.gitignore
View file @
f8a9ae64
...
...
@@ -38,7 +38,6 @@ Thumbs.db
###### Other
*.vtk
AUTHORS
COPYING
ChangeLog
...
...
src/VTKWriter.hpp
View file @
f8a9ae64
...
...
@@ -98,6 +98,7 @@ enum file_type
#define VECTOR_BOX 2
#define VECTOR_GRIDS 3
#define VECTOR_ST_GRIDS 4
#define VECTOR_POINTS 5
template
<
typename
Graph
,
unsigned
int
imp
>
class
VTKWriter
...
...
@@ -109,5 +110,6 @@ class VTKWriter
#include "VTKWriter_vector_box.hpp"
#include "VTKWriter_grids.hpp"
#include "VTKWriter_grids_st.hpp"
#include "VTKWriter_point_set.hpp"
#endif
/* VTKWRITER_HPP_ */
src/VTKWriter_grids.hpp
View file @
f8a9ae64
...
...
@@ -11,6 +11,12 @@
#include <boost/mpl/pair.hpp>
#include "VTKWriter_grids_util.hpp"
/*! \brief It store one grid
*
* \tparam Grid type of grid
* \tparam St type of space where the grid is defined
*
*/
template
<
typename
Grid
,
typename
St
>
class
ele_g
{
...
...
@@ -22,6 +28,7 @@ public:
:
g
(
g
),
offset
(
offset
),
spacing
(
spacing
),
dom
(
dom
)
{}
//! Dataset name
std
::
string
dataset
;
//! Grid
const
Grid
&
g
;
...
...
@@ -41,10 +48,8 @@ public:
* element of the boost::vector the operator() is called.
* Is mainly used to produce at output for each property
*
* \tparam Graph graph we are processing
*
* \param dim Dimensionality
* \param S type of grid
* \tparam ele_g element that store the grid and its attributes
* \param St type of space where the grid live
*
*/
...
...
src/VTKWriter_grids_util.hpp
View file @
f8a9ae64
...
...
@@ -198,7 +198,10 @@ public:
/*! \brief This class is an helper to create properties output from scalar and compile-time array elements
*
* This class is an helper to copy scalar and compile-time array elements
* \tparam I It is an boost::mpl::int_ that indicate which property we are writing
* \tparam ele_g element type that store the grid information
* \tparam St type of space where the grid live
* \tparam T the type of the property
*
*/
template
<
typename
I
,
typename
ele_g
,
typename
St
,
typename
T
>
...
...
src/VTKWriter_unit_tests.hpp
View file @
f8a9ae64
...
...
@@ -8,6 +8,9 @@
#ifndef VTKWRITER_UNIT_TESTS_HPP_
#define VTKWRITER_UNIT_TESTS_HPP_
#include "data_type/aggregate.hpp"
#include <random>
BOOST_AUTO_TEST_SUITE
(
vtk_writer_test
)
/* \brief Sub-domain vertex graph node
...
...
@@ -754,6 +757,76 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_grids)
}
}
BOOST_AUTO_TEST_CASE
(
vtk_writer_use_point_set
)
{
{
// Create 3 vectors with random particles
openfpm
::
vector
<
Point
<
3
,
double
>>
v1ps
;
openfpm
::
vector
<
Point
<
3
,
double
>>
v2ps
;
openfpm
::
vector
<
Point
<
3
,
double
>>
v3ps
;
openfpm
::
vector
<
aggregate
<
float
,
float
[
3
]
>>
v1pp
;
openfpm
::
vector
<
aggregate
<
float
,
float
[
3
]
>>
v2pp
;
openfpm
::
vector
<
aggregate
<
float
,
float
[
3
]
>>
v3pp
;
// set the seed
// create the random generator engine
std
::
srand
(
0
);
std
::
default_random_engine
eg
;
std
::
uniform_real_distribution
<
float
>
ud
(
0.0
f
,
1.0
f
);
// fill the vector with random data
v1ps
.
resize
(
100
);
v2ps
.
resize
(
100
);
v3ps
.
resize
(
100
);
v1pp
.
resize
(
100
);
v2pp
.
resize
(
100
);
v3pp
.
resize
(
100
);
for
(
size_t
i
=
0
;
i
<
v1ps
.
size
();
i
++
)
{
v1ps
.
template
get
<
0
>(
i
)[
0
]
=
ud
(
eg
);
v1ps
.
template
get
<
0
>(
i
)[
1
]
=
ud
(
eg
);
v1ps
.
template
get
<
0
>(
i
)[
2
]
=
ud
(
eg
);
v2ps
.
template
get
<
0
>(
i
)[
0
]
=
ud
(
eg
)
*
0.5
;
v2ps
.
template
get
<
0
>(
i
)[
1
]
=
ud
(
eg
)
*
0.5
;
v2ps
.
template
get
<
0
>(
i
)[
2
]
=
ud
(
eg
)
*
0.5
;
v3ps
.
template
get
<
0
>(
i
)[
0
]
=
ud
(
eg
)
*
0.3
;
v3ps
.
template
get
<
0
>(
i
)[
1
]
=
ud
(
eg
)
*
0.3
;
v3ps
.
template
get
<
0
>(
i
)[
2
]
=
ud
(
eg
)
*
0.3
;
v1pp
.
template
get
<
0
>(
i
)
=
ud
(
eg
);
v1pp
.
template
get
<
1
>(
i
)[
0
]
=
ud
(
eg
);
v1pp
.
template
get
<
1
>(
i
)[
1
]
=
ud
(
eg
);
v1pp
.
template
get
<
1
>(
i
)[
2
]
=
ud
(
eg
);
v2pp
.
template
get
<
0
>(
i
)
=
ud
(
eg
);
v2pp
.
template
get
<
1
>(
i
)[
0
]
=
ud
(
eg
);
v2pp
.
template
get
<
1
>(
i
)[
1
]
=
ud
(
eg
);
v2pp
.
template
get
<
1
>(
i
)[
2
]
=
ud
(
eg
);
v3pp
.
template
get
<
0
>(
i
)
=
ud
(
eg
);
v3pp
.
template
get
<
1
>(
i
)[
0
]
=
ud
(
eg
);
v3pp
.
template
get
<
1
>(
i
)[
1
]
=
ud
(
eg
);
v3pp
.
template
get
<
1
>(
i
)[
2
]
=
ud
(
eg
);
}
// Create a writer and write
VTKWriter
<
boost
::
mpl
::
pair
<
openfpm
::
vector
<
Point
<
3
,
double
>>
,
openfpm
::
vector
<
aggregate
<
float
,
float
[
3
]
>>>
,
VECTOR_POINTS
>
vtk_v
;
vtk_v
.
add
(
v1ps
,
v1pp
,
75
);
vtk_v
.
add
(
v2ps
,
v2pp
,
88
);
vtk_v
.
add
(
v3ps
,
v3pp
,
90
);
vtk_v
.
write
(
"vtk_points.vtk"
);
// Check that match
bool
test
=
compare
(
"vtk_points.vtk"
,
"vtk_points_test.vtk"
);
BOOST_REQUIRE_EQUAL
(
test
,
true
);
}
}
BOOST_AUTO_TEST_SUITE_END
()
#endif
/* VTKWRITER_UNIT_TESTS_HPP_ */
vtk_points_test.vtk
0 → 100644
View file @
f8a9ae64
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