From 51c04b17365fea2828fc61333486a37d44ae2766 Mon Sep 17 00:00:00 2001 From: Daniel Arndt <arndtd@ornl.gov> Date: Sat, 1 Jul 2023 14:54:50 -0400 Subject: [PATCH] Replace std_cxx17 --- examples/step-85/step-85.cc | 6 +-- include/deal.II/base/mutable_bind.h | 3 +- include/deal.II/base/quadrature_point_data.h | 18 ++++----- include/deal.II/base/std_cxx17/algorithm.h | 3 ++ include/deal.II/base/std_cxx17/optional.h | 3 ++ include/deal.II/base/std_cxx17/tuple.h | 3 ++ include/deal.II/base/std_cxx17/variant.h | 3 ++ include/deal.II/base/table_handler.h | 28 ++++++------- include/deal.II/base/thread_management.h | 6 +-- include/deal.II/grid/grid_tools.h | 29 +++++++------- include/deal.II/non_matching/fe_values.h | 39 +++++++++---------- .../non_matching/quadrature_generator.h | 12 +++--- include/deal.II/numerics/fe_field_function.h | 7 ++-- .../numerics/fe_field_function.templates.h | 12 +++--- .../deal.II/optimization/line_minimization.h | 19 +++++---- source/base/table_handler.cc | 10 ++--- source/cgal/intersections.cc | 28 ++++++------- source/grid/reference_cell.cc | 34 ++++++++-------- source/non_matching/fe_values.cc | 10 ++--- source/non_matching/quadrature_generator.cc | 26 ++++++------- .../non_matching/quadrature_generator.inst.in | 2 +- tests/base/cell_data_storage_01.cc | 8 ++-- tests/base/mutable_bind_01.cc | 3 +- tests/base/mutable_bind_02.cc | 3 +- tests/base/mutable_bind_03.cc | 3 +- tests/base/mutable_bind_04.cc | 3 +- tests/base/stdcxx17_apply.cc | 39 ------------------- tests/base/stdcxx17_apply.output | 2 - .../grid_tools_exchange_cell_data_04.cc | 6 +-- tests/non_matching/fe_interface_values.cc | 3 +- ...fe_interface_values_non_standard_meshes.cc | 2 +- tests/non_matching/fe_values.cc | 7 ++-- .../find_best_height_direction.cc | 4 +- 33 files changed, 179 insertions(+), 205 deletions(-) delete mode 100644 tests/base/stdcxx17_apply.cc delete mode 100644 tests/base/stdcxx17_apply.output diff --git a/examples/step-85/step-85.cc b/examples/step-85/step-85.cc index 981677edbb..abcee95b07 100644 --- a/examples/step-85/step-85.cc +++ b/examples/step-85/step-85.cc @@ -395,7 +395,7 @@ namespace Step85 // produces anything useful. It can happen that the algorithm produces 0 // quadrature points. When this happens, the returned optional will not // contain a value, even if the cell is formally intersected. - const std_cxx17::optional<FEValues<dim>> &inside_fe_values = + const std::optional<FEValues<dim>> &inside_fe_values = non_matching_fe_values.get_inside_fe_values(); if (inside_fe_values) @@ -433,7 +433,7 @@ namespace Step85 // An additional benefit of std::optional is that we do not need any // other check for whether we are on intersected cells: In case we are // on an inside cell, we get an empty object here. - const std_cxx17::optional<NonMatching::FEImmersedSurfaceValues<dim>> + const std::optional<NonMatching::FEImmersedSurfaceValues<dim>> &surface_fe_values = non_matching_fe_values.get_surface_fe_values(); if (surface_fe_values) @@ -634,7 +634,7 @@ namespace Step85 { non_matching_fe_values.reinit(cell); - const std_cxx17::optional<FEValues<dim>> &fe_values = + const std::optional<FEValues<dim>> &fe_values = non_matching_fe_values.get_inside_fe_values(); if (fe_values) diff --git a/include/deal.II/base/mutable_bind.h b/include/deal.II/base/mutable_bind.h index 7f153af4ca..79a5c0c64b 100644 --- a/include/deal.II/base/mutable_bind.h +++ b/include/deal.II/base/mutable_bind.h @@ -19,7 +19,6 @@ #include <deal.II/base/config.h> #include <deal.II/base/patterns.h> -#include <deal.II/base/std_cxx17/tuple.h> #include <tuple> #include <utility> @@ -253,7 +252,7 @@ namespace Utilities ReturnType MutableBind<ReturnType, FunctionArgs...>::operator()() const { - return std_cxx17::apply(function, arguments); + return std::apply(function, arguments); } diff --git a/include/deal.II/base/quadrature_point_data.h b/include/deal.II/base/quadrature_point_data.h index f40eb4e915..6e51a874a9 100644 --- a/include/deal.II/base/quadrature_point_data.h +++ b/include/deal.II/base/quadrature_point_data.h @@ -19,7 +19,6 @@ #include <deal.II/base/config.h> #include <deal.II/base/quadrature.h> -#include <deal.II/base/std_cxx17/optional.h> #include <deal.II/base/subscriptor.h> #include <deal.II/distributed/tria.h> @@ -33,6 +32,7 @@ #include <deal.II/lac/vector.h> #include <map> +#include <optional> #include <type_traits> #include <vector> @@ -170,9 +170,9 @@ public: get_data(const CellIteratorType &cell) const; /** - * Returns a std_cxx17::optional indicating whether @p cell contains an + * Returns a std::optional indicating whether @p cell contains an * associated data or not. If data is available, dereferencing the - * std_cxx17::optional reveals a vector of pointers to the underlying data + * std::optional reveals a vector of pointers to the underlying data * at the quadrature points. * A possible additional typename @p T is the class to which the base class * DataType could be cast. Since @p DataType is stored as shared pointers, @@ -186,13 +186,13 @@ public: * initialize() the cell data. */ template <typename T = DataType> - std_cxx17::optional<std::vector<std::shared_ptr<T>>> + std::optional<std::vector<std::shared_ptr<T>>> try_get_data(const CellIteratorType &cell); /** - * Returns a std_cxx17::optional indicating whether @p cell contains an + * Returns a std::optional indicating whether @p cell contains an * associated data or not. If data is available, dereferencing the - * std_cxx17::optional reveals a vector of constant pointers to the + * std::optional reveals a vector of constant pointers to the * underlying data at the quadrature points. * A possible additional typename @p T is the class to which the base class * DataType could be cast. Since @p DataType is stored as shared pointers, @@ -206,7 +206,7 @@ public: * initialize() the cell data. */ template <typename T = DataType> - std_cxx17::optional<std::vector<std::shared_ptr<const T>>> + std::optional<std::vector<std::shared_ptr<const T>>> try_get_data(const CellIteratorType &cell) const; private: @@ -746,7 +746,7 @@ CellDataStorage<CellIteratorType, DataType>::get_data( template <typename CellIteratorType, typename DataType> template <typename T> -inline std_cxx17::optional<std::vector<std::shared_ptr<T>>> +inline std::optional<std::vector<std::shared_ptr<T>>> CellDataStorage<CellIteratorType, DataType>::try_get_data( const CellIteratorType &cell) { @@ -777,7 +777,7 @@ CellDataStorage<CellIteratorType, DataType>::try_get_data( template <typename CellIteratorType, typename DataType> template <typename T> -inline std_cxx17::optional<std::vector<std::shared_ptr<const T>>> +inline std::optional<std::vector<std::shared_ptr<const T>>> CellDataStorage<CellIteratorType, DataType>::try_get_data( const CellIteratorType &cell) const { diff --git a/include/deal.II/base/std_cxx17/algorithm.h b/include/deal.II/base/std_cxx17/algorithm.h index d8404b88a6..3231bfe295 100644 --- a/include/deal.II/base/std_cxx17/algorithm.h +++ b/include/deal.II/base/std_cxx17/algorithm.h @@ -17,6 +17,9 @@ #include <deal.II/base/config.h> +DEAL_II_WARNING( + "This file is deprecated. Simply use the corresponding C++14 header <algorithm>.") + #include <algorithm> DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/std_cxx17/optional.h b/include/deal.II/base/std_cxx17/optional.h index 4d6cc23f2d..510857a6d2 100644 --- a/include/deal.II/base/std_cxx17/optional.h +++ b/include/deal.II/base/std_cxx17/optional.h @@ -17,6 +17,9 @@ #include <deal.II/base/config.h> +DEAL_II_WARNING( + "This file is deprecated. Simply use the corresponding C++14 header <optional>.") + #include <optional> DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/std_cxx17/tuple.h b/include/deal.II/base/std_cxx17/tuple.h index 03757d9bf6..e81cce318b 100644 --- a/include/deal.II/base/std_cxx17/tuple.h +++ b/include/deal.II/base/std_cxx17/tuple.h @@ -17,6 +17,9 @@ #include <deal.II/base/config.h> +DEAL_II_WARNING( + "This file is deprecated. Simply use the corresponding C++14 header <tuple>.") + #include <tuple> DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/std_cxx17/variant.h b/include/deal.II/base/std_cxx17/variant.h index 84cc794db4..a7d42b74b9 100644 --- a/include/deal.II/base/std_cxx17/variant.h +++ b/include/deal.II/base/std_cxx17/variant.h @@ -17,6 +17,9 @@ #include <deal.II/base/config.h> +DEAL_II_WARNING( + "This file is deprecated. Simply use the corresponding C++14 header <variant>.") + #include <variant> DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/base/table_handler.h b/include/deal.II/base/table_handler.h index 951568c871..a55bc25941 100644 --- a/include/deal.II/base/table_handler.h +++ b/include/deal.II/base/table_handler.h @@ -20,7 +20,6 @@ #include <deal.II/base/config.h> #include <deal.II/base/exceptions.h> -#include <deal.II/base/std_cxx17/variant.h> #include <boost/serialization/map.hpp> #include <boost/serialization/split_member.hpp> @@ -31,6 +30,7 @@ #include <map> #include <ostream> #include <string> +#include <variant> #include <vector> @@ -149,7 +149,7 @@ namespace internal * Abbreviation for the data type stored by this object. */ using value_type = - std_cxx17::variant<int, unsigned int, std::uint64_t, double, std::string>; + std::variant<int, unsigned int, std::uint64_t, double, std::string>; /** * Stored value. @@ -818,13 +818,13 @@ namespace internal { // we don't quite know the data type in 'value', but // it must be one of the ones in the type list of the - // std_cxx17::variant. so if T is not in the list, or if + // std::variant. so if T is not in the list, or if // the data stored in the TableEntry is not of type // T, then we will get an exception that we can // catch and produce an error message try { - return std_cxx17::get<T>(value); + return std::get<T>(value); } catch (...) { @@ -844,33 +844,33 @@ namespace internal // write first an identifier for the kind // of data stored and then the actual // data, in its correct data type - if (std_cxx17::holds_alternative<int>(value)) + if (std::holds_alternative<int>(value)) { - const int p = std_cxx17::get<int>(value); + const int p = std::get<int>(value); char c = 'i'; ar &c &p; } - else if (std_cxx17::holds_alternative<unsigned int>(value)) + else if (std::holds_alternative<unsigned int>(value)) { - const unsigned int p = std_cxx17::get<unsigned int>(value); + const unsigned int p = std::get<unsigned int>(value); char c = 'u'; ar &c &p; } - else if (std_cxx17::holds_alternative<double>(value)) + else if (std::holds_alternative<double>(value)) { - const double p = std_cxx17::get<double>(value); + const double p = std::get<double>(value); char c = 'd'; ar &c &p; } - else if (std_cxx17::holds_alternative<std::string>(value)) + else if (std::holds_alternative<std::string>(value)) { - const std::string p = std_cxx17::get<std::string>(value); + const std::string p = std::get<std::string>(value); char c = 's'; ar &c &p; } - else if (std_cxx17::holds_alternative<std::uint64_t>(value)) + else if (std::holds_alternative<std::uint64_t>(value)) { - const std::uint64_t p = std_cxx17::get<std::uint64_t>(value); + const std::uint64_t p = std::get<std::uint64_t>(value); char c = 'l'; ar &c &p; } diff --git a/include/deal.II/base/thread_management.h b/include/deal.II/base/thread_management.h index b41dc02096..b071d1dedf 100644 --- a/include/deal.II/base/thread_management.h +++ b/include/deal.II/base/thread_management.h @@ -22,7 +22,6 @@ #include <deal.II/base/exceptions.h> #include <deal.II/base/multithread_info.h> #include <deal.II/base/mutex.h> -#include <deal.II/base/std_cxx17/tuple.h> #include <deal.II/base/template_constraints.h> #include <atomic> @@ -31,6 +30,7 @@ #include <list> #include <memory> #include <thread> +#include <tuple> #include <utility> #include <vector> @@ -839,7 +839,7 @@ namespace Threads DEAL_II_DISABLE_EXTRA_DIAGNOSTICS auto dummy = std::make_tuple(internal::maybe_make_ref<Args>::act(args)...); return new_thread( - [dummy, fun_ptr]() -> RT { return std_cxx17::apply(fun_ptr, dummy); }); + [dummy, fun_ptr]() -> RT { return std::apply(fun_ptr, dummy); }); DEAL_II_ENABLE_EXTRA_DIAGNOSTICS } @@ -1633,7 +1633,7 @@ namespace Threads { auto dummy = std::make_tuple(internal::maybe_make_ref<Args>::act(args)...); return new_task( - [dummy, fun_ptr]() -> RT { return std_cxx17::apply(fun_ptr, dummy); }); + [dummy, fun_ptr]() -> RT { return std::apply(fun_ptr, dummy); }); } diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index dcf52d9ccf..7d1e427302 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -22,7 +22,6 @@ #include <deal.II/base/bounding_box.h> #include <deal.II/base/geometry_info.h> #include <deal.II/base/point.h> -#include <deal.II/base/std_cxx17/optional.h> #include <deal.II/boost_adaptors/bounding_box.h> @@ -52,6 +51,8 @@ #include <boost/serialization/array.hpp> #include <boost/serialization/vector.hpp> +#include <optional> + #ifdef DEAL_II_WITH_ZLIB # include <boost/iostreams/device/back_inserter.hpp> # include <boost/iostreams/filter/gzip.hpp> @@ -3398,12 +3399,12 @@ namespace GridTools * every ghost cell as it was given by @p pack on the owning processor. * Whether you do or do not receive information to @p unpack on a given * ghost cell depends on whether the @p pack function decided that - * something needs to be sent. It does so using the std_cxx17::optional - * mechanism: if the std_cxx17::optional return object of the @p pack + * something needs to be sent. It does so using the std::optional + * mechanism: if the std::optional return object of the @p pack * function is empty, then this implies that no data has to be sent for * the locally owned cell it was called on. In that case, @p unpack will * also not be called on the ghost cell that corresponds to it on the - * receiving side. On the other hand, if the std_cxx17::optional object is + * receiving side. On the other hand, if the std::optional object is * not empty, then the data stored within it will be sent to the received * and the @p unpack function called with it. * @@ -3421,11 +3422,11 @@ namespace GridTools * that is a ghost cell somewhere else. As mentioned above, the function * may return a regular data object of type @p DataType to indicate * that data should be sent, or an empty - * <code>std_cxx17::optional@<DataType@></code> to indicate that nothing has + * <code>std::optional@<DataType@></code> to indicate that nothing has * to be sent for this cell. * @param unpack The function that will be called for each ghost cell * for which data was sent, i.e., for which the @p pack function - * on the sending side returned a non-empty std_cxx17::optional object. + * on the sending side returned a non-empty std::optional object. * The @p unpack function is then called with the data sent by the * processor that owns that cell. * @param cell_filter Only cells are communicated where this filter function returns @@ -3462,7 +3463,7 @@ namespace GridTools * @endcode * * You will notice that the @p pack lambda function returns an `unsigned int`, - * not a `std_cxx17::optional<unsigned int>`. The former converts + * not a `std::optional<unsigned int>`. The former converts * automatically to the latter, implying that data will always be transported * to the other processor. * @@ -3480,7 +3481,7 @@ namespace GridTools DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler<MeshType>) void exchange_cell_data_to_ghosts( const MeshType & mesh, - const std::function<std_cxx17::optional<DataType>( + const std::function<std::optional<DataType>( const typename MeshType::active_cell_iterator &)> &pack, const std::function<void(const typename MeshType::active_cell_iterator &, const DataType &)> & unpack, @@ -3504,7 +3505,7 @@ namespace GridTools DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler<MeshType>) void exchange_cell_data_to_level_ghosts( const MeshType & mesh, - const std::function<std_cxx17::optional<DataType>( + const std::function<std::optional<DataType>( const typename MeshType::level_cell_iterator &)> &pack, const std::function<void(const typename MeshType::level_cell_iterator &, const DataType &)> & unpack, @@ -4613,8 +4614,8 @@ namespace GridTools DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler<MeshType>) inline void exchange_cell_data( const MeshType &mesh, - const std::function< - std_cxx17::optional<DataType>(const MeshCellIteratorType &)> &pack, + const std::function<std::optional<DataType>(const MeshCellIteratorType &)> + &pack, const std::function<void(const MeshCellIteratorType &, const DataType &)> & unpack, const std::function<bool(const MeshCellIteratorType &)> & cell_filter, @@ -4760,7 +4761,7 @@ namespace GridTools cell->index(), &mesh); - const std_cxx17::optional<DataType> data = pack(mesh_it); + const std::optional<DataType> data = pack(mesh_it); if (data) { data_to_send.emplace_back(*data); @@ -4903,7 +4904,7 @@ namespace GridTools DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler<MeshType>) inline void exchange_cell_data_to_ghosts( const MeshType & mesh, - const std::function<std_cxx17::optional<DataType>( + const std::function<std::optional<DataType>( const typename MeshType::active_cell_iterator &)> &pack, const std::function<void(const typename MeshType::active_cell_iterator &, const DataType &)> & unpack, @@ -4939,7 +4940,7 @@ namespace GridTools DEAL_II_CXX20_REQUIRES(concepts::is_triangulation_or_dof_handler<MeshType>) inline void exchange_cell_data_to_level_ghosts( const MeshType & mesh, - const std::function<std_cxx17::optional<DataType>( + const std::function<std::optional<DataType>( const typename MeshType::level_cell_iterator &)> &pack, const std::function<void(const typename MeshType::level_cell_iterator &, const DataType &)> & unpack, diff --git a/include/deal.II/non_matching/fe_values.h b/include/deal.II/non_matching/fe_values.h index 6d42e31ade..e3d7fdf1db 100644 --- a/include/deal.II/non_matching/fe_values.h +++ b/include/deal.II/non_matching/fe_values.h @@ -18,7 +18,6 @@ #include <deal.II/base/bounding_box.h> #include <deal.II/base/smartpointer.h> -#include <deal.II/base/std_cxx17/optional.h> #include <deal.II/dofs/dof_handler.h> @@ -37,6 +36,7 @@ #include <deal.II/non_matching/quadrature_generator.h> #include <deque> +#include <optional> DEAL_II_NAMESPACE_OPEN @@ -107,7 +107,7 @@ namespace NonMatching * can, for example, happen if the relative size of the cut is similar to the * floating-point accuracy. Since the FEValues-like objects are not allowed to * contain 0 points, the object that get_inside/outside/surface_fe_values() - * returns is wrapped in a std_cxx17::optional. This requires us to check if + * returns is wrapped in a std::optional. This requires us to check if * the returned FEValues-like object contains a value before we use it: * @code * NonMatching::FEValues<dim> fe_values(...); @@ -116,7 +116,7 @@ namespace NonMatching * { * fe_values.reinit(cell); * - * const std_cxx17::optional<FEValues<dim>> &fe_values_inside = + * const std::optional<FEValues<dim>> &fe_values_inside = * fe_values.get_inside_fe_values(); * * if (fe_values_inside) @@ -234,7 +234,7 @@ namespace NonMatching * cell is completely located in the outside domain, the returned * optional will not contain a value. */ - const std_cxx17::optional<dealii::FEValues<dim>> & + const std::optional<dealii::FEValues<dim>> & get_inside_fe_values() const; /** @@ -245,7 +245,7 @@ namespace NonMatching * cell is completely located in the inside domain, the returned * optional will not contain a value. */ - const std_cxx17::optional<dealii::FEValues<dim>> & + const std::optional<dealii::FEValues<dim>> & get_outside_fe_values() const; /** @@ -255,7 +255,7 @@ namespace NonMatching * @note If the quadrature rule over the region is empty, e.g. because the * cell is not intersected, the returned optional will not contain a value. */ - const std_cxx17::optional<FEImmersedSurfaceValues<dim>> & + const std::optional<FEImmersedSurfaceValues<dim>> & get_surface_fe_values() const; private: @@ -316,7 +316,7 @@ namespace NonMatching * This container is a std::deque, which is compatible with the `FEValues` * class that does not have a copy-constructor. */ - std::deque<std_cxx17::optional<dealii::FEValues<dim>>> + std::deque<std::optional<dealii::FEValues<dim>>> fe_values_inside_full_quadrature; /** @@ -332,7 +332,7 @@ namespace NonMatching * This container is a std::deque, which is compatible with the `FEValues` * class that does not have a copy-constructor. */ - std::deque<std_cxx17::optional<dealii::FEValues<dim>>> + std::deque<std::optional<dealii::FEValues<dim>>> fe_values_outside_full_quadrature; /** @@ -342,7 +342,7 @@ namespace NonMatching * or if 0 quadrature points were generated, this optional will not contain * a value. */ - std_cxx17::optional<dealii::FEValues<dim>> fe_values_inside; + std::optional<dealii::FEValues<dim>> fe_values_inside; /** * FEValues object created with a quadrature rule integrating over the @@ -351,7 +351,7 @@ namespace NonMatching * or if 0 quadrature points were generated, this optional will not contain * a value. */ - std_cxx17::optional<dealii::FEValues<dim>> fe_values_outside; + std::optional<dealii::FEValues<dim>> fe_values_outside; /** * FEImmersedSurfaceValues object created with a quadrature rule integrating @@ -360,8 +360,7 @@ namespace NonMatching * intersected or if 0 quadrature points were generated, this optional will * not contain a value. */ - std_cxx17::optional<NonMatching::FEImmersedSurfaceValues<dim>> - fe_values_surface; + std::optional<NonMatching::FEImmersedSurfaceValues<dim>> fe_values_surface; /** * Object that generates the immersed quadrature rules. @@ -394,7 +393,7 @@ namespace NonMatching * or get_outside_fe_values(). For the same reason as described in * NonMatching::FEValues, the returned the FEInterfaceValues objects that * get_inside/outside_fe_values() returns is wrapped in a - * std_cxx17::optional. Assembling using this class would then typically be + * std::optional. Assembling using this class would then typically be * done in the following way: * * @code @@ -414,7 +413,7 @@ namespace NonMatching * cell->neighbor_of_neighbor(face_index), * neighbor_subface_index); * - * const std_cxx17::optional<dealii::FEInterfaceValues<dim>> + * const std::optional<dealii::FEInterfaceValues<dim>> * &inside_fe_values = fe_interface_values.get_inside_fe_values(); * * // Check if the returned optional contains a value @@ -550,7 +549,7 @@ namespace NonMatching * cell is completely located in the outside domain, the returned * optional will not contain a value. */ - const std_cxx17::optional<dealii::FEInterfaceValues<dim>> & + const std::optional<dealii::FEInterfaceValues<dim>> & get_inside_fe_values() const; /** @@ -562,7 +561,7 @@ namespace NonMatching * cell is completely located in the inside domain, the returned * optional will not contain a value. */ - const std_cxx17::optional<dealii::FEInterfaceValues<dim>> & + const std::optional<dealii::FEInterfaceValues<dim>> & get_outside_fe_values() const; private: @@ -638,7 +637,7 @@ namespace NonMatching * This container is a std::deque, which is compatible with the * `FEInterfaceValues` class that does not have a copy-constructor. */ - std::deque<std_cxx17::optional<dealii::FEInterfaceValues<dim>>> + std::deque<std::optional<dealii::FEInterfaceValues<dim>>> fe_values_inside_full_quadrature; /** @@ -655,7 +654,7 @@ namespace NonMatching * This container is a std::deque, which is compatible with the * `FEInterfaceValues` class that does not have a copy-constructor. */ - std::deque<std_cxx17::optional<dealii::FEInterfaceValues<dim>>> + std::deque<std::optional<dealii::FEInterfaceValues<dim>>> fe_values_outside_full_quadrature; /** @@ -665,7 +664,7 @@ namespace NonMatching * intersected or if 0 quadrature points were generated, this optional will * not contain a value. */ - std_cxx17::optional<dealii::FEInterfaceValues<dim>> fe_values_inside; + std::optional<dealii::FEInterfaceValues<dim>> fe_values_inside; /** * FEInterfaceValues object created with a quadrature rule integrating over @@ -674,7 +673,7 @@ namespace NonMatching * intersected or if 0 quadrature points were generated, this optional will * not contain a value. */ - std_cxx17::optional<dealii::FEInterfaceValues<dim>> fe_values_outside; + std::optional<dealii::FEInterfaceValues<dim>> fe_values_outside; /** * Object that generates the immersed quadrature rules. diff --git a/include/deal.II/non_matching/quadrature_generator.h b/include/deal.II/non_matching/quadrature_generator.h index 7b7b7947cf..626b258a6e 100644 --- a/include/deal.II/non_matching/quadrature_generator.h +++ b/include/deal.II/non_matching/quadrature_generator.h @@ -22,7 +22,6 @@ #include <deal.II/base/function.h> #include <deal.II/base/function_restriction.h> #include <deal.II/base/quadrature.h> -#include <deal.II/base/std_cxx17/optional.h> #include <deal.II/dofs/dof_handler.h> @@ -33,6 +32,7 @@ #include <deal.II/non_matching/immersed_surface_quadrature.h> #include <functional> +#include <optional> DEAL_II_NAMESPACE_OPEN namespace NonMatching @@ -1149,10 +1149,10 @@ namespace NonMatching void split_box_and_recurse( const std::vector<std::reference_wrapper<const Function<dim>>> - & level_sets, - const BoundingBox<dim> & box, - const std_cxx17::optional<HeightDirectionData> &direction_data, - const unsigned int n_box_splits); + & level_sets, + const BoundingBox<dim> & box, + const std::optional<HeightDirectionData> &direction_data, + const unsigned int n_box_splits); /** * Uses the midpoint-method to create a quadrature over the box. @@ -1367,7 +1367,7 @@ namespace NonMatching * std::optional is non-set. */ template <int dim> - std_cxx17::optional<HeightDirectionData> + std::optional<HeightDirectionData> find_best_height_direction( const std::vector<FunctionBounds<dim>> &all_function_bounds); diff --git a/include/deal.II/numerics/fe_field_function.h b/include/deal.II/numerics/fe_field_function.h index 94430d1fcc..2b0922cdaa 100644 --- a/include/deal.II/numerics/fe_field_function.h +++ b/include/deal.II/numerics/fe_field_function.h @@ -20,7 +20,6 @@ #include <deal.II/base/function.h> #include <deal.II/base/point.h> -#include <deal.II/base/std_cxx17/optional.h> #include <deal.II/base/tensor.h> #include <deal.II/base/thread_local_storage.h> @@ -33,6 +32,8 @@ #include <deal.II/lac/vector.h> +#include <optional> + DEAL_II_NAMESPACE_OPEN @@ -479,9 +480,9 @@ namespace Functions /** * Given a cell, return the reference coordinates of the given point * within this cell if it indeed lies within the cell. Otherwise return an - * uninitialized std_cxx17::optional object. + * uninitialized std::optional object. */ - std_cxx17::optional<Point<dim>> + std::optional<Point<dim>> get_reference_coordinates( const typename DoFHandler<dim, spacedim>::active_cell_iterator &cell, const Point<dim> &point) const; diff --git a/include/deal.II/numerics/fe_field_function.templates.h b/include/deal.II/numerics/fe_field_function.templates.h index 7393281f21..edee5b5eda 100644 --- a/include/deal.II/numerics/fe_field_function.templates.h +++ b/include/deal.II/numerics/fe_field_function.templates.h @@ -81,7 +81,7 @@ namespace Functions if (cell == dh->end()) cell = dh->begin_active(); - std_cxx17::optional<Point<dim>> qp = get_reference_coordinates(cell, p); + std::optional<Point<dim>> qp = get_reference_coordinates(cell, p); if (!qp) { const std::pair< @@ -143,7 +143,7 @@ namespace Functions if (cell == dh->end()) cell = dh->begin_active(); - std_cxx17::optional<Point<dim>> qp = get_reference_coordinates(cell, p); + std::optional<Point<dim>> qp = get_reference_coordinates(cell, p); if (!qp) { const std::pair< @@ -219,7 +219,7 @@ namespace Functions if (cell == dh->end()) cell = dh->begin_active(); - std_cxx17::optional<Point<dim>> qp = get_reference_coordinates(cell, p); + std::optional<Point<dim>> qp = get_reference_coordinates(cell, p); if (!qp) { const std::pair< @@ -548,7 +548,7 @@ namespace Functions template <int dim, typename VectorType, int spacedim> - std_cxx17::optional<Point<dim>> + std::optional<Point<dim>> FEFieldFunction<dim, VectorType, spacedim>::get_reference_coordinates( const typename DoFHandler<dim, spacedim>::active_cell_iterator &cell, const Point<dim> & point) const @@ -559,14 +559,14 @@ namespace Functions if (GeometryInfo<dim>::is_inside_unit_cell(qp)) return qp; else - return std_cxx17::optional<Point<dim>>(); + return std::optional<Point<dim>>(); } catch (const typename Mapping<dim>::ExcTransformationFailed &) { // transformation failed, so // assume the point is // outside - return std_cxx17::optional<Point<dim>>(); + return std::optional<Point<dim>>(); } } diff --git a/include/deal.II/optimization/line_minimization.h b/include/deal.II/optimization/line_minimization.h index 4d792ab4b4..2f95f6362d 100644 --- a/include/deal.II/optimization/line_minimization.h +++ b/include/deal.II/optimization/line_minimization.h @@ -21,7 +21,6 @@ #include <deal.II/base/exceptions.h> #include <deal.II/base/logstream.h> #include <deal.II/base/numbers.h> -#include <deal.II/base/std_cxx17/optional.h> #include <deal.II/base/utilities.h> #include <deal.II/numerics/history.h> @@ -49,7 +48,7 @@ namespace LineMinimization * not have a solution for given parameters. */ template <typename NumberType> - std_cxx17::optional<NumberType> + std::optional<NumberType> quadratic_fit(const NumberType x_low, const NumberType f_low, const NumberType g_low, @@ -66,7 +65,7 @@ namespace LineMinimization * The return type is optional as the real-valued solution might not exist. */ template <typename NumberType> - std_cxx17::optional<NumberType> + std::optional<NumberType> cubic_fit(const NumberType x_low, const NumberType f_low, const NumberType g_low, @@ -82,7 +81,7 @@ namespace LineMinimization * The return type is optional as the real-valued solution might not exist. */ template <typename NumberType> - std_cxx17::optional<NumberType> + std::optional<NumberType> cubic_fit_three_points(const NumberType x_low, const NumberType f_low, const NumberType g_low, @@ -352,7 +351,7 @@ namespace LineMinimization template <typename NumberType> - std_cxx17::optional<NumberType> + std::optional<NumberType> quadratic_fit(const NumberType x1, const NumberType f1, const NumberType g1, @@ -370,7 +369,7 @@ namespace LineMinimization template <typename NumberType> - std_cxx17::optional<NumberType> + std::optional<NumberType> cubic_fit(const NumberType x1, const NumberType f1, const NumberType g1, @@ -397,7 +396,7 @@ namespace LineMinimization template <typename NumberType> - std_cxx17::optional<NumberType> + std::optional<NumberType> cubic_fit_three_points(const NumberType x1, const NumberType f1, const NumberType g1, @@ -462,7 +461,7 @@ namespace LineMinimization // https://github.com/scipy/scipy/blob/v1.0.0/scipy/optimize/linesearch.py#L555-L563 // First try cubic interpolation - std_cxx17::optional<NumberType> res = cubic_fit(x1, f1, g1, x2, f2, g2); + std::optional<NumberType> res = cubic_fit(x1, f1, g1, x2, f2, g2); if (res && *res >= bounds.first && *res <= bounds.second) return *res; @@ -498,10 +497,10 @@ namespace LineMinimization // https://github.com/scipy/scipy/blob/v1.0.0/scipy/optimize/linesearch.py#L555-L563 // First try cubic interpolation after first iteration - std_cxx17::optional<NumberType> res = + std::optional<NumberType> res = x_rec.size() > 0 ? cubic_fit_three_points(x1, f1, g1, x2, f2, x_rec[0], f_rec[0]) : - std_cxx17::optional<NumberType>{}; + std::optional<NumberType>{}; if (res && *res >= bounds.first && *res <= bounds.second) return *res; diff --git a/source/base/table_handler.cc b/source/base/table_handler.cc index 61f2b529dd..f14dc7749b 100644 --- a/source/base/table_handler.cc +++ b/source/base/table_handler.cc @@ -36,13 +36,13 @@ namespace internal { // we don't quite know the data type in 'value', but // it must be one of the ones in the type list of the - // std_cxx17::variant. Go through this list and return + // std::variant. Go through this list and return // the value if this happens to be a number // // first try with int try { - return std_cxx17::get<int>(value); + return std::get<int>(value); } catch (...) {} @@ -51,7 +51,7 @@ namespace internal // ... then with unsigned int... try { - return std_cxx17::get<unsigned int>(value); + return std::get<unsigned int>(value); } catch (...) {} @@ -59,7 +59,7 @@ namespace internal // ... then with std::uint64_t... try { - return std_cxx17::get<std::uint64_t>(value); + return std::get<std::uint64_t>(value); } catch (...) {} @@ -67,7 +67,7 @@ namespace internal // ...and finally with double precision: try { - return std_cxx17::get<double>(value); + return std::get<double>(value); } catch (...) { diff --git a/source/cgal/intersections.cc b/source/cgal/intersections.cc index 3fe147fa02..f292db9c9c 100644 --- a/source/cgal/intersections.cc +++ b/source/cgal/intersections.cc @@ -22,8 +22,6 @@ #ifdef DEAL_II_WITH_CGAL # include <deal.II/base/quadrature_lib.h> -# include <deal.II/base/std_cxx17/optional.h> -# include <deal.II/base/std_cxx17/variant.h> # include <deal.II/base/utilities.h> # include <deal.II/fe/mapping.h> @@ -55,7 +53,9 @@ # include <deal.II/cgal/utilities.h> # include <fstream> +# include <optional> # include <type_traits> +# include <variant> DEAL_II_NAMESPACE_OPEN @@ -130,7 +130,7 @@ namespace CGALWrappers * what we want to use because we like to use std data types. */ template <typename... Types> - std_cxx17::optional<std_cxx17::variant<Types...>> + std::optional<std::variant<Types...>> convert_boost_to_std(const boost::optional<boost::variant<Types...>> &x) { if (x) @@ -214,17 +214,17 @@ namespace CGALWrappers // Collection of utilities that compute intersection between simplices // identified by array of points. The return type is the one of - // CGAL::intersection(), i.e. a std_cxx17::optional<std_cxx17::variant<>>. + // CGAL::intersection(), i.e. a std::optional<std::variant<>>. // Intersection between 2d and 3d objects and 1d/3d objects are available // only with CGAL versions greater or equal than 5.5, hence the // corresponding functions are guarded by #ifdef directives. All the // signatures follow the convection that the first entity has an intrinsic // dimension higher than the second one. - std_cxx17::optional<std_cxx17::variant<CGALPoint2, - CGALSegment2, - CGALTriangle2, - std::vector<CGALPoint2>>> + std::optional<std::variant<CGALPoint2, + CGALSegment2, + CGALTriangle2, + std::vector<CGALPoint2>>> compute_intersection_triangle_triangle( const ArrayView<const Point<2>> &triangle0, const ArrayView<const Point<2>> &triangle1) @@ -251,7 +251,7 @@ namespace CGALWrappers } - std_cxx17::optional<std_cxx17::variant<CGALPoint2, CGALSegment2>> + std::optional<std::variant<CGALPoint2, CGALSegment2>> compute_intersection_triangle_segment( const ArrayView<const Point<2>> &triangle, const ArrayView<const Point<2>> &segment) @@ -312,7 +312,7 @@ namespace CGALWrappers - std_cxx17::optional<std_cxx17::variant<CGALPoint3, CGALSegment3>> + std::optional<std::variant<CGALPoint3, CGALSegment3>> compute_intersection_tetra_segment( const ArrayView<const Point<3>> &tetrahedron, const ArrayView<const Point<3>> &segment) @@ -352,10 +352,10 @@ namespace CGALWrappers // tetra, triangle - std_cxx17::optional<std_cxx17::variant<CGALPoint3, - CGALSegment3, - CGALTriangle3, - std::vector<CGALPoint3>>> + std::optional<std::variant<CGALPoint3, + CGALSegment3, + CGALTriangle3, + std::vector<CGALPoint3>>> compute_intersection_tetra_triangle( const ArrayView<const Point<3>> &tetrahedron, const ArrayView<const Point<3>> &triangle) diff --git a/source/grid/reference_cell.cc b/source/grid/reference_cell.cc index fa2f699230..5130f123a5 100644 --- a/source/grid/reference_cell.cc +++ b/source/grid/reference_cell.cc @@ -16,7 +16,6 @@ #include <deal.II/base/polynomial.h> #include <deal.II/base/polynomials_barycentric.h> #include <deal.II/base/quadrature_lib.h> -#include <deal.II/base/std_cxx17/algorithm.h> #include <deal.II/base/tensor_product_polynomials.h> #include <deal.II/fe/fe_pyramid_p.h> @@ -31,6 +30,7 @@ #include <deal.II/grid/reference_cell.h> #include <deal.II/grid/tria.h> +#include <algorithm> #include <iostream> #include <memory> @@ -1075,45 +1075,43 @@ ReferenceCell::closest_point(const Point<dim> &p) const case ReferenceCells::Quadrilateral: case ReferenceCells::Hexahedron: for (unsigned int d = 0; d < dim; ++d) - result[d] = std_cxx17::clamp(result[d], 0.0, 1.0); + result[d] = std::clamp(result[d], 0.0, 1.0); // simplices can use the standard definition of a simplex: break; case ReferenceCells::Triangle: - result[x_index] = std_cxx17::clamp(result[x_index], 0.0, 1.0); + result[x_index] = std::clamp(result[x_index], 0.0, 1.0); result[y_index] = - std_cxx17::clamp(result[y_index], 0.0, 1.0 - result[x_index]); + std::clamp(result[y_index], 0.0, 1.0 - result[x_index]); break; case ReferenceCells::Tetrahedron: - result[x_index] = std_cxx17::clamp(result[x_index], 0.0, 1.0); + result[x_index] = std::clamp(result[x_index], 0.0, 1.0); result[y_index] = - std_cxx17::clamp(result[y_index], 0.0, 1.0 - result[x_index]); + std::clamp(result[y_index], 0.0, 1.0 - result[x_index]); result[z_index] = - std_cxx17::clamp(result[z_index], - 0.0, - 1.0 - result[x_index] - result[y_index]); + std::clamp(result[z_index], + 0.0, + 1.0 - result[x_index] - result[y_index]); break; // wedges and pyramids are more ad-hoc: case ReferenceCells::Wedge: - result[x_index] = std_cxx17::clamp(result[x_index], 0.0, 1.0); + result[x_index] = std::clamp(result[x_index], 0.0, 1.0); result[y_index] = - std_cxx17::clamp(result[y_index], 0.0, 1.0 - result[x_index]); - result[z_index] = std_cxx17::clamp(result[z_index], 0.0, 1.0); + std::clamp(result[y_index], 0.0, 1.0 - result[x_index]); + result[z_index] = std::clamp(result[z_index], 0.0, 1.0); break; case ReferenceCells::Pyramid: { - result[x_index] = std_cxx17::clamp(result[x_index], -1.0, 1.0); - result[y_index] = std_cxx17::clamp(result[y_index], -1.0, 1.0); + result[x_index] = std::clamp(result[x_index], -1.0, 1.0); + result[y_index] = std::clamp(result[y_index], -1.0, 1.0); // It suffices to transform everything to the first quadrant to // adjust z: const auto x_abs = std::abs(result[x_index]); const auto y_abs = std::abs(result[y_index]); if (y_abs <= x_abs) - result[z_index] = - std_cxx17::clamp(result[z_index], 0.0, 1.0 - x_abs); + result[z_index] = std::clamp(result[z_index], 0.0, 1.0 - x_abs); else - result[z_index] = - std_cxx17::clamp(result[z_index], 0.0, 1.0 - y_abs); + result[z_index] = std::clamp(result[z_index], 0.0, 1.0 - y_abs); } break; default: diff --git a/source/non_matching/fe_values.cc b/source/non_matching/fe_values.cc index 4c17985207..e964884bd5 100644 --- a/source/non_matching/fe_values.cc +++ b/source/non_matching/fe_values.cc @@ -237,7 +237,7 @@ namespace NonMatching template <int dim> - const std_cxx17::optional<dealii::FEValues<dim>> & + const std::optional<dealii::FEValues<dim>> & FEValues<dim>::get_inside_fe_values() const { if (current_cell_location == LocationToLevelSet::inside) @@ -249,7 +249,7 @@ namespace NonMatching template <int dim> - const std_cxx17::optional<dealii::FEValues<dim>> & + const std::optional<dealii::FEValues<dim>> & FEValues<dim>::get_outside_fe_values() const { if (current_cell_location == LocationToLevelSet::outside) @@ -261,7 +261,7 @@ namespace NonMatching template <int dim> - const std_cxx17::optional<FEImmersedSurfaceValues<dim>> & + const std::optional<FEImmersedSurfaceValues<dim>> & FEValues<dim>::get_surface_fe_values() const { return fe_values_surface; @@ -457,7 +457,7 @@ namespace NonMatching template <int dim> - const std_cxx17::optional<dealii::FEInterfaceValues<dim>> & + const std::optional<dealii::FEInterfaceValues<dim>> & FEInterfaceValues<dim>::get_inside_fe_values() const { if (current_face_location == LocationToLevelSet::inside) @@ -469,7 +469,7 @@ namespace NonMatching template <int dim> - const std_cxx17::optional<dealii::FEInterfaceValues<dim>> & + const std::optional<dealii::FEInterfaceValues<dim>> & FEInterfaceValues<dim>::get_outside_fe_values() const { if (current_face_location == LocationToLevelSet::outside) diff --git a/source/non_matching/quadrature_generator.cc b/source/non_matching/quadrature_generator.cc index 18ed8736a5..2a2afcac7e 100644 --- a/source/non_matching/quadrature_generator.cc +++ b/source/non_matching/quadrature_generator.cc @@ -271,13 +271,13 @@ namespace NonMatching template <int dim> - std_cxx17::optional<HeightDirectionData> + std::optional<HeightDirectionData> find_best_height_direction( const std::vector<FunctionBounds<dim>> &all_function_bounds) { // Minimum (taken over the indefinite functions) on the lower bound on // each component of the gradient. - std_cxx17::optional<std::array<double, dim>> min_lower_abs_grad; + std::optional<std::array<double, dim>> min_lower_abs_grad; for (const FunctionBounds<dim> &bounds : all_function_bounds) { @@ -320,7 +320,7 @@ namespace NonMatching return data; } - return std_cxx17::optional<HeightDirectionData>(); + return std::optional<HeightDirectionData>(); } @@ -920,7 +920,7 @@ namespace NonMatching } else { - const std_cxx17::optional<HeightDirectionData> data = + const std::optional<HeightDirectionData> data = find_best_height_direction(all_function_bounds); // Check larger than a constant to avoid that min_abs_dfdx is only @@ -955,7 +955,7 @@ namespace NonMatching * will be non-set. */ template <int dim> - std_cxx17::optional<unsigned int> + std::optional<unsigned int> direction_of_largest_extent(const BoundingBox<dim> &box) { // Get the side lengths for each direction and sort them. @@ -972,7 +972,7 @@ namespace NonMatching // function isn't called in 1d, so the (dim - 2)-element exists. if (boost::math::epsilon_difference(side_lengths[dim - 1].first, side_lengths[dim - 2].first) < 100) - return std_cxx17::optional<unsigned int>(); + return std::optional<unsigned int>(); return side_lengths.back().second; } @@ -993,10 +993,10 @@ namespace NonMatching template <int dim> unsigned int compute_split_direction( - const BoundingBox<dim> & box, - const std_cxx17::optional<HeightDirectionData> &height_direction_data) + const BoundingBox<dim> & box, + const std::optional<HeightDirectionData> &height_direction_data) { - const std_cxx17::optional<unsigned int> direction = + const std::optional<unsigned int> direction = direction_of_largest_extent(box); if (direction) @@ -1055,10 +1055,10 @@ namespace NonMatching void QGenerator<dim, spacedim>::split_box_and_recurse( const std::vector<std::reference_wrapper<const Function<dim>>> - & level_sets, - const BoundingBox<dim> & box, - const std_cxx17::optional<HeightDirectionData> &direction_data, - const unsigned int n_box_splits) + & level_sets, + const BoundingBox<dim> & box, + const std::optional<HeightDirectionData> &direction_data, + const unsigned int n_box_splits) { if (this->additional_data.split_in_half) { diff --git a/source/non_matching/quadrature_generator.inst.in b/source/non_matching/quadrature_generator.inst.in index ab20f0a73e..e2f2e551ab 100644 --- a/source/non_matching/quadrature_generator.inst.in +++ b/source/non_matching/quadrature_generator.inst.in @@ -53,7 +53,7 @@ for (deal_II_dimension : DIMENSIONS) // gcc is wrong. We don't need the function when dim = 1, so we avoid // instantiating it. #if 1 < deal_II_dimension - template std_cxx17::optional<HeightDirectionData> + template std::optional<HeightDirectionData> find_best_height_direction( const std::vector<FunctionBounds<deal_II_dimension>> &); #endif diff --git a/tests/base/cell_data_storage_01.cc b/tests/base/cell_data_storage_01.cc index b5f171480f..015cef56d1 100644 --- a/tests/base/cell_data_storage_01.cc +++ b/tests/base/cell_data_storage_01.cc @@ -102,9 +102,9 @@ check_qph(Triangulation<dim> &tr, const std::vector<std::shared_ptr<DATA>> qpd = manager.get_data(cell); const std::vector<std::shared_ptr<const DATA>> qpd_const = manager_const.get_data(cell); - const std_cxx17::optional<std::vector<std::shared_ptr<DATA>>> - qpd_optional = manager.try_get_data(cell); - const std_cxx17::optional<std::vector<std::shared_ptr<const DATA>>> + const std::optional<std::vector<std::shared_ptr<DATA>>> qpd_optional = + manager.try_get_data(cell); + const std::optional<std::vector<std::shared_ptr<const DATA>>> qpd_const_optional = manager_const.try_get_data(cell); AssertThrow(qpd_optional, ExcInternalError()); AssertThrow(qpd_const_optional, ExcInternalError()); @@ -177,7 +177,7 @@ test() next_cell++; if (next_cell != tr.end()) { - const std_cxx17::optional<std::vector<std::shared_ptr<MyQData>>> + const std::optional<std::vector<std::shared_ptr<MyQData>>> nonexisting_data = data_storage.try_get_data(next_cell); AssertThrow(!nonexisting_data, ExcInternalError()); } diff --git a/tests/base/mutable_bind_01.cc b/tests/base/mutable_bind_01.cc index 1c532a2803..fa1cc92ad1 100644 --- a/tests/base/mutable_bind_01.cc +++ b/tests/base/mutable_bind_01.cc @@ -18,7 +18,8 @@ #include <deal.II/base/mutable_bind.h> #include <deal.II/base/point.h> -#include <deal.II/base/std_cxx17/tuple.h> + +#include <tuple> #include "../tests.h" diff --git a/tests/base/mutable_bind_02.cc b/tests/base/mutable_bind_02.cc index d80e08cfc8..763fd87886 100644 --- a/tests/base/mutable_bind_02.cc +++ b/tests/base/mutable_bind_02.cc @@ -18,7 +18,8 @@ #include <deal.II/base/mutable_bind.h> #include <deal.II/base/point.h> -#include <deal.II/base/std_cxx17/tuple.h> + +#include <tuple> #include "../tests.h" diff --git a/tests/base/mutable_bind_03.cc b/tests/base/mutable_bind_03.cc index c5edf315db..8f583fd543 100644 --- a/tests/base/mutable_bind_03.cc +++ b/tests/base/mutable_bind_03.cc @@ -19,7 +19,8 @@ #include <deal.II/base/mutable_bind.h> #include <deal.II/base/point.h> -#include <deal.II/base/std_cxx17/tuple.h> + +#include <tuple> #include "../tests.h" diff --git a/tests/base/mutable_bind_04.cc b/tests/base/mutable_bind_04.cc index a659b023a4..2dd02facff 100644 --- a/tests/base/mutable_bind_04.cc +++ b/tests/base/mutable_bind_04.cc @@ -19,7 +19,8 @@ #include <deal.II/base/mutable_bind.h> #include <deal.II/base/point.h> -#include <deal.II/base/std_cxx17/tuple.h> + +#include <tuple> #include "../tests.h" diff --git a/tests/base/stdcxx17_apply.cc b/tests/base/stdcxx17_apply.cc deleted file mode 100644 index 151c4dfe46..0000000000 --- a/tests/base/stdcxx17_apply.cc +++ /dev/null @@ -1,39 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2017 - 2019 by the deal.II authors -// -// This file is part of the deal.II library. -// -// The deal.II library is free software; you can use it, redistribute -// it, and/or modify it under the terms of the GNU Lesser General -// Public License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// The full text of the license can be found in the file LICENSE.md at -// the top level directory of deal.II. -// -// --------------------------------------------------------------------- - - -// test the implementation of the std_cxx17::apply function - - -#include <deal.II/base/point.h> -#include <deal.II/base/std_cxx17/tuple.h> - -#include "../tests.h" - - -void -example_function(const Point<2> &p, const double &d, const unsigned int i = 3) -{ - deallog << "P: " << p << ", d: " << d << ", i: " << i << std::endl; -} - - -int -main() -{ - initlog(); - auto tup = std::make_tuple(Point<2>(.5, .5), 2.0, 3u); - std_cxx17::apply(example_function, tup); -} diff --git a/tests/base/stdcxx17_apply.output b/tests/base/stdcxx17_apply.output deleted file mode 100644 index 8f2ac511fb..0000000000 --- a/tests/base/stdcxx17_apply.output +++ /dev/null @@ -1,2 +0,0 @@ - -DEAL::P: 0.500000 0.500000, d: 2.00000, i: 3 diff --git a/tests/distributed_grids/grid_tools_exchange_cell_data_04.cc b/tests/distributed_grids/grid_tools_exchange_cell_data_04.cc index 646911bb69..49459cd1ba 100644 --- a/tests/distributed_grids/grid_tools_exchange_cell_data_04.cc +++ b/tests/distributed_grids/grid_tools_exchange_cell_data_04.cc @@ -17,7 +17,7 @@ // test GridTools::exchange_cell_data_to_ghosts // // this test works just like the _01 test, but it skips those cells -// where we have an odd 'counter' value via the std_cxx17::optional +// where we have an odd 'counter' value via the std::optional // framework #include <deal.II/base/logstream.h> @@ -80,7 +80,7 @@ test() GridTools:: exchange_cell_data_to_ghosts<DT, parallel::distributed::Triangulation<dim>>( tria, - [&](const cell_iterator &cell) -> std_cxx17::optional<DT> { + [&](const cell_iterator &cell) -> std::optional<DT> { const auto counter = map[cell->id()]; std::ostringstream oss; if (counter % 2 == 0) @@ -95,7 +95,7 @@ test() { oss << "skipping " << cell->id() << ' ' << counter; input[cell->id()] = oss.str(); - return std_cxx17::optional<DT>(); + return std::optional<DT>(); } }, [&](const cell_iterator &cell, const DT &data) { diff --git a/tests/non_matching/fe_interface_values.cc b/tests/non_matching/fe_interface_values.cc index 91425c1b85..c8947adb97 100644 --- a/tests/non_matching/fe_interface_values.cc +++ b/tests/non_matching/fe_interface_values.cc @@ -16,7 +16,6 @@ #include <deal.II/base/exceptions.h> #include <deal.II/base/function_signed_distance.h> #include <deal.II/base/quadrature_lib.h> -#include <deal.II/base/std_cxx17/optional.h> #include <deal.II/fe/fe_q.h> #include <deal.II/fe/mapping_cartesian.h> @@ -27,6 +26,8 @@ #include <deal.II/numerics/vector_tools.h> +#include <optional> + #include "../tests.h" using namespace dealii; diff --git a/tests/non_matching/fe_interface_values_non_standard_meshes.cc b/tests/non_matching/fe_interface_values_non_standard_meshes.cc index 113520c761..6c10913f50 100644 --- a/tests/non_matching/fe_interface_values_non_standard_meshes.cc +++ b/tests/non_matching/fe_interface_values_non_standard_meshes.cc @@ -27,7 +27,6 @@ #include <deal.II/base/exceptions.h> #include <deal.II/base/function_signed_distance.h> #include <deal.II/base/quadrature_lib.h> -#include <deal.II/base/std_cxx17/optional.h> #include <deal.II/fe/fe_q.h> @@ -38,6 +37,7 @@ #include <deal.II/numerics/vector_tools.h> #include <bitset> +#include <optional> #include "../tests.h" diff --git a/tests/non_matching/fe_values.cc b/tests/non_matching/fe_values.cc index 06a1c15b44..b63ffeacab 100644 --- a/tests/non_matching/fe_values.cc +++ b/tests/non_matching/fe_values.cc @@ -16,7 +16,6 @@ #include <deal.II/base/exceptions.h> #include <deal.II/base/function_signed_distance.h> #include <deal.II/base/quadrature_lib.h> -#include <deal.II/base/std_cxx17/optional.h> #include <deal.II/fe/fe_q.h> #include <deal.II/fe/fe_values.h> @@ -28,6 +27,8 @@ #include <deal.II/numerics/vector_tools.h> +#include <optional> + #include "../tests.h" using namespace dealii; @@ -48,7 +49,7 @@ assert_cells_are_the_same( // Assert that the incoming optional does not have a value. template <class FEVALUES> void -assert_doesnt_have_value(const std_cxx17::optional<FEVALUES> &fe_values) +assert_doesnt_have_value(const std::optional<FEVALUES> &fe_values) { AssertThrow(!fe_values, ExcInternalError()); deallog << "OK" << std::endl; @@ -67,7 +68,7 @@ assert_doesnt_have_value(const std_cxx17::optional<FEVALUES> &fe_values) // Test the following: // 1. That we can construct a NonMatching::FEValues object. // 2. That when we call reinit on each cell in the triangulation, -// the std_cxx17::optionals that we get from +// the std::optionals that we get from // get_inside/outside/surface_fe_values are set up correctly. That is, the // optionals that should contain a value do and the ones that should not contain // a value do not. diff --git a/tests/non_matching/find_best_height_direction.cc b/tests/non_matching/find_best_height_direction.cc index 1edccd1fec..7a9e7f3319 100644 --- a/tests/non_matching/find_best_height_direction.cc +++ b/tests/non_matching/find_best_height_direction.cc @@ -51,7 +51,7 @@ test_ignores_definite_functions() bounds[0].value = pair_with_equal_entries(-1); bounds[1].value = pair_with_equal_entries(1); - const std_cxx17::optional<HeightDirectionData> data = + const std::optional<HeightDirectionData> data = find_best_height_direction(bounds); if (!data) @@ -87,7 +87,7 @@ test_find_best_height_direction() bounds[0].gradient[1] = pair_with_equal_entries(6); bounds[1].gradient[1] = pair_with_equal_entries(5); - const std_cxx17::optional<HeightDirectionData> data = + const std::optional<HeightDirectionData> data = find_best_height_direction(bounds); deallog << "height direction = " << data->direction << std::endl; -- 2.39.5