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
4b2e3c09
Commit
4b2e3c09
authored
Dec 12, 2018
by
incardon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable MPI writer on single core
parent
b3fee8bc
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
20 deletions
+95
-20
src/HDF5_wr/HDF5_writer_vd.hpp
src/HDF5_wr/HDF5_writer_vd.hpp
+70
-0
src/VTKWriter/VTKWriter.hpp
src/VTKWriter/VTKWriter.hpp
+9
-2
src/VTKWriter/VTKWriter_grids_util.hpp
src/VTKWriter/VTKWriter_grids_util.hpp
+6
-8
src/VTKWriter/VTKWriter_point_set.hpp
src/VTKWriter/VTKWriter_point_set.hpp
+5
-5
src/VTKWriter/VTKWriter_unit_tests.hpp
src/VTKWriter/VTKWriter_unit_tests.hpp
+2
-2
src/VTKWriter/byteswap_portable.hpp
src/VTKWriter/byteswap_portable.hpp
+1
-1
src/VTKWriter/is_vtk_writable.hpp
src/VTKWriter/is_vtk_writable.hpp
+2
-2
No files found.
src/HDF5_wr/HDF5_writer_vd.hpp
View file @
4b2e3c09
...
...
@@ -158,6 +158,76 @@ public:
H5Fclose
(
file
);
}
/*! \brief Return the equivalent HDF5 type for T
*
* \return The HDF5 type equivalent to T
*
*/
template
<
typename
T
>
hid_t
getType
()
{
if
(
std
::
is_same
<
T
,
float
>::
value
)
{
return
H5T_IEEE_F32LE
;}
else
if
(
std
::
is_same
<
T
,
double
>::
value
)
{
return
H5T_IEEE_F64LE
;}
else
if
(
std
::
is_same
<
T
,
char
>::
value
||
std
::
is_same
<
T
,
unsigned
char
>::
value
)
{
return
H5T_STD_I8LE
;}
else
if
(
std
::
is_same
<
T
,
short
>::
value
||
std
::
is_same
<
T
,
unsigned
short
>::
value
)
{
return
H5T_STD_I16LE
;}
else
if
(
std
::
is_same
<
T
,
int
>::
value
||
std
::
is_same
<
T
,
unsigned
int
>::
value
)
{
return
H5T_STD_I32LE
;}
else
if
(
std
::
is_same
<
T
,
long
int
>::
value
||
std
::
is_same
<
T
,
unsigned
long
int
>::
value
)
{
return
H5T_STD_I64LE
;}
}
/*! \brief It add an attribute to an already opened file
*
* \param dataset_id dataset_id
* \param name_ name of the attribute
* \param att_ attribute value
*/
template
<
typename
value_type
>
void
addAttributeHDF5
(
hid_t
dataset_id
,
std
::
string
name_
,
value_type
att_
)
{
//create the data space for the scalar attibute
hid_t
dataspace_id
=
H5Screate
(
H5S_SCALAR
);
//create the dataset attribute (H5T_IEEE_F64BE: 64-bit float little endian)
hid_t
attribute_id
=
H5Acreate2
(
dataset_id
,
name_
.
c_str
(),
H5T_IEEE_F32LE
,
dataspace_id
,
H5P_DEFAULT
,
H5P_DEFAULT
);
//write the attibute data
herr_t
status
=
H5Awrite
(
attribute_id
,
H5T_NATIVE_DOUBLE
,
&
att_
);
//close the attribute
status
=
H5Aclose
(
attribute_id
);
//close the dataspace
status
=
H5Sclose
(
dataspace_id
);
}
/*! \brief It add an attribute to an already opened file
*
* \param dataset_id dataset_id
* \param name_ name of the attribute
* \param att_ attribute value
*/
template
<
typename
value_type
>
void
addAttributeHDF5
(
std
::
string
filename
,
std
::
string
name_
,
value_type
att_
)
{
Vcluster
<>
&
v_cl
=
create_vcluster
();
MPI_Comm
comm
=
v_cl
.
getMPIComm
();
MPI_Info
info
=
MPI_INFO_NULL
;
// Set up file access property list with parallel I/O access
hid_t
plist_id
=
H5Pcreate
(
H5P_FILE_ACCESS
);
hid_t
file_id
=
H5Fopen
(
filename
.
c_str
(),
H5F_ACC_RDWR
,
plist_id
);
hid_t
dataset_id
=
H5Dopen2
(
file_id
,
"/vector_dist"
,
H5P_DEFAULT
);
addAttributeHDF5
(
dataset_id
,
name_
.
c_str
(),
att_
);
//close the dataset
herr_t
status
=
H5Dclose
(
dataset_id
);
//close the file
status
=
H5Fclose
(
file_id
);
}
};
...
...
src/VTKWriter/VTKWriter.hpp
View file @
4b2e3c09
...
...
@@ -41,9 +41,9 @@ template <typename T> std::string getType()
else
if
(
typeid
(
T
)
==
typeid
(
unsigned
int
))
return
"unsigned_int"
;
else
if
(
typeid
(
T
)
==
typeid
(
long
int
))
return
"
long
"
;
return
"
int
"
;
else
if
(
typeid
(
T
)
==
typeid
(
unsigned
long
int
))
return
"unsigned_
long
"
;
return
"unsigned_
int
"
;
else
if
(
typeid
(
T
)
==
typeid
(
bool
))
return
"bit"
;
...
...
@@ -114,7 +114,14 @@ class VTKWriter
#include "VTKWriter_vector_box.hpp"
#include "VTKWriter_grids.hpp"
#include "VTKWriter_grids_st.hpp"
// This is only active if MPI compiler work
#ifndef DISABLE_MPI_WRITTERS
#include "VTKWriter_dist_graph.hpp"
#endif
#include "VTKWriter_point_set.hpp"
#endif
/* VTKWRITER_HPP_ */
src/VTKWriter/VTKWriter_grids_util.hpp
View file @
4b2e3c09
...
...
@@ -309,13 +309,11 @@ struct meta_prop<I, ele_g,St,T[N1],is_writable>
{
// Print the properties
for
(
size_t
i1
=
0
;
i1
<
N1
;
i1
++
)
{
v_out
+=
std
::
to_string
(
vg
.
get
(
k
).
g
.
get_o
(
it
.
get
()).
template
get
<
I
::
value
>()[
i1
])
+
" "
;
}
{
v_out
+=
std
::
to_string
(
vg
.
get
(
k
).
g
.
get_o
(
it
.
get
()).
template
get
<
I
::
value
>()[
i1
])
+
" "
;}
if
(
N1
==
2
)
{
v_out
+=
"0.0"
;
}
{
v_out
+=
"0.0"
;}
v_out
+=
"
\n
"
;
}
else
...
...
@@ -342,7 +340,7 @@ struct meta_prop<I, ele_g,St,T[N1],is_writable>
}
}
if
(
ft
==
file_type
::
BINARY
)
v_out
+=
"
\n
"
;
{
v_out
+=
"
\n
"
;}
}
}
};
...
...
@@ -466,7 +464,7 @@ template<unsigned int dims,typename T> inline void output_point(Point<dims,T> &
inline
void
output_vertex
(
size_t
k
,
std
::
string
&
v_out
,
file_type
ft
)
{
if
(
ft
==
file_type
::
ASCII
)
v_out
+=
"1 "
+
std
::
to_string
(
k
)
+
"
\n
"
;
{
v_out
+=
"1 "
+
std
::
to_string
(
k
)
+
"
\n
"
;}
else
{
int
tmp
;
...
...
src/VTKWriter/VTKWriter_point_set.hpp
View file @
4b2e3c09
...
...
@@ -239,9 +239,9 @@ class VTKWriter<pair,VECTOR_POINTS>
// write the number of vertex
if
(
ft
==
file_type
::
ASCII
)
v_out
+=
"POINTS "
+
std
::
to_string
(
get_total
())
+
" float"
+
"
\n
"
;
{
v_out
+=
"POINTS "
+
std
::
to_string
(
get_total
())
+
" float"
+
"
\n
"
;}
else
v_out
+=
"POINTS "
+
std
::
to_string
(
get_total
())
+
" "
+
getType
<
typename
pair
::
first
::
value_type
::
coord_type
>
()
+
"
\n
"
;
{
v_out
+=
"POINTS "
+
std
::
to_string
(
get_total
())
+
" "
+
getType
<
typename
pair
::
first
::
value_type
::
coord_type
>
()
+
"
\n
"
;}
// return the vertex properties string
return
v_out
;
...
...
@@ -317,7 +317,7 @@ class VTKWriter<pair,VECTOR_POINTS>
//! In case of binary we have to add a new line at the end of the list
if
(
ft
==
file_type
::
BINARY
)
v_out
+=
"
\n
"
;
{
v_out
+=
"
\n
"
;}
// return the vertex list
return
v_out
;
...
...
@@ -433,9 +433,9 @@ public:
prop_out_v
<
ele_vpp
<
typename
pair
::
second
>
,
typename
pair
::
first
::
value_type
::
coord_type
>
pp
(
point_data
,
vpp
,
prop_names
,
ft
);
if
(
prp
==
-
1
)
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
0
,
pair
::
second
::
value_type
::
max_prop
>
>
(
pp
);
{
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
0
,
pair
::
second
::
value_type
::
max_prop
>
>
(
pp
);}
else
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
prp
,
prp
>
>
(
pp
);
{
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
prp
,
prp
>
>
(
pp
);}
// Add the last property
pp
.
lastProp
();
...
...
src/VTKWriter/VTKWriter_unit_tests.hpp
View file @
4b2e3c09
...
...
@@ -664,8 +664,8 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_grids)
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
});
Point
<
1
,
float
>
offset2
({
5.0
});
Point
<
1
,
float
>
spacing2
({
0.2
});
Box
<
1
,
size_t
>
d2
({
2
},{
13
});
// Create box grids
...
...
src/VTKWriter/byteswap_portable.hpp
View file @
4b2e3c09
...
...
@@ -33,7 +33,7 @@ T swap_endian_lt(T u)
source
.
u
=
u
;
for
(
size_t
k
=
0
;
k
<
sizeof
(
T
);
k
++
)
dest
.
u8
[
k
]
=
source
.
u8
[
sizeof
(
T
)
-
k
-
1
];
{
dest
.
u8
[
k
]
=
source
.
u8
[
sizeof
(
T
)
-
k
-
1
];}
return
dest
.
u
;
}
...
...
src/VTKWriter/is_vtk_writable.hpp
View file @
4b2e3c09
...
...
@@ -200,7 +200,7 @@ struct is_vtk_writable<unsigned int>
template
<
>
struct
is_vtk_writable
<
long
int
>
{
typedef
long
base
;
typedef
int
base
;
//! long int is vtk writable
enum
...
...
@@ -213,7 +213,7 @@ struct is_vtk_writable<long int>
template
<
>
struct
is_vtk_writable
<
unsigned
long
int
>
{
typedef
unsigned
long
base
;
typedef
unsigned
int
base
;
//! unsigned long int is vtk writable
enum
...
...
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