From: Daniel Garcia-Sanchez Date: Mon, 20 Aug 2018 22:06:20 +0000 (+0200) Subject: Remove long double and std::complex instantiations X-Git-Tag: v9.1.0-rc1~453^2~60 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a4ebeee895ad882bc978095eefc516ccda37590;p=dealii.git Remove long double and std::complex instantiations The std::complex instantiation creates errors with valgrind. Although long double does not create errors with valgrind, it is not a widely used. --- diff --git a/include/deal.II/base/hdf5.h b/include/deal.II/base/hdf5.h index 950f8f04c2..0163db464e 100644 --- a/include/deal.II/base/hdf5.h +++ b/include/deal.II/base/hdf5.h @@ -128,10 +128,10 @@ namespace HDF5 }; /** - * Reads an attribute. T can be float, double, long double, - * std::complex, std::complex, std::complex, - * int, unsigned int, bool or std::string. Note that the encoding of - * std::string is UTF8 in order to be compatible with python3. + * Reads an attribute. T can be float, double, std::complex, + * std::complex, int, unsigned int, bool or std::string. Note that + * the encoding of std::string is UTF8 in order to be compatible with + * python3. * * Datatype conversion takes place at the time of a read or write and is * automatic. See the , std::complex, std::complex, - * int, unsigned int, bool or std::string. Note that the encoding of - * std::string is UTF8 in order to be compatible with python3. + * Reads an attribute. T can be float, double, std::complex, + * std::complex, int, unsigned int, bool or std::string. Note that + * the encoding of std::string is UTF8 in order to be compatible with + * python3. * * Datatype conversion takes place at the time of a read or write and is * automatic. See the , std::complex, std::complex, int - * or unsigned int. + * Reads data of the dataset. Number can be float, double, + * std::complex, std::complex, int or unsigned int. * * Datatype conversion takes place at the time of a read or write and is * automatic. See the , std::complex, - * std::complex, int or unsigned int. + * Reads data of a subset of the dataset. Number can be float, double, + * std::complex, std::complex, int or unsigned int. * * The selected elements can be scattered and take any shape in the dataset. * For examples, in the 4D case, we will be selecting three points and a 4D @@ -263,8 +261,8 @@ namespace HDF5 /** * This function does not read any data, but can contribute to a collective - * read call. Number can be float, double, long double, std::complex, - * std::complex, std::complex, int or unsigned int. + * read call. Number can be float, double, std::complex, + * std::complex, int or unsigned int. * * Datatype conversion takes place at the time of a read or write and is * automatic. See the , std::complex, std::complex, int - * or unsigned int. + * Writes data in the dataset. Number can be float, double, + * std::complex, std::complex, int or unsigned int. * * Datatype conversion takes place at the time of a read or write and is * automatic. See the &data); /** - * Writes data to a subset of the dataset. Number can be float, double, long - * double, std::complex, std::complex, - * std::complex, int or unsigned int. + * Writes data to a subset of the dataset. Number can be float, double, + * std::complex, std::complex, int or unsigned int. * * The selected elements can be scattered and take any shape in the dataset. * For examples, in the 4D case, we will be selecting three points and a 4D @@ -392,9 +388,8 @@ namespace HDF5 /** * This function does not write any data, but can contribute to a collective - * write call. Number can be float, double, long double, - * std::complex, std::complex, std::complex, int - * or unsigned int. + * write call. Number can be float, double, std::complex, + * std::complex, int or unsigned int. * * Datatype conversion takes place at the time of a read or write and is * automatic. See the , std::complex, - * std::complex, int or unsigned int. + * Creates a dataset. Number can be float, double, std::complex, + * std::complex, int or unsigned int. * * Datatype conversion takes place at the time of a read or write and is * automatic. See the dimensions) const; /** - * Creates and writes data to a dataset. Number can be float, double, long - * double, std::complex, std::complex, - * std::complex, int or unsigned int. + * Creates and writes data to a dataset. Number can be float, double, + * std::complex, std::complex, int or unsigned int. * * Datatype conversion takes place at the time of a read or write and is * automatic. See the (new hid_t); *t_type = H5T_NATIVE_DOUBLE; } - else if (std::is_same::value) - { - t_type = std::shared_ptr(new hid_t); - *t_type = H5T_NATIVE_LDOUBLE; - } else if (std::is_same::value) { t_type = std::shared_ptr(new hid_t); @@ -97,21 +92,6 @@ namespace HDF5 H5Tinsert(*t_type, "r", 0, H5T_NATIVE_DOUBLE); H5Tinsert(*t_type, "i", sizeof(double), H5T_NATIVE_DOUBLE); } - else if (std::is_same>::value) - { - t_type = std::shared_ptr(new hid_t, [](auto pointer) { - // Relase the HDF5 resource - H5Tclose(*pointer); - delete pointer; - }); - *t_type = H5Tcreate(H5T_COMPOUND, sizeof(std::complex)); - // The C++ standards committee agreed to mandate that the storage - // format used for the std::complex type be binary-compatible with - // the C99 type, i.e. an array T[2] with consecutive real [0] and - // imaginary [1] parts. - H5Tinsert(*t_type, "r", 0, H5T_NATIVE_LDOUBLE); - H5Tinsert(*t_type, "i", sizeof(long double), H5T_NATIVE_LDOUBLE); - } else { Assert(false, ExcInternalError()); @@ -1364,15 +1344,10 @@ namespace HDF5 HDF5Object::attr(const std::string attr_name) const; template double HDF5Object::attr(const std::string attr_name) const; - template long double - HDF5Object::attr(const std::string attr_name) const; template std::complex HDF5Object::attr>(const std::string attr_name) const; template std::complex HDF5Object::attr>(const std::string attr_name) const; - template std::complex - HDF5Object::attr>( - const std::string attr_name) const; template int HDF5Object::attr(const std::string attr_name) const; template unsigned int @@ -1385,9 +1360,6 @@ namespace HDF5 HDF5Object::write_attr(const std::string attr_name, double value) const; template void - HDF5Object::write_attr(const std::string attr_name, - long double value) const; - template void HDF5Object::write_attr>(const std::string attr_name, std::complex value) const; template void @@ -1395,10 +1367,6 @@ namespace HDF5 const std::string attr_name, std::complex value) const; template void - HDF5Object::write_attr>( - const std::string attr_name, - std::complex value) const; - template void HDF5Object::write_attr(const std::string attr_name, int value) const; template void HDF5Object::write_attr(const std::string attr_name, @@ -1408,14 +1376,10 @@ namespace HDF5 DataSet::read(); template std::vector DataSet::read(); - template std::vector - DataSet::read(); template std::vector> DataSet::read>(); template std::vector> DataSet::read>(); - template std::vector> - DataSet::read>(); template std::vector DataSet::read(); template std::vector @@ -1424,8 +1388,6 @@ namespace HDF5 DataSet::read(); template FullMatrix DataSet::read(); - template FullMatrix - DataSet::read(); template FullMatrix> DataSet::read>(); template FullMatrix> @@ -1435,17 +1397,12 @@ namespace HDF5 DataSet::read_selection(const std::vector coordinates); template std::vector DataSet::read_selection(const std::vector coordinates); - template std::vector - DataSet::read_selection(const std::vector coordinates); template std::vector> DataSet::read_selection>( const std::vector coordinates); template std::vector> DataSet::read_selection>( const std::vector coordinates); - template std::vector> - DataSet::read_selection>( - const std::vector coordinates); template std::vector DataSet::read_selection(const std::vector coordinates); template std::vector @@ -1459,10 +1416,6 @@ namespace HDF5 DataSet::read_hyperslab( const std::vector &offset, const std::vector &count); - template std::vector - DataSet::read_hyperslab( - const std::vector &offset, - const std::vector &count); template std::vector> DataSet::read_hyperslab>( const std::vector &offset, @@ -1471,10 +1424,6 @@ namespace HDF5 DataSet::read_hyperslab>( const std::vector &offset, const std::vector &count); - template std::vector> - DataSet::read_hyperslab>( - const std::vector &offset, - const std::vector &count); template std::vector DataSet::read_hyperslab(const std::vector &offset, const std::vector &count); @@ -1503,14 +1452,10 @@ namespace HDF5 template void DataSet::read_none(); template void - DataSet::read_none(); - template void DataSet::read_none>(); template void DataSet::read_none>(); template void - DataSet::read_none>(); - template void DataSet::read_none(); template void DataSet::read_none(); @@ -1520,18 +1465,12 @@ namespace HDF5 template void DataSet::write(const std::vector &data); template void - DataSet::write( - const std::vector &data); - template void DataSet::write>( const std::vector> &data); template void DataSet::write>( const std::vector> &data); template void - DataSet::write>( - const std::vector> &data); - template void DataSet::write(const std::vector &data); template void DataSet::write( @@ -1554,9 +1493,6 @@ namespace HDF5 DataSet::write_selection(const std::vector &data, const std::vector coordinates); template void - DataSet::write_selection(const std::vector &data, - const std::vector coordinates); - template void DataSet::write_selection>( const std::vector> &data, const std::vector coordinates); @@ -1565,10 +1501,6 @@ namespace HDF5 const std::vector> &data, const std::vector coordinates); template void - DataSet::write_selection>( - const std::vector> &data, - const std::vector coordinates); - template void DataSet::write_selection(const std::vector & data, const std::vector coordinates); template void @@ -1587,11 +1519,6 @@ namespace HDF5 const std::vector &offset, const std::vector &count); template void - DataSet::write_hyperslab( - const std::vector &data, - const std::vector & offset, - const std::vector & count); - template void DataSet::write_hyperslab>( const std::vector> &data, const std::vector & offset, @@ -1602,11 +1529,6 @@ namespace HDF5 const std::vector & offset, const std::vector & count); template void - DataSet::write_hyperslab>( - const std::vector> &data, - const std::vector & offset, - const std::vector & count); - template void DataSet::write_hyperslab(const std::vector & data, const std::vector &offset, const std::vector &count); @@ -1653,14 +1575,6 @@ namespace HDF5 const std::vector &count, const std::vector &block); template void - DataSet::write_hyperslab( - const std::vector &data, - const std::vector & data_dimensions, - const std::vector & offset, - const std::vector & stride, - const std::vector & count, - const std::vector & block); - template void DataSet::write_hyperslab>( const std::vector> &data, const std::vector & data_dimensions, @@ -1677,14 +1591,6 @@ namespace HDF5 const std::vector & count, const std::vector & block); template void - DataSet::write_hyperslab>( - const std::vector> &data, - const std::vector & data_dimensions, - const std::vector & offset, - const std::vector & stride, - const std::vector & count, - const std::vector & block); - template void DataSet::write_hyperslab( const std::vector & data, const std::vector &data_dimensions, @@ -1738,14 +1644,10 @@ namespace HDF5 template void DataSet::write_none(); template void - DataSet::write_none(); - template void DataSet::write_none>(); template void DataSet::write_none>(); template void - DataSet::write_none>(); - template void DataSet::write_none(); template void DataSet::write_none(); @@ -1757,10 +1659,6 @@ namespace HDF5 Group::create_dataset(const std::string name, const std::vector dimensions) const; template DataSet - Group::create_dataset( - const std::string name, - const std::vector dimensions) const; - template DataSet Group::create_dataset>( const std::string name, const std::vector dimensions) const; @@ -1769,10 +1667,6 @@ namespace HDF5 const std::string name, const std::vector dimensions) const; template DataSet - Group::create_dataset>( - const std::string name, - const std::vector dimensions) const; - template DataSet Group::create_dataset(const std::string name, const std::vector dimensions) const; template DataSet @@ -1787,19 +1681,12 @@ namespace HDF5 Group::write_dataset(const std::string name, const std::vector &data) const; template void - Group::write_dataset(const std::string name, - const std::vector &data) const; - template void Group::write_dataset(const std::string name, const std::vector> &data) const; template void Group::write_dataset(const std::string name, const std::vector> &data) const; template void - Group::write_dataset( - const std::string name, - const std::vector> &data) const; - template void Group::write_dataset(const std::string name, const std::vector &data) const; template void diff --git a/tests/base/hdf5_01.cc b/tests/base/hdf5_01.cc index 7dd9c0d329..d093b1b964 100644 --- a/tests/base/hdf5_01.cc +++ b/tests/base/hdf5_01.cc @@ -34,31 +34,24 @@ test() // Create attributes attached to the root const float root_float = 2.45681934e5; const double root_double = 6.234542e3; - const long double root_long_double = 4.321432e6; const int root_int = -56; const unsigned int root_unsigned_int = 22; data_file.write_attr("root_float", root_float); data_file.write_attr("root_double", root_double); - data_file.write_attr("root_long_double", root_long_double); data_file.write_attr("root_int", root_int); data_file.write_attr("root_unsigned_int", root_unsigned_int); data_file.write_attr("root_total", - (root_float + root_double + root_long_double) * - root_int * root_unsigned_int); + (root_float + root_double) * root_int * + root_unsigned_int); // Create attributes attached to a group auto test_group = data_file.create_group("test_group"); - const std::complex group_complex_float = {2.45681934e5, 45e2}; - const std::complex group_complex_double = {6.234542e3, 2}; - const std::complex group_complex_long_double = {4.321432e6, - 23}; + const std::complex group_complex_float = {2.45681934e5, 45e2}; + const std::complex group_complex_double = {6.234542e3, 2}; test_group.write_attr("group_complex_float", group_complex_float); test_group.write_attr("group_complex_double", group_complex_double); - test_group.write_attr("group_complex_long_double", - group_complex_long_double); test_group.write_attr("group_complex_total", - group_complex_float * group_complex_double * - group_complex_long_double); + group_complex_float * group_complex_double); test_group.write_attr("group_string", std::string("test_string_attribute")); // Create attributes attached to a dataset @@ -78,15 +71,13 @@ test() HDF5::File data_file(filename, HDF5::File::Mode::open); auto root_float = data_file.attr("root_float"); auto root_double = data_file.attr("root_double"); - auto root_long_double = data_file.attr("root_long_double"); - auto root_int = data_file.attr("root_int"); + auto root_int = data_file.attr("root_int"); auto root_unsigned_int = data_file.attr("root_unsigned_int"); // calculated and read should be the same deallog << "root_total calculated:" - << (root_float + root_double + root_long_double) * root_int * - root_unsigned_int + << (root_float + root_double) * root_int * root_unsigned_int << std::endl; - deallog << "root_total read:" << data_file.attr("root_total") + deallog << "root_total read:" << data_file.attr("root_total") << std::endl; // Read attributes attached to a group @@ -95,14 +86,10 @@ test() test_group.attr>("group_complex_float"); auto group_complex_double = test_group.attr>("group_complex_double"); - auto group_complex_long_double = - test_group.attr>("group_complex_long_double"); deallog << "group_complex_total calculated:" - << (group_complex_float * group_complex_double * - group_complex_long_double) - << std::endl; + << (group_complex_float * group_complex_double) << std::endl; deallog << "group_complex_total read:" - << test_group.attr>("group_complex_total") + << test_group.attr>("group_complex_total") << std::endl; deallog << "group_string read:" << test_group.attr("group_string") << std::endl; diff --git a/tests/base/hdf5_01.output b/tests/base/hdf5_01.output index 90484a04eb..2885b923d3 100644 --- a/tests/base/hdf5_01.output +++ b/tests/base/hdf5_01.output @@ -1,8 +1,8 @@ -DEAL::root_total calculated:-5.63437e+09 -DEAL::root_total read:-5.63437e+09 -DEAL::group_complex_total calculated:(6.61916e+15,1.23398e+14) -DEAL::group_complex_total read:(6.61916e+15,1.23398e+14) +DEAL::root_total calculated:-3.10361e+08 +DEAL::root_total read:-3.10361e+08 +DEAL::group_complex_total calculated:(1.53171e+09,2.85468e+07) +DEAL::group_complex_total read:(1.53171e+09,2.85468e+07) DEAL::group_string read:test_string_attribute DEAL::dataset_double read:20.2000 DEAL::dataset_string read:test_dataset_attribute diff --git a/tests/base/hdf5_02.cc b/tests/base/hdf5_02.cc index ba7716dae8..4054403785 100644 --- a/tests/base/hdf5_02.cc +++ b/tests/base/hdf5_02.cc @@ -34,31 +34,24 @@ test() // Create attributes attached to the root const float root_float = 2.45681934e5; const double root_double = 6.234542e3; - const long double root_long_double = 4.321432e6; const int root_int = -56; const unsigned int root_unsigned_int = 22; data_file.write_attr("root_float", root_float); data_file.write_attr("root_double", root_double); - data_file.write_attr("root_long_double", root_long_double); data_file.write_attr("root_int", root_int); data_file.write_attr("root_unsigned_int", root_unsigned_int); data_file.write_attr("root_total", - (root_float + root_double + root_long_double) * - root_int * root_unsigned_int); + (root_float + root_double) * root_int * + root_unsigned_int); // Create attributes attached to a group auto test_group = data_file.create_group("test_group"); - const std::complex group_complex_float = {2.45681934e5, 45e2}; - const std::complex group_complex_double = {6.234542e3, 2}; - const std::complex group_complex_long_double = {4.321432e6, - 23}; + const std::complex group_complex_float = {2.45681934e5, 45e2}; + const std::complex group_complex_double = {6.234542e3, 2}; test_group.write_attr("group_complex_float", group_complex_float); test_group.write_attr("group_complex_double", group_complex_double); - test_group.write_attr("group_complex_long_double", - group_complex_long_double); test_group.write_attr("group_complex_total", - group_complex_float * group_complex_double * - group_complex_long_double); + group_complex_float * group_complex_double); test_group.write_attr("group_string", std::string("test_string_attribute")); // Create attributes attached to a dataset @@ -78,15 +71,13 @@ test() HDF5::File data_file(filename, MPI_COMM_WORLD, HDF5::File::Mode::open); auto root_float = data_file.attr("root_float"); auto root_double = data_file.attr("root_double"); - auto root_long_double = data_file.attr("root_long_double"); - auto root_int = data_file.attr("root_int"); + auto root_int = data_file.attr("root_int"); auto root_unsigned_int = data_file.attr("root_unsigned_int"); // calculated and read should be the same deallog << "root_total calculated:" - << (root_float + root_double + root_long_double) * root_int * - root_unsigned_int + << (root_float + root_double) * root_int * root_unsigned_int << std::endl; - deallog << "root_total read:" << data_file.attr("root_total") + deallog << "root_total read:" << data_file.attr("root_total") << std::endl; // Read attributes attached to a group @@ -95,14 +86,10 @@ test() test_group.attr>("group_complex_float"); auto group_complex_double = test_group.attr>("group_complex_double"); - auto group_complex_long_double = - test_group.attr>("group_complex_long_double"); deallog << "group_complex_total calculated:" - << (group_complex_float * group_complex_double * - group_complex_long_double) - << std::endl; + << (group_complex_float * group_complex_double) << std::endl; deallog << "group_complex_total read:" - << test_group.attr>("group_complex_total") + << test_group.attr>("group_complex_total") << std::endl; deallog << "group_string read:" << test_group.attr("group_string") << std::endl; diff --git a/tests/base/hdf5_02.with_hdf5=true.mpirun=1.output b/tests/base/hdf5_02.with_hdf5=true.mpirun=1.output index 90484a04eb..2885b923d3 100644 --- a/tests/base/hdf5_02.with_hdf5=true.mpirun=1.output +++ b/tests/base/hdf5_02.with_hdf5=true.mpirun=1.output @@ -1,8 +1,8 @@ -DEAL::root_total calculated:-5.63437e+09 -DEAL::root_total read:-5.63437e+09 -DEAL::group_complex_total calculated:(6.61916e+15,1.23398e+14) -DEAL::group_complex_total read:(6.61916e+15,1.23398e+14) +DEAL::root_total calculated:-3.10361e+08 +DEAL::root_total read:-3.10361e+08 +DEAL::group_complex_total calculated:(1.53171e+09,2.85468e+07) +DEAL::group_complex_total read:(1.53171e+09,2.85468e+07) DEAL::group_string read:test_string_attribute DEAL::dataset_double read:20.2000 DEAL::dataset_string read:test_dataset_attribute diff --git a/tests/base/hdf5_02.with_hdf5=true.mpirun=4.output b/tests/base/hdf5_02.with_hdf5=true.mpirun=4.output index 90484a04eb..2885b923d3 100644 --- a/tests/base/hdf5_02.with_hdf5=true.mpirun=4.output +++ b/tests/base/hdf5_02.with_hdf5=true.mpirun=4.output @@ -1,8 +1,8 @@ -DEAL::root_total calculated:-5.63437e+09 -DEAL::root_total read:-5.63437e+09 -DEAL::group_complex_total calculated:(6.61916e+15,1.23398e+14) -DEAL::group_complex_total read:(6.61916e+15,1.23398e+14) +DEAL::root_total calculated:-3.10361e+08 +DEAL::root_total read:-3.10361e+08 +DEAL::group_complex_total calculated:(1.53171e+09,2.85468e+07) +DEAL::group_complex_total read:(1.53171e+09,2.85468e+07) DEAL::group_string read:test_string_attribute DEAL::dataset_double read:20.2000 DEAL::dataset_string read:test_dataset_attribute